From 7c596f6b02fe2592fa7af0698b37d4232f5ddc5e Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Wed, 24 Sep 2008 00:02:36 -0300 Subject: [PATCH 001/948] irc.client: Make irc-client have its own nick field, profiles shouldn't be mutated --- extra/irc/client/client-tests.factor | 6 +++--- extra/irc/client/client.factor | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/extra/irc/client/client-tests.factor b/extra/irc/client/client-tests.factor index c768c1a82e..3554f6c120 100644 --- a/extra/irc/client/client-tests.factor +++ b/extra/irc/client/client-tests.factor @@ -42,9 +42,9 @@ M: mb-writer stream-nl ( mb-writer -- ) ! TESTS ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -[ { t } [ irc> profile>> nickname>> me? ] unit-test +[ { t } [ irc> nick>> me? ] unit-test - { "factorbot" } [ irc> profile>> nickname>> ] unit-test + { "factorbot" } [ irc> nick>> ] unit-test { "someuser" } [ "someuser!n=user@some.where" parse-name ] unit-test @@ -58,7 +58,7 @@ M: mb-writer stream-nl ( mb-writer -- ) ! Test login and nickname set [ { "factorbot2" } [ ":some.where 001 factorbot2 :Welcome factorbot2" %push-line - irc> profile>> nickname>> + irc> nick>> ] unit-test ] with-irc diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor index 569f6c4bf7..b6eeec9468 100755 --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -18,9 +18,9 @@ TUPLE: irc-profile server port nickname password ; C: irc-profile TUPLE: irc-client profile stream in-messages out-messages join-messages - listeners is-running connect reconnect-time ; + listeners is-running nick connect reconnect-time ; : ( profile -- irc-client ) - f H{ } clone f + [ f H{ } clone f ] keep nickname>> [ latin1 ] 15 seconds irc-client boa ; TUPLE: irc-listener in-messages out-messages ; @@ -78,7 +78,9 @@ PRIVATE> : terminate-irc ( irc-client -- ) [ is-running>> ] keep and [ - [ end-loops ] [ [ f ] dip (>>is-running) ] bi + [ end-loops ] + [ [ f ] dip (>>is-running) ] + bi ] when* ; out-messages>> mailbox-put ; : listener> ( name -- listener/f ) irc> listeners>> at ; : channel-mode? ( mode -- ? ) name>> first "#&" member? ; -: me? ( string -- ? ) irc> profile>> nickname>> = ; +: me? ( string -- ? ) irc> nick>> = ; GENERIC: to-listener ( message obj -- ) @@ -122,7 +124,7 @@ M: irc-listener to-listener ( message irc-listener -- ) : listeners-with-participant ( nick -- seq ) irc> listeners>> values - [ dup irc-channel-listener? [ participants>> key? ] [ 2drop f ] if ] + [ [ irc-channel-listener? ] keep and [ participants>> key? ] when* ] with filter ; : to-listeners-with-participant ( message nickname -- ) @@ -218,7 +220,7 @@ M: object process-message ( object -- ) drop ; M: logged-in process-message ( logged-in -- ) - name>> irc> profile>> (>>nickname) ; + name>> irc> (>>nick) ; M: ping process-message ( ping -- ) trailing>> /PONG ; @@ -285,7 +287,7 @@ DEFER: (connect-irc) irc> [ [ irc-disconnected ] dip in-messages>> mailbox-put ] [ dup reconnect-time>> sleep (connect-irc) ] - [ profile>> nickname>> /LOGIN ] + [ nick>> /LOGIN ] tri ; ! FIXME: do something with the exception, store somewhere to help debugging @@ -391,7 +393,7 @@ PRIVATE> : connect-irc ( irc-client -- ) [ irc> - [ (connect-irc) ] [ profile>> nickname>> /LOGIN ] bi + [ (connect-irc) ] [ nick>> /LOGIN ] bi spawn-irc ] with-irc-client ; : add-listener ( irc-listener irc-client -- ) From 6e09d7cb634e7ed2a537e48c8ede4a4541e65cb1 Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Thu, 25 Sep 2008 01:05:44 -0300 Subject: [PATCH 002/948] irc.client: Refactor, clean, etc. Stop using a thread for each listener for output messages --- extra/irc/client/client-tests.factor | 73 ++++++---- extra/irc/client/client.factor | 166 +++++++++-------------- extra/irc/messages/messages-tests.factor | 10 ++ extra/irc/messages/messages.factor | 71 +++++----- extra/irc/ui/ui.factor | 14 +- 5 files changed, 159 insertions(+), 175 deletions(-) diff --git a/extra/irc/client/client-tests.factor b/extra/irc/client/client-tests.factor index 3554f6c120..acd5a783db 100644 --- a/extra/irc/client/client-tests.factor +++ b/extra/irc/client/client-tests.factor @@ -28,9 +28,11 @@ M: mb-writer stream-nl ( mb-writer -- ) dup [ spawn-irc yield ] with-irc-client ; ! to be used inside with-irc-client quotations -: %add-named-listener ( listener -- ) [ name>> ] keep set+run-listener ; -: %join ( channel -- ) irc> add-listener ; +: %add-named-listener ( listener -- ) irc> add-listener ; : %push-line ( line -- ) irc> stream>> in>> push-line yield ; +: %join ( channel -- ) + + [ irc> add-listener ] [ join-irc-channel ] bi ; : read-matching-message ( listener quot: ( msg -- ? ) -- irc-message ) [ in-messages>> 0.1 seconds ] dip mailbox-get-timeout? ; @@ -62,13 +64,28 @@ M: mb-writer stream-nl ( mb-writer -- ) ] unit-test ] with-irc +! Test connect +{ V{ "NICK factorbot" "USER factorbot hostname servername :irc.factor" } } [ + "someserver" irc-port "factorbot" f + [ 2drop t ] >>connect + [ connect-irc ] keep stream>> out>> lines>> +] unit-test + +! Test join +[ { "JOIN #factortest" } [ + "#factortest" %join + irc> stream>> out>> lines>> pop + ] unit-test +] with-irc + [ { join_ "#factortest" } [ + "#factortest" [ %add-named-listener ] keep { ":factorbot!n=factorbo@some.where JOIN :#factortest" ":ircserver.net 353 factorbot @ #factortest :@factorbot " ":ircserver.net 366 factorbot #factortest :End of /NAMES list." ":ircserver.net 477 factorbot #factortest :[ircserver-info] blah blah" } [ %push-line ] each - irc> join-messages>> 0.1 seconds mailbox-get-timeout + in-messages>> 0.1 seconds mailbox-get-timeout [ class ] [ trailing>> ] bi ] unit-test ] with-irc @@ -89,8 +106,8 @@ M: mb-writer stream-nl ( mb-writer -- ) ] with-irc [ { privmsg "factorbot" "hello" } [ - "somedude" [ %add-named-listener ] keep - ":somedude!n=user@isp.net PRIVMSG factorbot :hello" %push-line + "ircuser" [ %add-named-listener ] keep + ":ircuser!n=user@isp.net PRIVMSG factorbot :hello" %push-line [ privmsg? ] read-matching-message [ class ] [ name>> ] [ trailing>> ] tri ] unit-test @@ -104,48 +121,48 @@ M: mb-writer stream-nl ( mb-writer -- ) ] with-irc ! Participant lists tests -[ { H{ { "somedude" +normal+ } } } [ +[ { H{ { "ircuser" +normal+ } } } [ "#factortest" [ %add-named-listener ] keep - ":somedude!n=user@isp.net JOIN :#factortest" %push-line + ":ircuser!n=user@isp.net JOIN :#factortest" %push-line participants>> ] unit-test ] with-irc -[ { H{ { "somedude2" +normal+ } } } [ +[ { H{ { "ircuser2" +normal+ } } } [ "#factortest" - H{ { "somedude2" +normal+ } - { "somedude" +normal+ } } clone >>participants + H{ { "ircuser2" +normal+ } + { "ircuser" +normal+ } } clone >>participants [ %add-named-listener ] keep - ":somedude!n=user@isp.net PART #factortest" %push-line + ":ircuser!n=user@isp.net PART #factortest" %push-line participants>> ] unit-test ] with-irc -[ { H{ { "somedude2" +normal+ } } } [ +[ { H{ { "ircuser2" +normal+ } } } [ "#factortest" - H{ { "somedude2" +normal+ } - { "somedude" +normal+ } } clone >>participants + H{ { "ircuser2" +normal+ } + { "ircuser" +normal+ } } clone >>participants [ %add-named-listener ] keep - ":somedude!n=user@isp.net QUIT" %push-line + ":ircuser!n=user@isp.net QUIT" %push-line participants>> ] unit-test ] with-irc -[ { H{ { "somedude2" +normal+ } } } [ +[ { H{ { "ircuser2" +normal+ } } } [ "#factortest" - H{ { "somedude2" +normal+ } - { "somedude" +normal+ } } clone >>participants + H{ { "ircuser2" +normal+ } + { "ircuser" +normal+ } } clone >>participants [ %add-named-listener ] keep - ":somedude2!n=user2@isp.net KICK #factortest somedude" %push-line + ":ircuser2!n=user2@isp.net KICK #factortest ircuser" %push-line participants>> ] unit-test ] with-irc -[ { H{ { "somedude2" +normal+ } } } [ +[ { H{ { "ircuser2" +normal+ } } } [ "#factortest" - H{ { "somedude" +normal+ } } clone >>participants + H{ { "ircuser" +normal+ } } clone >>participants [ %add-named-listener ] keep - ":somedude!n=user2@isp.net NICK :somedude2" %push-line + ":ircuser!n=user2@isp.net NICK :ircuser2" %push-line participants>> ] unit-test ] with-irc @@ -159,20 +176,20 @@ M: mb-writer stream-nl ( mb-writer -- ) ] unit-test ] with-irc -[ { T{ participant-changed f "somedude" +part+ f } } [ +[ { T{ participant-changed f "ircuser" +part+ f } } [ "#factortest" - H{ { "somedude" +normal+ } } clone >>participants + H{ { "ircuser" +normal+ } } clone >>participants [ %add-named-listener ] keep - ":somedude!n=user@isp.net QUIT" %push-line + ":ircuser!n=user@isp.net QUIT" %push-line [ participant-changed? ] read-matching-message ] unit-test ] with-irc -[ { T{ participant-changed f "somedude" +nick+ "somedude2" } } [ +[ { T{ participant-changed f "ircuser" +nick+ "ircuser2" } } [ "#factortest" - H{ { "somedude" +normal+ } } clone >>participants + H{ { "ircuser" +normal+ } } clone >>participants [ %add-named-listener ] keep - ":somedude!n=user2@isp.net NICK :somedude2" %push-line + ":ircuser!n=user2@isp.net NICK :ircuser2" %push-line [ participant-changed? ] read-matching-message ] unit-test ] with-irc diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor index b6eeec9468..ca16ff3b88 100755 --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -17,13 +17,13 @@ IN: irc.client TUPLE: irc-profile server port nickname password ; C: irc-profile -TUPLE: irc-client profile stream in-messages out-messages join-messages +TUPLE: irc-client profile stream in-messages out-messages listeners is-running nick connect reconnect-time ; : ( profile -- irc-client ) - [ f H{ } clone f ] keep nickname>> + [ f H{ } clone f ] keep nickname>> [ latin1 ] 15 seconds irc-client boa ; -TUPLE: irc-listener in-messages out-messages ; +TUPLE: irc-listener in-messages client ; TUPLE: irc-server-listener < irc-listener ; TUPLE: irc-channel-listener < irc-listener name password timeout participants ; TUPLE: irc-nick-listener < irc-listener name ; @@ -47,14 +47,14 @@ SYMBOL: +nick+ : ( -- irc-listener ) irc-listener boa ; : ( -- irc-server-listener ) - irc-server-listener boa ; + f irc-server-listener boa ; : ( name -- irc-channel-listener ) - [ ] dip f 60 seconds H{ } clone + [ f ] dip f 60 seconds H{ } clone irc-channel-listener boa ; : ( name -- irc-nick-listener ) - [ ] dip irc-nick-listener boa ; + [ f ] dip irc-nick-listener boa ; ! ====================================== ! Message objects @@ -68,19 +68,11 @@ SINGLETON: irc-end ! sent when the client isn't running anymore SINGLETON: irc-disconnected ! sent when connection is lost SINGLETON: irc-connected ! sent when connection is established -> values [ out-messages>> ] map ] - [ in-messages>> ] - [ out-messages>> ] tri 2array prepend - [ irc-end swap mailbox-put ] each ; -PRIVATE> - : terminate-irc ( irc-client -- ) [ is-running>> ] keep and [ - [ end-loops ] - [ [ f ] dip (>>is-running) ] - bi + f >>is-running + [ in-messages>> ] [ out-messages>> ] bi 2array + [ irc-end swap mailbox-put ] each ] when* ; [ +server-listener+ listener> ] unless* [ to-listener ] [ drop ] if* ; -M: irc-listener to-listener ( message irc-listener -- ) - in-messages>> mailbox-put ; +M: irc-listener to-listener in-messages>> mailbox-put ; : unregister-listener ( name -- ) irc> listeners>> @@ -156,10 +147,6 @@ M: irc-listener to-listener ( message irc-listener -- ) DEFER: me? -: maybe-forward-join ( join -- ) - [ irc-message-sender me? ] keep and - [ irc> join-messages>> mailbox-put ] when* ; - ! ====================================== ! IRC client messages ! ====================================== @@ -187,63 +174,50 @@ DEFER: me? ! ====================================== GENERIC: forward-name ( irc-message -- name ) -M: join forward-name ( join -- name ) trailing>> ; -M: part forward-name ( part -- name ) channel>> ; -M: kick forward-name ( kick -- name ) channel>> ; -M: mode forward-name ( mode -- name ) name>> ; -M: privmsg forward-name ( privmsg -- name ) - dup name>> me? [ irc-message-sender ] [ name>> ] if ; +M: join forward-name trailing>> ; +M: part forward-name channel>> ; +M: kick forward-name channel>> ; +M: mode forward-name name>> ; +M: privmsg forward-name dup name>> me? [ irc-message-sender ] [ name>> ] if ; UNION: single-forward join part kick mode privmsg ; UNION: multiple-forward nick quit ; UNION: broadcast-forward irc-end irc-disconnected irc-connected ; GENERIC: forward-message ( irc-message -- ) -M: irc-message forward-message ( irc-message -- ) +M: irc-message forward-message +server-listener+ listener> [ to-listener ] [ drop ] if* ; -M: single-forward forward-message ( forward-single -- ) - dup forward-name to-listener ; +M: single-forward forward-message dup forward-name to-listener ; -M: multiple-forward forward-message ( multiple-forward -- ) +M: multiple-forward forward-message dup irc-message-sender to-listeners-with-participant ; - -M: join forward-message ( join -- ) - [ maybe-forward-join ] [ call-next-method ] bi ; - -M: broadcast-forward forward-message ( irc-broadcasted-message -- ) + +M: broadcast-forward forward-message irc> listeners>> values [ to-listener ] with each ; GENERIC: process-message ( irc-message -- ) +M: object process-message drop ; +M: logged-in process-message name>> irc> (>>nick) ; +M: ping process-message trailing>> /PONG ; +M: nick-in-use process-message name>> "_" append /NICK ; -M: object process-message ( object -- ) - drop ; - -M: logged-in process-message ( logged-in -- ) - name>> irc> (>>nick) ; - -M: ping process-message ( ping -- ) - trailing>> /PONG ; - -M: nick-in-use process-message ( nick-in-use -- ) - name>> "_" append /NICK ; - -M: join process-message ( join -- ) +M: join process-message [ drop +normal+ ] [ irc-message-sender ] [ trailing>> ] tri dup listener> [ add-participant ] [ 3drop ] if ; -M: part process-message ( part -- ) +M: part process-message [ irc-message-sender ] [ channel>> ] bi remove-participant ; -M: kick process-message ( kick -- ) +M: kick process-message [ [ who>> ] [ channel>> ] bi remove-participant ] [ dup who>> me? [ unregister-listener ] [ drop ] if ] bi ; -M: quit process-message ( quit -- ) +M: quit process-message irc-message-sender remove-participant-from-all ; -M: nick process-message ( nick -- ) +M: nick process-message [ irc-message-sender ] [ trailing>> ] bi rename-participant-in-all ; ! M: mode process-message ( mode -- ) @@ -259,7 +233,7 @@ M: nick process-message ( nick -- ) trailing>> [ blank? ] trim " " split [ >nick/mode 2array ] map >hashtable ; -M: names-reply process-message ( names-reply -- ) +M: names-reply process-message [ names-reply>participants ] [ channel>> listener> ] bi [ [ (>>participants) ] [ [ f f f ] dip name>> to-listener ] bi @@ -270,9 +244,8 @@ M: names-reply process-message ( names-reply -- ) ! ====================================== GENERIC: handle-outgoing-irc ( irc-message -- ? ) -M: irc-end handle-outgoing-irc ( irc-end -- ? ) drop f ; -M: irc-message handle-outgoing-irc ( irc-message -- ? ) - irc-message>client-line irc-print t ; +M: irc-end handle-outgoing-irc drop f ; +M: irc-message handle-outgoing-irc irc-message>client-line irc-print t ; ! ====================================== ! Reader/Writer @@ -326,16 +299,11 @@ DEFER: (connect-irc) [ nip ] } cond ; -GENERIC: handle-listener-out ( irc-message -- ? ) -M: irc-end handle-listener-out ( irc-end -- ? ) drop f ; -M: irc-message handle-listener-out ( irc-message -- ? ) - irc> out-messages>> mailbox-put t ; - -: listener-loop ( name -- ? ) - dup listener> [ - out-messages>> mailbox-get - maybe-annotate-with-name handle-listener-out - ] [ drop f ] if* ; +GENERIC: annotate-message ( listener object -- object ) +M: object annotate-message nip ; +M: part annotate-message swap name>> >>channel ; +M: privmsg annotate-message swap name>> >>name ; +M: string annotate-message [ name>> ] dip strings>privmsg ; : spawn-irc ( -- ) [ reader-loop ] "irc-reader-loop" spawn-server @@ -343,48 +311,33 @@ M: irc-message handle-listener-out ( irc-message -- ? ) [ in-multiplexer-loop ] "in-multiplexer-loop" spawn-server 3drop ; -! ====================================== -! Listener join request handling -! ====================================== - -: set+run-listener ( name irc-listener -- ) - over irc> listeners>> set-at - '[ _ listener-loop ] "irc-listener-loop" spawn-server drop ; - GENERIC: (add-listener) ( irc-listener -- ) -M: irc-channel-listener (add-listener) ( irc-channel-listener -- ) - [ [ name>> ] [ password>> ] bi /JOIN ] - [ [ [ drop irc> join-messages>> ] - [ timeout>> ] - [ name>> '[ trailing>> _ = ] ] - tri mailbox-get-timeout? trailing>> ] keep set+run-listener - ] bi ; +M: irc-listener (add-listener) + [ irc> >>client ] [ name>> ] bi irc> listeners>> set-at ; -M: irc-nick-listener (add-listener) ( irc-nick-listener -- ) - [ name>> ] keep set+run-listener ; - -M: irc-server-listener (add-listener) ( irc-server-listener -- ) - [ +server-listener+ ] dip set+run-listener ; +M: irc-server-listener (add-listener) + irc> >>client +server-listener+ irc> listeners>> set-at ; GENERIC: (remove-listener) ( irc-listener -- ) -M: irc-nick-listener (remove-listener) ( irc-nick-listener -- ) +M: irc-nick-listener (remove-listener) name>> unregister-listener ; -M: irc-channel-listener (remove-listener) ( irc-channel-listener -- ) - [ [ name>> ] [ out-messages>> ] bi - [ [ part new ] dip >>channel ] dip mailbox-put ] keep +M: irc-channel-listener (remove-listener) + [ part new annotate-message irc> out-messages>> mailbox-put ] keep name>> unregister-listener ; -M: irc-server-listener (remove-listener) ( irc-server-listener -- ) +M: irc-server-listener (remove-listener) drop +server-listener+ unregister-listener ; : (connect-irc) ( irc-client -- ) - [ profile>> [ server>> ] [ port>> ] bi /CONNECT ] keep - swap >>stream - t >>is-running - in-messages>> [ irc-connected ] dip mailbox-put ; + { + [ profile>> [ server>> ] [ port>> ] bi /CONNECT ] + [ (>>stream) ] + [ t swap (>>is-running) ] + [ in-messages>> [ irc-connected ] dip mailbox-put ] + } cleave ; : with-irc-client ( irc-client quot: ( -- ) -- ) [ \ current-irc-client ] dip with-variable ; inline @@ -392,15 +345,18 @@ M: irc-server-listener (remove-listener) ( irc-server-listener -- ) PRIVATE> : connect-irc ( irc-client -- ) - [ irc> - [ (connect-irc) ] [ nick>> /LOGIN ] bi - spawn-irc ] with-irc-client ; + dup [ [ (connect-irc) ] [ nick>> /LOGIN ] bi spawn-irc ] with-irc-client ; : add-listener ( irc-listener irc-client -- ) swap '[ _ (add-listener) ] with-irc-client ; -: remove-listener ( irc-listener irc-client -- ) - swap '[ _ (remove-listener) ] with-irc-client ; +: remove-listener ( irc-listener -- ) + [ client>> ] keep '[ _ (remove-listener) ] with-irc-client ; + +: join-irc-channel ( irc-channel-listener -- ) + dup client>> [ [ name>> ] [ password>> ] bi /JOIN ] with-irc-client ; + +: write-message ( message irc-listener -- ) + [ swap annotate-message ] [ client>> out-messages>> mailbox-put ] bi ; -: write-message ( message irc-listener -- ) out-messages>> mailbox-put ; : read-message ( irc-listener -- message ) in-messages>> mailbox-get ; diff --git a/extra/irc/messages/messages-tests.factor b/extra/irc/messages/messages-tests.factor index b61dd16448..41272a43f2 100644 --- a/extra/irc/messages/messages-tests.factor +++ b/extra/irc/messages/messages-tests.factor @@ -62,4 +62,14 @@ IN: irc.messages.tests { parameters { } } { trailing "someuser2" } } } [ ":someuser!n=user@some.where NICK :someuser2" + parse-irc-line f >>timestamp ] unit-test + +{ T{ nick-in-use + { line ":ircserver.net 433 * nickname :Nickname is already in use" } + { prefix "ircserver.net" } + { command "433" } + { parameters { "*" "nickname" } } + { name "nickname" } + { trailing "Nickname is already in use" } } } +[ ":ircserver.net 433 * nickname :Nickname is already in use" parse-irc-line f >>timestamp ] unit-test \ No newline at end of file diff --git a/extra/irc/messages/messages.factor b/extra/irc/messages/messages.factor index 9201f822da..882cec5c8d 100755 --- a/extra/irc/messages/messages.factor +++ b/extra/irc/messages/messages.factor @@ -17,7 +17,7 @@ TUPLE: nick < irc-message ; TUPLE: privmsg < irc-message name ; TUPLE: kick < irc-message channel who ; TUPLE: roomlist < irc-message channel names ; -TUPLE: nick-in-use < irc-message asterisk name ; +TUPLE: nick-in-use < irc-message name ; TUPLE: notice < irc-message type ; TUPLE: mode < irc-message name mode parameter ; TUPLE: names-reply < irc-message who channel ; @@ -31,45 +31,43 @@ TUPLE: unhandled < irc-message ; GENERIC: command-string>> ( irc-message -- string ) -M: irc-message command-string>> ( irc-message -- string ) command>> ; -M: ping command-string>> ( ping -- string ) drop "PING" ; -M: join command-string>> ( join -- string ) drop "JOIN" ; -M: part command-string>> ( part -- string ) drop "PART" ; -M: quit command-string>> ( quit -- string ) drop "QUIT" ; -M: nick command-string>> ( nick -- string ) drop "NICK" ; -M: privmsg command-string>> ( privmsg -- string ) drop "PRIVMSG" ; -M: notice command-string>> ( notice -- string ) drop "NOTICE" ; -M: mode command-string>> ( mode -- string ) drop "MODE" ; -M: kick command-string>> ( kick -- string ) drop "KICK" ; +M: irc-message command-string>> command>> ; +M: ping command-string>> drop "PING" ; +M: join command-string>> drop "JOIN" ; +M: part command-string>> drop "PART" ; +M: quit command-string>> drop "QUIT" ; +M: nick command-string>> drop "NICK" ; +M: privmsg command-string>> drop "PRIVMSG" ; +M: notice command-string>> drop "NOTICE" ; +M: mode command-string>> drop "MODE" ; +M: kick command-string>> drop "KICK" ; GENERIC: command-parameters>> ( irc-message -- seq ) -M: irc-message command-parameters>> ( irc-message -- seq ) parameters>> ; -M: ping command-parameters>> ( ping -- seq ) drop { } ; -M: join command-parameters>> ( join -- seq ) drop { } ; -M: part command-parameters>> ( part -- seq ) channel>> 1array ; -M: quit command-parameters>> ( quit -- seq ) drop { } ; -M: nick command-parameters>> ( nick -- seq ) drop { } ; -M: privmsg command-parameters>> ( privmsg -- seq ) name>> 1array ; -M: notice command-parameters>> ( norice -- seq ) type>> 1array ; -M: kick command-parameters>> ( kick -- seq ) - [ channel>> ] [ who>> ] bi 2array ; -M: mode command-parameters>> ( mode -- seq ) - [ name>> ] [ channel>> ] [ mode>> ] tri 3array ; +M: irc-message command-parameters>> parameters>> ; +M: ping command-parameters>> drop { } ; +M: join command-parameters>> drop { } ; +M: part command-parameters>> channel>> 1array ; +M: quit command-parameters>> drop { } ; +M: nick command-parameters>> drop { } ; +M: privmsg command-parameters>> name>> 1array ; +M: notice command-parameters>> type>> 1array ; +M: kick command-parameters>> [ channel>> ] [ who>> ] bi 2array ; +M: mode command-parameters>> [ name>> ] [ channel>> ] [ mode>> ] tri 3array ; GENERIC: (>>command-parameters) ( params irc-message -- ) -M: irc-message (>>command-parameters) ( params irc-message -- ) 2drop ; -M: logged-in (>>command-parameters) ( params part -- ) [ first ] dip (>>name) ; -M: privmsg (>>command-parameters) ( params privmsg -- ) [ first ] dip (>>name) ; -M: notice (>>command-parameters) ( params notice -- ) [ first ] dip (>>type) ; -M: part (>>command-parameters) ( params part -- ) - [ first ] dip (>>channel) ; -M: kick (>>command-parameters) ( params kick -- ) +M: irc-message (>>command-parameters) 2drop ; +M: logged-in (>>command-parameters) [ first ] dip (>>name) ; +M: privmsg (>>command-parameters) [ first ] dip (>>name) ; +M: notice (>>command-parameters) [ first ] dip (>>type) ; +M: part (>>command-parameters) [ first ] dip (>>channel) ; +M: nick-in-use (>>command-parameters) [ second ] dip (>>name) ; +M: kick (>>command-parameters) [ first2 ] dip [ (>>who) ] [ (>>channel) ] bi ; -M: names-reply (>>command-parameters) ( params names-reply -- ) +M: names-reply (>>command-parameters) [ [ first ] dip (>>who) ] [ [ third ] dip (>>channel) ] 2bi ; -M: mode (>>command-parameters) ( params mode -- ) +M: mode (>>command-parameters) { { [ >r 2array r> ] [ [ (>>mode) ] [ (>>name) ] bi ] } { [ >r 3array r> ] [ [ (>>parameter) ] [ (>>mode) ] [ (>>name) ] tri ] } } switch ; @@ -78,16 +76,14 @@ PRIVATE> GENERIC: irc-message>client-line ( irc-message -- string ) -M: irc-message irc-message>client-line ( irc-message -- string ) +M: irc-message irc-message>client-line [ command-string>> ] [ command-parameters>> " " sjoin ] [ trailing>> [ CHAR: : prefix ] [ "" ] if* ] tri 3array " " sjoin ; GENERIC: irc-message>server-line ( irc-message -- string ) - -M: irc-message irc-message>server-line ( irc-message -- string ) - drop "not implemented yet" ; +M: irc-message irc-message>server-line drop "not implemented yet" ; UNION: sender-in-prefix privmsg join part quit kick mode nick ; GENERIC: irc-message-sender ( irc-message -- sender ) -M: sender-in-prefix irc-message-sender ( sender-in-prefix -- sender ) - prefix>> parse-name ; +M: sender-in-prefix irc-message-sender prefix>> parse-name ; : string>irc-message ( string -- object ) dup split-prefix split-trailing diff --git a/extra/irc/ui/ui.factor b/extra/irc/ui/ui.factor index 1e4bcf35f8..c171fef0b6 100755 --- a/extra/irc/ui/ui.factor +++ b/extra/irc/ui/ui.factor @@ -182,11 +182,16 @@ irc-editor "general" f { [ @center grid-add ] keep @bottom grid-add ; +GENERIC: init-listener ( listener -- ) +M: object init-listener drop ; +M: irc-channel-listener init-listener join-irc-channel ; + M: irc-tab graft* - [ listener>> ] [ window>> client>> ] bi add-listener ; + [ listener>> dup ] [ window>> client>> ] bi add-listener + init-listener ; M: irc-tab ungraft* - [ listener>> ] [ window>> client>> ] bi remove-listener ; + listener>> remove-listener ; TUPLE: irc-channel-tab < irc-tab userlist ; @@ -239,8 +244,9 @@ M: irc-tab pref-dim* [ connect-irc ] } cleave ; : server-open ( server port nick password channels -- ) - [ ui-connect [ irc-window ] keep ] dip - [ over join-channel ] each drop ; + [ ui-connect [ irc-window ] keep ] dip 2drop ; +! FIXME: should join channels only after we have been logged in +! [ over join-channel ] each drop ; : main-run ( -- ) run-ircui ; From 177abec11efaca3eec84a0a0df3a5efbf5a5d9b1 Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Tue, 30 Sep 2008 03:00:48 -0300 Subject: [PATCH 003/948] irc.client: Fix listeners-with-participant --- extra/irc/client/client.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor index ca16ff3b88..606a8206da 100755 --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -67,6 +67,7 @@ SINGLETON: irc-listener-end ! send to a listener to stop its execution SINGLETON: irc-end ! sent when the client isn't running anymore SINGLETON: irc-disconnected ! sent when connection is lost SINGLETON: irc-connected ! sent when connection is established +SINGLETON: irc-ready ! sent after the client is logged in : terminate-irc ( irc-client -- ) [ is-running>> ] keep and [ @@ -115,7 +116,7 @@ M: irc-listener to-listener in-messages>> mailbox-put ; : listeners-with-participant ( nick -- seq ) irc> listeners>> values - [ [ irc-channel-listener? ] keep and [ participants>> key? ] when* ] + [ [ irc-channel-listener? ] keep and [ participants>> key? ] [ drop f ] if* ] with filter ; : to-listeners-with-participant ( message nickname -- ) From f12357e4e1cf21e11faaf216054b3244f5235394 Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Tue, 30 Sep 2008 03:11:54 -0300 Subject: [PATCH 004/948] irc.client: Fix docs --- extra/irc/client/client-docs.factor | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/extra/irc/client/client-docs.factor b/extra/irc/client/client-docs.factor index 6bb6a6328e..d150e6d36f 100644 --- a/extra/irc/client/client-docs.factor +++ b/extra/irc/client/client-docs.factor @@ -1,20 +1,15 @@ USING: help.markup help.syntax quotations kernel irc.messages ; IN: irc.client -HELP: irc-client "IRC Client object" -"blah" ; +HELP: irc-client "IRC Client object" ; -HELP: irc-server-listener "Listener for server messages unmanaged by other listeners" -"blah" ; +HELP: irc-server-listener "Listener for server messages unmanaged by other listeners" ; -HELP: irc-channel-listener "Listener for irc channels" -"blah" ; +HELP: irc-channel-listener "Listener for irc channels" ; -HELP: irc-nick-listener "Listener for irc users" -"blah" ; +HELP: irc-nick-listener "Listener for irc users" ; -HELP: irc-profile "IRC Client profile object" -"blah" ; +HELP: irc-profile "IRC Client profile object" ; HELP: connect-irc "Connecting to an irc server" { $values { "irc-client" "an irc client object" } } @@ -24,6 +19,10 @@ HELP: add-listener "Listening to irc channels/users/etc" { $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } } { $description "Registers " { $snippet "irc-listener" } " with " { $snippet "irc-client" } " and starts listening." } ; +HELP: join-irc-channel "Joining channels" +{ $values { "irc-client-listener" "an irc client listener object" } } +{ $description "Joins to the channel being listened by " { $snippet "irc-listener" } "." } ; + HELP: remove-listener "Stop an unregister listener" { $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } } { $description "Unregisters " { $snippet "irc-listener" } " from " { $snippet "irc-client" } " and stops listening. This is how you part from a channel." } ; @@ -55,6 +54,7 @@ ARTICLE: "irc.client" "IRC Client" { $subsection terminate-irc } { $subsection add-listener } { $subsection remove-listener } +{ $subsection join-irc-channel } { $subsection read-message } { $subsection write-message } { $heading "IRC messages" } @@ -77,13 +77,14 @@ ARTICLE: "irc.client" "IRC Client" { $heading "Special messages" } "Some special messages that are created by the library and not by the irc server." { $table - { { $link irc-end } " sent when the client isn't running anymore, listeners should stop after this." } + { { $link irc-listener-end } "sent to a listener when it has been dettached from the client, the listener should stop after it receives this message. " } + { { $link irc-end } " sent when the client isn't running anymore, listeners should stop after it receives this message." } { { $link irc-disconnected } " sent to notify listeners that connection was lost." } { { $link irc-connected } " sent to notify listeners that a connection with the irc server was established." } } { $heading "Example:" } { $code - "USING: irc.client concurrency.mailboxes ;" + "USING: irc.client ;" "SYMBOL: bot" "SYMBOL: mychannel" "! Create the profile and client objects" @@ -94,6 +95,8 @@ ARTICLE: "irc.client" "IRC Client" "\"#mychannel123\" mychannel set" "! Register and start listener (this joins the channel)" "mychannel get bot get add-listener" + "! Join to the channel" + "mychannel get join-irc-channel" "! Send a message to the channel" "\"what's up?\" mychannel get write-message" "! Read a message from the channel" From 1ff9d3f304688d917967199e03720116a5634701 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 30 Sep 2008 12:47:46 -0500 Subject: [PATCH 005/948] fixed taxes --- extra/taxes/usa/federal/federal.factor | 47 +++++++++ extra/taxes/usa/fica/fica.factor | 17 ++++ extra/taxes/usa/futa/futa.factor | 15 +++ extra/taxes/usa/medicare/medicare.factor | 8 ++ extra/taxes/usa/mn/mn.factor | 33 +++++++ extra/taxes/usa/usa-tests.factor | 118 +++++++++++++++++++++++ extra/taxes/usa/usa.factor | 41 ++++++++ extra/taxes/usa/w4/w4.factor | 13 +++ extra/taxes/utils/utils.factor | 10 ++ 9 files changed, 302 insertions(+) create mode 100644 extra/taxes/usa/federal/federal.factor create mode 100644 extra/taxes/usa/fica/fica.factor create mode 100644 extra/taxes/usa/futa/futa.factor create mode 100644 extra/taxes/usa/medicare/medicare.factor create mode 100644 extra/taxes/usa/mn/mn.factor create mode 100644 extra/taxes/usa/usa-tests.factor create mode 100644 extra/taxes/usa/usa.factor create mode 100644 extra/taxes/usa/w4/w4.factor create mode 100644 extra/taxes/utils/utils.factor diff --git a/extra/taxes/usa/federal/federal.factor b/extra/taxes/usa/federal/federal.factor new file mode 100644 index 0000000000..91d22ee828 --- /dev/null +++ b/extra/taxes/usa/federal/federal.factor @@ -0,0 +1,47 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays assocs kernel math math.intervals +namespaces sequences combinators.lib money math.order +taxes.usa.fica taxes.usa.medicare taxes.usa taxes.usa.w4 ; +IN: taxes.usa.federal + +! http://www.irs.gov/pub/irs-pdf/p15.pdf +! Table 7 ANNUAL Payroll Period + +: federal-single ( -- triples ) + { + { 0 2650 DECIMAL: 0 } + { 2650 10300 DECIMAL: .10 } + { 10300 33960 DECIMAL: .15 } + { 33960 79725 DECIMAL: .25 } + { 79725 166500 DECIMAL: .28 } + { 166500 359650 DECIMAL: .33 } + { 359650 1/0. DECIMAL: .35 } + } ; + +: federal-married ( -- triples ) + { + { 0 8000 DECIMAL: 0 } + { 8000 23550 DECIMAL: .10 } + { 23550 72150 DECIMAL: .15 } + { 72150 137850 DECIMAL: .25 } + { 137850 207700 DECIMAL: .28 } + { 207700 365100 DECIMAL: .33 } + { 365100 1/0. DECIMAL: .35 } + } ; + +SINGLETON: federal +: ( -- obj ) + federal federal-single federal-married ; + +: federal-tax ( salary w4 tax-table -- n ) + [ adjust-allowances ] 2keep marriage-table tax ; + +M: federal adjust-allowances* ( salary w4 collector entity -- newsalary ) + 2drop calculate-w4-allowances - ; + +M: federal withholding* ( salary w4 tax-table entity -- x ) + drop + [ federal-tax ] 3keep drop + [ fica-tax ] 2keep + medicare-tax + + ; diff --git a/extra/taxes/usa/fica/fica.factor b/extra/taxes/usa/fica/fica.factor new file mode 100644 index 0000000000..69a62753f2 --- /dev/null +++ b/extra/taxes/usa/fica/fica.factor @@ -0,0 +1,17 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors math math.order assocs.lib money ; +IN: taxes.usa.fica + +: fica-tax-rate ( -- x ) DECIMAL: .062 ; inline + +ERROR: fica-base-unknown year ; + +: fica-base-rate ( year -- x ) + H{ + { 2008 102000 } + { 2007 97500 } + } [ fica-base-unknown ] unless-at ; + +: fica-tax ( salary w4 -- x ) + year>> fica-base-rate min fica-tax-rate * ; diff --git a/extra/taxes/usa/futa/futa.factor b/extra/taxes/usa/futa/futa.factor new file mode 100644 index 0000000000..36d3097007 --- /dev/null +++ b/extra/taxes/usa/futa/futa.factor @@ -0,0 +1,15 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays assocs kernel math math.intervals +namespaces sequences combinators.lib money math.order ; +IN: taxes.usa.futa + +! Employer tax only, not withheld +: futa-tax-rate ( -- x ) DECIMAL: .062 ; inline +: futa-base-rate ( -- x ) 7000 ; inline +: futa-tax-offset-credit ( -- x ) DECIMAL: .054 ; inline + +: futa-tax ( salary w4 -- x ) + drop futa-base-rate min + futa-tax-rate futa-tax-offset-credit - + * ; diff --git a/extra/taxes/usa/medicare/medicare.factor b/extra/taxes/usa/medicare/medicare.factor new file mode 100644 index 0000000000..ea95224456 --- /dev/null +++ b/extra/taxes/usa/medicare/medicare.factor @@ -0,0 +1,8 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel math money ; +IN: taxes.usa.medicare + +! No base rate for medicare; all wages subject +: medicare-tax-rate ( -- x ) DECIMAL: .0145 ; inline +: medicare-tax ( salary w4 -- x ) drop medicare-tax-rate * ; diff --git a/extra/taxes/usa/mn/mn.factor b/extra/taxes/usa/mn/mn.factor new file mode 100644 index 0000000000..8bb629efcd --- /dev/null +++ b/extra/taxes/usa/mn/mn.factor @@ -0,0 +1,33 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays assocs kernel math math.intervals +namespaces sequences money math.order usa-cities +taxes.usa taxes.usa.w4 ; +IN: taxes.usa.mn + +! Minnesota +: mn-single ( -- triples ) + { + { 0 1950 DECIMAL: 0 } + { 1950 23750 DECIMAL: .0535 } + { 23750 73540 DECIMAL: .0705 } + { 73540 1/0. DECIMAL: .0785 } + } ; + +: mn-married ( -- triples ) + { + { 0 7400 DECIMAL: 0 } + { 7400 39260 DECIMAL: .0535 } + { 39260 133980 DECIMAL: .0705 } + { 133980 1/0. DECIMAL: .0785 } + } ; + +: ( -- obj ) + MN mn-single mn-married ; + +M: MN adjust-allowances* ( salary w4 collector entity -- newsalary ) + 2drop calculate-w4-allowances - ; + +M: MN withholding* ( salary w4 collector entity -- x ) + drop + [ adjust-allowances ] 2keep marriage-table tax ; diff --git a/extra/taxes/usa/usa-tests.factor b/extra/taxes/usa/usa-tests.factor new file mode 100644 index 0000000000..6aac4b928c --- /dev/null +++ b/extra/taxes/usa/usa-tests.factor @@ -0,0 +1,118 @@ +USING: kernel money tools.test +taxes.usa taxes.usa.federal taxes.usa.mn +taxes.utils taxes.usa.w4 usa-cities ; +IN: taxes.usa.tests + +[ + 426 23 +] [ + 12000 2008 3 f net biweekly + dollars/cents +] unit-test + +[ + 426 23 +] [ + 12000 2008 3 t net biweekly + dollars/cents +] unit-test + +[ + 684 4 +] [ + 20000 2008 3 f net biweekly + dollars/cents +] unit-test + + + +[ + 804 58 +] [ + 24000 2008 3 f net biweekly + dollars/cents +] unit-test + +[ + 831 31 +] [ + 24000 2008 3 t net biweekly + dollars/cents +] unit-test + + +[ + 780 81 +] [ + 24000 2008 3 f net biweekly + dollars/cents +] unit-test + +[ + 818 76 +] [ + 24000 2008 3 t net biweekly + dollars/cents +] unit-test + + +[ + 2124 39 +] [ + 78250 2008 3 f net biweekly + dollars/cents +] unit-test + +[ + 2321 76 +] [ + 78250 2008 3 t net biweekly + dollars/cents +] unit-test + + +[ + 2612 63 +] [ + 100000 2008 3 f net biweekly + dollars/cents +] unit-test + +[ + 22244 52 +] [ + 1000000 2008 3 f net biweekly + dollars/cents +] unit-test + +[ + 578357 40 +] [ + 1000000 2008 3 f net + dollars/cents +] unit-test + +[ + 588325 41 +] [ + 1000000 2008 3 t net + dollars/cents +] unit-test + + +[ 30 97 ] [ + 24000 2008 2 f MN withholding* biweekly dollars/cents +] unit-test + +[ 173 66 ] [ + 78250 2008 2 f MN withholding* biweekly dollars/cents +] unit-test + + +[ 138 69 ] [ + 24000 2008 2 f withholding biweekly dollars/cents +] unit-test + +[ 754 72 ] [ + 78250 2008 2 f withholding biweekly dollars/cents +] unit-test diff --git a/extra/taxes/usa/usa.factor b/extra/taxes/usa/usa.factor new file mode 100644 index 0000000000..1d21524b45 --- /dev/null +++ b/extra/taxes/usa/usa.factor @@ -0,0 +1,41 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors arrays assocs kernel math math.intervals +namespaces sequences money math.order taxes.usa.w4 +taxes.usa.federal ; +IN: taxes.usa + +! Withhold: FICA, Medicare, Federal (FICA is social security) + +TUPLE: tax-table entity single married ; +C: tax-table + +GENERIC: adjust-allowances* ( salary w4 tax-table entity -- newsalary ) +GENERIC: withholding* ( salary w4 tax-table entity -- x ) + +: adjust-allowances ( salary w4 tax-table -- newsalary ) + dup entity>> adjust-allowances* ; + +: withholding ( salary w4 tax-table -- x ) + dup entity>> federal = [ + dup entity>> withholding* + ] [ + [ dup entity>> withholding* ] + [ drop federal withholding* ] 3bi + + ] if ; + +: tax-bracket-range ( pair -- n ) first2 swap - ; + +: tax-bracket ( tax salary triples -- tax salary ) + [ [ tax-bracket-range min ] keep third * + ] 2keep + tax-bracket-range [-] ; + +: tax ( salary triples -- x ) + 0 -rot [ tax-bracket ] each drop ; + +: marriage-table ( w4 tax-table -- triples ) + swap married?>> + [ married>> ] [ single>> ] if ; + +: net ( salary w4 collector -- x ) + >r dupd r> withholding - ; diff --git a/extra/taxes/usa/w4/w4.factor b/extra/taxes/usa/w4/w4.factor new file mode 100644 index 0000000000..aad3773220 --- /dev/null +++ b/extra/taxes/usa/w4/w4.factor @@ -0,0 +1,13 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors kernel math ; +IN: taxes.usa.w4 + +! Each employee fills out a w4 +TUPLE: w4 year allowances married? ; +C: w4 + +: allowance ( -- x ) 3500 ; inline + +: calculate-w4-allowances ( w4 -- x ) allowances>> allowance * ; + diff --git a/extra/taxes/utils/utils.factor b/extra/taxes/utils/utils.factor new file mode 100644 index 0000000000..a5c2240625 --- /dev/null +++ b/extra/taxes/utils/utils.factor @@ -0,0 +1,10 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: math ; +IN: taxes.utils + +: monthly ( x -- y ) 12 / ; +: semimonthly ( x -- y ) 24 / ; +: biweekly ( x -- y ) 26 / ; +: weekly ( x -- y ) 52 / ; +: daily ( x -- y ) 360 / ; From cb8e58ba0d7c39869e9373010439b5075a5480f0 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 30 Sep 2008 12:48:22 -0500 Subject: [PATCH 006/948] remove old taxes --- unmaintained/taxes/authors.txt | 1 - unmaintained/taxes/summary.txt | 1 - unmaintained/taxes/tags.txt | 1 - unmaintained/taxes/taxes-tests.factor | 116 --------------------- unmaintained/taxes/taxes.factor | 145 -------------------------- 5 files changed, 264 deletions(-) delete mode 100644 unmaintained/taxes/authors.txt delete mode 100644 unmaintained/taxes/summary.txt delete mode 100644 unmaintained/taxes/tags.txt delete mode 100644 unmaintained/taxes/taxes-tests.factor delete mode 100644 unmaintained/taxes/taxes.factor diff --git a/unmaintained/taxes/authors.txt b/unmaintained/taxes/authors.txt deleted file mode 100644 index 7c1b2f2279..0000000000 --- a/unmaintained/taxes/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Doug Coleman diff --git a/unmaintained/taxes/summary.txt b/unmaintained/taxes/summary.txt deleted file mode 100644 index e983139ccb..0000000000 --- a/unmaintained/taxes/summary.txt +++ /dev/null @@ -1 +0,0 @@ -Calculate federal and state tax withholdings diff --git a/unmaintained/taxes/tags.txt b/unmaintained/taxes/tags.txt deleted file mode 100644 index 2964ef21b1..0000000000 --- a/unmaintained/taxes/tags.txt +++ /dev/null @@ -1 +0,0 @@ -taxes diff --git a/unmaintained/taxes/taxes-tests.factor b/unmaintained/taxes/taxes-tests.factor deleted file mode 100644 index 17d1998f67..0000000000 --- a/unmaintained/taxes/taxes-tests.factor +++ /dev/null @@ -1,116 +0,0 @@ -USING: kernel money taxes tools.test ; -IN: taxes.tests - -[ - 426 23 -] [ - 12000 2008 3 f net biweekly - dollars/cents -] unit-test - -[ - 426 23 -] [ - 12000 2008 3 t net biweekly - dollars/cents -] unit-test - -[ - 684 4 -] [ - 20000 2008 3 f net biweekly - dollars/cents -] unit-test - - - -[ - 804 58 -] [ - 24000 2008 3 f net biweekly - dollars/cents -] unit-test - -[ - 831 31 -] [ - 24000 2008 3 t net biweekly - dollars/cents -] unit-test - - -[ - 780 81 -] [ - 24000 2008 3 f net biweekly - dollars/cents -] unit-test - -[ - 818 76 -] [ - 24000 2008 3 t net biweekly - dollars/cents -] unit-test - - -[ - 2124 39 -] [ - 78250 2008 3 f net biweekly - dollars/cents -] unit-test - -[ - 2321 76 -] [ - 78250 2008 3 t net biweekly - dollars/cents -] unit-test - - -[ - 2612 63 -] [ - 100000 2008 3 f net biweekly - dollars/cents -] unit-test - -[ - 22244 52 -] [ - 1000000 2008 3 f net biweekly - dollars/cents -] unit-test - -[ - 578357 40 -] [ - 1000000 2008 3 f net - dollars/cents -] unit-test - -[ - 588325 41 -] [ - 1000000 2008 3 t net - dollars/cents -] unit-test - - -[ 30 97 ] [ - 24000 2008 2 f withholding biweekly dollars/cents -] unit-test - -[ 173 66 ] [ - 78250 2008 2 f withholding biweekly dollars/cents -] unit-test - - -[ 138 69 ] [ - 24000 2008 2 f withholding biweekly dollars/cents -] unit-test - -[ 754 72 ] [ - 78250 2008 2 f withholding biweekly dollars/cents -] unit-test diff --git a/unmaintained/taxes/taxes.factor b/unmaintained/taxes/taxes.factor deleted file mode 100644 index 5e2a395c40..0000000000 --- a/unmaintained/taxes/taxes.factor +++ /dev/null @@ -1,145 +0,0 @@ -! Copyright (C) 2008 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: accessors arrays assocs kernel math math.intervals -namespaces sequences combinators.lib money math.order ; -IN: taxes - -: monthly ( x -- y ) 12 / ; -: semimonthly ( x -- y ) 24 / ; -: biweekly ( x -- y ) 26 / ; -: weekly ( x -- y ) 52 / ; -: daily ( x -- y ) 360 / ; - -! Each employee fills out a w4 -TUPLE: w4 year allowances married? ; -C: w4 - -: allowance ( -- x ) 3500 ; inline - -: calculate-w4-allowances ( w4 -- x ) allowances>> allowance * ; - -! Withhold: FICA, Medicare, Federal (FICA is social security) -: fica-tax-rate ( -- x ) DECIMAL: .062 ; inline - -! Base rate -- income over this rate is not taxed -ERROR: fica-base-unknown ; -: fica-base-rate ( year -- x ) - H{ - { 2008 102000 } - { 2007 97500 } - } at* [ fica-base-unknown ] unless ; - -: fica-tax ( salary w4 -- x ) - year>> fica-base-rate min fica-tax-rate * ; - -! Employer tax only, not withheld -: futa-tax-rate ( -- x ) DECIMAL: .062 ; inline -: futa-base-rate ( -- x ) 7000 ; inline -: futa-tax-offset-credit ( -- x ) DECIMAL: .054 ; inline - -: futa-tax ( salary w4 -- x ) - drop futa-base-rate min - futa-tax-rate futa-tax-offset-credit - - * ; - -! No base rate for medicare; all wages subject -: medicare-tax-rate ( -- x ) DECIMAL: .0145 ; inline -: medicare-tax ( salary w4 -- x ) drop medicare-tax-rate * ; - -MIXIN: collector -GENERIC: adjust-allowances ( salary w4 collector -- newsalary ) -GENERIC: withholding ( salary w4 collector -- x ) - -TUPLE: tax-table single married ; - -: ( single married class -- obj ) - >r tax-table boa r> construct-delegate ; - -: tax-bracket-range ( pair -- n ) dup second swap first - ; - -: tax-bracket ( tax salary triples -- tax salary ) - [ [ tax-bracket-range min ] keep third * + ] 2keep - tax-bracket-range [-] ; - -: tax ( salary triples -- x ) - 0 -rot [ tax-bracket ] each drop ; - -: marriage-table ( w4 tax-table -- triples ) - swap married?>> [ married>> ] [ single>> ] if ; - -: federal-tax ( salary w4 tax-table -- n ) - [ adjust-allowances ] 2keep marriage-table tax ; - -! http://www.irs.gov/pub/irs-pdf/p15.pdf -! Table 7 ANNUAL Payroll Period - -: federal-single ( -- triples ) - { - { 0 2650 DECIMAL: 0 } - { 2650 10300 DECIMAL: .10 } - { 10300 33960 DECIMAL: .15 } - { 33960 79725 DECIMAL: .25 } - { 79725 166500 DECIMAL: .28 } - { 166500 359650 DECIMAL: .33 } - { 359650 1/0. DECIMAL: .35 } - } ; - -: federal-married ( -- triples ) - { - { 0 8000 DECIMAL: 0 } - { 8000 23550 DECIMAL: .10 } - { 23550 72150 DECIMAL: .15 } - { 72150 137850 DECIMAL: .25 } - { 137850 207700 DECIMAL: .28 } - { 207700 365100 DECIMAL: .33 } - { 365100 1/0. DECIMAL: .35 } - } ; - -TUPLE: federal ; -INSTANCE: federal collector -: ( -- obj ) - federal-single federal-married federal ; - -M: federal adjust-allowances ( salary w4 collector -- newsalary ) - drop calculate-w4-allowances - ; - -M: federal withholding ( salary w4 tax-table -- x ) - [ federal-tax ] 3keep drop - [ fica-tax ] 2keep - medicare-tax + + ; - - -! Minnesota -: minnesota-single ( -- triples ) - { - { 0 1950 DECIMAL: 0 } - { 1950 23750 DECIMAL: .0535 } - { 23750 73540 DECIMAL: .0705 } - { 73540 1/0. DECIMAL: .0785 } - } ; - -: minnesota-married ( -- triples ) - { - { 0 7400 DECIMAL: 0 } - { 7400 39260 DECIMAL: .0535 } - { 39260 133980 DECIMAL: .0705 } - { 133980 1/0. DECIMAL: .0785 } - } ; - -TUPLE: minnesota ; -INSTANCE: minnesota collector -: ( -- obj ) - minnesota-single minnesota-married minnesota ; - -M: minnesota adjust-allowances ( salary w4 collector -- newsalary ) - drop calculate-w4-allowances - ; - -M: minnesota withholding ( salary w4 collector -- x ) - [ adjust-allowances ] 2keep marriage-table tax ; - -: employer-withhold ( salary w4 collector -- x ) - [ withholding ] 3keep - dup federal? [ 3drop ] [ drop withholding + ] if ; - -: net ( salary w4 collector -- x ) - >r dupd r> employer-withhold - ; From 1b7c0b78573feae5b812b9c13df6f2adbc08ec15 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 30 Sep 2008 13:33:32 -0500 Subject: [PATCH 007/948] remove lib usage --- extra/taxes/usa/federal/federal.factor | 4 ++-- extra/taxes/usa/fica/fica.factor | 2 +- extra/taxes/usa/futa/futa.factor | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/taxes/usa/federal/federal.factor b/extra/taxes/usa/federal/federal.factor index 91d22ee828..5274535f81 100644 --- a/extra/taxes/usa/federal/federal.factor +++ b/extra/taxes/usa/federal/federal.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs kernel math math.intervals -namespaces sequences combinators.lib money math.order -taxes.usa.fica taxes.usa.medicare taxes.usa taxes.usa.w4 ; +namespaces sequences money math.order taxes.usa.fica +taxes.usa.medicare taxes.usa taxes.usa.w4 ; IN: taxes.usa.federal ! http://www.irs.gov/pub/irs-pdf/p15.pdf diff --git a/extra/taxes/usa/fica/fica.factor b/extra/taxes/usa/fica/fica.factor index 69a62753f2..e71b2723a3 100644 --- a/extra/taxes/usa/fica/fica.factor +++ b/extra/taxes/usa/fica/fica.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors math math.order assocs.lib money ; +USING: accessors math math.order money ; IN: taxes.usa.fica : fica-tax-rate ( -- x ) DECIMAL: .062 ; inline diff --git a/extra/taxes/usa/futa/futa.factor b/extra/taxes/usa/futa/futa.factor index 36d3097007..7368aef825 100644 --- a/extra/taxes/usa/futa/futa.factor +++ b/extra/taxes/usa/futa/futa.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs kernel math math.intervals -namespaces sequences combinators.lib money math.order ; +namespaces sequences money math.order ; IN: taxes.usa.futa ! Employer tax only, not withheld From b0ad7dfebc5d176c303f482d643fdccbe724ec18 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 1 Oct 2008 19:58:53 -0700 Subject: [PATCH 008/948] Adding bin-packing routines in extra/math/binpack. --- extra/math/binpack/authors.txt | 1 + extra/math/binpack/binpack-docs.factor | 19 +++++++++++++++++++ extra/math/binpack/binpack-tests.factor | 11 +++++++++++ extra/math/binpack/binpack.factor | 21 +++++++++++++++++++++ extra/math/binpack/summary.txt | 1 + 5 files changed, 53 insertions(+) create mode 100644 extra/math/binpack/authors.txt create mode 100644 extra/math/binpack/binpack-docs.factor create mode 100644 extra/math/binpack/binpack-tests.factor create mode 100644 extra/math/binpack/binpack.factor create mode 100644 extra/math/binpack/summary.txt diff --git a/extra/math/binpack/authors.txt b/extra/math/binpack/authors.txt new file mode 100644 index 0000000000..e091bb8164 --- /dev/null +++ b/extra/math/binpack/authors.txt @@ -0,0 +1 @@ +John Benediktsson diff --git a/extra/math/binpack/binpack-docs.factor b/extra/math/binpack/binpack-docs.factor new file mode 100644 index 0000000000..36a29c7aa1 --- /dev/null +++ b/extra/math/binpack/binpack-docs.factor @@ -0,0 +1,19 @@ +! Copyright (C) 2008 John Benediktsson +! See http://factorcode.org/license.txt for BSD license + +USING: help.syntax help.markup kernel assocs sequences quotations ; + +IN: math.binpack + +HELP: binpack +{ $values { "assoc" assoc } { "n" "number of bins" } { "bins" "packed bins" } } +{ $description "Packs the (key, value) pairs into the specified number of bins, using the value as a weight." } ; + +HELP: binpack* +{ $values { "items" sequence } { "n" "number of bins" } { "bins" "packed bins" } } +{ $description "Packs a sequence of numbers into the specified number of bins." } ; + +HELP: binpack! +{ $values { "items" sequence } { "quot" quotation } { "n" "number of bins" } { "bins" "packed bins" } } +{ $description "Packs a sequence of items into the specified number of bins, using the quotatino to determine the weight." } ; + diff --git a/extra/math/binpack/binpack-tests.factor b/extra/math/binpack/binpack-tests.factor new file mode 100644 index 0000000000..6f94b8ce22 --- /dev/null +++ b/extra/math/binpack/binpack-tests.factor @@ -0,0 +1,11 @@ +! Copyright (C) 2008 John Benediktsson +! See http://factorcode.org/license.txt for BSD license + +USING: kernel tools.test ; + +[ t ] [ { { 3 } { 2 1 } } { 1 2 3 } 2 binpack-numbers = ] unit-test + +[ t ] [ { { 1000 } { 100 30 } { 70 40 23 } { 60 60 7 3 } } + { 100 23 40 60 1000 30 60 07 70 03 } 3 binpack-numbers = ] unit-test + + diff --git a/extra/math/binpack/binpack.factor b/extra/math/binpack/binpack.factor new file mode 100644 index 0000000000..6885789ee1 --- /dev/null +++ b/extra/math/binpack/binpack.factor @@ -0,0 +1,21 @@ +! Copyright (C) 2008 John Benediktsson +! See http://factorcode.org/license.txt for BSD license + +USING: sequences kernel arrays vectors accessors assocs sorting math math.functions ; + +IN: math.binpack + +: (binpack) ( bins item -- ) + swap dup [ [ second ] map sum ] map swap zip sort-keys values first push ; + +: binpack ( assoc n -- bins ) + [ sort-values reverse [ length ] keep swap ] dip + [ / ceiling ] keep [ ] map + swap [ dupd (binpack) ] each ; + +: binpack* ( items n -- bins ) + [ dup zip ] dip binpack [ keys ] map ; + +: binpack! ( items quot n -- bins ) + [ dup ] 2dip [ map zip ] dip binpack [ keys ] map ; + diff --git a/extra/math/binpack/summary.txt b/extra/math/binpack/summary.txt new file mode 100644 index 0000000000..c8b91966bb --- /dev/null +++ b/extra/math/binpack/summary.txt @@ -0,0 +1 @@ +Bin-packing algorithms. From bce227c8f33215f620f11a16a2b673d17caa5226 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 1 Oct 2008 20:05:08 -0700 Subject: [PATCH 009/948] math-binpack: Fix incorrect array size, and update tests. --- extra/math/binpack/binpack-tests.factor | 10 ++++++---- extra/math/binpack/binpack.factor | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/extra/math/binpack/binpack-tests.factor b/extra/math/binpack/binpack-tests.factor index 6f94b8ce22..d0d4630484 100644 --- a/extra/math/binpack/binpack-tests.factor +++ b/extra/math/binpack/binpack-tests.factor @@ -1,11 +1,13 @@ ! Copyright (C) 2008 John Benediktsson ! See http://factorcode.org/license.txt for BSD license -USING: kernel tools.test ; +USING: kernel tools.test math.binpack ; -[ t ] [ { { 3 } { 2 1 } } { 1 2 3 } 2 binpack-numbers = ] unit-test +[ t ] [ { V{ } } { } 1 binpack = ] unit-test -[ t ] [ { { 1000 } { 100 30 } { 70 40 23 } { 60 60 7 3 } } - { 100 23 40 60 1000 30 60 07 70 03 } 3 binpack-numbers = ] unit-test +[ t ] [ { { 3 } { 2 1 } } { 1 2 3 } 2 binpack* = ] unit-test + +[ t ] [ { { 1000 } { 100 60 30 7 } { 70 60 40 23 3 } } + { 100 23 40 60 1000 30 60 07 70 03 } 3 binpack* = ] unit-test diff --git a/extra/math/binpack/binpack.factor b/extra/math/binpack/binpack.factor index 6885789ee1..f6473f2e25 100644 --- a/extra/math/binpack/binpack.factor +++ b/extra/math/binpack/binpack.factor @@ -10,7 +10,7 @@ IN: math.binpack : binpack ( assoc n -- bins ) [ sort-values reverse [ length ] keep swap ] dip - [ / ceiling ] keep [ ] map + [ / ceiling ] keep swap [ ] map swap [ dupd (binpack) ] each ; : binpack* ( items n -- bins ) From 1b889d1f1b6b91162bc888d5270352928e74e04f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 1 Oct 2008 23:02:25 -0500 Subject: [PATCH 010/948] Clear our next-method-quot-cache when deploying --- basis/tools/deploy/shaker/shaker.factor | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index f8b0862c9d..b502a4b4a2 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -373,7 +373,8 @@ SYMBOL: deploy-vocab r> strip-words compress-byte-arrays compress-quotations - compress-strings ; + compress-strings + H{ } clone classes:next-method-quot-cache set-global ; : (deploy) ( final-image vocab config -- ) #! Does the actual work of a deployment in the slave From c7f5b0de813fb247fc78be2a6f6bb7aac2857146 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 1 Oct 2008 23:33:57 -0500 Subject: [PATCH 011/948] throw an error when all slots are IGNORE --- basis/db/queries/queries.factor | 3 +++ basis/db/tuples/tuples-tests.factor | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/basis/db/queries/queries.factor b/basis/db/queries/queries.factor index 0b206cea8f..768ec70185 100644 --- a/basis/db/queries/queries.factor +++ b/basis/db/queries/queries.factor @@ -145,10 +145,13 @@ M: db ( tuple table -- sql ) where-clause ] query-make ; +ERROR: all-slots-ignored class ; + M: db ( tuple class -- statement ) [ "select " 0% [ dupd filter-ignores ] dip + over empty? [ all-slots-ignored ] when over [ ", " 0% ] [ dup column-name>> 0% 2, ] interleave diff --git a/basis/db/tuples/tuples-tests.factor b/basis/db/tuples/tuples-tests.factor index 6114c7ebe1..406d4756a2 100755 --- a/basis/db/tuples/tuples-tests.factor +++ b/basis/db/tuples/tuples-tests.factor @@ -356,9 +356,7 @@ TUPLE: exam id name score ; [ f ] [ T{ exam { name IGNORE } { score IGNORE } } select-tuples first score>> ] unit-test - ! FIXME - ! [ f ] - ! [ T{ exam { name IGNORE } { score IGNORE } { id IGNORE } } select-tuples first score>> ] unit-test + [ T{ exam { name IGNORE } { score IGNORE } { id IGNORE } } select-tuples first score>> ] [ class>> "EXAM" = ] must-fail-with [ { From 47d884cf417675f3f8d129be899128765d82d4fa Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 1 Oct 2008 23:56:20 -0500 Subject: [PATCH 012/948] fix typos in db docs --- basis/db/tuples/tuples-docs.factor | 2 +- basis/db/types/types-docs.factor | 28 +++++++++++++++------------- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/basis/db/tuples/tuples-docs.factor b/basis/db/tuples/tuples-docs.factor index d7ee3a5ad2..497cc2e8c5 100644 --- a/basis/db/tuples/tuples-docs.factor +++ b/basis/db/tuples/tuples-docs.factor @@ -190,7 +190,7 @@ T{ book { $list "Make a new tuple to represent your data" { "Map the Factor types to the database types with " { $link define-persistent } } - { "Make a " { $link "db-custom-database-combinators" } " to open your database and run a " { $snippet "quotation" } } + { "Make a custom database combinator (see" { $link "db-custom-database-combinators" } ") to open your database and run a " { $link quotation } } { "Create a table with " { $link create-table } ", " { $link ensure-table } ", or " { $link recreate-table } } { "Start making and storing objects with " { $link insert-tuple } ", " { $link update-tuple } ", " { $link delete-tuples } ", and " { $link select-tuples } } } ; diff --git a/basis/db/types/types-docs.factor b/basis/db/types/types-docs.factor index 401bbbc4d7..f1a6ba6c6c 100644 --- a/basis/db/types/types-docs.factor +++ b/basis/db/types/types-docs.factor @@ -8,7 +8,7 @@ HELP: +autoincrement+ { $description "" } ; HELP: +db-assigned-id+ -{ $description "The database assigns a primary key to the object. The primary key is most likely a big integer, but is database-dependent." } ; +{ $description "The database assigns a primary key to the object. The primary key is most likely a big integer, but is database-dependent." } ; HELP: +default+ { $description "" } ; @@ -29,7 +29,7 @@ HELP: +primary-key+ { $description "" } ; HELP: +random-id+ -{ $description "Factor chooses a random number and tries to insert the tuple into the database with this number as its primary key. The default number of retries to find a unique random number is 10, though in practice it will almost certainly succeed on the first try." } ; +{ $description "Factor chooses a random number and tries to insert the tuple into the database with this number as its primary key. The default number of retries to find a unique random number is 10, though in practice it will almost certainly succeed on the first try." } ; HELP: +serial+ { $description "" } ; @@ -38,7 +38,7 @@ HELP: +unique+ { $description "" } ; HELP: +user-assigned-id+ -{ $description "The user is responsible for choosing a primary key for tuples inserted with this database type. Keys must be unique or else the database will throw an error. Usually it is better to use a " { $link +db-assigned-id+ } "." } ; +{ $description "The user is responsible for choosing a primary key for tuples inserted with this database type. Keys must be unique or else the database will throw an error. Usually it is better to use a " { $link +db-assigned-id+ } "." } ; HELP: { $description "" } ; @@ -53,7 +53,7 @@ HELP: BIG-INTEGER { $description "A 64-bit integer. Whether this number is signed or unsigned depends on the database backend." } ; HELP: BLOB -{ $description "A serialized Factor object. The database library automatically serializes the object for a SQL insert or update and deserializes it on a tuple query." } ; +{ $description "A byte array." } ; HELP: BOOLEAN { $description "Either true or false." } ; @@ -65,7 +65,7 @@ HELP: DATETIME { $description "A date and a time." } ; HELP: DOUBLE -{ $description "Corresponds to Factor's 64bit floating-point numbers." } ; +{ $description "Corresponds to Factor's 64-bit floating-point numbers." } ; HELP: FACTOR-BLOB { $description "A serialized Factor object." } ; @@ -77,30 +77,31 @@ HELP: NULL { $description "The SQL null type." } ; HELP: REAL -{ $description "" } ; +{ $description "A real number of unlimited precision. May not be supported on all databases." } ; HELP: SIGNED-BIG-INTEGER -{ $description "For portability, if a number is known to be 64bit and signed, then this datatype may be used. Some databases, like SQLite, cannot store arbitrary bignums as BIGINT types. If storing arbitrary bignums, use " { $link FACTOR-BLOB } "." } ; +{ $description "For portability, if a number is known to be 64bit and signed, then this datatype may be used. Some databases, like SQLite, cannot store arbitrary bignums as BIGINT types. If storing arbitrary bignums, use " { $link FACTOR-BLOB } "." } ; HELP: TEXT -{ $description "" } ; +{ $description "Stores a string that is longer than a " { $link VARCHAR } ". SQLite uses this type for strings; it does not handle " { $link VARCHAR } " strings." } ; HELP: TIME -{ $description "" } ; +{ $description "A timestamp without a date component." } ; HELP: TIMESTAMP { $description "A Factor timestamp." } ; HELP: UNSIGNED-BIG-INTEGER -{ $description "For portability, if a number is known to be 64bit, then this datatype may be used. Some databases, like SQLite, cannot store arbitrary bignums as BIGINT types. If storing arbitrary bignums, use " { $link FACTOR-BLOB } "." } ; +{ $description "For portability, if a number is known to be 64bit, then this datatype may be used. Some databases, like SQLite, cannot store arbitrary bignums as BIGINT types. If storing arbitrary bignums, use " { $link FACTOR-BLOB } "." } ; { INTEGER SIGNED-BIG-INTEGER UNSIGNED-BIG-INTEGER } related-words HELP: URL -{ $description "A Factor " { $link "urls" } " object." } ; +{ $description "A Factor " { $link "urls" } " object." } ; HELP: VARCHAR -{ $description "The SQL varchar type. This type can take an integer as an argument." } ; +{ $description "The SQL varchar type. This type can take an integer as an argument." } +{ $examples { $unchecked-example "{ VARCHAR 256 }" "" } } ; HELP: user-assigned-id-spec? { $values @@ -279,8 +280,9 @@ ARTICLE: "db.types" "Database types" { $subsection DATETIME } { $subsection TIME } { $subsection TIMESTAMP } -"Arbitrary Factor objects:" +"Factor byte-arrays:" { $subsection BLOB } +"Arbitrary Factor objects:" { $subsection FACTOR-BLOB } "Factor URLs:" { $subsection URL } ; From d4134a2ca1555b3554537231515c8111a8fd256a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 01:17:45 -0500 Subject: [PATCH 013/948] Fix loop detection bug --- basis/compiler/tests/optimizer.factor | 15 ++++++++++++ .../tree/recursive/recursive-tests.factor | 24 +++++++++++++++++++ .../compiler/tree/recursive/recursive.factor | 12 ++++++---- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/basis/compiler/tests/optimizer.factor b/basis/compiler/tests/optimizer.factor index 4c39da0479..f1b3e32eed 100755 --- a/basis/compiler/tests/optimizer.factor +++ b/basis/compiler/tests/optimizer.factor @@ -362,3 +362,18 @@ TUPLE: some-tuple x ; [ B{ 0 1 2 3 4 5 6 7 } ] [ [ 8 [ ] B{ } map-as ] compile-call ] unit-test [ 0 ] [ 1234 [ { fixnum } declare -64 shift ] compile-call ] unit-test + +! Loop detection problem found by doublec +SYMBOL: counter + +DEFER: loop-bbb + +: loop-aaa ( -- ) + counter inc counter get 2 < [ loop-bbb ] when ; inline recursive + +: loop-bbb ( -- ) + [ loop-aaa ] with-scope ; inline recursive + +: loop-ccc ( -- ) loop-bbb ; + +[ 0 ] [ 0 counter set loop-ccc counter get ] unit-test diff --git a/basis/compiler/tree/recursive/recursive-tests.factor b/basis/compiler/tree/recursive/recursive-tests.factor index c66c182869..b1f9406092 100644 --- a/basis/compiler/tree/recursive/recursive-tests.factor +++ b/basis/compiler/tree/recursive/recursive-tests.factor @@ -148,3 +148,27 @@ DEFER: a' [ a' ] build-tree analyze-recursive \ b' label-is-loop? ] unit-test + +DEFER: a'' + +: b'' ( -- ) + a'' ; inline recursive + +: a'' ( -- ) + b'' a'' ; inline recursive + +[ t ] [ + [ a'' ] build-tree analyze-recursive + \ a'' label-is-not-loop? +] unit-test + +: loop-in-non-loop ( x quot: ( i -- ) -- ) + over 0 > [ + [ [ 1 - ] dip loop-in-non-loop ] [ call ] 2bi + ] [ 2drop ] if ; inline recursive + +[ t ] [ + [ 10 [ [ drop ] each-integer ] loop-in-non-loop ] + build-tree analyze-recursive + \ (each-integer) label-is-loop? +] unit-test diff --git a/basis/compiler/tree/recursive/recursive.factor b/basis/compiler/tree/recursive/recursive.factor index d1e4c7c70e..d257cd6600 100644 --- a/basis/compiler/tree/recursive/recursive.factor +++ b/basis/compiler/tree/recursive/recursive.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel assocs namespaces accessors sequences deques +USING: kernel assocs arrays namespaces accessors sequences deques search-deques compiler.tree compiler.tree.combinators ; IN: compiler.tree.recursive @@ -50,11 +50,10 @@ GENERIC: collect-loop-info* ( tail? node -- ) loop-stack get length swap loop-heights get set-at ; M: #recursive collect-loop-info* - nip [ [ label>> - [ loop-stack [ swap suffix ] change ] + [ swap 2array loop-stack [ swap suffix ] change ] [ remember-loop-info ] [ t >>loop? drop ] tri @@ -62,7 +61,7 @@ M: #recursive collect-loop-info* [ t swap child>> (collect-loop-info) ] bi ] with-scope ; -: current-loop-nesting ( label -- labels ) +: current-loop-nesting ( label -- alist ) loop-stack get swap loop-heights get at tail ; : disqualify-loop ( label -- ) @@ -71,7 +70,10 @@ M: #recursive collect-loop-info* M: #call-recursive collect-loop-info* label>> swap [ dup disqualify-loop ] unless - dup current-loop-nesting [ loop-calls get push-at ] with each ; + dup current-loop-nesting + [ keys [ loop-calls get push-at ] with each ] + [ [ nip not ] assoc-filter keys [ disqualify-loop ] each ] + bi ; M: #if collect-loop-info* children>> [ (collect-loop-info) ] with each ; From 87c71ee3769896fafb8af3b9ced6902be45ee746 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 01:17:54 -0500 Subject: [PATCH 014/948] Rice --- basis/http/client/client.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/http/client/client.factor b/basis/http/client/client.factor index aa1e0771ba..9260f15a7b 100755 --- a/basis/http/client/client.factor +++ b/basis/http/client/client.factor @@ -120,7 +120,7 @@ SYMBOL: redirects ] if ; inline recursive : read-unchunked ( quot: ( chunk -- ) -- ) - 8192 read dup [ + 8192 read-partial dup [ [ swap call ] [ drop read-unchunked ] 2bi ] [ 2drop ] if ; inline recursive From 1c76a6865a310a10035fbf8806ff4f5b27590f4d Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Wed, 1 Oct 2008 23:44:45 -0700 Subject: [PATCH 015/948] math-binpack: Some cleanups recommended on IRC. --- extra/math/binpack/binpack.factor | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/extra/math/binpack/binpack.factor b/extra/math/binpack/binpack.factor index f6473f2e25..e3a009feb5 100644 --- a/extra/math/binpack/binpack.factor +++ b/extra/math/binpack/binpack.factor @@ -6,16 +6,17 @@ USING: sequences kernel arrays vectors accessors assocs sorting math math.functi IN: math.binpack : (binpack) ( bins item -- ) - swap dup [ [ second ] map sum ] map swap zip sort-keys values first push ; + [ [ values sum ] map ] keep + zip sort-keys values first push ; : binpack ( assoc n -- bins ) - [ sort-values reverse [ length ] keep swap ] dip - [ / ceiling ] keep swap [ ] map - swap [ dupd (binpack) ] each ; + [ sort-values dup length ] dip + tuck / ceiling [ ] map + tuck [ (binpack) ] curry each ; : binpack* ( items n -- bins ) [ dup zip ] dip binpack [ keys ] map ; : binpack! ( items quot n -- bins ) - [ dup ] 2dip [ map zip ] dip binpack [ keys ] map ; + [ dupd map zip ] dip binpack [ keys ] map ; From 1ef5dbe3fb601e049d268a7f21915e5511c9b3ee Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 03:37:53 -0500 Subject: [PATCH 016/948] Move hsva to colors.hsv --- basis/colors/colors.factor | 49 ++++++---------- basis/colors/gray/gray.factor | 11 ++++ basis/colors/hsv/hsv-tests.factor | 26 +++++++++ basis/colors/hsv/hsv.factor | 65 ++++++++++----------- extra/benchmark/mandel/colors/colors.factor | 7 ++- extra/color-picker/color-picker.factor | 2 +- 6 files changed, 90 insertions(+), 70 deletions(-) create mode 100644 basis/colors/gray/gray.factor create mode 100644 basis/colors/hsv/hsv-tests.factor diff --git a/basis/colors/colors.factor b/basis/colors/colors.factor index 77a1f46c87..1183c2e46c 100644 --- a/basis/colors/colors.factor +++ b/basis/colors/colors.factor @@ -1,48 +1,33 @@ -! Copyright (C) 2003, 2007, 2008 Slava Pestov. +! Copyright (C) 2003, 2008 Slava Pestov. +! Copyright (C) 2008 Eduardo Cavazos. ! See http://factorcode.org/license.txt for BSD license. - -USING: kernel combinators sequences arrays classes.tuple accessors colors.hsv ; - +USING: kernel accessors ; IN: colors -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - TUPLE: color ; TUPLE: rgba < color red green blue alpha ; -TUPLE: hsva < color hue saturation value alpha ; - -TUPLE: gray < color gray alpha ; - -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +C: rgba GENERIC: >rgba ( object -- rgba ) M: rgba >rgba ( rgba -- rgba ) ; -M: hsva >rgba ( hsva -- rgba ) - { [ hue>> ] [ saturation>> ] [ value>> ] [ alpha>> ] } cleave 4array - [ hsv>rgb ] [ peek ] bi suffix first4 rgba boa ; - -M: gray >rgba ( gray -- rgba ) [ gray>> dup dup ] [ alpha>> ] bi rgba boa ; - M: color red>> ( color -- red ) >rgba red>> ; M: color green>> ( color -- green ) >rgba green>> ; M: color blue>> ( color -- blue ) >rgba blue>> ; -! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -: black T{ rgba f 0.0 0.0 0.0 1.0 } ; -: blue T{ rgba f 0.0 0.0 1.0 1.0 } ; -: cyan T{ rgba f 0 0.941 0.941 1 } ; -: gray T{ rgba f 0.6 0.6 0.6 1.0 } ; -: green T{ rgba f 0.0 1.0 0.0 1.0 } ; -: light-gray T{ rgba f 0.95 0.95 0.95 0.95 } ; -: light-purple T{ rgba f 0.8 0.8 1.0 1.0 } ; -: magenta T{ rgba f 0.941 0 0.941 1 } ; -: orange T{ rgba f 0.941 0.627 0 1 } ; -: purple T{ rgba f 0.627 0 0.941 1 } ; -: red T{ rgba f 1.0 0.0 0.0 1.0 } ; -: white T{ rgba f 1.0 1.0 1.0 1.0 } ; -: yellow T{ rgba f 1.0 1.0 0.0 1.0 } ; +: black T{ rgba f 0.0 0.0 0.0 1.0 } ; inline +: blue T{ rgba f 0.0 0.0 1.0 1.0 } ; inline +: cyan T{ rgba f 0 0.941 0.941 1 } ; inline +: gray T{ rgba f 0.6 0.6 0.6 1.0 } ; inline +: green T{ rgba f 0.0 1.0 0.0 1.0 } ; inline +: light-gray T{ rgba f 0.95 0.95 0.95 0.95 } ; inline +: light-purple T{ rgba f 0.8 0.8 1.0 1.0 } ; inline +: magenta T{ rgba f 0.941 0 0.941 1 } ; inline +: orange T{ rgba f 0.941 0.627 0 1 } ; inline +: purple T{ rgba f 0.627 0 0.941 1 } ; inline +: red T{ rgba f 1.0 0.0 0.0 1.0 } ; inline +: white T{ rgba f 1.0 1.0 1.0 1.0 } ; inline +: yellow T{ rgba f 1.0 1.0 0.0 1.0 } ; inline diff --git a/basis/colors/gray/gray.factor b/basis/colors/gray/gray.factor new file mode 100644 index 0000000000..26ec1177b6 --- /dev/null +++ b/basis/colors/gray/gray.factor @@ -0,0 +1,11 @@ +! Copyright (C) 2008 Eduardo Cavazos. +! See http://factorcode.org/license.txt for BSD license. +USING: colors kernel accessors ; +IN: colors.gray + +TUPLE: gray < color gray alpha ; + +C: gray + +M: gray >rgba ( gray -- rgba ) + [ gray>> dup dup ] [ alpha>> ] bi ; diff --git a/basis/colors/hsv/hsv-tests.factor b/basis/colors/hsv/hsv-tests.factor new file mode 100644 index 0000000000..8a736553bb --- /dev/null +++ b/basis/colors/hsv/hsv-tests.factor @@ -0,0 +1,26 @@ +IN: colors.hsv.tests +USING: accessors kernel colors colors.hsv tools.test math ; + +: hsv>rgb ( h s v -- r g b ) + [ 360 * ] 2dip + 1 >rgba [ red>> ] [ green>> ] [ blue>> ] tri ; + +[ 1/2 1/2 1/2 ] [ 0 0 1/2 hsv>rgb ] unit-test + +[ 1/2 1/4 1/4 ] [ 0 1/2 1/2 hsv>rgb ] unit-test +[ 1/3 2/9 2/9 ] [ 0 1/3 1/3 hsv>rgb ] unit-test + +[ 24/125 1/5 4/25 ] [ 1/5 1/5 1/5 hsv>rgb ] unit-test +[ 29/180 1/6 5/36 ] [ 1/5 1/6 1/6 hsv>rgb ] unit-test + +[ 6/25 2/5 38/125 ] [ 2/5 2/5 2/5 hsv>rgb ] unit-test +[ 8/25 4/5 64/125 ] [ 2/5 3/5 4/5 hsv>rgb ] unit-test + +[ 6/25 48/125 3/5 ] [ 3/5 3/5 3/5 hsv>rgb ] unit-test +[ 0 0 0 ] [ 3/5 1/5 0 hsv>rgb ] unit-test + +[ 84/125 4/25 4/5 ] [ 4/5 4/5 4/5 hsv>rgb ] unit-test +[ 7/15 1/3 1/2 ] [ 4/5 1/3 1/2 hsv>rgb ] unit-test + +[ 5/6 5/36 5/6 ] [ 5/6 5/6 5/6 hsv>rgb ] unit-test +[ 1/6 0 1/6 ] [ 5/6 1 1/6 hsv>rgb ] unit-test diff --git a/basis/colors/hsv/hsv.factor b/basis/colors/hsv/hsv.factor index dd2811822b..6f658818a1 100644 --- a/basis/colors/hsv/hsv.factor +++ b/basis/colors/hsv/hsv.factor @@ -1,41 +1,38 @@ -! Copyright (C) 2007 Eduardo Cavazos +! Copyright (C) 2008 Eduardo Cavazos. ! See http://factorcode.org/license.txt for BSD license. - -USING: kernel combinators arrays sequences math math.functions ; - +USING: colors kernel combinators math math.functions accessors ; IN: colors.hsv - - ! h [0,360) ! s [0,1] ! v [0,1] +TUPLE: hsva < color hue saturation value alpha ; -: hsv>rgb ( hsv -- rgb ) -dup Hi -{ { 0 [ [ V ] [ t ] [ p ] tri ] } - { 1 [ [ q ] [ V ] [ p ] tri ] } - { 2 [ [ p ] [ V ] [ t ] tri ] } - { 3 [ [ p ] [ q ] [ V ] tri ] } - { 4 [ [ t ] [ p ] [ V ] tri ] } - { 5 [ [ V ] [ p ] [ q ] tri ] } } case 3array ; +C: hsva + +> 60 / floor 6 mod ; inline + +: f ( hsv -- f ) [ hue>> 60 / ] [ Hi ] bi - ; inline + +: p ( hsv -- p ) [ saturation>> 1 swap - ] [ value>> ] bi * ; inline + +: q ( hsv -- q ) [ [ f ] [ saturation>> ] bi * 1 swap - ] [ value>> ] bi * ; inline + +: t ( hsv -- t ) [ [ f 1 swap - ] [ saturation>> ] bi * 1 swap - ] [ value>> ] bi * ; inline + +PRIVATE> + +M: hsva >rgba ( hsva -- rgba ) + [ + dup Hi + { + { 0 [ [ value>> ] [ t ] [ p ] tri ] } + { 1 [ [ q ] [ value>> ] [ p ] tri ] } + { 2 [ [ p ] [ value>> ] [ t ] tri ] } + { 3 [ [ p ] [ q ] [ value>> ] tri ] } + { 4 [ [ t ] [ p ] [ value>> ] tri ] } + { 5 [ [ value>> ] [ p ] [ q ] tri ] } + } case + ] [ alpha>> ] bi ; diff --git a/extra/benchmark/mandel/colors/colors.factor b/extra/benchmark/mandel/colors/colors.factor index 7bbb25a47d..218f566eda 100644 --- a/extra/benchmark/mandel/colors/colors.factor +++ b/extra/benchmark/mandel/colors/colors.factor @@ -1,10 +1,11 @@ USING: math math.order kernel arrays byte-arrays sequences -colors.hsv benchmark.mandel.params ; +colors.hsv benchmark.mandel.params accessors colors ; IN: benchmark.mandel.colors : scale 255 * >fixnum ; inline -: scale-rgb ( r g b -- n ) [ scale ] tri@ 3byte-array ; +: scale-rgb ( rgba -- n ) + [ red>> scale ] [ green>> scale ] [ blue>> scale ] tri 3byte-array ; : sat 0.85 ; inline : val 0.85 ; inline @@ -12,7 +13,7 @@ IN: benchmark.mandel.colors : ( nb-cols -- map ) dup [ 360 * swap 1+ / sat val - 3array hsv>rgb first3 scale-rgb + 1 >rgba scale-rgb ] with map ; : color-map ( -- map ) diff --git a/extra/color-picker/color-picker.factor b/extra/color-picker/color-picker.factor index 4a0c148145..6ed8c1220c 100755 --- a/extra/color-picker/color-picker.factor +++ b/extra/color-picker/color-picker.factor @@ -23,7 +23,7 @@ M: color-preview model-changed swap value>> >>interior relayout-1 ; : ( model -- model ) - [ [ 256 /f ] map 1 suffix first4 rgba boa ] ; + [ first3 [ 256 /f ] tri@ 1 ] ; : ( -- model gadget ) 3 [ 0 0 0 255 ] replicate From 15eaf33ee83bd2e6a3b923edc4338341c10c703c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 03:38:09 -0500 Subject: [PATCH 017/948] Remove http.client => logging dependency --- basis/http/http.factor | 4 +--- basis/http/parsers/parsers.factor | 4 +--- basis/http/server/server.factor | 2 ++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/basis/http/http.factor b/basis/http/http.factor index cfc205dbb5..c90a1872ce 100755 --- a/basis/http/http.factor +++ b/basis/http/http.factor @@ -3,7 +3,7 @@ USING: accessors kernel combinators math namespaces make assocs sequences splitting sorting sets debugger strings vectors hashtables quotations arrays byte-arrays -math.parser calendar calendar.format present urls logging +math.parser calendar calendar.format present urls io io.encodings io.encodings.iana io.encodings.binary io.encodings.8-bit @@ -96,8 +96,6 @@ TUPLE: cookie name value version comment path domain expires max-age http-only s drop ] { } make ; -\ parse-cookie DEBUG add-input-logging - : check-cookie-string ( string -- string' ) dup "=;'\"\r\n" intersect empty? [ "Bad cookie name or value" throw ] unless ; diff --git a/basis/http/parsers/parsers.factor b/basis/http/parsers/parsers.factor index ce8257dec5..8e8e7358d1 100644 --- a/basis/http/parsers/parsers.factor +++ b/basis/http/parsers/parsers.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: combinators.short-circuit math math.order math.parser kernel sequences sequences.deep peg peg.parsers assocs arrays -hashtables strings unicode.case namespaces make ascii logging ; +hashtables strings unicode.case namespaces make ascii ; IN: http.parsers : except ( quot -- parser ) @@ -61,8 +61,6 @@ PEG: parse-request-line ( string -- triple ) 'space' , ] seq* just ; -\ parse-request-line DEBUG add-input-logging - : 'text' ( -- parser ) [ ctl? ] except ; diff --git a/basis/http/server/server.factor b/basis/http/server/server.factor index 547e1b69fb..697dec24ce 100755 --- a/basis/http/server/server.factor +++ b/basis/http/server/server.factor @@ -24,6 +24,8 @@ html.elements html.streams ; IN: http.server +\ parse-cookie DEBUG add-input-logging + : check-absolute ( url -- url ) dup path>> "/" head? [ "Bad request: URL" throw ] unless ; inline From 2e48915f9c566ca1e2593432484134f4bac5dd26 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 03:38:36 -0500 Subject: [PATCH 018/948] Strip out C I/O if native I/O enabled --- basis/io/sockets/sockets.factor | 16 +++++++--- basis/io/unix/sockets/sockets.factor | 4 ++- basis/io/windows/nt/backend/backend.factor | 10 +++--- basis/io/windows/nt/sockets/sockets.factor | 4 +-- basis/tools/deploy/shaker/shaker.factor | 36 ++++++++++++---------- core/io/backend/backend.factor | 4 +++ core/io/streams/c/c.factor | 14 +++++---- 7 files changed, 53 insertions(+), 35 deletions(-) diff --git a/basis/io/sockets/sockets.factor b/basis/io/sockets/sockets.factor index 9bfcc7e310..c704382dd4 100755 --- a/basis/io/sockets/sockets.factor +++ b/basis/io/sockets/sockets.factor @@ -17,10 +17,12 @@ IN: io.sockets ! Addressing GENERIC: protocol-family ( addrspec -- af ) -GENERIC: sockaddr-type ( addrspec -- type ) +GENERIC: sockaddr-size ( addrspec -- n ) GENERIC: make-sockaddr ( addrspec -- sockaddr ) +GENERIC: empty-sockaddr ( addrspec -- sockaddr ) + GENERIC: address-size ( addrspec -- n ) GENERIC: inet-ntop ( data addrspec -- str ) @@ -28,10 +30,10 @@ GENERIC: inet-ntop ( data addrspec -- str ) GENERIC: inet-pton ( str addrspec -- data ) : make-sockaddr/size ( addrspec -- sockaddr size ) - [ make-sockaddr ] [ sockaddr-type heap-size ] bi ; + [ make-sockaddr ] [ sockaddr-size ] bi ; : empty-sockaddr/size ( addrspec -- sockaddr size ) - sockaddr-type [ ] [ heap-size ] bi ; + [ empty-sockaddr ] [ sockaddr-size ] bi ; GENERIC: parse-sockaddr ( sockaddr addrspec -- newaddrspec ) @@ -74,7 +76,9 @@ M: inet4 address-size drop 4 ; M: inet4 protocol-family drop PF_INET ; -M: inet4 sockaddr-type drop "sockaddr-in" c-type ; +M: inet4 sockaddr-size drop "sockaddr-in" heap-size ; + +M: inet4 empty-sockaddr drop "sockaddr-in" ; M: inet4 make-sockaddr ( inet -- sockaddr ) "sockaddr-in" @@ -128,7 +132,9 @@ M: inet6 address-size drop 16 ; M: inet6 protocol-family drop PF_INET6 ; -M: inet6 sockaddr-type drop "sockaddr-in6" c-type ; +M: inet6 sockaddr-size drop "sockaddr-in6" heap-size ; + +M: inet6 empty-sockaddr drop "sockaddr-in6" ; M: inet6 make-sockaddr ( inet -- sockaddr ) "sockaddr-in6" diff --git a/basis/io/unix/sockets/sockets.factor b/basis/io/unix/sockets/sockets.factor index 50952dd217..8f9ff4f066 100755 --- a/basis/io/unix/sockets/sockets.factor +++ b/basis/io/unix/sockets/sockets.factor @@ -139,7 +139,9 @@ M: unix (send) ( packet addrspec datagram -- ) ! Unix domain sockets M: local protocol-family drop PF_UNIX ; -M: local sockaddr-type drop "sockaddr-un" c-type ; +M: local sockaddr-size drop "sockaddr-un" heap-size ; + +M: local empty-sockaddr drop "sockaddr-un" ; M: local make-sockaddr path>> (normalize-path) diff --git a/basis/io/windows/nt/backend/backend.factor b/basis/io/windows/nt/backend/backend.factor index 7fbc1dbcf9..73b77508b7 100755 --- a/basis/io/windows/nt/backend/backend.factor +++ b/basis/io/windows/nt/backend/backend.factor @@ -1,9 +1,9 @@ USING: alien alien.c-types arrays assocs combinators continuations destructors io io.backend io.ports io.timeouts -io.windows io.windows.files libc kernel math namespaces -sequences threads windows windows.errors windows.kernel32 -strings splitting io.files io.buffers qualified ascii system -accessors locals ; +io.windows io.windows.files io.files io.buffers io.streams.c +libc kernel math namespaces sequences threads windows +windows.errors windows.kernel32 strings splitting qualified +ascii system accessors locals ; QUALIFIED: windows.winsock IN: io.windows.nt.backend @@ -120,3 +120,5 @@ M: winnt (wait-to-read) ( port -- ) [ finish-read ] tri ] with-destructors ; + +M: winnt (init-stdio) init-c-stdio ; diff --git a/basis/io/windows/nt/sockets/sockets.factor b/basis/io/windows/nt/sockets/sockets.factor index 41c5e88f5f..5d94cf2d4a 100755 --- a/basis/io/windows/nt/sockets/sockets.factor +++ b/basis/io/windows/nt/sockets/sockets.factor @@ -71,7 +71,7 @@ TUPLE: AcceptEx-args port dwLocalAddressLength dwRemoteAddressLength lpdwBytesReceived lpOverlapped ; : init-accept-buffer ( addr AcceptEx -- ) - swap sockaddr-type heap-size 16 + + swap sockaddr-size 16 + [ >>dwLocalAddressLength ] [ >>dwRemoteAddressLength ] bi dup dwLocalAddressLength>> 2 * malloc &free >>lpOutputBuffer drop ; inline @@ -135,7 +135,7 @@ TUPLE: WSARecvFrom-args port WSARecvFrom-args new swap >>port dup port>> handle>> handle>> >>s - dup port>> addr>> sockaddr-type heap-size + dup port>> addr>> sockaddr-size [ malloc &free >>lpFrom ] [ malloc-int &free >>lpFromLen ] bi make-receive-buffer >>lpBuffers diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index b502a4b4a2..86393771de 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -1,19 +1,18 @@ ! Copyright (C) 2007, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors qualified io.streams.c init fry namespaces make -assocs kernel parser lexer strings.parser tools.deploy.config -vocabs sequences words words.private memory kernel.private -continuations io prettyprint vocabs.loader debugger system -strings sets vectors quotations byte-arrays sorting ; +USING: accessors qualified io.backend io.streams.c init fry +namespaces make assocs kernel parser lexer strings.parser +tools.deploy.config vocabs sequences words words.private memory +kernel.private continuations io prettyprint vocabs.loader +debugger system strings sets vectors quotations byte-arrays +sorting compiler.units definitions ; QUALIFIED: bootstrap.stage2 QUALIFIED: classes QUALIFIED: command-line QUALIFIED: compiler.errors.private -QUALIFIED: compiler.units QUALIFIED: continuations QUALIFIED: definitions QUALIFIED: init -QUALIFIED: io.backend QUALIFIED: io.thread QUALIFIED: layouts QUALIFIED: listener @@ -198,11 +197,6 @@ IN: tools.deploy.shaker strip-word-names? [ dup strip-word-names ] when 2drop ; -: strip-recompile-hook ( -- ) - [ [ f ] { } map>assoc ] - compiler.units:recompile-hook - set-global ; - : strip-vocab-globals ( except names -- words ) [ child-vocabs [ words ] map concat ] map concat swap diff ; @@ -233,7 +227,7 @@ IN: tools.deploy.shaker "initial-thread" "threads" lookup , ] unless - strip-io? [ io.backend:io-backend , ] when + strip-io? [ io-backend , ] when { } { "alarms" @@ -260,9 +254,9 @@ IN: tools.deploy.shaker command-line:main-vocab-hook compiled-crossref compiled-generic-crossref - compiler.units:recompile-hook - compiler.units:update-tuples-hook - compiler.units:definition-observers + recompile-hook + update-tuples-hook + definition-observers definitions:crossref interactive-vocabs layouts:num-tags @@ -326,6 +320,14 @@ IN: tools.deploy.shaker 21 setenv ] [ drop ] if ; +: strip-c-io ( -- ) + deploy-io get 2 = [ + [ + c-io-backend forget + "io.streams.c" forget-vocab + ] with-compilation-unit + ] unless ; + : compress ( pred string -- ) "Compressing " prepend show instances @@ -362,10 +364,10 @@ SYMBOL: deploy-vocab set-boot-quot ; : strip ( -- ) + strip-c-io strip-libc strip-cocoa strip-debugger - strip-recompile-hook strip-init-hooks deploy-vocab get vocab-main set-boot-quot* stripped-word-props >r diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor index 0760063f0d..0c13277106 100755 --- a/core/io/backend/backend.factor +++ b/core/io/backend/backend.factor @@ -6,6 +6,10 @@ IN: io.backend SYMBOL: io-backend +SINGLETON: c-io-backend + +c-io-backend io-backend set-global + HOOK: init-io io-backend ( -- ) HOOK: (init-stdio) io-backend ( -- stdin stdout stderr ) diff --git a/core/io/streams/c/c.factor b/core/io/streams/c/c.factor index 780d892d2e..1e12d7e956 100755 --- a/core/io/streams/c/c.factor +++ b/core/io/streams/c/c.factor @@ -54,26 +54,28 @@ M: c-reader stream-read-until M: c-reader dispose* handle>> fclose ; -M: object init-io ; +M: c-io-backend init-io ; : stdin-handle 11 getenv ; : stdout-handle 12 getenv ; : stderr-handle 61 getenv ; -M: object (init-stdio) +: init-c-stdio ( -- stdin stdout stderr ) stdin-handle stdout-handle stderr-handle ; -M: object io-multiplex 60 60 * 1000 * or (sleep) ; +M: c-io-backend (init-stdio) init-c-stdio ; -M: object (file-reader) +M: c-io-backend io-multiplex 60 60 * 1000 * or (sleep) ; + +M: c-io-backend (file-reader) "rb" fopen ; -M: object (file-writer) +M: c-io-backend (file-writer) "wb" fopen ; -M: object (file-appender) +M: c-io-backend (file-appender) "ab" fopen ; : show ( msg -- ) From f539406ee1092541dfb3accffe924fd656e65187 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 05:12:38 -0500 Subject: [PATCH 019/948] Fold class predicates applied to literals --- .../tree/propagation/propagation-tests.factor | 4 +++- .../compiler/tree/propagation/simple/simple.factor | 14 +++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/basis/compiler/tree/propagation/propagation-tests.factor b/basis/compiler/tree/propagation/propagation-tests.factor index d73e8b7db1..19ee051ac6 100644 --- a/basis/compiler/tree/propagation/propagation-tests.factor +++ b/basis/compiler/tree/propagation/propagation-tests.factor @@ -8,7 +8,7 @@ math.functions math.private strings layouts compiler.tree.propagation.info compiler.tree.def-use compiler.tree.debugger compiler.tree.checker slots.private words hashtables classes assocs locals -float-arrays ; +float-arrays system ; IN: compiler.tree.propagation.tests \ propagate must-infer @@ -590,6 +590,8 @@ MIXIN: empty-mixin [ V{ float-array } ] [ [| | F{ } ] final-classes ] unit-test +[ V{ t } ] [ [ netbsd unix? ] final-literals ] unit-test + ! [ V{ string } ] [ ! [ dup string? t xor [ "A" throw ] [ ] if ] final-classes ! ] unit-test diff --git a/basis/compiler/tree/propagation/simple/simple.factor b/basis/compiler/tree/propagation/simple/simple.factor index 7fc38239f1..d586ff398f 100644 --- a/basis/compiler/tree/propagation/simple/simple.factor +++ b/basis/compiler/tree/propagation/simple/simple.factor @@ -76,13 +76,25 @@ M: #declare propagate-before : fold-call ( #call word -- ) [ (fold-call) ] [ drop out-d>> ] 2bi set-value-infos ; -: predicate-output-infos ( info class -- info ) +: predicate-output-infos/literal ( info class -- info ) + [ literal>> ] dip + '[ _ _ instance? ] + [ drop object-info ] + recover ; + +: predicate-output-infos/class ( info class -- info ) [ class>> ] dip { { [ 2dup class<= ] [ t ] } { [ 2dup classes-intersect? not ] [ f ] } [ object-info ] } cond 2nip ; +: predicate-output-infos ( info class -- info ) + over literal?>> + [ predicate-output-infos/literal ] + [ predicate-output-infos/class ] + if ; + : propagate-predicate ( #call word -- infos ) #! We need to force the caller word to recompile when the class #! is redefined, since now we're making assumptions but the From 7a2eb1d7b2397e3ee04437751d1c9ebeb7ea7dfa Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 05:13:22 -0500 Subject: [PATCH 020/948] Split off urls.secure for SSL support; reduces deployed image size --- basis/http/client/client-docs.factor | 2 ++ basis/urls/secure/secure.factor | 6 ++++++ basis/urls/urls.factor | 10 ++++++++-- 3 files changed, 16 insertions(+), 2 deletions(-) create mode 100644 basis/urls/secure/secure.factor diff --git a/basis/http/client/client-docs.factor b/basis/http/client/client-docs.factor index a762d1a5ef..d4f277a7c3 100644 --- a/basis/http/client/client-docs.factor +++ b/basis/http/client/client-docs.factor @@ -95,6 +95,8 @@ ARTICLE: "http.client.errors" "HTTP client errors" ARTICLE: "http.client" "HTTP client" "The " { $vocab-link "http.client" } " vocabulary implements an HTTP and HTTPS client on top of " { $link "http" } "." $nl +"For HTTPS support, you must load the " { $vocab-link "urls.secure" } " vocab first. If you don't load it, HTTPS will not load and images generated by " { $vocab-link "tools.deploy" } " will be smaller as a result." +$nl "There are two primary usage patterns, data retrieval with GET requests and form submission with POST requests:" { $subsection "http.client.get" } { $subsection "http.client.post" } diff --git a/basis/urls/secure/secure.factor b/basis/urls/secure/secure.factor new file mode 100644 index 0000000000..d2fa55f7f3 --- /dev/null +++ b/basis/urls/secure/secure.factor @@ -0,0 +1,6 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: urls urls.private io.sockets io.sockets.secure ; +IN: urls.secure + +M: abstract-inet >secure-addr ; diff --git a/basis/urls/urls.factor b/basis/urls/urls.factor index 5cc8c9693b..30e8c68f9d 100644 --- a/basis/urls/urls.factor +++ b/basis/urls/urls.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel ascii combinators combinators.short-circuit sequences splitting fry namespaces make assocs arrays strings -io.sockets io.sockets.secure io.encodings.string +io.sockets io.encodings.string io.encodings.utf8 math math.parser accessors parser strings.parser lexer prettyprint.backend hashtables present peg.ebnf urls.encoding ; @@ -159,6 +159,12 @@ PRIVATE> : secure-protocol? ( protocol -- ? ) "https" = ; +secure-addr ( addrspec -- addrspec' ) + +PRIVATE> + : url-addr ( url -- addr ) [ [ host>> ] @@ -166,7 +172,7 @@ PRIVATE> [ protocol>> protocol-port ] tri or ] [ protocol>> ] bi - secure-protocol? [ ] when ; + secure-protocol? [ >secure-addr ] when ; : ensure-port ( url -- url ) dup protocol>> '[ _ protocol-port or ] change-port ; From 2b420656d6448cee20062f1ab620d376048104b2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 05:14:05 -0500 Subject: [PATCH 021/948] Tree shaker no longer loads threads into threadless images; 77kb improvement on hello-world size --- basis/tools/deploy/shaker/shaker.factor | 4 ++-- basis/tools/deploy/shaker/strip-debugger.factor | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index 86393771de..f3177a76e1 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -13,7 +13,6 @@ QUALIFIED: compiler.errors.private QUALIFIED: continuations QUALIFIED: definitions QUALIFIED: init -QUALIFIED: io.thread QUALIFIED: layouts QUALIFIED: listener QUALIFIED: prettyprint.config @@ -214,13 +213,14 @@ IN: tools.deploy.shaker continuations:restarts listener:error-hook init:init-hooks - io.thread:io-thread source-files:source-files input-stream output-stream error-stream } % + "io-thread" "io.thread" lookup , + "mallocs" "libc.private" lookup , deploy-threads? [ diff --git a/basis/tools/deploy/shaker/strip-debugger.factor b/basis/tools/deploy/shaker/strip-debugger.factor index 2302b61715..bdcc6c237e 100755 --- a/basis/tools/deploy/shaker/strip-debugger.factor +++ b/basis/tools/deploy/shaker/strip-debugger.factor @@ -1,8 +1,14 @@ -USING: kernel threads threads.private ; +USING: compiler.units words vocabs kernel threads.private ; IN: debugger : print-error ( error -- ) die drop ; : error. ( error -- ) die drop ; -M: thread error-in-thread ( error thread -- ) die 2drop ; +"threads" vocab [ + [ + "error-in-thread" "threads" lookup + [ die 2drop ] + define + ] with-compilation-unit +] when From e722698b1bc007c51e4ccd99e5ccd045b4f86318 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 05:15:05 -0500 Subject: [PATCH 022/948] os and cpu words now foldable; reduces deploy image size --- core/system/system.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/system/system.factor b/core/system/system.factor index 3c207c4ab5..6c9d838fa4 100755 --- a/core/system/system.factor +++ b/core/system/system.factor @@ -11,7 +11,7 @@ SINGLETON: ppc UNION: x86 x86.32 x86.64 ; -: cpu ( -- class ) \ cpu get ; +: cpu ( -- class ) \ cpu get-global ; foldable SINGLETON: winnt SINGLETON: wince @@ -29,7 +29,7 @@ UNION: bsd freebsd netbsd openbsd macosx ; UNION: unix bsd solaris linux ; -: os ( -- class ) \ os get ; +: os ( -- class ) \ os get-global ; foldable Date: Thu, 2 Oct 2008 06:41:17 -0500 Subject: [PATCH 023/948] Debugging tree shaker --- basis/tools/deploy/shaker/shaker.factor | 14 ++++++++++---- basis/tools/deploy/shaker/strip-cocoa.factor | 9 ++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor index f3177a76e1..7c02e87209 100755 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -85,8 +85,8 @@ IN: tools.deploy.shaker ] change-props drop ] each ] [ - "Remaining word properties:" print - [ props>> keys ] gather . + "Remaining word properties:\n" show + [ props>> keys ] gather unparse show ] [ H{ } clone '[ [ [ _ [ ] cache ] map ] change-props drop @@ -360,15 +360,21 @@ SYMBOL: deploy-vocab init-hooks get values concat % , strip-io? [ \ flush , ] unless - ] [ ] make "Boot quotation: " write dup . flush + ] [ ] make "Boot quotation: " show dup unparse show set-boot-quot ; +: init-stripper ( -- ) + t "quiet" set-global + f output-stream set-global ; + : strip ( -- ) - strip-c-io + init-stripper strip-libc strip-cocoa strip-debugger strip-init-hooks + strip-c-io + f 5 setenv ! we can't use the Factor debugger or Factor I/O anymore deploy-vocab get vocab-main set-boot-quot* stripped-word-props >r stripped-globals strip-globals diff --git a/basis/tools/deploy/shaker/strip-cocoa.factor b/basis/tools/deploy/shaker/strip-cocoa.factor index 2cf803e270..d5249dc20c 100755 --- a/basis/tools/deploy/shaker/strip-cocoa.factor +++ b/basis/tools/deploy/shaker/strip-cocoa.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: cocoa cocoa.messages cocoa.application cocoa.nibs assocs namespaces kernel kernel.private words compiler.units sequences -ui ui.cocoa init ; +init vocabs ; IN: tools.deploy.shaker.cocoa : pool ( obj -- obj' ) \ pool get [ ] cache ; @@ -23,9 +23,12 @@ IN: cocoa.application H{ } clone \ pool [ global [ - stop-after-last-window? set + "stop-after-last-window?" "ui" lookup set - [ "MiniFactor.nib" load-nib ] cocoa-init-hook set-global + "ui.cocoa" vocab [ + [ "MiniFactor.nib" load-nib ] + "cocoa-init-hook" "ui.cocoa" lookup set-global + ] when ! Only keeps those methods that we actually call sent-messages get super-sent-messages get assoc-union From 28d3654f61d1d38bb5d2710dbb6be49e5d3cba53 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 06:47:20 -0500 Subject: [PATCH 024/948] Small ricing --- core/sequences/sequences.factor | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor index 267238a502..63cc14d1d7 100755 --- a/core/sequences/sequences.factor +++ b/core/sequences/sequences.factor @@ -27,7 +27,7 @@ M: sequence lengthen 2dup length > [ set-length ] [ 2drop ] if ; M: sequence shorten 2dup length < [ set-length ] [ 2drop ] if ; -: empty? ( seq -- ? ) length zero? ; inline +: empty? ( seq -- ? ) length 0 = ; inline : if-empty ( seq quot1 quot2 -- ) [ dup empty? ] [ [ drop ] prepose ] [ ] tri* if ; inline @@ -362,7 +362,7 @@ PRIVATE> prepose curry ; inline : (interleave) ( n elt between quot -- ) - roll zero? [ nip ] [ swapd 2slip ] if call ; inline + roll 0 = [ nip ] [ swapd 2slip ] if call ; inline PRIVATE> @@ -530,7 +530,7 @@ M: sequence <=> [ -rot 2nth-unsafe <=> ] [ [ length ] compare ] if* ; : sequence= ( seq1 seq2 -- ? ) - 2dup [ length ] bi@ number= + 2dup [ length ] bi@ = [ mismatch not ] [ 2drop f ] if ; inline : sequence-hashcode-step ( oldhash newpart -- newhash ) @@ -547,7 +547,7 @@ M: reversed equal? over reversed? [ sequence= ] [ 2drop f ] if ; M: slice equal? over slice? [ sequence= ] [ 2drop f ] if ; : move ( to from seq -- ) - 2over number= + 2over = [ 3drop ] [ [ nth swap ] [ set-nth ] bi ] if ; inline r 2over + pick r> move >r 1+ r> ] keep @@ -590,7 +590,7 @@ PRIVATE> ] if ; : move-forward ( shift from to seq -- ) - 2over number= [ + 2over = [ 2drop 2drop ] [ [ >r pick >r dup dup r> + swap r> move 1- ] keep @@ -607,7 +607,7 @@ PRIVATE> PRIVATE> : open-slice ( shift from seq -- ) - pick zero? [ + pick 0 = [ 3drop ] [ pick over length + over >r >r @@ -680,7 +680,7 @@ PRIVATE> : padding ( seq n elt quot -- newseq ) [ - [ over length [-] dup zero? [ drop ] ] dip + [ over length [-] dup 0 = [ drop ] ] dip [ ] curry ] dip compose if ; inline From b45ee5b8be5ddc1ecfce65c3f6137d83fc3f5963 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 06:47:48 -0500 Subject: [PATCH 025/948] Fix bootstrap --- basis/ui/gadgets/theme/theme.factor | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/basis/ui/gadgets/theme/theme.factor b/basis/ui/gadgets/theme/theme.factor index 46fa0105a3..5e4a2fbf4c 100644 --- a/basis/ui/gadgets/theme/theme.factor +++ b/basis/ui/gadgets/theme/theme.factor @@ -2,7 +2,8 @@ ! Copyright (C) 2006, 2007 Alex Chapman. ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel sequences io.styles ui.gadgets ui.render -colors accessors ; +colors colors.gray qualified accessors ; +QUALIFIED: colors IN: ui.gadgets.theme : solid-interior ( gadget color -- gadget ) @@ -12,7 +13,7 @@ IN: ui.gadgets.theme >>boundary ; inline : faint-boundary ( gadget -- gadget ) - gray solid-boundary ; inline + colors:gray solid-boundary ; inline : selection-color ( -- color ) light-purple ; From b4d918caa529470b218d0acec3d644fee2337cac Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 07:10:22 -0500 Subject: [PATCH 026/948] Some minor new features for Cocoa binding --- basis/cocoa/application/application.factor | 2 +- basis/cocoa/cocoa-docs.factor | 9 ++++++++- basis/cocoa/cocoa.factor | 12 +++++++++++- basis/cocoa/messages/messages-docs.factor | 6 +----- basis/cocoa/messages/messages.factor | 3 ++- basis/cocoa/standalone/standalone.factor | 12 ++++++++++++ 6 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 basis/cocoa/standalone/standalone.factor diff --git a/basis/cocoa/application/application.factor b/basis/cocoa/application/application.factor index a28952ea33..065a4abc5a 100755 --- a/basis/cocoa/application/application.factor +++ b/basis/cocoa/application/application.factor @@ -30,7 +30,7 @@ IN: cocoa.application FUNCTION: void NSBeep ( ) ; : with-cocoa ( quot -- ) - [ NSApp drop call ] with-autorelease-pool ; + [ NSApp drop call ] with-autorelease-pool ; inline : next-event ( app -- event ) 0 f CFRunLoopDefaultMode 1 diff --git a/basis/cocoa/cocoa-docs.factor b/basis/cocoa/cocoa-docs.factor index a971288251..dd8d331b35 100644 --- a/basis/cocoa/cocoa-docs.factor +++ b/basis/cocoa/cocoa-docs.factor @@ -16,9 +16,16 @@ HELP: SUPER-> { send super-send POSTPONE: -> POSTPONE: SUPER-> } related-words +HELP: IMPORT: +{ $syntax "IMPORT: name" } +{ $description "Makes an Objective C class available for use." } +{ $examples + { $code "IMPORT: QTMovie" "QTMovie \"My Movie.mov\" f -> movieWithFile:error:" } +} ; + ARTICLE: "objc-calling" "Calling Objective C code" "Before an Objective C class can be used, it must be imported; by default, a small set of common classes are imported automatically, but additional classes can be imported as needed." -{ $subsection import-objc-class } +{ $subsection POSTPONE: IMPORT: } "Every imported Objective C class has as corresponding class word in the " { $vocab-link "cocoa.classes" } " vocabulary. Class words push the class object in the stack, allowing class methods to be invoked." $nl "Messages can be sent to classes and instances using a pair of parsing words:" diff --git a/basis/cocoa/cocoa.factor b/basis/cocoa/cocoa.factor index 744d577c0d..ab86796236 100755 --- a/basis/cocoa/cocoa.factor +++ b/basis/cocoa/cocoa.factor @@ -3,7 +3,7 @@ USING: compiler io kernel cocoa.runtime cocoa.subclassing cocoa.messages cocoa.types sequences words vocabs parser core-foundation namespaces assocs hashtables compiler.units -lexer ; +lexer init ; IN: cocoa : (remember-send) ( selector variable -- ) @@ -27,6 +27,16 @@ SYMBOL: super-sent-messages scan dup remember-super-send parsed \ super-send parsed ; parsing +SYMBOL: frameworks + +frameworks global [ V{ } clone or ] change-at + +[ frameworks get [ load-framework ] each ] "cocoa.messages" add-init-hook + +: FRAMEWORK: scan [ load-framework ] [ frameworks get push ] bi ; parsing + +: IMPORT: scan [ ] import-objc-class ; parsing + "Compiling Objective C bridge..." print "cocoa.classes" create-vocab drop diff --git a/basis/cocoa/messages/messages-docs.factor b/basis/cocoa/messages/messages-docs.factor index f78981c923..9b5e3fdfd9 100644 --- a/basis/cocoa/messages/messages-docs.factor +++ b/basis/cocoa/messages/messages-docs.factor @@ -32,11 +32,7 @@ HELP: alien>objc-types HELP: import-objc-class { $values { "name" string } { "quot" "a quotation with stack effect " { $snippet "( -- )" } } } -{ $description "If a class named " { $snippet "name" } " is already known to the Objective C interface, does nothing. Otherwise, first calls the quotation. The quotation should make the class available to the Objective C runtime if necessary, either by loading a framework or defining it directly. After the quotation returns, this word makes the class available to Factor programs by importing methods and creating a class word the class object in the " { $vocab-link "cocoa.classes" } " vocabulary." } -{ $notes "In most cases, the quotation should be " { $link f } "." } -{ $examples - { $code "\"QTMovie\" f import-objc-class" "QTMovie \"My Movie.mov\" f -> movieWithFile:error:" } -} ; +{ $description "If a class named " { $snippet "name" } " is already known to the Objective C interface, does nothing. Otherwise, first calls the quotation. The quotation should make the class available to the Objective C runtime if necessary, either by loading a framework or defining it directly. After the quotation returns, this word makes the class available to Factor programs by importing methods and creating a class word the class object in the " { $vocab-link "cocoa.classes" } " vocabulary." } ; HELP: root-class { $values { "class" alien } { "root" alien } } diff --git a/basis/cocoa/messages/messages.factor b/basis/cocoa/messages/messages.factor index 7977485b02..09601ef8cc 100755 --- a/basis/cocoa/messages/messages.factor +++ b/basis/cocoa/messages/messages.factor @@ -4,7 +4,8 @@ USING: accessors alien alien.c-types alien.strings arrays assocs combinators compiler kernel math namespaces make parser prettyprint prettyprint.sections quotations sequences strings words cocoa.runtime io macros memoize debugger -io.encodings.ascii effects compiler.generator libc libc.private ; +io.encodings.ascii effects compiler.generator libc libc.private +parser lexer init core-foundation ; IN: cocoa.messages : make-sender ( method function -- quot ) diff --git a/basis/cocoa/standalone/standalone.factor b/basis/cocoa/standalone/standalone.factor new file mode 100644 index 0000000000..528736f172 --- /dev/null +++ b/basis/cocoa/standalone/standalone.factor @@ -0,0 +1,12 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel cocoa.nibs cocoa.application cocoa ; +IN: cocoa.standalone + +: cocoa-app ( quot -- ) + [ + "MiniFactor.nib" load-nib + call + finish-launching + NSApp -> run + ] with-cocoa ; inline From 403d5207f06f9dfce922ca578d0a9d21b9155fb5 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 08:30:38 -0500 Subject: [PATCH 027/948] stop-server/stop-this-server split --- basis/concurrency/distributed/distributed.factor | 2 +- basis/http/http-tests.factor | 2 +- basis/io/encodings/ascii/ascii-docs.factor | 4 ++-- basis/io/servers/connection/connection-docs.factor | 13 ++++++++++--- basis/io/servers/connection/connection-tests.factor | 2 +- basis/io/servers/connection/connection.factor | 7 +++++-- basis/io/sockets/sockets-docs.factor | 2 +- basis/tools/deploy/deploy-tests.factor | 2 +- 8 files changed, 22 insertions(+), 12 deletions(-) diff --git a/basis/concurrency/distributed/distributed.factor b/basis/concurrency/distributed/distributed.factor index 5e2f1bb6d1..99ad239011 100755 --- a/basis/concurrency/distributed/distributed.factor +++ b/basis/concurrency/distributed/distributed.factor @@ -10,7 +10,7 @@ SYMBOL: local-node : handle-node-client ( -- ) deserialize - [ first2 get-process send ] [ stop-server ] if* ; + [ first2 get-process send ] [ stop-this-server ] if* ; : ( addrspec -- threaded-server ) diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor index 9a1421a3ad..49ef03543e 100755 --- a/basis/http/http-tests.factor +++ b/basis/http/http-tests.factor @@ -179,7 +179,7 @@ http.server.dispatchers db.tuples ; : add-quit-action - [ stop-server "Goodbye" "text/html" ] >>display + [ stop-this-server "Goodbye" "text/html" ] >>display "quit" add-responder ; : test-db "test.db" temp-file sqlite-db ; diff --git a/basis/io/encodings/ascii/ascii-docs.factor b/basis/io/encodings/ascii/ascii-docs.factor index fa496a3526..e0ab11f1a4 100644 --- a/basis/io/encodings/ascii/ascii-docs.factor +++ b/basis/io/encodings/ascii/ascii-docs.factor @@ -4,8 +4,8 @@ IN: io.encodings.ascii HELP: ascii { $class-description "ASCII encoding descriptor." } ; -ARTICLE: "ascii" "ASCII encoding" +ARTICLE: "io.encodings.ascii" "ASCII encoding" "By default, if there's a non-ASCII character in an input stream, it will be replaced with a replacement character (U+FFFD), and if a non-ASCII character is used in output, an exception is thrown." { $subsection ascii } ; -ABOUT: "ascii" +ABOUT: "io.encodings.ascii" diff --git a/basis/io/servers/connection/connection-docs.factor b/basis/io/servers/connection/connection-docs.factor index 839f3d8414..00711ce226 100755 --- a/basis/io/servers/connection/connection-docs.factor +++ b/basis/io/servers/connection/connection-docs.factor @@ -58,9 +58,11 @@ ARTICLE: "io.servers.connection" "Threaded servers" { $subsection start-server } { $subsection start-server* } { $subsection wait-for-server } +"Stopping the server:" +{ $subsection stop-server } "From within the dynamic scope of a client handler, several words can be used to interact with the threaded server:" { $subsection remote-address } -{ $subsection stop-server } +{ $subsection stop-this-server } { $subsection secure-port } { $subsection insecure-port } "Additionally, the " { $link local-address } " variable is set, as in " { $link with-client } "." ; @@ -88,7 +90,8 @@ HELP: handle-client* HELP: start-server { $values { "threaded-server" threaded-server } } -{ $description "Starts a threaded server, returning when a client handler calls " { $link stop-server } "." } ; +{ $description "Starts a threaded server." } +{ $notes "Use " { $link stop-server } " or " { $link stop-this-server } " to stop the server." } ; HELP: wait-for-server { $values { "threaded-server" threaded-server } } @@ -96,9 +99,13 @@ HELP: wait-for-server HELP: start-server* { $values { "threaded-server" threaded-server } } -{ $description "Starts a threaded server, returning as soon as it is accepting connections." } ; +{ $description "Starts a threaded server, returning as soon as it is ready to begin accepting connections." } ; HELP: stop-server +{ $values { "threaded-server" threaded-server } } +{ $description "Stops a threaded server, preventing it from accepting any more connections and returning to the caller of " { $link start-server } ". All client connections which have already been opened continue to be serviced." } ; + +HELP: stop-this-server { $description "Stops the current threaded server, preventing it from accepting any more connections and returning to the caller of " { $link start-server } ". All client connections which have already been opened continue to be serviced." } ; HELP: secure-port diff --git a/basis/io/servers/connection/connection-tests.factor b/basis/io/servers/connection/connection-tests.factor index aa8df0b16c..a3223ed2aa 100755 --- a/basis/io/servers/connection/connection-tests.factor +++ b/basis/io/servers/connection/connection-tests.factor @@ -33,7 +33,7 @@ concurrency.promises io.encodings.ascii io threads calendar ; 5 >>max-connections 1237 >>insecure - [ "Hello world." write stop-server ] >>handler + [ "Hello world." write stop-this-server ] >>handler "server" set ] unit-test diff --git a/basis/io/servers/connection/connection.factor b/basis/io/servers/connection/connection.factor index bde4e518ac..0516f24402 100755 --- a/basis/io/servers/connection/connection.factor +++ b/basis/io/servers/connection/connection.factor @@ -136,8 +136,11 @@ PRIVATE> [ wait-for-server ] bi ; -: stop-server ( -- ) - threaded-server get [ f ] change-sockets drop dispose-each ; +: stop-server ( threaded-server -- ) + [ f ] change-sockets drop dispose-each ; + +: stop-this-server ( -- ) + threaded-server get stop-server ; GENERIC: port ( addrspec -- n ) diff --git a/basis/io/sockets/sockets-docs.factor b/basis/io/sockets/sockets-docs.factor index 3c77be254c..3454f3384e 100755 --- a/basis/io/sockets/sockets-docs.factor +++ b/basis/io/sockets/sockets-docs.factor @@ -104,7 +104,7 @@ HELP: } ; HELP: with-client -{ $values { "remote" "an address specifier" } { "encoding" "an encding descriptor" } { "quot" quotation } } +{ $values { "remote" "an address specifier" } { "encoding" "an encoding descriptor" } { "quot" quotation } } { $description "Opens a network connection and calls the quotation in a new dynamic scope with " { $link input-stream } " and " { $link output-stream } " rebound to the network streams. The local address the socket is bound to is stored in the " { $link local-address } " variable." } { $errors "Throws an error if the connection cannot be established." } ; diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor index 1d5b59bf0c..db4255cdb1 100755 --- a/basis/tools/deploy/deploy-tests.factor +++ b/basis/tools/deploy/deploy-tests.factor @@ -66,7 +66,7 @@ http.server.responses http.server.static io.servers.connection ; SINGLETON: quit-responder M: quit-responder call-responder* - 2drop stop-server "Goodbye" "text/html" ; + 2drop stop-this-server "Goodbye" "text/html" ; : add-quot-responder ( responder -- responder ) quit-responder "quit" add-responder ; From c8127d1e1b9d9cfe1e9adf5e72ac04d6490d058a Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 08:30:49 -0500 Subject: [PATCH 028/948] Fix typo --- basis/present/present-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/present/present-docs.factor b/basis/present/present-docs.factor index f148d96b32..bda7723173 100644 --- a/basis/present/present-docs.factor +++ b/basis/present/present-docs.factor @@ -8,6 +8,6 @@ ARTICLE: "present" "Converting objects to human-readable strings" HELP: present { $values { "object" object } { "string" string } } { $contract "Outputs a human-readable string from an object." } -{ $notes "New methods can be defined by user code. Most often, this is done so that the object can be used with various words in the " { $link "html.components" } " or " { $link "urls" } " vocabularies." } ; +{ $notes "New methods can be defined by user code. Most often, this is done so that the object can be used with various words in the " { $vocab-link "html.components" } " or " { $link "urls" } " vocabularies." } ; ABOUT: "present" From c19f2257f470ca28d6dbed779ee499d8cdfa70ef Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 08:34:49 -0500 Subject: [PATCH 029/948] Fix permission bits --- basis/alarms/alarms-docs.factor | 0 basis/alarms/alarms-tests.factor | 0 basis/alarms/alarms.factor | 0 basis/alias/alias.factor | 0 basis/alien/arrays/arrays-docs.factor | 0 basis/alien/c-types/c-types-docs.factor | 0 basis/alien/c-types/c-types-tests.factor | 0 basis/alien/c-types/c-types.factor | 0 basis/alien/remote-control/remote-control.factor | 0 basis/alien/strings/strings.factor | 0 basis/alien/structs/structs-docs.factor | 0 basis/alien/structs/structs.factor | 0 basis/alien/syntax/syntax-docs.factor | 0 basis/alien/syntax/syntax.factor | 0 basis/ascii/ascii-docs.factor | 0 basis/ascii/ascii.factor | 0 basis/bit-arrays/bit-arrays-tests.factor | 0 basis/bit-arrays/bit-arrays.factor | 0 basis/bit-vectors/bit-vectors-docs.factor | 0 basis/bit-vectors/bit-vectors-tests.factor | 0 basis/bit-vectors/bit-vectors.factor | 0 basis/bootstrap/compiler/compiler.factor | 0 basis/bootstrap/handbook/handbook.factor | 0 basis/bootstrap/help/help.factor | 0 basis/bootstrap/image/image-tests.factor | 0 basis/bootstrap/image/image.factor | 0 basis/bootstrap/image/upload/upload.factor | 0 basis/bootstrap/io/io.factor | 0 basis/bootstrap/random/random.factor | 0 basis/bootstrap/stage2.factor | 0 basis/bootstrap/tools/tools.factor | 0 basis/bootstrap/ui/tools/tools.factor | 0 basis/bootstrap/unicode/unicode.factor | 0 basis/boxes/boxes-docs.factor | 0 basis/boxes/boxes-tests.factor | 0 basis/boxes/boxes.factor | 0 basis/calendar/calendar-tests.factor | 0 basis/calendar/calendar.factor | 0 basis/calendar/format/format-tests.factor | 0 basis/calendar/format/format.factor | 0 basis/calendar/model/model.factor | 0 basis/calendar/windows/windows.factor | 0 basis/channels/channels-tests.factor | 0 basis/channels/channels.factor | 0 basis/channels/examples/examples.factor | 0 basis/channels/remote/remote.factor | 0 basis/checksums/adler-32/adler-32-docs.factor | 0 basis/checksums/md5/md5-docs.factor | 0 basis/checksums/md5/md5-tests.factor | 0 basis/checksums/md5/md5.factor | 0 basis/checksums/sha1/sha1-tests.factor | 0 basis/checksums/sha1/sha1.factor | 0 basis/checksums/sha2/sha2-tests.factor | 0 basis/checksums/sha2/sha2.factor | 0 basis/circular/circular-tests.factor | 0 basis/circular/circular.factor | 0 basis/cocoa/application/application.factor | 0 basis/cocoa/cocoa.factor | 0 basis/cocoa/messages/messages.factor | 0 basis/cocoa/pasteboard/pasteboard.factor | 0 basis/cocoa/subclassing/subclassing.factor | 0 basis/cocoa/windows/windows.factor | 0 basis/combinators/short-circuit/short-circuit.factor | 0 basis/compiler/compiler-docs.factor | 0 basis/compiler/compiler.factor | 0 basis/compiler/constants/constants.factor | 0 basis/compiler/generator/fixup/fixup.factor | 0 basis/compiler/generator/generator-docs.factor | 0 basis/compiler/generator/generator.factor | 0 basis/compiler/generator/registers/registers.factor | 0 basis/compiler/tests/alien.factor | 0 basis/compiler/tests/curry.factor | 0 basis/compiler/tests/float.factor | 0 basis/compiler/tests/intrinsics.factor | 0 basis/compiler/tests/optimizer.factor | 0 basis/compiler/tests/simple.factor | 0 basis/compiler/tests/stack-trace.factor | 0 basis/compiler/tests/templates-early.factor | 0 basis/compiler/tests/templates.factor | 0 basis/compiler/tests/tuples.factor | 0 basis/compiler/tree/dead-code/simple/simple.factor | 0 basis/compiler/tree/def-use/def-use-tests.factor | 0 basis/compiler/tree/def-use/def-use.factor | 0 basis/compiler/tree/propagation/propagation.factor | 0 basis/compiler/tree/tree.factor | 0 basis/concurrency/combinators/combinators-docs.factor | 0 basis/concurrency/combinators/combinators-tests.factor | 0 basis/concurrency/combinators/combinators.factor | 0 basis/concurrency/conditions/conditions.factor | 0 basis/concurrency/count-downs/count-downs-docs.factor | 0 basis/concurrency/count-downs/count-downs-tests.factor | 0 basis/concurrency/count-downs/count-downs.factor | 0 basis/concurrency/distributed/distributed-docs.factor | 0 basis/concurrency/distributed/distributed-tests.factor | 0 basis/concurrency/distributed/distributed.factor | 0 basis/concurrency/exchangers/exchangers-docs.factor | 0 basis/concurrency/exchangers/exchangers-tests.factor | 0 basis/concurrency/exchangers/exchangers.factor | 0 basis/concurrency/flags/flags-tests.factor | 0 basis/concurrency/flags/flags.factor | 0 basis/concurrency/futures/futures-docs.factor | 0 basis/concurrency/futures/futures-tests.factor | 0 basis/concurrency/futures/futures.factor | 0 basis/concurrency/locks/locks-docs.factor | 0 basis/concurrency/locks/locks-tests.factor | 0 basis/concurrency/locks/locks.factor | 0 basis/concurrency/mailboxes/mailboxes-docs.factor | 0 basis/concurrency/mailboxes/mailboxes-tests.factor | 0 basis/concurrency/mailboxes/mailboxes.factor | 0 basis/concurrency/messaging/messaging-docs.factor | 0 basis/concurrency/messaging/messaging-tests.factor | 0 basis/concurrency/messaging/messaging.factor | 0 basis/concurrency/promises/promises-docs.factor | 0 basis/concurrency/promises/promises-tests.factor | 0 basis/concurrency/promises/promises.factor | 0 basis/concurrency/semaphores/semaphores-docs.factor | 0 basis/concurrency/semaphores/semaphores.factor | 0 basis/cpu/architecture/architecture.factor | 0 basis/cpu/ppc/allot/allot.factor | 0 basis/cpu/ppc/architecture/architecture.factor | 0 basis/cpu/ppc/assembler/assembler.factor | 0 basis/cpu/ppc/bootstrap.factor | 0 basis/cpu/ppc/intrinsics/intrinsics.factor | 0 basis/cpu/ppc/linux/bootstrap.factor | 0 basis/cpu/ppc/macosx/bootstrap.factor | 0 basis/cpu/ppc/ppc.factor | 0 basis/cpu/x86/32/32.factor | 0 basis/cpu/x86/32/bootstrap.factor | 0 basis/cpu/x86/64/64.factor | 0 basis/cpu/x86/64/bootstrap.factor | 0 basis/cpu/x86/allot/allot.factor | 0 basis/cpu/x86/architecture/architecture.factor | 0 basis/cpu/x86/assembler/assembler.factor | 0 basis/cpu/x86/bootstrap.factor | 0 basis/cpu/x86/intrinsics/intrinsics.factor | 0 basis/cpu/x86/sse2/sse2.factor | 0 basis/db/db-tests.factor | 0 basis/db/db.factor | 0 basis/db/postgresql/ffi/ffi.factor | 0 basis/db/postgresql/lib/lib.factor | 0 basis/db/postgresql/postgresql-tests.factor | 0 basis/db/postgresql/postgresql.factor | 0 basis/db/sqlite/ffi/ffi.factor | 0 basis/db/sqlite/lib/lib.factor | 0 basis/db/sqlite/sqlite-tests.factor | 0 basis/db/sqlite/sqlite.factor | 0 basis/db/tuples/tuples-tests.factor | 0 basis/db/tuples/tuples.factor | 0 basis/db/types/types.factor | 0 basis/debugger/debugger-docs.factor | 0 basis/debugger/debugger-tests.factor | 0 basis/debugger/debugger.factor | 0 basis/delegate/delegate-tests.factor | 0 basis/delegate/delegate.factor | 0 basis/delegate/protocols/protocols.factor | 0 basis/dlists/dlists-docs.factor | 0 basis/dlists/dlists-tests.factor | 0 basis/dlists/dlists.factor | 0 basis/documents/documents.factor | 0 basis/editors/editors.factor | 0 basis/editors/editpadpro/editpadpro.factor | 0 basis/editors/editplus/editplus.factor | 0 basis/editors/emacs/emacs.factor | 0 basis/editors/emeditor/emeditor.factor | 0 basis/editors/gvim/gvim.factor | 0 basis/editors/gvim/windows/windows.factor | 0 basis/editors/jedit/jedit.factor | 0 basis/editors/macvim/macvim.factor | 0 basis/editors/notepadpp/notepadpp.factor | 0 basis/editors/scite/scite.factor | 0 basis/editors/ted-notepad/ted-notepad.factor | 0 basis/editors/textedit/textedit.factor | 0 basis/editors/textmate/textmate.factor | 0 basis/editors/ultraedit/ultraedit.factor | 0 basis/editors/vim/vim.factor | 0 basis/editors/wordpad/wordpad.factor | 0 basis/float-arrays/float-arrays-tests.factor | 0 basis/float-arrays/float-arrays.factor | 0 basis/float-vectors/float-vectors-docs.factor | 0 basis/float-vectors/float-vectors-tests.factor | 0 basis/float-vectors/float-vectors.factor | 0 basis/freetype/freetype.factor | 0 basis/fry/fry-docs.factor | 0 basis/fry/fry-tests.factor | 0 basis/fry/fry.factor | 0 basis/furnace/actions/actions-tests.factor | 0 basis/furnace/actions/actions.factor | 0 basis/furnace/auth/auth.factor | 0 basis/furnace/auth/basic/basic.factor | 0 basis/furnace/auth/login/login-tests.factor | 0 basis/furnace/auth/login/login.factor | 0 basis/furnace/auth/providers/assoc/assoc-tests.factor | 0 basis/furnace/auth/providers/assoc/assoc.factor | 0 basis/furnace/auth/providers/db/db-tests.factor | 0 basis/furnace/auth/providers/db/db.factor | 0 basis/furnace/auth/providers/null/null.factor | 0 basis/furnace/auth/providers/providers.factor | 0 basis/furnace/db/db.factor | 0 basis/furnace/sessions/sessions-tests.factor | 0 basis/furnace/sessions/sessions.factor | 0 basis/generalizations/generalizations-docs.factor | 0 basis/generalizations/generalizations-tests.factor | 0 basis/generalizations/generalizations.factor | 0 basis/globs/globs.factor | 0 basis/hash2/hash2-tests.factor | 0 basis/heaps/heaps-docs.factor | 0 basis/heaps/heaps-tests.factor | 0 basis/heaps/heaps.factor | 0 basis/help/cookbook/cookbook.factor | 0 basis/help/crossref/crossref-tests.factor | 0 basis/help/definitions/definitions-tests.factor | 0 basis/help/definitions/definitions.factor | 0 basis/help/handbook/handbook.factor | 0 basis/help/help-docs.factor | 0 basis/help/help.factor | 0 basis/help/lint/lint.factor | 0 basis/help/markup/markup.factor | 0 basis/help/stylesheet/stylesheet.factor | 0 basis/help/syntax/syntax-tests.factor | 0 basis/help/syntax/syntax.factor | 0 basis/help/topics/topics.factor | 0 basis/help/tutorial/tutorial.factor | 0 basis/html/streams/streams.factor | 0 basis/html/templates/fhtml/fhtml-tests.factor | 0 basis/html/templates/fhtml/fhtml.factor | 0 basis/http/client/client-tests.factor | 0 basis/http/client/client.factor | 0 basis/http/http-tests.factor | 0 basis/http/http.factor | 0 basis/http/server/cgi/cgi.factor | 0 basis/http/server/server.factor | 0 basis/http/server/static/static.factor | 0 basis/inspector/inspector.factor | 0 basis/interval-maps/interval-maps-docs.factor | 0 basis/interval-maps/interval-maps-tests.factor | 0 basis/interval-maps/interval-maps.factor | 0 basis/io/buffers/buffers-docs.factor | 0 basis/io/buffers/buffers-tests.factor | 0 basis/io/buffers/buffers.factor | 0 basis/io/encodings/8-bit/8-bit.factor | 0 basis/io/encodings/ascii/ascii.factor | 0 basis/io/encodings/iana/iana.factor | 0 basis/io/encodings/utf16/utf16-tests.factor | 0 basis/io/encodings/utf16/utf16.factor | 0 basis/io/launcher/launcher-docs.factor | 0 basis/io/launcher/launcher-tests.factor | 0 basis/io/launcher/launcher.factor | 0 basis/io/mmap/mmap-docs.factor | 0 basis/io/mmap/mmap-tests.factor | 0 basis/io/mmap/mmap.factor | 0 basis/io/monitors/monitors-docs.factor | 0 basis/io/monitors/monitors-tests.factor | 0 basis/io/monitors/monitors.factor | 0 basis/io/pipes/pipes-tests.factor | 0 basis/io/ports/ports-docs.factor | 0 basis/io/ports/ports.factor | 0 basis/io/servers/connection/connection-docs.factor | 0 basis/io/servers/connection/connection-tests.factor | 0 basis/io/servers/connection/connection.factor | 0 basis/io/sockets/secure/secure-tests.factor | 0 basis/io/sockets/secure/secure.factor | 0 basis/io/sockets/sockets-docs.factor | 0 basis/io/sockets/sockets-tests.factor | 0 basis/io/sockets/sockets.factor | 0 basis/io/streams/duplex/duplex-docs.factor | 0 basis/io/streams/duplex/duplex-tests.factor | 0 basis/io/streams/duplex/duplex.factor | 0 basis/io/streams/null/null.factor | 0 basis/io/thread/thread.factor | 0 basis/io/timeouts/timeouts-docs.factor | 0 basis/io/timeouts/timeouts.factor | 0 basis/io/unix/backend/backend.factor | 0 basis/io/unix/bsd/bsd.factor | 0 basis/io/unix/files/files-tests.factor | 0 basis/io/unix/files/files.factor | 0 basis/io/unix/kqueue/kqueue.factor | 0 basis/io/unix/launcher/launcher-tests.factor | 0 basis/io/unix/launcher/launcher.factor | 0 basis/io/unix/launcher/parser/parser-tests.factor | 0 basis/io/unix/launcher/parser/parser.factor | 0 basis/io/unix/linux/linux.factor | 0 basis/io/unix/mmap/mmap.factor | 0 basis/io/unix/select/select.factor | 0 basis/io/unix/sockets/secure/secure.factor | 0 basis/io/unix/sockets/sockets.factor | 0 basis/io/unix/unix-tests.factor | 0 basis/io/unix/unix.factor | 0 basis/io/windows/files/files.factor | 0 basis/io/windows/files/unique/unique.factor | 0 basis/io/windows/launcher/launcher-tests.factor | 0 basis/io/windows/launcher/launcher.factor | 0 basis/io/windows/mmap/mmap.factor | 0 basis/io/windows/nt/backend/backend.factor | 0 basis/io/windows/nt/files/files-tests.factor | 0 basis/io/windows/nt/files/files.factor | 0 basis/io/windows/nt/launcher/launcher-tests.factor | 0 basis/io/windows/nt/launcher/launcher.factor | 0 basis/io/windows/nt/launcher/test/append.factor | 0 basis/io/windows/nt/launcher/test/env.factor | 0 basis/io/windows/nt/launcher/test/stderr.factor | 0 basis/io/windows/nt/monitors/monitors-tests.factor | 0 basis/io/windows/nt/monitors/monitors.factor | 0 basis/io/windows/nt/nt.factor | 0 basis/io/windows/nt/pipes/pipes.factor | 0 basis/io/windows/nt/privileges/privileges.factor | 0 basis/io/windows/nt/sockets/sockets.factor | 0 basis/io/windows/privileges/privileges.factor | 0 basis/io/windows/sockets/sockets.factor | 0 basis/io/windows/windows.factor | 0 basis/json/reader/reader.factor | 0 basis/lcs/lcs-docs.factor | 0 basis/lcs/lcs-tests.factor | 0 basis/lcs/lcs.factor | 0 basis/libc/libc-tests.factor | 0 basis/libc/libc.factor | 0 basis/listener/listener-docs.factor | 0 basis/listener/listener-tests.factor | 0 basis/listener/listener.factor | 0 basis/locals/locals-tests.factor | 0 basis/locals/locals.factor | 0 basis/logging/analysis/analysis.factor | 0 basis/logging/insomniac/insomniac-docs.factor | 0 basis/logging/insomniac/insomniac.factor | 0 basis/logging/logging-docs.factor | 0 basis/logging/logging.factor | 0 basis/logging/parser/parser.factor | 0 basis/logging/server/server.factor | 0 basis/macros/macros.factor | 0 basis/match/match-tests.factor | 0 basis/match/match.factor | 0 basis/math/bitwise/bitwise-tests.factor | 0 basis/math/complex/complex-docs.factor | 0 basis/math/complex/complex-tests.factor | 0 basis/math/complex/complex.factor | 0 basis/math/constants/constants-docs.factor | 0 basis/math/constants/constants.factor | 0 basis/math/functions/functions-docs.factor | 0 basis/math/functions/functions-tests.factor | 0 basis/math/functions/functions.factor | 0 basis/math/intervals/intervals-tests.factor | 0 basis/math/intervals/intervals.factor | 0 basis/math/libm/libm.factor | 0 basis/math/ranges/ranges.factor | 0 basis/math/ratios/ratios-docs.factor | 0 basis/math/ratios/ratios-tests.factor | 0 basis/math/ratios/ratios.factor | 0 basis/math/vectors/vectors-docs.factor | 0 basis/math/vectors/vectors.factor | 0 basis/memoize/memoize-docs.factor | 0 basis/memoize/memoize.factor | 0 basis/mime-types/mime-types.factor | 0 basis/mirrors/mirrors-docs.factor | 0 basis/mirrors/mirrors-tests.factor | 0 basis/mirrors/mirrors.factor | 0 basis/models/compose/compose-docs.factor | 0 basis/models/compose/compose-tests.factor | 0 basis/models/compose/compose.factor | 0 basis/models/delay/delay-docs.factor | 0 basis/models/delay/delay.factor | 0 basis/models/filter/filter-docs.factor | 0 basis/models/filter/filter-tests.factor | 0 basis/models/filter/filter.factor | 0 basis/models/history/history-docs.factor | 0 basis/models/history/history-tests.factor | 0 basis/models/history/history.factor | 0 basis/models/mapping/mapping-tests.factor | 0 basis/models/mapping/mapping.factor | 0 basis/models/models-docs.factor | 0 basis/models/models-tests.factor | 0 basis/models/models.factor | 0 basis/models/range/range-docs.factor | 0 basis/models/range/range-tests.factor | 0 basis/models/range/range.factor | 0 basis/multiline/multiline-tests.factor | 0 basis/multiline/multiline.factor | 0 basis/opengl/gl/windows/windows.factor | 0 basis/opengl/opengl.factor | 0 basis/openssl/libcrypto/libcrypto.factor | 0 basis/openssl/libssl/libssl.factor | 0 basis/openssl/openssl-tests.factor | 0 basis/openssl/openssl.factor | 0 basis/peg/parsers/parsers-docs.factor | 0 basis/peg/parsers/parsers.factor | 0 basis/peg/peg.factor | 0 basis/peg/search/search-docs.factor | 0 basis/peg/search/search-tests.factor | 0 basis/peg/search/search.factor | 0 basis/prettyprint/backend/backend-docs.factor | 0 basis/prettyprint/backend/backend.factor | 0 basis/prettyprint/prettyprint-docs.factor | 0 basis/prettyprint/prettyprint-tests.factor | 0 basis/prettyprint/prettyprint.factor | 0 basis/prettyprint/sections/sections-docs.factor | 0 basis/qualified/qualified-docs.factor | 0 basis/random/dummy/dummy.factor | 0 basis/random/mersenne-twister/mersenne-twister-tests.factor | 0 basis/random/mersenne-twister/mersenne-twister.factor | 0 basis/random/random.factor | 0 basis/sequences/deep/deep-tests.factor | 0 basis/sequences/next/next.factor | 0 basis/serialize/serialize-docs.factor | 0 basis/serialize/serialize-tests.factor | 0 basis/serialize/serialize.factor | 0 basis/shuffle/shuffle-tests.factor | 0 basis/smtp/server/server.factor | 0 basis/smtp/smtp-tests.factor | 0 basis/smtp/smtp.factor | 0 basis/stack-checker/backend/backend.factor | 0 basis/stack-checker/known-words/known-words.factor | 0 basis/stack-checker/stack-checker-docs.factor | 0 basis/stack-checker/stack-checker-tests.factor | 0 basis/stack-checker/stack-checker.factor | 0 basis/stack-checker/state/state.factor | 0 basis/stack-checker/transforms/transforms-docs.factor | 0 basis/stack-checker/transforms/transforms-tests.factor | 0 basis/stack-checker/transforms/transforms.factor | 0 basis/state-parser/state-parser-tests.factor | 0 basis/symbols/symbols-tests.factor | 0 basis/symbols/symbols.factor | 0 basis/syndication/syndication-tests.factor | 0 basis/threads/threads-docs.factor | 0 basis/threads/threads-tests.factor | 0 basis/threads/threads.factor | 0 basis/tools/annotations/annotations-docs.factor | 0 basis/tools/annotations/annotations-tests.factor | 0 basis/tools/annotations/annotations.factor | 0 basis/tools/completion/completion.factor | 0 basis/tools/crossref/crossref-tests.factor | 0 basis/tools/crossref/crossref.factor | 0 basis/tools/crossref/test/foo.factor | 0 basis/tools/deploy/backend/backend.factor | 0 basis/tools/deploy/config/config-docs.factor | 0 basis/tools/deploy/config/config.factor | 0 basis/tools/deploy/deploy-docs.factor | 0 basis/tools/deploy/deploy-tests.factor | 0 basis/tools/deploy/deploy.factor | 0 basis/tools/deploy/macosx/macosx.factor | 0 basis/tools/deploy/shaker/shaker.factor | 0 basis/tools/deploy/shaker/strip-cocoa.factor | 0 basis/tools/deploy/shaker/strip-debugger.factor | 0 basis/tools/deploy/shaker/strip-libc.factor | 0 basis/tools/deploy/test/1/1.factor | 0 basis/tools/deploy/test/1/deploy.factor | 0 basis/tools/deploy/test/2/2.factor | 0 basis/tools/deploy/test/2/deploy.factor | 0 basis/tools/deploy/test/3/3.factor | 0 basis/tools/deploy/test/3/deploy.factor | 0 basis/tools/deploy/windows/windows-tests.factor | 0 basis/tools/deploy/windows/windows.factor | 0 basis/tools/disassembler/disassembler-docs.factor | 0 basis/tools/disassembler/disassembler-tests.factor | 0 basis/tools/disassembler/disassembler.factor | 0 basis/tools/memory/memory-docs.factor | 0 basis/tools/memory/memory.factor | 0 basis/tools/profiler/profiler-docs.factor | 0 basis/tools/profiler/profiler-tests.factor | 0 basis/tools/profiler/profiler.factor | 0 basis/tools/test/test-docs.factor | 0 basis/tools/test/test.factor | 0 basis/tools/test/ui/ui.factor | 0 basis/tools/threads/threads.factor | 0 basis/tools/time/time-docs.factor | 0 basis/tools/vocabs/browser/browser-docs.factor | 0 basis/tools/vocabs/browser/browser-tests.factor | 0 basis/tools/vocabs/browser/browser.factor | 0 basis/tools/vocabs/monitor/monitor.factor | 0 basis/tools/vocabs/vocabs-docs.factor | 0 basis/tools/vocabs/vocabs.factor | 0 basis/tools/walker/debug/debug.factor | 0 basis/tools/walker/walker-tests.factor | 0 basis/tools/walker/walker.factor | 0 basis/tuple-arrays/tuple-arrays-tests.factor | 0 basis/ui/backend/backend.factor | 0 basis/ui/cocoa/cocoa.factor | 0 basis/ui/cocoa/tools/tools.factor | 0 basis/ui/cocoa/views/views.factor | 0 basis/ui/commands/commands.factor | 0 basis/ui/freetype/freetype-docs.factor | 0 basis/ui/freetype/freetype.factor | 0 basis/ui/gadgets/books/books-docs.factor | 0 basis/ui/gadgets/books/books-tests.factor | 0 basis/ui/gadgets/books/books.factor | 0 basis/ui/gadgets/buttons/buttons-docs.factor | 0 basis/ui/gadgets/buttons/buttons-tests.factor | 0 basis/ui/gadgets/buttons/buttons.factor | 0 basis/ui/gadgets/canvas/canvas-tests.factor | 0 basis/ui/gadgets/canvas/canvas.factor | 0 basis/ui/gadgets/editors/editors-docs.factor | 0 basis/ui/gadgets/editors/editors-tests.factor | 0 basis/ui/gadgets/editors/editors.factor | 0 basis/ui/gadgets/frames/frames-docs.factor | 0 basis/ui/gadgets/gadgets-docs.factor | 0 basis/ui/gadgets/gadgets-tests.factor | 0 basis/ui/gadgets/gadgets.factor | 0 basis/ui/gadgets/grid-lines/grid-lines-docs.factor | 0 basis/ui/gadgets/grid-lines/grid-lines.factor | 0 basis/ui/gadgets/grids/grids-docs.factor | 0 basis/ui/gadgets/incremental/incremental-docs.factor | 0 basis/ui/gadgets/incremental/incremental.factor | 0 basis/ui/gadgets/labelled/labelled-docs.factor | 0 basis/ui/gadgets/labelled/labelled.factor | 0 basis/ui/gadgets/labels/labels-docs.factor | 0 basis/ui/gadgets/labels/labels.factor | 0 basis/ui/gadgets/lists/lists-docs.factor | 0 basis/ui/gadgets/lists/lists.factor | 0 basis/ui/gadgets/menus/menus-docs.factor | 0 basis/ui/gadgets/packs/packs-docs.factor | 0 basis/ui/gadgets/packs/packs.factor | 0 basis/ui/gadgets/panes/panes-docs.factor | 0 basis/ui/gadgets/panes/panes-tests.factor | 0 basis/ui/gadgets/panes/panes.factor | 0 basis/ui/gadgets/presentations/presentations-docs.factor | 0 basis/ui/gadgets/scrollers/scrollers-docs.factor | 0 basis/ui/gadgets/scrollers/scrollers-tests.factor | 0 basis/ui/gadgets/scrollers/scrollers.factor | 0 basis/ui/gadgets/sliders/sliders-docs.factor | 0 basis/ui/gadgets/sliders/sliders.factor | 0 basis/ui/gadgets/slots/slots.factor | 0 basis/ui/gadgets/status-bar/status-bar-docs.factor | 0 basis/ui/gadgets/status-bar/status-bar.factor | 0 basis/ui/gadgets/tracks/tracks-docs.factor | 0 basis/ui/gadgets/viewports/viewports-docs.factor | 0 basis/ui/gadgets/viewports/viewports.factor | 0 basis/ui/gadgets/worlds/worlds-docs.factor | 0 basis/ui/gadgets/worlds/worlds.factor | 0 basis/ui/gestures/gestures.factor | 0 basis/ui/operations/operations-tests.factor | 0 basis/ui/operations/operations.factor | 0 basis/ui/render/render-docs.factor | 0 basis/ui/tools/browser/browser-tests.factor | 0 basis/ui/tools/browser/browser.factor | 0 basis/ui/tools/debugger/debugger-docs.factor | 0 basis/ui/tools/deploy/deploy-docs.factor | 0 basis/ui/tools/deploy/deploy.factor | 0 basis/ui/tools/interactor/interactor-docs.factor | 0 basis/ui/tools/interactor/interactor-tests.factor | 0 basis/ui/tools/interactor/interactor.factor | 0 basis/ui/tools/listener/listener-tests.factor | 0 basis/ui/tools/listener/listener.factor | 0 basis/ui/tools/operations/operations.factor | 0 basis/ui/tools/profiler/profiler.factor | 0 basis/ui/tools/search/search-tests.factor | 0 basis/ui/tools/search/search.factor | 0 basis/ui/tools/tools-docs.factor | 0 basis/ui/tools/tools-tests.factor | 0 basis/ui/tools/tools.factor | 0 basis/ui/tools/traceback/traceback.factor | 0 basis/ui/tools/walker/walker-docs.factor | 0 basis/ui/tools/walker/walker-tests.factor | 0 basis/ui/tools/walker/walker.factor | 0 basis/ui/tools/workspace/workspace-tests.factor | 0 basis/ui/tools/workspace/workspace.factor | 0 basis/ui/traverse/traverse-tests.factor | 0 basis/ui/ui-docs.factor | 0 basis/ui/ui.factor | 0 basis/ui/windows/windows.factor | 0 basis/ui/x11/x11.factor | 0 basis/unicode/breaks/breaks-tests.factor | 0 basis/unicode/breaks/breaks.factor | 0 basis/unicode/case/case-tests.factor | 0 basis/unicode/case/case.factor | 0 basis/unicode/collation/collation-tests.factor | 0 basis/unicode/collation/collation.factor | 0 basis/unicode/data/data.factor | 0 basis/unicode/normalize/normalize-tests.factor | 0 basis/unicode/normalize/normalize.factor | 0 basis/unicode/script/script-docs.factor | 0 basis/unicode/script/script-tests.factor | 0 basis/unicode/script/script.factor | 0 basis/unicode/syntax/syntax.factor | 0 basis/unix/bsd/bsd.factor | 0 basis/unix/linux/ifreq/ifreq.factor | 0 basis/unix/linux/linux.factor | 0 basis/unix/process/process.factor | 0 basis/unix/types/freebsd/freebsd.factor | 0 basis/unix/types/netbsd/32/32.factor | 0 basis/unix/types/netbsd/64/64.factor | 0 basis/unix/types/netbsd/netbsd.factor | 0 basis/unix/types/openbsd/openbsd.factor | 0 basis/unix/unix.factor | 0 basis/values/values-docs.factor | 0 basis/values/values-tests.factor | 0 basis/values/values.factor | 0 basis/windows/advapi32/advapi32.factor | 0 basis/windows/com/com-tests.factor | 0 basis/windows/com/com.factor | 0 basis/windows/com/syntax/syntax-docs.factor | 0 basis/windows/com/syntax/syntax.factor | 0 basis/windows/com/wrapper/wrapper-docs.factor | 0 basis/windows/com/wrapper/wrapper.factor | 0 basis/windows/dinput/constants/constants.factor | 0 basis/windows/dinput/dinput.factor | 0 basis/windows/gdi32/gdi32.factor | 0 basis/windows/kernel32/kernel32.factor | 0 basis/windows/messages/messages.factor | 0 basis/windows/ole32/ole32.factor | 0 basis/windows/opengl32/opengl32.factor | 0 basis/windows/user32/user32.factor | 0 basis/windows/winsock/winsock.factor | 0 basis/x11/clipboard/clipboard.factor | 0 basis/x11/windows/windows.factor | 0 basis/x11/xim/xim.factor | 0 basis/x11/xlib/xlib.factor | 0 basis/xml-rpc/xml-rpc.factor | 0 basis/xml/char-classes/char-classes.factor | 0 basis/xml/data/data.factor | 0 basis/xml/errors/errors-tests.factor | 0 basis/xml/tests/soap.factor | 0 basis/xml/utilities/utilities.factor | 0 basis/xmode/catalog/catalog.factor | 0 basis/xmode/code2html/code2html.factor | 0 basis/xmode/code2html/responder/responder.factor | 0 basis/xmode/loader/loader.factor | 0 basis/xmode/marker/marker-tests.factor | 0 basis/xmode/marker/marker.factor | 0 basis/xmode/marker/state/state.factor | 0 basis/xmode/rules/rules.factor | 0 basis/xmode/tokens/tokens.factor | 0 basis/xmode/utilities/utilities-tests.factor | 0 core/alien/alien-docs.factor | 0 core/alien/alien-tests.factor | 0 core/alien/alien.factor | 0 core/arrays/arrays-docs.factor | 0 core/arrays/arrays-tests.factor | 0 core/arrays/arrays.factor | 0 core/assocs/assocs-docs.factor | 0 core/assocs/assocs-tests.factor | 0 core/assocs/assocs.factor | 0 core/bootstrap/layouts/layouts.factor | 0 core/bootstrap/primitives.factor | 0 core/bootstrap/stage1.factor | 0 core/bootstrap/syntax.factor | 0 core/byte-arrays/byte-arrays-docs.factor | 0 core/byte-arrays/byte-arrays-tests.factor | 0 core/byte-arrays/byte-arrays.factor | 0 core/byte-vectors/byte-vectors-docs.factor | 0 core/byte-vectors/byte-vectors-tests.factor | 0 core/byte-vectors/byte-vectors.factor | 0 core/checksums/crc32/crc32.factor | 0 core/classes/algebra/algebra-docs.factor | 0 core/classes/algebra/algebra-tests.factor | 0 core/classes/algebra/algebra.factor | 0 core/classes/classes-docs.factor | 0 core/classes/classes-tests.factor | 0 core/classes/classes.factor | 0 core/classes/mixin/mixin-docs.factor | 0 core/classes/mixin/mixin.factor | 0 core/classes/predicate/predicate-docs.factor | 0 core/classes/predicate/predicate.factor | 0 core/classes/singleton/singleton.factor | 0 core/classes/tuple/tuple-docs.factor | 0 core/classes/tuple/tuple-tests.factor | 0 core/classes/tuple/tuple.factor | 0 core/classes/union/union-docs.factor | 0 core/classes/union/union.factor | 0 core/combinators/combinators-docs.factor | 0 core/combinators/combinators-tests.factor | 0 core/combinators/combinators.factor | 0 core/compiler/errors/errors-docs.factor | 0 core/compiler/errors/errors.factor | 0 core/compiler/units/units-docs.factor | 0 core/compiler/units/units.factor | 0 core/continuations/continuations-docs.factor | 0 core/continuations/continuations-tests.factor | 0 core/continuations/continuations.factor | 0 core/definitions/definitions-docs.factor | 0 core/definitions/definitions-tests.factor | 0 core/definitions/definitions.factor | 0 core/destructors/destructors-docs.factor | 0 core/destructors/destructors-tests.factor | 0 core/destructors/destructors.factor | 0 core/effects/effects.factor | 0 core/generic/generic-docs.factor | 0 core/generic/generic-tests.factor | 0 core/generic/generic.factor | 0 core/generic/math/math-docs.factor | 0 core/generic/math/math.factor | 0 core/growable/growable-docs.factor | 0 core/growable/growable-tests.factor | 0 core/hashtables/hashtables-docs.factor | 0 core/hashtables/hashtables-tests.factor | 0 core/hashtables/hashtables.factor | 0 core/init/init.factor | 0 core/io/backend/backend-tests.factor | 0 core/io/backend/backend.factor | 0 core/io/binary/binary-tests.factor | 0 core/io/binary/binary.factor | 0 core/io/encodings/binary/binary.factor | 0 core/io/encodings/encodings-tests.factor | 0 core/io/encodings/encodings.factor | 0 core/io/encodings/utf8/utf8-docs.factor | 0 core/io/encodings/utf8/utf8-tests.factor | 0 core/io/encodings/utf8/utf8.factor | 0 core/io/files/files-docs.factor | 0 core/io/files/files-tests.factor | 0 core/io/files/files.factor | 0 core/io/io-docs.factor | 0 core/io/io-tests.factor | 0 core/io/io.factor | 0 core/io/streams/c/c-docs.factor | 0 core/io/streams/c/c-tests.factor | 0 core/io/streams/c/c.factor | 0 core/io/streams/nested/nested.factor | 0 core/io/streams/string/string.factor | 0 core/kernel/kernel-docs.factor | 0 core/kernel/kernel-tests.factor | 0 core/kernel/kernel.factor | 0 core/layouts/layouts-docs.factor | 0 core/layouts/layouts-tests.factor | 0 core/layouts/layouts.factor | 0 core/math/floats/floats-tests.factor | 0 core/math/floats/floats.factor | 0 core/math/integers/integers-docs.factor | 0 core/math/integers/integers-tests.factor | 0 core/math/integers/integers.factor | 0 core/math/math-docs.factor | 0 core/math/math.factor | 0 core/math/parser/parser-tests.factor | 0 core/math/parser/parser.factor | 0 core/memory/memory-docs.factor | 0 core/memory/memory-tests.factor | 0 core/namespaces/namespaces-docs.factor | 0 core/parser/parser-docs.factor | 0 core/parser/parser-tests.factor | 0 core/parser/parser.factor | 0 core/parser/test/assert-depth.factor | 0 core/quotations/quotations-docs.factor | 0 core/quotations/quotations-tests.factor | 0 core/quotations/quotations.factor | 0 core/sbufs/sbufs.factor | 0 core/sequences/sequences-docs.factor | 0 core/sequences/sequences-tests.factor | 0 core/sequences/sequences.factor | 0 core/slots/slots-docs.factor | 0 core/slots/slots.factor | 0 core/sorting/sorting-tests.factor | 0 core/sorting/sorting.factor | 0 core/source-files/source-files-docs.factor | 0 core/source-files/source-files.factor | 0 core/splitting/splitting.factor | 0 core/strings/strings-docs.factor | 0 core/strings/strings-tests.factor | 0 core/strings/strings.factor | 0 core/syntax/syntax-docs.factor | 0 core/syntax/syntax.factor | 0 core/system/system-docs.factor | 0 core/system/system-tests.factor | 0 core/system/system.factor | 0 core/vectors/vectors-docs.factor | 0 core/vectors/vectors-tests.factor | 0 core/vectors/vectors.factor | 0 core/vocabs/loader/loader-docs.factor | 0 core/vocabs/loader/loader-tests.factor | 0 core/vocabs/loader/loader.factor | 0 core/vocabs/loader/test/a/a.factor | 0 core/vocabs/loader/test/b/b.factor | 0 core/vocabs/vocabs-docs.factor | 0 core/vocabs/vocabs.factor | 0 core/words/words-docs.factor | 0 core/words/words-tests.factor | 0 core/words/words.factor | 0 761 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 basis/alarms/alarms-docs.factor mode change 100755 => 100644 basis/alarms/alarms-tests.factor mode change 100755 => 100644 basis/alarms/alarms.factor mode change 100755 => 100644 basis/alias/alias.factor mode change 100755 => 100644 basis/alien/arrays/arrays-docs.factor mode change 100755 => 100644 basis/alien/c-types/c-types-docs.factor mode change 100755 => 100644 basis/alien/c-types/c-types-tests.factor mode change 100755 => 100644 basis/alien/c-types/c-types.factor mode change 100755 => 100644 basis/alien/remote-control/remote-control.factor mode change 100755 => 100644 basis/alien/strings/strings.factor mode change 100755 => 100644 basis/alien/structs/structs-docs.factor mode change 100755 => 100644 basis/alien/structs/structs.factor mode change 100755 => 100644 basis/alien/syntax/syntax-docs.factor mode change 100755 => 100644 basis/alien/syntax/syntax.factor mode change 100755 => 100644 basis/ascii/ascii-docs.factor mode change 100755 => 100644 basis/ascii/ascii.factor mode change 100755 => 100644 basis/bit-arrays/bit-arrays-tests.factor mode change 100755 => 100644 basis/bit-arrays/bit-arrays.factor mode change 100755 => 100644 basis/bit-vectors/bit-vectors-docs.factor mode change 100755 => 100644 basis/bit-vectors/bit-vectors-tests.factor mode change 100755 => 100644 basis/bit-vectors/bit-vectors.factor mode change 100755 => 100644 basis/bootstrap/compiler/compiler.factor mode change 100755 => 100644 basis/bootstrap/handbook/handbook.factor mode change 100755 => 100644 basis/bootstrap/help/help.factor mode change 100755 => 100644 basis/bootstrap/image/image-tests.factor mode change 100755 => 100644 basis/bootstrap/image/image.factor mode change 100755 => 100644 basis/bootstrap/image/upload/upload.factor mode change 100755 => 100644 basis/bootstrap/io/io.factor mode change 100755 => 100644 basis/bootstrap/random/random.factor mode change 100755 => 100644 basis/bootstrap/stage2.factor mode change 100755 => 100644 basis/bootstrap/tools/tools.factor mode change 100755 => 100644 basis/bootstrap/ui/tools/tools.factor mode change 100755 => 100644 basis/bootstrap/unicode/unicode.factor mode change 100755 => 100644 basis/boxes/boxes-docs.factor mode change 100755 => 100644 basis/boxes/boxes-tests.factor mode change 100755 => 100644 basis/boxes/boxes.factor mode change 100755 => 100644 basis/calendar/calendar-tests.factor mode change 100755 => 100644 basis/calendar/calendar.factor mode change 100755 => 100644 basis/calendar/format/format-tests.factor mode change 100755 => 100644 basis/calendar/format/format.factor mode change 100755 => 100644 basis/calendar/model/model.factor mode change 100755 => 100644 basis/calendar/windows/windows.factor mode change 100755 => 100644 basis/channels/channels-tests.factor mode change 100755 => 100644 basis/channels/channels.factor mode change 100755 => 100644 basis/channels/examples/examples.factor mode change 100755 => 100644 basis/channels/remote/remote.factor mode change 100755 => 100644 basis/checksums/adler-32/adler-32-docs.factor mode change 100755 => 100644 basis/checksums/md5/md5-docs.factor mode change 100755 => 100644 basis/checksums/md5/md5-tests.factor mode change 100755 => 100644 basis/checksums/md5/md5.factor mode change 100755 => 100644 basis/checksums/sha1/sha1-tests.factor mode change 100755 => 100644 basis/checksums/sha1/sha1.factor mode change 100755 => 100644 basis/checksums/sha2/sha2-tests.factor mode change 100755 => 100644 basis/checksums/sha2/sha2.factor mode change 100755 => 100644 basis/circular/circular-tests.factor mode change 100755 => 100644 basis/circular/circular.factor mode change 100755 => 100644 basis/cocoa/application/application.factor mode change 100755 => 100644 basis/cocoa/cocoa.factor mode change 100755 => 100644 basis/cocoa/messages/messages.factor mode change 100755 => 100644 basis/cocoa/pasteboard/pasteboard.factor mode change 100755 => 100644 basis/cocoa/subclassing/subclassing.factor mode change 100755 => 100644 basis/cocoa/windows/windows.factor mode change 100755 => 100644 basis/combinators/short-circuit/short-circuit.factor mode change 100755 => 100644 basis/compiler/compiler-docs.factor mode change 100755 => 100644 basis/compiler/compiler.factor mode change 100755 => 100644 basis/compiler/constants/constants.factor mode change 100755 => 100644 basis/compiler/generator/fixup/fixup.factor mode change 100755 => 100644 basis/compiler/generator/generator-docs.factor mode change 100755 => 100644 basis/compiler/generator/generator.factor mode change 100755 => 100644 basis/compiler/generator/registers/registers.factor mode change 100755 => 100644 basis/compiler/tests/alien.factor mode change 100755 => 100644 basis/compiler/tests/curry.factor mode change 100755 => 100644 basis/compiler/tests/float.factor mode change 100755 => 100644 basis/compiler/tests/intrinsics.factor mode change 100755 => 100644 basis/compiler/tests/optimizer.factor mode change 100755 => 100644 basis/compiler/tests/simple.factor mode change 100755 => 100644 basis/compiler/tests/stack-trace.factor mode change 100755 => 100644 basis/compiler/tests/templates-early.factor mode change 100755 => 100644 basis/compiler/tests/templates.factor mode change 100755 => 100644 basis/compiler/tests/tuples.factor mode change 100755 => 100644 basis/compiler/tree/dead-code/simple/simple.factor mode change 100755 => 100644 basis/compiler/tree/def-use/def-use-tests.factor mode change 100755 => 100644 basis/compiler/tree/def-use/def-use.factor mode change 100755 => 100644 basis/compiler/tree/propagation/propagation.factor mode change 100755 => 100644 basis/compiler/tree/tree.factor mode change 100755 => 100644 basis/concurrency/combinators/combinators-docs.factor mode change 100755 => 100644 basis/concurrency/combinators/combinators-tests.factor mode change 100755 => 100644 basis/concurrency/combinators/combinators.factor mode change 100755 => 100644 basis/concurrency/conditions/conditions.factor mode change 100755 => 100644 basis/concurrency/count-downs/count-downs-docs.factor mode change 100755 => 100644 basis/concurrency/count-downs/count-downs-tests.factor mode change 100755 => 100644 basis/concurrency/count-downs/count-downs.factor mode change 100755 => 100644 basis/concurrency/distributed/distributed-docs.factor mode change 100755 => 100644 basis/concurrency/distributed/distributed-tests.factor mode change 100755 => 100644 basis/concurrency/distributed/distributed.factor mode change 100755 => 100644 basis/concurrency/exchangers/exchangers-docs.factor mode change 100755 => 100644 basis/concurrency/exchangers/exchangers-tests.factor mode change 100755 => 100644 basis/concurrency/exchangers/exchangers.factor mode change 100755 => 100644 basis/concurrency/flags/flags-tests.factor mode change 100755 => 100644 basis/concurrency/flags/flags.factor mode change 100755 => 100644 basis/concurrency/futures/futures-docs.factor mode change 100755 => 100644 basis/concurrency/futures/futures-tests.factor mode change 100755 => 100644 basis/concurrency/futures/futures.factor mode change 100755 => 100644 basis/concurrency/locks/locks-docs.factor mode change 100755 => 100644 basis/concurrency/locks/locks-tests.factor mode change 100755 => 100644 basis/concurrency/locks/locks.factor mode change 100755 => 100644 basis/concurrency/mailboxes/mailboxes-docs.factor mode change 100755 => 100644 basis/concurrency/mailboxes/mailboxes-tests.factor mode change 100755 => 100644 basis/concurrency/mailboxes/mailboxes.factor mode change 100755 => 100644 basis/concurrency/messaging/messaging-docs.factor mode change 100755 => 100644 basis/concurrency/messaging/messaging-tests.factor mode change 100755 => 100644 basis/concurrency/messaging/messaging.factor mode change 100755 => 100644 basis/concurrency/promises/promises-docs.factor mode change 100755 => 100644 basis/concurrency/promises/promises-tests.factor mode change 100755 => 100644 basis/concurrency/promises/promises.factor mode change 100755 => 100644 basis/concurrency/semaphores/semaphores-docs.factor mode change 100755 => 100644 basis/concurrency/semaphores/semaphores.factor mode change 100755 => 100644 basis/cpu/architecture/architecture.factor mode change 100755 => 100644 basis/cpu/ppc/allot/allot.factor mode change 100755 => 100644 basis/cpu/ppc/architecture/architecture.factor mode change 100755 => 100644 basis/cpu/ppc/assembler/assembler.factor mode change 100755 => 100644 basis/cpu/ppc/bootstrap.factor mode change 100755 => 100644 basis/cpu/ppc/intrinsics/intrinsics.factor mode change 100755 => 100644 basis/cpu/ppc/linux/bootstrap.factor mode change 100755 => 100644 basis/cpu/ppc/macosx/bootstrap.factor mode change 100755 => 100644 basis/cpu/ppc/ppc.factor mode change 100755 => 100644 basis/cpu/x86/32/32.factor mode change 100755 => 100644 basis/cpu/x86/32/bootstrap.factor mode change 100755 => 100644 basis/cpu/x86/64/64.factor mode change 100755 => 100644 basis/cpu/x86/64/bootstrap.factor mode change 100755 => 100644 basis/cpu/x86/allot/allot.factor mode change 100755 => 100644 basis/cpu/x86/architecture/architecture.factor mode change 100755 => 100644 basis/cpu/x86/assembler/assembler.factor mode change 100755 => 100644 basis/cpu/x86/bootstrap.factor mode change 100755 => 100644 basis/cpu/x86/intrinsics/intrinsics.factor mode change 100755 => 100644 basis/cpu/x86/sse2/sse2.factor mode change 100755 => 100644 basis/db/db-tests.factor mode change 100755 => 100644 basis/db/db.factor mode change 100755 => 100644 basis/db/postgresql/ffi/ffi.factor mode change 100755 => 100644 basis/db/postgresql/lib/lib.factor mode change 100755 => 100644 basis/db/postgresql/postgresql-tests.factor mode change 100755 => 100644 basis/db/postgresql/postgresql.factor mode change 100755 => 100644 basis/db/sqlite/ffi/ffi.factor mode change 100755 => 100644 basis/db/sqlite/lib/lib.factor mode change 100755 => 100644 basis/db/sqlite/sqlite-tests.factor mode change 100755 => 100644 basis/db/sqlite/sqlite.factor mode change 100755 => 100644 basis/db/tuples/tuples-tests.factor mode change 100755 => 100644 basis/db/tuples/tuples.factor mode change 100755 => 100644 basis/db/types/types.factor mode change 100755 => 100644 basis/debugger/debugger-docs.factor mode change 100755 => 100644 basis/debugger/debugger-tests.factor mode change 100755 => 100644 basis/debugger/debugger.factor mode change 100755 => 100644 basis/delegate/delegate-tests.factor mode change 100755 => 100644 basis/delegate/delegate.factor mode change 100755 => 100644 basis/delegate/protocols/protocols.factor mode change 100755 => 100644 basis/dlists/dlists-docs.factor mode change 100755 => 100644 basis/dlists/dlists-tests.factor mode change 100755 => 100644 basis/dlists/dlists.factor mode change 100755 => 100644 basis/documents/documents.factor mode change 100755 => 100644 basis/editors/editors.factor mode change 100755 => 100644 basis/editors/editpadpro/editpadpro.factor mode change 100755 => 100644 basis/editors/editplus/editplus.factor mode change 100755 => 100644 basis/editors/emacs/emacs.factor mode change 100755 => 100644 basis/editors/emeditor/emeditor.factor mode change 100755 => 100644 basis/editors/gvim/gvim.factor mode change 100755 => 100644 basis/editors/gvim/windows/windows.factor mode change 100755 => 100644 basis/editors/jedit/jedit.factor mode change 100755 => 100644 basis/editors/macvim/macvim.factor mode change 100755 => 100644 basis/editors/notepadpp/notepadpp.factor mode change 100755 => 100644 basis/editors/scite/scite.factor mode change 100755 => 100644 basis/editors/ted-notepad/ted-notepad.factor mode change 100755 => 100644 basis/editors/textedit/textedit.factor mode change 100755 => 100644 basis/editors/textmate/textmate.factor mode change 100755 => 100644 basis/editors/ultraedit/ultraedit.factor mode change 100755 => 100644 basis/editors/vim/vim.factor mode change 100755 => 100644 basis/editors/wordpad/wordpad.factor mode change 100755 => 100644 basis/float-arrays/float-arrays-tests.factor mode change 100755 => 100644 basis/float-arrays/float-arrays.factor mode change 100755 => 100644 basis/float-vectors/float-vectors-docs.factor mode change 100755 => 100644 basis/float-vectors/float-vectors-tests.factor mode change 100755 => 100644 basis/float-vectors/float-vectors.factor mode change 100755 => 100644 basis/freetype/freetype.factor mode change 100755 => 100644 basis/fry/fry-docs.factor mode change 100755 => 100644 basis/fry/fry-tests.factor mode change 100755 => 100644 basis/fry/fry.factor mode change 100755 => 100644 basis/furnace/actions/actions-tests.factor mode change 100755 => 100644 basis/furnace/actions/actions.factor mode change 100755 => 100644 basis/furnace/auth/auth.factor mode change 100755 => 100644 basis/furnace/auth/basic/basic.factor mode change 100755 => 100644 basis/furnace/auth/login/login-tests.factor mode change 100755 => 100644 basis/furnace/auth/login/login.factor mode change 100755 => 100644 basis/furnace/auth/providers/assoc/assoc-tests.factor mode change 100755 => 100644 basis/furnace/auth/providers/assoc/assoc.factor mode change 100755 => 100644 basis/furnace/auth/providers/db/db-tests.factor mode change 100755 => 100644 basis/furnace/auth/providers/db/db.factor mode change 100755 => 100644 basis/furnace/auth/providers/null/null.factor mode change 100755 => 100644 basis/furnace/auth/providers/providers.factor mode change 100755 => 100644 basis/furnace/db/db.factor mode change 100755 => 100644 basis/furnace/sessions/sessions-tests.factor mode change 100755 => 100644 basis/furnace/sessions/sessions.factor mode change 100755 => 100644 basis/generalizations/generalizations-docs.factor mode change 100755 => 100644 basis/generalizations/generalizations-tests.factor mode change 100755 => 100644 basis/generalizations/generalizations.factor mode change 100755 => 100644 basis/globs/globs.factor mode change 100755 => 100644 basis/hash2/hash2-tests.factor mode change 100755 => 100644 basis/heaps/heaps-docs.factor mode change 100755 => 100644 basis/heaps/heaps-tests.factor mode change 100755 => 100644 basis/heaps/heaps.factor mode change 100755 => 100644 basis/help/cookbook/cookbook.factor mode change 100755 => 100644 basis/help/crossref/crossref-tests.factor mode change 100755 => 100644 basis/help/definitions/definitions-tests.factor mode change 100755 => 100644 basis/help/definitions/definitions.factor mode change 100755 => 100644 basis/help/handbook/handbook.factor mode change 100755 => 100644 basis/help/help-docs.factor mode change 100755 => 100644 basis/help/help.factor mode change 100755 => 100644 basis/help/lint/lint.factor mode change 100755 => 100644 basis/help/markup/markup.factor mode change 100755 => 100644 basis/help/stylesheet/stylesheet.factor mode change 100755 => 100644 basis/help/syntax/syntax-tests.factor mode change 100755 => 100644 basis/help/syntax/syntax.factor mode change 100755 => 100644 basis/help/topics/topics.factor mode change 100755 => 100644 basis/help/tutorial/tutorial.factor mode change 100755 => 100644 basis/html/streams/streams.factor mode change 100755 => 100644 basis/html/templates/fhtml/fhtml-tests.factor mode change 100755 => 100644 basis/html/templates/fhtml/fhtml.factor mode change 100755 => 100644 basis/http/client/client-tests.factor mode change 100755 => 100644 basis/http/client/client.factor mode change 100755 => 100644 basis/http/http-tests.factor mode change 100755 => 100644 basis/http/http.factor mode change 100755 => 100644 basis/http/server/cgi/cgi.factor mode change 100755 => 100644 basis/http/server/server.factor mode change 100755 => 100644 basis/http/server/static/static.factor mode change 100755 => 100644 basis/inspector/inspector.factor mode change 100755 => 100644 basis/interval-maps/interval-maps-docs.factor mode change 100755 => 100644 basis/interval-maps/interval-maps-tests.factor mode change 100755 => 100644 basis/interval-maps/interval-maps.factor mode change 100755 => 100644 basis/io/buffers/buffers-docs.factor mode change 100755 => 100644 basis/io/buffers/buffers-tests.factor mode change 100755 => 100644 basis/io/buffers/buffers.factor mode change 100755 => 100644 basis/io/encodings/8-bit/8-bit.factor mode change 100755 => 100644 basis/io/encodings/ascii/ascii.factor mode change 100755 => 100644 basis/io/encodings/iana/iana.factor mode change 100755 => 100644 basis/io/encodings/utf16/utf16-tests.factor mode change 100755 => 100644 basis/io/encodings/utf16/utf16.factor mode change 100755 => 100644 basis/io/launcher/launcher-docs.factor mode change 100755 => 100644 basis/io/launcher/launcher-tests.factor mode change 100755 => 100644 basis/io/launcher/launcher.factor mode change 100755 => 100644 basis/io/mmap/mmap-docs.factor mode change 100755 => 100644 basis/io/mmap/mmap-tests.factor mode change 100755 => 100644 basis/io/mmap/mmap.factor mode change 100755 => 100644 basis/io/monitors/monitors-docs.factor mode change 100755 => 100644 basis/io/monitors/monitors-tests.factor mode change 100755 => 100644 basis/io/monitors/monitors.factor mode change 100755 => 100644 basis/io/pipes/pipes-tests.factor mode change 100755 => 100644 basis/io/ports/ports-docs.factor mode change 100755 => 100644 basis/io/ports/ports.factor mode change 100755 => 100644 basis/io/servers/connection/connection-docs.factor mode change 100755 => 100644 basis/io/servers/connection/connection-tests.factor mode change 100755 => 100644 basis/io/servers/connection/connection.factor mode change 100755 => 100644 basis/io/sockets/secure/secure-tests.factor mode change 100755 => 100644 basis/io/sockets/secure/secure.factor mode change 100755 => 100644 basis/io/sockets/sockets-docs.factor mode change 100755 => 100644 basis/io/sockets/sockets-tests.factor mode change 100755 => 100644 basis/io/sockets/sockets.factor mode change 100755 => 100644 basis/io/streams/duplex/duplex-docs.factor mode change 100755 => 100644 basis/io/streams/duplex/duplex-tests.factor mode change 100755 => 100644 basis/io/streams/duplex/duplex.factor mode change 100755 => 100644 basis/io/streams/null/null.factor mode change 100755 => 100644 basis/io/thread/thread.factor mode change 100755 => 100644 basis/io/timeouts/timeouts-docs.factor mode change 100755 => 100644 basis/io/timeouts/timeouts.factor mode change 100755 => 100644 basis/io/unix/backend/backend.factor mode change 100755 => 100644 basis/io/unix/bsd/bsd.factor mode change 100755 => 100644 basis/io/unix/files/files-tests.factor mode change 100755 => 100644 basis/io/unix/files/files.factor mode change 100755 => 100644 basis/io/unix/kqueue/kqueue.factor mode change 100755 => 100644 basis/io/unix/launcher/launcher-tests.factor mode change 100755 => 100644 basis/io/unix/launcher/launcher.factor mode change 100755 => 100644 basis/io/unix/launcher/parser/parser-tests.factor mode change 100755 => 100644 basis/io/unix/launcher/parser/parser.factor mode change 100755 => 100644 basis/io/unix/linux/linux.factor mode change 100755 => 100644 basis/io/unix/mmap/mmap.factor mode change 100755 => 100644 basis/io/unix/select/select.factor mode change 100755 => 100644 basis/io/unix/sockets/secure/secure.factor mode change 100755 => 100644 basis/io/unix/sockets/sockets.factor mode change 100755 => 100644 basis/io/unix/unix-tests.factor mode change 100755 => 100644 basis/io/unix/unix.factor mode change 100755 => 100644 basis/io/windows/files/files.factor mode change 100755 => 100644 basis/io/windows/files/unique/unique.factor mode change 100755 => 100644 basis/io/windows/launcher/launcher-tests.factor mode change 100755 => 100644 basis/io/windows/launcher/launcher.factor mode change 100755 => 100644 basis/io/windows/mmap/mmap.factor mode change 100755 => 100644 basis/io/windows/nt/backend/backend.factor mode change 100755 => 100644 basis/io/windows/nt/files/files-tests.factor mode change 100755 => 100644 basis/io/windows/nt/files/files.factor mode change 100755 => 100644 basis/io/windows/nt/launcher/launcher-tests.factor mode change 100755 => 100644 basis/io/windows/nt/launcher/launcher.factor mode change 100755 => 100644 basis/io/windows/nt/launcher/test/append.factor mode change 100755 => 100644 basis/io/windows/nt/launcher/test/env.factor mode change 100755 => 100644 basis/io/windows/nt/launcher/test/stderr.factor mode change 100755 => 100644 basis/io/windows/nt/monitors/monitors-tests.factor mode change 100755 => 100644 basis/io/windows/nt/monitors/monitors.factor mode change 100755 => 100644 basis/io/windows/nt/nt.factor mode change 100755 => 100644 basis/io/windows/nt/pipes/pipes.factor mode change 100755 => 100644 basis/io/windows/nt/privileges/privileges.factor mode change 100755 => 100644 basis/io/windows/nt/sockets/sockets.factor mode change 100755 => 100644 basis/io/windows/privileges/privileges.factor mode change 100755 => 100644 basis/io/windows/sockets/sockets.factor mode change 100755 => 100644 basis/io/windows/windows.factor mode change 100755 => 100644 basis/json/reader/reader.factor mode change 100755 => 100644 basis/lcs/lcs-docs.factor mode change 100755 => 100644 basis/lcs/lcs-tests.factor mode change 100755 => 100644 basis/lcs/lcs.factor mode change 100755 => 100644 basis/libc/libc-tests.factor mode change 100755 => 100644 basis/libc/libc.factor mode change 100755 => 100644 basis/listener/listener-docs.factor mode change 100755 => 100644 basis/listener/listener-tests.factor mode change 100755 => 100644 basis/listener/listener.factor mode change 100755 => 100644 basis/locals/locals-tests.factor mode change 100755 => 100644 basis/locals/locals.factor mode change 100755 => 100644 basis/logging/analysis/analysis.factor mode change 100755 => 100644 basis/logging/insomniac/insomniac-docs.factor mode change 100755 => 100644 basis/logging/insomniac/insomniac.factor mode change 100755 => 100644 basis/logging/logging-docs.factor mode change 100755 => 100644 basis/logging/logging.factor mode change 100755 => 100644 basis/logging/parser/parser.factor mode change 100755 => 100644 basis/logging/server/server.factor mode change 100755 => 100644 basis/macros/macros.factor mode change 100755 => 100644 basis/match/match-tests.factor mode change 100755 => 100644 basis/match/match.factor mode change 100755 => 100644 basis/math/bitwise/bitwise-tests.factor mode change 100755 => 100644 basis/math/complex/complex-docs.factor mode change 100755 => 100644 basis/math/complex/complex-tests.factor mode change 100755 => 100644 basis/math/complex/complex.factor mode change 100755 => 100644 basis/math/constants/constants-docs.factor mode change 100755 => 100644 basis/math/constants/constants.factor mode change 100755 => 100644 basis/math/functions/functions-docs.factor mode change 100755 => 100644 basis/math/functions/functions-tests.factor mode change 100755 => 100644 basis/math/functions/functions.factor mode change 100755 => 100644 basis/math/intervals/intervals-tests.factor mode change 100755 => 100644 basis/math/intervals/intervals.factor mode change 100755 => 100644 basis/math/libm/libm.factor mode change 100755 => 100644 basis/math/ranges/ranges.factor mode change 100755 => 100644 basis/math/ratios/ratios-docs.factor mode change 100755 => 100644 basis/math/ratios/ratios-tests.factor mode change 100755 => 100644 basis/math/ratios/ratios.factor mode change 100755 => 100644 basis/math/vectors/vectors-docs.factor mode change 100755 => 100644 basis/math/vectors/vectors.factor mode change 100755 => 100644 basis/memoize/memoize-docs.factor mode change 100755 => 100644 basis/memoize/memoize.factor mode change 100755 => 100644 basis/mime-types/mime-types.factor mode change 100755 => 100644 basis/mirrors/mirrors-docs.factor mode change 100755 => 100644 basis/mirrors/mirrors-tests.factor mode change 100755 => 100644 basis/mirrors/mirrors.factor mode change 100755 => 100644 basis/models/compose/compose-docs.factor mode change 100755 => 100644 basis/models/compose/compose-tests.factor mode change 100755 => 100644 basis/models/compose/compose.factor mode change 100755 => 100644 basis/models/delay/delay-docs.factor mode change 100755 => 100644 basis/models/delay/delay.factor mode change 100755 => 100644 basis/models/filter/filter-docs.factor mode change 100755 => 100644 basis/models/filter/filter-tests.factor mode change 100755 => 100644 basis/models/filter/filter.factor mode change 100755 => 100644 basis/models/history/history-docs.factor mode change 100755 => 100644 basis/models/history/history-tests.factor mode change 100755 => 100644 basis/models/history/history.factor mode change 100755 => 100644 basis/models/mapping/mapping-tests.factor mode change 100755 => 100644 basis/models/mapping/mapping.factor mode change 100755 => 100644 basis/models/models-docs.factor mode change 100755 => 100644 basis/models/models-tests.factor mode change 100755 => 100644 basis/models/models.factor mode change 100755 => 100644 basis/models/range/range-docs.factor mode change 100755 => 100644 basis/models/range/range-tests.factor mode change 100755 => 100644 basis/models/range/range.factor mode change 100755 => 100644 basis/multiline/multiline-tests.factor mode change 100755 => 100644 basis/multiline/multiline.factor mode change 100755 => 100644 basis/opengl/gl/windows/windows.factor mode change 100755 => 100644 basis/opengl/opengl.factor mode change 100755 => 100644 basis/openssl/libcrypto/libcrypto.factor mode change 100755 => 100644 basis/openssl/libssl/libssl.factor mode change 100755 => 100644 basis/openssl/openssl-tests.factor mode change 100755 => 100644 basis/openssl/openssl.factor mode change 100755 => 100644 basis/peg/parsers/parsers-docs.factor mode change 100755 => 100644 basis/peg/parsers/parsers.factor mode change 100755 => 100644 basis/peg/peg.factor mode change 100755 => 100644 basis/peg/search/search-docs.factor mode change 100755 => 100644 basis/peg/search/search-tests.factor mode change 100755 => 100644 basis/peg/search/search.factor mode change 100755 => 100644 basis/prettyprint/backend/backend-docs.factor mode change 100755 => 100644 basis/prettyprint/backend/backend.factor mode change 100755 => 100644 basis/prettyprint/prettyprint-docs.factor mode change 100755 => 100644 basis/prettyprint/prettyprint-tests.factor mode change 100755 => 100644 basis/prettyprint/prettyprint.factor mode change 100755 => 100644 basis/prettyprint/sections/sections-docs.factor mode change 100755 => 100644 basis/qualified/qualified-docs.factor mode change 100755 => 100644 basis/random/dummy/dummy.factor mode change 100755 => 100644 basis/random/mersenne-twister/mersenne-twister-tests.factor mode change 100755 => 100644 basis/random/mersenne-twister/mersenne-twister.factor mode change 100755 => 100644 basis/random/random.factor mode change 100755 => 100644 basis/sequences/deep/deep-tests.factor mode change 100755 => 100644 basis/sequences/next/next.factor mode change 100755 => 100644 basis/serialize/serialize-docs.factor mode change 100755 => 100644 basis/serialize/serialize-tests.factor mode change 100755 => 100644 basis/serialize/serialize.factor mode change 100755 => 100644 basis/shuffle/shuffle-tests.factor mode change 100755 => 100644 basis/smtp/server/server.factor mode change 100755 => 100644 basis/smtp/smtp-tests.factor mode change 100755 => 100644 basis/smtp/smtp.factor mode change 100755 => 100644 basis/stack-checker/backend/backend.factor mode change 100755 => 100644 basis/stack-checker/known-words/known-words.factor mode change 100755 => 100644 basis/stack-checker/stack-checker-docs.factor mode change 100755 => 100644 basis/stack-checker/stack-checker-tests.factor mode change 100755 => 100644 basis/stack-checker/stack-checker.factor mode change 100755 => 100644 basis/stack-checker/state/state.factor mode change 100755 => 100644 basis/stack-checker/transforms/transforms-docs.factor mode change 100755 => 100644 basis/stack-checker/transforms/transforms-tests.factor mode change 100755 => 100644 basis/stack-checker/transforms/transforms.factor mode change 100755 => 100644 basis/state-parser/state-parser-tests.factor mode change 100755 => 100644 basis/symbols/symbols-tests.factor mode change 100755 => 100644 basis/symbols/symbols.factor mode change 100755 => 100644 basis/syndication/syndication-tests.factor mode change 100755 => 100644 basis/threads/threads-docs.factor mode change 100755 => 100644 basis/threads/threads-tests.factor mode change 100755 => 100644 basis/threads/threads.factor mode change 100755 => 100644 basis/tools/annotations/annotations-docs.factor mode change 100755 => 100644 basis/tools/annotations/annotations-tests.factor mode change 100755 => 100644 basis/tools/annotations/annotations.factor mode change 100755 => 100644 basis/tools/completion/completion.factor mode change 100755 => 100644 basis/tools/crossref/crossref-tests.factor mode change 100755 => 100644 basis/tools/crossref/crossref.factor mode change 100755 => 100644 basis/tools/crossref/test/foo.factor mode change 100755 => 100644 basis/tools/deploy/backend/backend.factor mode change 100755 => 100644 basis/tools/deploy/config/config-docs.factor mode change 100755 => 100644 basis/tools/deploy/config/config.factor mode change 100755 => 100644 basis/tools/deploy/deploy-docs.factor mode change 100755 => 100644 basis/tools/deploy/deploy-tests.factor mode change 100755 => 100644 basis/tools/deploy/deploy.factor mode change 100755 => 100644 basis/tools/deploy/macosx/macosx.factor mode change 100755 => 100644 basis/tools/deploy/shaker/shaker.factor mode change 100755 => 100644 basis/tools/deploy/shaker/strip-cocoa.factor mode change 100755 => 100644 basis/tools/deploy/shaker/strip-debugger.factor mode change 100755 => 100644 basis/tools/deploy/shaker/strip-libc.factor mode change 100755 => 100644 basis/tools/deploy/test/1/1.factor mode change 100755 => 100644 basis/tools/deploy/test/1/deploy.factor mode change 100755 => 100644 basis/tools/deploy/test/2/2.factor mode change 100755 => 100644 basis/tools/deploy/test/2/deploy.factor mode change 100755 => 100644 basis/tools/deploy/test/3/3.factor mode change 100755 => 100644 basis/tools/deploy/test/3/deploy.factor mode change 100755 => 100644 basis/tools/deploy/windows/windows-tests.factor mode change 100755 => 100644 basis/tools/deploy/windows/windows.factor mode change 100755 => 100644 basis/tools/disassembler/disassembler-docs.factor mode change 100755 => 100644 basis/tools/disassembler/disassembler-tests.factor mode change 100755 => 100644 basis/tools/disassembler/disassembler.factor mode change 100755 => 100644 basis/tools/memory/memory-docs.factor mode change 100755 => 100644 basis/tools/memory/memory.factor mode change 100755 => 100644 basis/tools/profiler/profiler-docs.factor mode change 100755 => 100644 basis/tools/profiler/profiler-tests.factor mode change 100755 => 100644 basis/tools/profiler/profiler.factor mode change 100755 => 100644 basis/tools/test/test-docs.factor mode change 100755 => 100644 basis/tools/test/test.factor mode change 100755 => 100644 basis/tools/test/ui/ui.factor mode change 100755 => 100644 basis/tools/threads/threads.factor mode change 100755 => 100644 basis/tools/time/time-docs.factor mode change 100755 => 100644 basis/tools/vocabs/browser/browser-docs.factor mode change 100755 => 100644 basis/tools/vocabs/browser/browser-tests.factor mode change 100755 => 100644 basis/tools/vocabs/browser/browser.factor mode change 100755 => 100644 basis/tools/vocabs/monitor/monitor.factor mode change 100755 => 100644 basis/tools/vocabs/vocabs-docs.factor mode change 100755 => 100644 basis/tools/vocabs/vocabs.factor mode change 100755 => 100644 basis/tools/walker/debug/debug.factor mode change 100755 => 100644 basis/tools/walker/walker-tests.factor mode change 100755 => 100644 basis/tools/walker/walker.factor mode change 100755 => 100644 basis/tuple-arrays/tuple-arrays-tests.factor mode change 100755 => 100644 basis/ui/backend/backend.factor mode change 100755 => 100644 basis/ui/cocoa/cocoa.factor mode change 100755 => 100644 basis/ui/cocoa/tools/tools.factor mode change 100755 => 100644 basis/ui/cocoa/views/views.factor mode change 100755 => 100644 basis/ui/commands/commands.factor mode change 100755 => 100644 basis/ui/freetype/freetype-docs.factor mode change 100755 => 100644 basis/ui/freetype/freetype.factor mode change 100755 => 100644 basis/ui/gadgets/books/books-docs.factor mode change 100755 => 100644 basis/ui/gadgets/books/books-tests.factor mode change 100755 => 100644 basis/ui/gadgets/books/books.factor mode change 100755 => 100644 basis/ui/gadgets/buttons/buttons-docs.factor mode change 100755 => 100644 basis/ui/gadgets/buttons/buttons-tests.factor mode change 100755 => 100644 basis/ui/gadgets/buttons/buttons.factor mode change 100755 => 100644 basis/ui/gadgets/canvas/canvas-tests.factor mode change 100755 => 100644 basis/ui/gadgets/canvas/canvas.factor mode change 100755 => 100644 basis/ui/gadgets/editors/editors-docs.factor mode change 100755 => 100644 basis/ui/gadgets/editors/editors-tests.factor mode change 100755 => 100644 basis/ui/gadgets/editors/editors.factor mode change 100755 => 100644 basis/ui/gadgets/frames/frames-docs.factor mode change 100755 => 100644 basis/ui/gadgets/gadgets-docs.factor mode change 100755 => 100644 basis/ui/gadgets/gadgets-tests.factor mode change 100755 => 100644 basis/ui/gadgets/gadgets.factor mode change 100755 => 100644 basis/ui/gadgets/grid-lines/grid-lines-docs.factor mode change 100755 => 100644 basis/ui/gadgets/grid-lines/grid-lines.factor mode change 100755 => 100644 basis/ui/gadgets/grids/grids-docs.factor mode change 100755 => 100644 basis/ui/gadgets/incremental/incremental-docs.factor mode change 100755 => 100644 basis/ui/gadgets/incremental/incremental.factor mode change 100755 => 100644 basis/ui/gadgets/labelled/labelled-docs.factor mode change 100755 => 100644 basis/ui/gadgets/labelled/labelled.factor mode change 100755 => 100644 basis/ui/gadgets/labels/labels-docs.factor mode change 100755 => 100644 basis/ui/gadgets/labels/labels.factor mode change 100755 => 100644 basis/ui/gadgets/lists/lists-docs.factor mode change 100755 => 100644 basis/ui/gadgets/lists/lists.factor mode change 100755 => 100644 basis/ui/gadgets/menus/menus-docs.factor mode change 100755 => 100644 basis/ui/gadgets/packs/packs-docs.factor mode change 100755 => 100644 basis/ui/gadgets/packs/packs.factor mode change 100755 => 100644 basis/ui/gadgets/panes/panes-docs.factor mode change 100755 => 100644 basis/ui/gadgets/panes/panes-tests.factor mode change 100755 => 100644 basis/ui/gadgets/panes/panes.factor mode change 100755 => 100644 basis/ui/gadgets/presentations/presentations-docs.factor mode change 100755 => 100644 basis/ui/gadgets/scrollers/scrollers-docs.factor mode change 100755 => 100644 basis/ui/gadgets/scrollers/scrollers-tests.factor mode change 100755 => 100644 basis/ui/gadgets/scrollers/scrollers.factor mode change 100755 => 100644 basis/ui/gadgets/sliders/sliders-docs.factor mode change 100755 => 100644 basis/ui/gadgets/sliders/sliders.factor mode change 100755 => 100644 basis/ui/gadgets/slots/slots.factor mode change 100755 => 100644 basis/ui/gadgets/status-bar/status-bar-docs.factor mode change 100755 => 100644 basis/ui/gadgets/status-bar/status-bar.factor mode change 100755 => 100644 basis/ui/gadgets/tracks/tracks-docs.factor mode change 100755 => 100644 basis/ui/gadgets/viewports/viewports-docs.factor mode change 100755 => 100644 basis/ui/gadgets/viewports/viewports.factor mode change 100755 => 100644 basis/ui/gadgets/worlds/worlds-docs.factor mode change 100755 => 100644 basis/ui/gadgets/worlds/worlds.factor mode change 100755 => 100644 basis/ui/gestures/gestures.factor mode change 100755 => 100644 basis/ui/operations/operations-tests.factor mode change 100755 => 100644 basis/ui/operations/operations.factor mode change 100755 => 100644 basis/ui/render/render-docs.factor mode change 100755 => 100644 basis/ui/tools/browser/browser-tests.factor mode change 100755 => 100644 basis/ui/tools/browser/browser.factor mode change 100755 => 100644 basis/ui/tools/debugger/debugger-docs.factor mode change 100755 => 100644 basis/ui/tools/deploy/deploy-docs.factor mode change 100755 => 100644 basis/ui/tools/deploy/deploy.factor mode change 100755 => 100644 basis/ui/tools/interactor/interactor-docs.factor mode change 100755 => 100644 basis/ui/tools/interactor/interactor-tests.factor mode change 100755 => 100644 basis/ui/tools/interactor/interactor.factor mode change 100755 => 100644 basis/ui/tools/listener/listener-tests.factor mode change 100755 => 100644 basis/ui/tools/listener/listener.factor mode change 100755 => 100644 basis/ui/tools/operations/operations.factor mode change 100755 => 100644 basis/ui/tools/profiler/profiler.factor mode change 100755 => 100644 basis/ui/tools/search/search-tests.factor mode change 100755 => 100644 basis/ui/tools/search/search.factor mode change 100755 => 100644 basis/ui/tools/tools-docs.factor mode change 100755 => 100644 basis/ui/tools/tools-tests.factor mode change 100755 => 100644 basis/ui/tools/tools.factor mode change 100755 => 100644 basis/ui/tools/traceback/traceback.factor mode change 100755 => 100644 basis/ui/tools/walker/walker-docs.factor mode change 100755 => 100644 basis/ui/tools/walker/walker-tests.factor mode change 100755 => 100644 basis/ui/tools/walker/walker.factor mode change 100755 => 100644 basis/ui/tools/workspace/workspace-tests.factor mode change 100755 => 100644 basis/ui/tools/workspace/workspace.factor mode change 100755 => 100644 basis/ui/traverse/traverse-tests.factor mode change 100755 => 100644 basis/ui/ui-docs.factor mode change 100755 => 100644 basis/ui/ui.factor mode change 100755 => 100644 basis/ui/windows/windows.factor mode change 100755 => 100644 basis/ui/x11/x11.factor mode change 100755 => 100644 basis/unicode/breaks/breaks-tests.factor mode change 100755 => 100644 basis/unicode/breaks/breaks.factor mode change 100755 => 100644 basis/unicode/case/case-tests.factor mode change 100755 => 100644 basis/unicode/case/case.factor mode change 100755 => 100644 basis/unicode/collation/collation-tests.factor mode change 100755 => 100644 basis/unicode/collation/collation.factor mode change 100755 => 100644 basis/unicode/data/data.factor mode change 100755 => 100644 basis/unicode/normalize/normalize-tests.factor mode change 100755 => 100644 basis/unicode/normalize/normalize.factor mode change 100755 => 100644 basis/unicode/script/script-docs.factor mode change 100755 => 100644 basis/unicode/script/script-tests.factor mode change 100755 => 100644 basis/unicode/script/script.factor mode change 100755 => 100644 basis/unicode/syntax/syntax.factor mode change 100755 => 100644 basis/unix/bsd/bsd.factor mode change 100755 => 100644 basis/unix/linux/ifreq/ifreq.factor mode change 100755 => 100644 basis/unix/linux/linux.factor mode change 100755 => 100644 basis/unix/process/process.factor mode change 100755 => 100644 basis/unix/types/freebsd/freebsd.factor mode change 100755 => 100644 basis/unix/types/netbsd/32/32.factor mode change 100755 => 100644 basis/unix/types/netbsd/64/64.factor mode change 100755 => 100644 basis/unix/types/netbsd/netbsd.factor mode change 100755 => 100644 basis/unix/types/openbsd/openbsd.factor mode change 100755 => 100644 basis/unix/unix.factor mode change 100755 => 100644 basis/values/values-docs.factor mode change 100755 => 100644 basis/values/values-tests.factor mode change 100755 => 100644 basis/values/values.factor mode change 100755 => 100644 basis/windows/advapi32/advapi32.factor mode change 100755 => 100644 basis/windows/com/com-tests.factor mode change 100755 => 100644 basis/windows/com/com.factor mode change 100755 => 100644 basis/windows/com/syntax/syntax-docs.factor mode change 100755 => 100644 basis/windows/com/syntax/syntax.factor mode change 100755 => 100644 basis/windows/com/wrapper/wrapper-docs.factor mode change 100755 => 100644 basis/windows/com/wrapper/wrapper.factor mode change 100755 => 100644 basis/windows/dinput/constants/constants.factor mode change 100755 => 100644 basis/windows/dinput/dinput.factor mode change 100755 => 100644 basis/windows/gdi32/gdi32.factor mode change 100755 => 100644 basis/windows/kernel32/kernel32.factor mode change 100755 => 100644 basis/windows/messages/messages.factor mode change 100755 => 100644 basis/windows/ole32/ole32.factor mode change 100755 => 100644 basis/windows/opengl32/opengl32.factor mode change 100755 => 100644 basis/windows/user32/user32.factor mode change 100755 => 100644 basis/windows/winsock/winsock.factor mode change 100755 => 100644 basis/x11/clipboard/clipboard.factor mode change 100755 => 100644 basis/x11/windows/windows.factor mode change 100755 => 100644 basis/x11/xim/xim.factor mode change 100755 => 100644 basis/x11/xlib/xlib.factor mode change 100755 => 100644 basis/xml-rpc/xml-rpc.factor mode change 100755 => 100644 basis/xml/char-classes/char-classes.factor mode change 100755 => 100644 basis/xml/data/data.factor mode change 100755 => 100644 basis/xml/errors/errors-tests.factor mode change 100755 => 100644 basis/xml/tests/soap.factor mode change 100755 => 100644 basis/xml/utilities/utilities.factor mode change 100755 => 100644 basis/xmode/catalog/catalog.factor mode change 100755 => 100644 basis/xmode/code2html/code2html.factor mode change 100755 => 100644 basis/xmode/code2html/responder/responder.factor mode change 100755 => 100644 basis/xmode/loader/loader.factor mode change 100755 => 100644 basis/xmode/marker/marker-tests.factor mode change 100755 => 100644 basis/xmode/marker/marker.factor mode change 100755 => 100644 basis/xmode/marker/state/state.factor mode change 100755 => 100644 basis/xmode/rules/rules.factor mode change 100755 => 100644 basis/xmode/tokens/tokens.factor mode change 100755 => 100644 basis/xmode/utilities/utilities-tests.factor mode change 100755 => 100644 core/alien/alien-docs.factor mode change 100755 => 100644 core/alien/alien-tests.factor mode change 100755 => 100644 core/alien/alien.factor mode change 100755 => 100644 core/arrays/arrays-docs.factor mode change 100755 => 100644 core/arrays/arrays-tests.factor mode change 100755 => 100644 core/arrays/arrays.factor mode change 100755 => 100644 core/assocs/assocs-docs.factor mode change 100755 => 100644 core/assocs/assocs-tests.factor mode change 100755 => 100644 core/assocs/assocs.factor mode change 100755 => 100644 core/bootstrap/layouts/layouts.factor mode change 100755 => 100644 core/bootstrap/primitives.factor mode change 100755 => 100644 core/bootstrap/stage1.factor mode change 100755 => 100644 core/bootstrap/syntax.factor mode change 100755 => 100644 core/byte-arrays/byte-arrays-docs.factor mode change 100755 => 100644 core/byte-arrays/byte-arrays-tests.factor mode change 100755 => 100644 core/byte-arrays/byte-arrays.factor mode change 100755 => 100644 core/byte-vectors/byte-vectors-docs.factor mode change 100755 => 100644 core/byte-vectors/byte-vectors-tests.factor mode change 100755 => 100644 core/byte-vectors/byte-vectors.factor mode change 100755 => 100644 core/checksums/crc32/crc32.factor mode change 100755 => 100644 core/classes/algebra/algebra-docs.factor mode change 100755 => 100644 core/classes/algebra/algebra-tests.factor mode change 100755 => 100644 core/classes/algebra/algebra.factor mode change 100755 => 100644 core/classes/classes-docs.factor mode change 100755 => 100644 core/classes/classes-tests.factor mode change 100755 => 100644 core/classes/classes.factor mode change 100755 => 100644 core/classes/mixin/mixin-docs.factor mode change 100755 => 100644 core/classes/mixin/mixin.factor mode change 100755 => 100644 core/classes/predicate/predicate-docs.factor mode change 100755 => 100644 core/classes/predicate/predicate.factor mode change 100755 => 100644 core/classes/singleton/singleton.factor mode change 100755 => 100644 core/classes/tuple/tuple-docs.factor mode change 100755 => 100644 core/classes/tuple/tuple-tests.factor mode change 100755 => 100644 core/classes/tuple/tuple.factor mode change 100755 => 100644 core/classes/union/union-docs.factor mode change 100755 => 100644 core/classes/union/union.factor mode change 100755 => 100644 core/combinators/combinators-docs.factor mode change 100755 => 100644 core/combinators/combinators-tests.factor mode change 100755 => 100644 core/combinators/combinators.factor mode change 100755 => 100644 core/compiler/errors/errors-docs.factor mode change 100755 => 100644 core/compiler/errors/errors.factor mode change 100755 => 100644 core/compiler/units/units-docs.factor mode change 100755 => 100644 core/compiler/units/units.factor mode change 100755 => 100644 core/continuations/continuations-docs.factor mode change 100755 => 100644 core/continuations/continuations-tests.factor mode change 100755 => 100644 core/continuations/continuations.factor mode change 100755 => 100644 core/definitions/definitions-docs.factor mode change 100755 => 100644 core/definitions/definitions-tests.factor mode change 100755 => 100644 core/definitions/definitions.factor mode change 100755 => 100644 core/destructors/destructors-docs.factor mode change 100755 => 100644 core/destructors/destructors-tests.factor mode change 100755 => 100644 core/destructors/destructors.factor mode change 100755 => 100644 core/effects/effects.factor mode change 100755 => 100644 core/generic/generic-docs.factor mode change 100755 => 100644 core/generic/generic-tests.factor mode change 100755 => 100644 core/generic/generic.factor mode change 100755 => 100644 core/generic/math/math-docs.factor mode change 100755 => 100644 core/generic/math/math.factor mode change 100755 => 100644 core/growable/growable-docs.factor mode change 100755 => 100644 core/growable/growable-tests.factor mode change 100755 => 100644 core/hashtables/hashtables-docs.factor mode change 100755 => 100644 core/hashtables/hashtables-tests.factor mode change 100755 => 100644 core/hashtables/hashtables.factor mode change 100755 => 100644 core/init/init.factor mode change 100755 => 100644 core/io/backend/backend-tests.factor mode change 100755 => 100644 core/io/backend/backend.factor mode change 100755 => 100644 core/io/binary/binary-tests.factor mode change 100755 => 100644 core/io/binary/binary.factor mode change 100755 => 100644 core/io/encodings/binary/binary.factor mode change 100755 => 100644 core/io/encodings/encodings-tests.factor mode change 100755 => 100644 core/io/encodings/encodings.factor mode change 100755 => 100644 core/io/encodings/utf8/utf8-docs.factor mode change 100755 => 100644 core/io/encodings/utf8/utf8-tests.factor mode change 100755 => 100644 core/io/encodings/utf8/utf8.factor mode change 100755 => 100644 core/io/files/files-docs.factor mode change 100755 => 100644 core/io/files/files-tests.factor mode change 100755 => 100644 core/io/files/files.factor mode change 100755 => 100644 core/io/io-docs.factor mode change 100755 => 100644 core/io/io-tests.factor mode change 100755 => 100644 core/io/io.factor mode change 100755 => 100644 core/io/streams/c/c-docs.factor mode change 100755 => 100644 core/io/streams/c/c-tests.factor mode change 100755 => 100644 core/io/streams/c/c.factor mode change 100755 => 100644 core/io/streams/nested/nested.factor mode change 100755 => 100644 core/io/streams/string/string.factor mode change 100755 => 100644 core/kernel/kernel-docs.factor mode change 100755 => 100644 core/kernel/kernel-tests.factor mode change 100755 => 100644 core/kernel/kernel.factor mode change 100755 => 100644 core/layouts/layouts-docs.factor mode change 100755 => 100644 core/layouts/layouts-tests.factor mode change 100755 => 100644 core/layouts/layouts.factor mode change 100755 => 100644 core/math/floats/floats-tests.factor mode change 100755 => 100644 core/math/floats/floats.factor mode change 100755 => 100644 core/math/integers/integers-docs.factor mode change 100755 => 100644 core/math/integers/integers-tests.factor mode change 100755 => 100644 core/math/integers/integers.factor mode change 100755 => 100644 core/math/math-docs.factor mode change 100755 => 100644 core/math/math.factor mode change 100755 => 100644 core/math/parser/parser-tests.factor mode change 100755 => 100644 core/math/parser/parser.factor mode change 100755 => 100644 core/memory/memory-docs.factor mode change 100755 => 100644 core/memory/memory-tests.factor mode change 100755 => 100644 core/namespaces/namespaces-docs.factor mode change 100755 => 100644 core/parser/parser-docs.factor mode change 100755 => 100644 core/parser/parser-tests.factor mode change 100755 => 100644 core/parser/parser.factor mode change 100755 => 100644 core/parser/test/assert-depth.factor mode change 100755 => 100644 core/quotations/quotations-docs.factor mode change 100755 => 100644 core/quotations/quotations-tests.factor mode change 100755 => 100644 core/quotations/quotations.factor mode change 100755 => 100644 core/sbufs/sbufs.factor mode change 100755 => 100644 core/sequences/sequences-docs.factor mode change 100755 => 100644 core/sequences/sequences-tests.factor mode change 100755 => 100644 core/sequences/sequences.factor mode change 100755 => 100644 core/slots/slots-docs.factor mode change 100755 => 100644 core/slots/slots.factor mode change 100755 => 100644 core/sorting/sorting-tests.factor mode change 100755 => 100644 core/sorting/sorting.factor mode change 100755 => 100644 core/source-files/source-files-docs.factor mode change 100755 => 100644 core/source-files/source-files.factor mode change 100755 => 100644 core/splitting/splitting.factor mode change 100755 => 100644 core/strings/strings-docs.factor mode change 100755 => 100644 core/strings/strings-tests.factor mode change 100755 => 100644 core/strings/strings.factor mode change 100755 => 100644 core/syntax/syntax-docs.factor mode change 100755 => 100644 core/syntax/syntax.factor mode change 100755 => 100644 core/system/system-docs.factor mode change 100755 => 100644 core/system/system-tests.factor mode change 100755 => 100644 core/system/system.factor mode change 100755 => 100644 core/vectors/vectors-docs.factor mode change 100755 => 100644 core/vectors/vectors-tests.factor mode change 100755 => 100644 core/vectors/vectors.factor mode change 100755 => 100644 core/vocabs/loader/loader-docs.factor mode change 100755 => 100644 core/vocabs/loader/loader-tests.factor mode change 100755 => 100644 core/vocabs/loader/loader.factor mode change 100755 => 100644 core/vocabs/loader/test/a/a.factor mode change 100755 => 100644 core/vocabs/loader/test/b/b.factor mode change 100755 => 100644 core/vocabs/vocabs-docs.factor mode change 100755 => 100644 core/vocabs/vocabs.factor mode change 100755 => 100644 core/words/words-docs.factor mode change 100755 => 100644 core/words/words-tests.factor mode change 100755 => 100644 core/words/words.factor diff --git a/basis/alarms/alarms-docs.factor b/basis/alarms/alarms-docs.factor old mode 100755 new mode 100644 diff --git a/basis/alarms/alarms-tests.factor b/basis/alarms/alarms-tests.factor old mode 100755 new mode 100644 diff --git a/basis/alarms/alarms.factor b/basis/alarms/alarms.factor old mode 100755 new mode 100644 diff --git a/basis/alias/alias.factor b/basis/alias/alias.factor old mode 100755 new mode 100644 diff --git a/basis/alien/arrays/arrays-docs.factor b/basis/alien/arrays/arrays-docs.factor old mode 100755 new mode 100644 diff --git a/basis/alien/c-types/c-types-docs.factor b/basis/alien/c-types/c-types-docs.factor old mode 100755 new mode 100644 diff --git a/basis/alien/c-types/c-types-tests.factor b/basis/alien/c-types/c-types-tests.factor old mode 100755 new mode 100644 diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor old mode 100755 new mode 100644 diff --git a/basis/alien/remote-control/remote-control.factor b/basis/alien/remote-control/remote-control.factor old mode 100755 new mode 100644 diff --git a/basis/alien/strings/strings.factor b/basis/alien/strings/strings.factor old mode 100755 new mode 100644 diff --git a/basis/alien/structs/structs-docs.factor b/basis/alien/structs/structs-docs.factor old mode 100755 new mode 100644 diff --git a/basis/alien/structs/structs.factor b/basis/alien/structs/structs.factor old mode 100755 new mode 100644 diff --git a/basis/alien/syntax/syntax-docs.factor b/basis/alien/syntax/syntax-docs.factor old mode 100755 new mode 100644 diff --git a/basis/alien/syntax/syntax.factor b/basis/alien/syntax/syntax.factor old mode 100755 new mode 100644 diff --git a/basis/ascii/ascii-docs.factor b/basis/ascii/ascii-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ascii/ascii.factor b/basis/ascii/ascii.factor old mode 100755 new mode 100644 diff --git a/basis/bit-arrays/bit-arrays-tests.factor b/basis/bit-arrays/bit-arrays-tests.factor old mode 100755 new mode 100644 diff --git a/basis/bit-arrays/bit-arrays.factor b/basis/bit-arrays/bit-arrays.factor old mode 100755 new mode 100644 diff --git a/basis/bit-vectors/bit-vectors-docs.factor b/basis/bit-vectors/bit-vectors-docs.factor old mode 100755 new mode 100644 diff --git a/basis/bit-vectors/bit-vectors-tests.factor b/basis/bit-vectors/bit-vectors-tests.factor old mode 100755 new mode 100644 diff --git a/basis/bit-vectors/bit-vectors.factor b/basis/bit-vectors/bit-vectors.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/compiler/compiler.factor b/basis/bootstrap/compiler/compiler.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/handbook/handbook.factor b/basis/bootstrap/handbook/handbook.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/help/help.factor b/basis/bootstrap/help/help.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/image/image-tests.factor b/basis/bootstrap/image/image-tests.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/image/image.factor b/basis/bootstrap/image/image.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/image/upload/upload.factor b/basis/bootstrap/image/upload/upload.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/io/io.factor b/basis/bootstrap/io/io.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/random/random.factor b/basis/bootstrap/random/random.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/stage2.factor b/basis/bootstrap/stage2.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/tools/tools.factor b/basis/bootstrap/tools/tools.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/ui/tools/tools.factor b/basis/bootstrap/ui/tools/tools.factor old mode 100755 new mode 100644 diff --git a/basis/bootstrap/unicode/unicode.factor b/basis/bootstrap/unicode/unicode.factor old mode 100755 new mode 100644 diff --git a/basis/boxes/boxes-docs.factor b/basis/boxes/boxes-docs.factor old mode 100755 new mode 100644 diff --git a/basis/boxes/boxes-tests.factor b/basis/boxes/boxes-tests.factor old mode 100755 new mode 100644 diff --git a/basis/boxes/boxes.factor b/basis/boxes/boxes.factor old mode 100755 new mode 100644 diff --git a/basis/calendar/calendar-tests.factor b/basis/calendar/calendar-tests.factor old mode 100755 new mode 100644 diff --git a/basis/calendar/calendar.factor b/basis/calendar/calendar.factor old mode 100755 new mode 100644 diff --git a/basis/calendar/format/format-tests.factor b/basis/calendar/format/format-tests.factor old mode 100755 new mode 100644 diff --git a/basis/calendar/format/format.factor b/basis/calendar/format/format.factor old mode 100755 new mode 100644 diff --git a/basis/calendar/model/model.factor b/basis/calendar/model/model.factor old mode 100755 new mode 100644 diff --git a/basis/calendar/windows/windows.factor b/basis/calendar/windows/windows.factor old mode 100755 new mode 100644 diff --git a/basis/channels/channels-tests.factor b/basis/channels/channels-tests.factor old mode 100755 new mode 100644 diff --git a/basis/channels/channels.factor b/basis/channels/channels.factor old mode 100755 new mode 100644 diff --git a/basis/channels/examples/examples.factor b/basis/channels/examples/examples.factor old mode 100755 new mode 100644 diff --git a/basis/channels/remote/remote.factor b/basis/channels/remote/remote.factor old mode 100755 new mode 100644 diff --git a/basis/checksums/adler-32/adler-32-docs.factor b/basis/checksums/adler-32/adler-32-docs.factor old mode 100755 new mode 100644 diff --git a/basis/checksums/md5/md5-docs.factor b/basis/checksums/md5/md5-docs.factor old mode 100755 new mode 100644 diff --git a/basis/checksums/md5/md5-tests.factor b/basis/checksums/md5/md5-tests.factor old mode 100755 new mode 100644 diff --git a/basis/checksums/md5/md5.factor b/basis/checksums/md5/md5.factor old mode 100755 new mode 100644 diff --git a/basis/checksums/sha1/sha1-tests.factor b/basis/checksums/sha1/sha1-tests.factor old mode 100755 new mode 100644 diff --git a/basis/checksums/sha1/sha1.factor b/basis/checksums/sha1/sha1.factor old mode 100755 new mode 100644 diff --git a/basis/checksums/sha2/sha2-tests.factor b/basis/checksums/sha2/sha2-tests.factor old mode 100755 new mode 100644 diff --git a/basis/checksums/sha2/sha2.factor b/basis/checksums/sha2/sha2.factor old mode 100755 new mode 100644 diff --git a/basis/circular/circular-tests.factor b/basis/circular/circular-tests.factor old mode 100755 new mode 100644 diff --git a/basis/circular/circular.factor b/basis/circular/circular.factor old mode 100755 new mode 100644 diff --git a/basis/cocoa/application/application.factor b/basis/cocoa/application/application.factor old mode 100755 new mode 100644 diff --git a/basis/cocoa/cocoa.factor b/basis/cocoa/cocoa.factor old mode 100755 new mode 100644 diff --git a/basis/cocoa/messages/messages.factor b/basis/cocoa/messages/messages.factor old mode 100755 new mode 100644 diff --git a/basis/cocoa/pasteboard/pasteboard.factor b/basis/cocoa/pasteboard/pasteboard.factor old mode 100755 new mode 100644 diff --git a/basis/cocoa/subclassing/subclassing.factor b/basis/cocoa/subclassing/subclassing.factor old mode 100755 new mode 100644 diff --git a/basis/cocoa/windows/windows.factor b/basis/cocoa/windows/windows.factor old mode 100755 new mode 100644 diff --git a/basis/combinators/short-circuit/short-circuit.factor b/basis/combinators/short-circuit/short-circuit.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/compiler-docs.factor b/basis/compiler/compiler-docs.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/compiler.factor b/basis/compiler/compiler.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/constants/constants.factor b/basis/compiler/constants/constants.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/generator/fixup/fixup.factor b/basis/compiler/generator/fixup/fixup.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/generator/generator-docs.factor b/basis/compiler/generator/generator-docs.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/generator/generator.factor b/basis/compiler/generator/generator.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/generator/registers/registers.factor b/basis/compiler/generator/registers/registers.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/alien.factor b/basis/compiler/tests/alien.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/curry.factor b/basis/compiler/tests/curry.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/float.factor b/basis/compiler/tests/float.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/intrinsics.factor b/basis/compiler/tests/intrinsics.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/optimizer.factor b/basis/compiler/tests/optimizer.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/simple.factor b/basis/compiler/tests/simple.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/stack-trace.factor b/basis/compiler/tests/stack-trace.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/templates-early.factor b/basis/compiler/tests/templates-early.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/templates.factor b/basis/compiler/tests/templates.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tests/tuples.factor b/basis/compiler/tests/tuples.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tree/dead-code/simple/simple.factor b/basis/compiler/tree/dead-code/simple/simple.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tree/def-use/def-use-tests.factor b/basis/compiler/tree/def-use/def-use-tests.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tree/def-use/def-use.factor b/basis/compiler/tree/def-use/def-use.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tree/propagation/propagation.factor b/basis/compiler/tree/propagation/propagation.factor old mode 100755 new mode 100644 diff --git a/basis/compiler/tree/tree.factor b/basis/compiler/tree/tree.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/combinators/combinators-docs.factor b/basis/concurrency/combinators/combinators-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/combinators/combinators-tests.factor b/basis/concurrency/combinators/combinators-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/combinators/combinators.factor b/basis/concurrency/combinators/combinators.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/conditions/conditions.factor b/basis/concurrency/conditions/conditions.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/count-downs/count-downs-docs.factor b/basis/concurrency/count-downs/count-downs-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/count-downs/count-downs-tests.factor b/basis/concurrency/count-downs/count-downs-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/count-downs/count-downs.factor b/basis/concurrency/count-downs/count-downs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/distributed/distributed-docs.factor b/basis/concurrency/distributed/distributed-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/distributed/distributed-tests.factor b/basis/concurrency/distributed/distributed-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/distributed/distributed.factor b/basis/concurrency/distributed/distributed.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/exchangers/exchangers-docs.factor b/basis/concurrency/exchangers/exchangers-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/exchangers/exchangers-tests.factor b/basis/concurrency/exchangers/exchangers-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/exchangers/exchangers.factor b/basis/concurrency/exchangers/exchangers.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/flags/flags-tests.factor b/basis/concurrency/flags/flags-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/flags/flags.factor b/basis/concurrency/flags/flags.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/futures/futures-docs.factor b/basis/concurrency/futures/futures-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/futures/futures-tests.factor b/basis/concurrency/futures/futures-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/futures/futures.factor b/basis/concurrency/futures/futures.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/locks/locks-docs.factor b/basis/concurrency/locks/locks-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/locks/locks-tests.factor b/basis/concurrency/locks/locks-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/locks/locks.factor b/basis/concurrency/locks/locks.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/mailboxes/mailboxes-docs.factor b/basis/concurrency/mailboxes/mailboxes-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/mailboxes/mailboxes-tests.factor b/basis/concurrency/mailboxes/mailboxes-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/mailboxes/mailboxes.factor b/basis/concurrency/mailboxes/mailboxes.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/messaging/messaging-docs.factor b/basis/concurrency/messaging/messaging-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/messaging/messaging-tests.factor b/basis/concurrency/messaging/messaging-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/messaging/messaging.factor b/basis/concurrency/messaging/messaging.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/promises/promises-docs.factor b/basis/concurrency/promises/promises-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/promises/promises-tests.factor b/basis/concurrency/promises/promises-tests.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/promises/promises.factor b/basis/concurrency/promises/promises.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/semaphores/semaphores-docs.factor b/basis/concurrency/semaphores/semaphores-docs.factor old mode 100755 new mode 100644 diff --git a/basis/concurrency/semaphores/semaphores.factor b/basis/concurrency/semaphores/semaphores.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/architecture/architecture.factor b/basis/cpu/architecture/architecture.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/ppc/allot/allot.factor b/basis/cpu/ppc/allot/allot.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/ppc/architecture/architecture.factor b/basis/cpu/ppc/architecture/architecture.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/ppc/assembler/assembler.factor b/basis/cpu/ppc/assembler/assembler.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/ppc/bootstrap.factor b/basis/cpu/ppc/bootstrap.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/ppc/intrinsics/intrinsics.factor b/basis/cpu/ppc/intrinsics/intrinsics.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/ppc/linux/bootstrap.factor b/basis/cpu/ppc/linux/bootstrap.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/ppc/macosx/bootstrap.factor b/basis/cpu/ppc/macosx/bootstrap.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/ppc/ppc.factor b/basis/cpu/ppc/ppc.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/32/bootstrap.factor b/basis/cpu/x86/32/bootstrap.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/64/64.factor b/basis/cpu/x86/64/64.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/64/bootstrap.factor b/basis/cpu/x86/64/bootstrap.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/allot/allot.factor b/basis/cpu/x86/allot/allot.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/architecture/architecture.factor b/basis/cpu/x86/architecture/architecture.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/assembler/assembler.factor b/basis/cpu/x86/assembler/assembler.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/bootstrap.factor b/basis/cpu/x86/bootstrap.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/intrinsics/intrinsics.factor b/basis/cpu/x86/intrinsics/intrinsics.factor old mode 100755 new mode 100644 diff --git a/basis/cpu/x86/sse2/sse2.factor b/basis/cpu/x86/sse2/sse2.factor old mode 100755 new mode 100644 diff --git a/basis/db/db-tests.factor b/basis/db/db-tests.factor old mode 100755 new mode 100644 diff --git a/basis/db/db.factor b/basis/db/db.factor old mode 100755 new mode 100644 diff --git a/basis/db/postgresql/ffi/ffi.factor b/basis/db/postgresql/ffi/ffi.factor old mode 100755 new mode 100644 diff --git a/basis/db/postgresql/lib/lib.factor b/basis/db/postgresql/lib/lib.factor old mode 100755 new mode 100644 diff --git a/basis/db/postgresql/postgresql-tests.factor b/basis/db/postgresql/postgresql-tests.factor old mode 100755 new mode 100644 diff --git a/basis/db/postgresql/postgresql.factor b/basis/db/postgresql/postgresql.factor old mode 100755 new mode 100644 diff --git a/basis/db/sqlite/ffi/ffi.factor b/basis/db/sqlite/ffi/ffi.factor old mode 100755 new mode 100644 diff --git a/basis/db/sqlite/lib/lib.factor b/basis/db/sqlite/lib/lib.factor old mode 100755 new mode 100644 diff --git a/basis/db/sqlite/sqlite-tests.factor b/basis/db/sqlite/sqlite-tests.factor old mode 100755 new mode 100644 diff --git a/basis/db/sqlite/sqlite.factor b/basis/db/sqlite/sqlite.factor old mode 100755 new mode 100644 diff --git a/basis/db/tuples/tuples-tests.factor b/basis/db/tuples/tuples-tests.factor old mode 100755 new mode 100644 diff --git a/basis/db/tuples/tuples.factor b/basis/db/tuples/tuples.factor old mode 100755 new mode 100644 diff --git a/basis/db/types/types.factor b/basis/db/types/types.factor old mode 100755 new mode 100644 diff --git a/basis/debugger/debugger-docs.factor b/basis/debugger/debugger-docs.factor old mode 100755 new mode 100644 diff --git a/basis/debugger/debugger-tests.factor b/basis/debugger/debugger-tests.factor old mode 100755 new mode 100644 diff --git a/basis/debugger/debugger.factor b/basis/debugger/debugger.factor old mode 100755 new mode 100644 diff --git a/basis/delegate/delegate-tests.factor b/basis/delegate/delegate-tests.factor old mode 100755 new mode 100644 diff --git a/basis/delegate/delegate.factor b/basis/delegate/delegate.factor old mode 100755 new mode 100644 diff --git a/basis/delegate/protocols/protocols.factor b/basis/delegate/protocols/protocols.factor old mode 100755 new mode 100644 diff --git a/basis/dlists/dlists-docs.factor b/basis/dlists/dlists-docs.factor old mode 100755 new mode 100644 diff --git a/basis/dlists/dlists-tests.factor b/basis/dlists/dlists-tests.factor old mode 100755 new mode 100644 diff --git a/basis/dlists/dlists.factor b/basis/dlists/dlists.factor old mode 100755 new mode 100644 diff --git a/basis/documents/documents.factor b/basis/documents/documents.factor old mode 100755 new mode 100644 diff --git a/basis/editors/editors.factor b/basis/editors/editors.factor old mode 100755 new mode 100644 diff --git a/basis/editors/editpadpro/editpadpro.factor b/basis/editors/editpadpro/editpadpro.factor old mode 100755 new mode 100644 diff --git a/basis/editors/editplus/editplus.factor b/basis/editors/editplus/editplus.factor old mode 100755 new mode 100644 diff --git a/basis/editors/emacs/emacs.factor b/basis/editors/emacs/emacs.factor old mode 100755 new mode 100644 diff --git a/basis/editors/emeditor/emeditor.factor b/basis/editors/emeditor/emeditor.factor old mode 100755 new mode 100644 diff --git a/basis/editors/gvim/gvim.factor b/basis/editors/gvim/gvim.factor old mode 100755 new mode 100644 diff --git a/basis/editors/gvim/windows/windows.factor b/basis/editors/gvim/windows/windows.factor old mode 100755 new mode 100644 diff --git a/basis/editors/jedit/jedit.factor b/basis/editors/jedit/jedit.factor old mode 100755 new mode 100644 diff --git a/basis/editors/macvim/macvim.factor b/basis/editors/macvim/macvim.factor old mode 100755 new mode 100644 diff --git a/basis/editors/notepadpp/notepadpp.factor b/basis/editors/notepadpp/notepadpp.factor old mode 100755 new mode 100644 diff --git a/basis/editors/scite/scite.factor b/basis/editors/scite/scite.factor old mode 100755 new mode 100644 diff --git a/basis/editors/ted-notepad/ted-notepad.factor b/basis/editors/ted-notepad/ted-notepad.factor old mode 100755 new mode 100644 diff --git a/basis/editors/textedit/textedit.factor b/basis/editors/textedit/textedit.factor old mode 100755 new mode 100644 diff --git a/basis/editors/textmate/textmate.factor b/basis/editors/textmate/textmate.factor old mode 100755 new mode 100644 diff --git a/basis/editors/ultraedit/ultraedit.factor b/basis/editors/ultraedit/ultraedit.factor old mode 100755 new mode 100644 diff --git a/basis/editors/vim/vim.factor b/basis/editors/vim/vim.factor old mode 100755 new mode 100644 diff --git a/basis/editors/wordpad/wordpad.factor b/basis/editors/wordpad/wordpad.factor old mode 100755 new mode 100644 diff --git a/basis/float-arrays/float-arrays-tests.factor b/basis/float-arrays/float-arrays-tests.factor old mode 100755 new mode 100644 diff --git a/basis/float-arrays/float-arrays.factor b/basis/float-arrays/float-arrays.factor old mode 100755 new mode 100644 diff --git a/basis/float-vectors/float-vectors-docs.factor b/basis/float-vectors/float-vectors-docs.factor old mode 100755 new mode 100644 diff --git a/basis/float-vectors/float-vectors-tests.factor b/basis/float-vectors/float-vectors-tests.factor old mode 100755 new mode 100644 diff --git a/basis/float-vectors/float-vectors.factor b/basis/float-vectors/float-vectors.factor old mode 100755 new mode 100644 diff --git a/basis/freetype/freetype.factor b/basis/freetype/freetype.factor old mode 100755 new mode 100644 diff --git a/basis/fry/fry-docs.factor b/basis/fry/fry-docs.factor old mode 100755 new mode 100644 diff --git a/basis/fry/fry-tests.factor b/basis/fry/fry-tests.factor old mode 100755 new mode 100644 diff --git a/basis/fry/fry.factor b/basis/fry/fry.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/actions/actions-tests.factor b/basis/furnace/actions/actions-tests.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/actions/actions.factor b/basis/furnace/actions/actions.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/auth.factor b/basis/furnace/auth/auth.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/basic/basic.factor b/basis/furnace/auth/basic/basic.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/login/login-tests.factor b/basis/furnace/auth/login/login-tests.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/login/login.factor b/basis/furnace/auth/login/login.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/providers/assoc/assoc-tests.factor b/basis/furnace/auth/providers/assoc/assoc-tests.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/providers/assoc/assoc.factor b/basis/furnace/auth/providers/assoc/assoc.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/providers/db/db-tests.factor b/basis/furnace/auth/providers/db/db-tests.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/providers/db/db.factor b/basis/furnace/auth/providers/db/db.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/providers/null/null.factor b/basis/furnace/auth/providers/null/null.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/auth/providers/providers.factor b/basis/furnace/auth/providers/providers.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/db/db.factor b/basis/furnace/db/db.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/sessions/sessions-tests.factor b/basis/furnace/sessions/sessions-tests.factor old mode 100755 new mode 100644 diff --git a/basis/furnace/sessions/sessions.factor b/basis/furnace/sessions/sessions.factor old mode 100755 new mode 100644 diff --git a/basis/generalizations/generalizations-docs.factor b/basis/generalizations/generalizations-docs.factor old mode 100755 new mode 100644 diff --git a/basis/generalizations/generalizations-tests.factor b/basis/generalizations/generalizations-tests.factor old mode 100755 new mode 100644 diff --git a/basis/generalizations/generalizations.factor b/basis/generalizations/generalizations.factor old mode 100755 new mode 100644 diff --git a/basis/globs/globs.factor b/basis/globs/globs.factor old mode 100755 new mode 100644 diff --git a/basis/hash2/hash2-tests.factor b/basis/hash2/hash2-tests.factor old mode 100755 new mode 100644 diff --git a/basis/heaps/heaps-docs.factor b/basis/heaps/heaps-docs.factor old mode 100755 new mode 100644 diff --git a/basis/heaps/heaps-tests.factor b/basis/heaps/heaps-tests.factor old mode 100755 new mode 100644 diff --git a/basis/heaps/heaps.factor b/basis/heaps/heaps.factor old mode 100755 new mode 100644 diff --git a/basis/help/cookbook/cookbook.factor b/basis/help/cookbook/cookbook.factor old mode 100755 new mode 100644 diff --git a/basis/help/crossref/crossref-tests.factor b/basis/help/crossref/crossref-tests.factor old mode 100755 new mode 100644 diff --git a/basis/help/definitions/definitions-tests.factor b/basis/help/definitions/definitions-tests.factor old mode 100755 new mode 100644 diff --git a/basis/help/definitions/definitions.factor b/basis/help/definitions/definitions.factor old mode 100755 new mode 100644 diff --git a/basis/help/handbook/handbook.factor b/basis/help/handbook/handbook.factor old mode 100755 new mode 100644 diff --git a/basis/help/help-docs.factor b/basis/help/help-docs.factor old mode 100755 new mode 100644 diff --git a/basis/help/help.factor b/basis/help/help.factor old mode 100755 new mode 100644 diff --git a/basis/help/lint/lint.factor b/basis/help/lint/lint.factor old mode 100755 new mode 100644 diff --git a/basis/help/markup/markup.factor b/basis/help/markup/markup.factor old mode 100755 new mode 100644 diff --git a/basis/help/stylesheet/stylesheet.factor b/basis/help/stylesheet/stylesheet.factor old mode 100755 new mode 100644 diff --git a/basis/help/syntax/syntax-tests.factor b/basis/help/syntax/syntax-tests.factor old mode 100755 new mode 100644 diff --git a/basis/help/syntax/syntax.factor b/basis/help/syntax/syntax.factor old mode 100755 new mode 100644 diff --git a/basis/help/topics/topics.factor b/basis/help/topics/topics.factor old mode 100755 new mode 100644 diff --git a/basis/help/tutorial/tutorial.factor b/basis/help/tutorial/tutorial.factor old mode 100755 new mode 100644 diff --git a/basis/html/streams/streams.factor b/basis/html/streams/streams.factor old mode 100755 new mode 100644 diff --git a/basis/html/templates/fhtml/fhtml-tests.factor b/basis/html/templates/fhtml/fhtml-tests.factor old mode 100755 new mode 100644 diff --git a/basis/html/templates/fhtml/fhtml.factor b/basis/html/templates/fhtml/fhtml.factor old mode 100755 new mode 100644 diff --git a/basis/http/client/client-tests.factor b/basis/http/client/client-tests.factor old mode 100755 new mode 100644 diff --git a/basis/http/client/client.factor b/basis/http/client/client.factor old mode 100755 new mode 100644 diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor old mode 100755 new mode 100644 diff --git a/basis/http/http.factor b/basis/http/http.factor old mode 100755 new mode 100644 diff --git a/basis/http/server/cgi/cgi.factor b/basis/http/server/cgi/cgi.factor old mode 100755 new mode 100644 diff --git a/basis/http/server/server.factor b/basis/http/server/server.factor old mode 100755 new mode 100644 diff --git a/basis/http/server/static/static.factor b/basis/http/server/static/static.factor old mode 100755 new mode 100644 diff --git a/basis/inspector/inspector.factor b/basis/inspector/inspector.factor old mode 100755 new mode 100644 diff --git a/basis/interval-maps/interval-maps-docs.factor b/basis/interval-maps/interval-maps-docs.factor old mode 100755 new mode 100644 diff --git a/basis/interval-maps/interval-maps-tests.factor b/basis/interval-maps/interval-maps-tests.factor old mode 100755 new mode 100644 diff --git a/basis/interval-maps/interval-maps.factor b/basis/interval-maps/interval-maps.factor old mode 100755 new mode 100644 diff --git a/basis/io/buffers/buffers-docs.factor b/basis/io/buffers/buffers-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/buffers/buffers-tests.factor b/basis/io/buffers/buffers-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/buffers/buffers.factor b/basis/io/buffers/buffers.factor old mode 100755 new mode 100644 diff --git a/basis/io/encodings/8-bit/8-bit.factor b/basis/io/encodings/8-bit/8-bit.factor old mode 100755 new mode 100644 diff --git a/basis/io/encodings/ascii/ascii.factor b/basis/io/encodings/ascii/ascii.factor old mode 100755 new mode 100644 diff --git a/basis/io/encodings/iana/iana.factor b/basis/io/encodings/iana/iana.factor old mode 100755 new mode 100644 diff --git a/basis/io/encodings/utf16/utf16-tests.factor b/basis/io/encodings/utf16/utf16-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/encodings/utf16/utf16.factor b/basis/io/encodings/utf16/utf16.factor old mode 100755 new mode 100644 diff --git a/basis/io/launcher/launcher-docs.factor b/basis/io/launcher/launcher-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/launcher/launcher-tests.factor b/basis/io/launcher/launcher-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/launcher/launcher.factor b/basis/io/launcher/launcher.factor old mode 100755 new mode 100644 diff --git a/basis/io/mmap/mmap-docs.factor b/basis/io/mmap/mmap-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/mmap/mmap-tests.factor b/basis/io/mmap/mmap-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/mmap/mmap.factor b/basis/io/mmap/mmap.factor old mode 100755 new mode 100644 diff --git a/basis/io/monitors/monitors-docs.factor b/basis/io/monitors/monitors-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/monitors/monitors-tests.factor b/basis/io/monitors/monitors-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/monitors/monitors.factor b/basis/io/monitors/monitors.factor old mode 100755 new mode 100644 diff --git a/basis/io/pipes/pipes-tests.factor b/basis/io/pipes/pipes-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/ports/ports-docs.factor b/basis/io/ports/ports-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/ports/ports.factor b/basis/io/ports/ports.factor old mode 100755 new mode 100644 diff --git a/basis/io/servers/connection/connection-docs.factor b/basis/io/servers/connection/connection-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/servers/connection/connection-tests.factor b/basis/io/servers/connection/connection-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/servers/connection/connection.factor b/basis/io/servers/connection/connection.factor old mode 100755 new mode 100644 diff --git a/basis/io/sockets/secure/secure-tests.factor b/basis/io/sockets/secure/secure-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/sockets/secure/secure.factor b/basis/io/sockets/secure/secure.factor old mode 100755 new mode 100644 diff --git a/basis/io/sockets/sockets-docs.factor b/basis/io/sockets/sockets-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/sockets/sockets-tests.factor b/basis/io/sockets/sockets-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/sockets/sockets.factor b/basis/io/sockets/sockets.factor old mode 100755 new mode 100644 diff --git a/basis/io/streams/duplex/duplex-docs.factor b/basis/io/streams/duplex/duplex-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/streams/duplex/duplex-tests.factor b/basis/io/streams/duplex/duplex-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/streams/duplex/duplex.factor b/basis/io/streams/duplex/duplex.factor old mode 100755 new mode 100644 diff --git a/basis/io/streams/null/null.factor b/basis/io/streams/null/null.factor old mode 100755 new mode 100644 diff --git a/basis/io/thread/thread.factor b/basis/io/thread/thread.factor old mode 100755 new mode 100644 diff --git a/basis/io/timeouts/timeouts-docs.factor b/basis/io/timeouts/timeouts-docs.factor old mode 100755 new mode 100644 diff --git a/basis/io/timeouts/timeouts.factor b/basis/io/timeouts/timeouts.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/backend/backend.factor b/basis/io/unix/backend/backend.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/bsd/bsd.factor b/basis/io/unix/bsd/bsd.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/files/files-tests.factor b/basis/io/unix/files/files-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/files/files.factor b/basis/io/unix/files/files.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/kqueue/kqueue.factor b/basis/io/unix/kqueue/kqueue.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/launcher/launcher-tests.factor b/basis/io/unix/launcher/launcher-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/launcher/launcher.factor b/basis/io/unix/launcher/launcher.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/launcher/parser/parser-tests.factor b/basis/io/unix/launcher/parser/parser-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/launcher/parser/parser.factor b/basis/io/unix/launcher/parser/parser.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/linux/linux.factor b/basis/io/unix/linux/linux.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/mmap/mmap.factor b/basis/io/unix/mmap/mmap.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/select/select.factor b/basis/io/unix/select/select.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/sockets/secure/secure.factor b/basis/io/unix/sockets/secure/secure.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/sockets/sockets.factor b/basis/io/unix/sockets/sockets.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/unix-tests.factor b/basis/io/unix/unix-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/unix/unix.factor b/basis/io/unix/unix.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/files/files.factor b/basis/io/windows/files/files.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/files/unique/unique.factor b/basis/io/windows/files/unique/unique.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/launcher/launcher-tests.factor b/basis/io/windows/launcher/launcher-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/launcher/launcher.factor b/basis/io/windows/launcher/launcher.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/mmap/mmap.factor b/basis/io/windows/mmap/mmap.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/backend/backend.factor b/basis/io/windows/nt/backend/backend.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/files/files-tests.factor b/basis/io/windows/nt/files/files-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/files/files.factor b/basis/io/windows/nt/files/files.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/launcher/launcher-tests.factor b/basis/io/windows/nt/launcher/launcher-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/launcher/launcher.factor b/basis/io/windows/nt/launcher/launcher.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/launcher/test/append.factor b/basis/io/windows/nt/launcher/test/append.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/launcher/test/env.factor b/basis/io/windows/nt/launcher/test/env.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/launcher/test/stderr.factor b/basis/io/windows/nt/launcher/test/stderr.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/monitors/monitors-tests.factor b/basis/io/windows/nt/monitors/monitors-tests.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/monitors/monitors.factor b/basis/io/windows/nt/monitors/monitors.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/nt.factor b/basis/io/windows/nt/nt.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/pipes/pipes.factor b/basis/io/windows/nt/pipes/pipes.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/privileges/privileges.factor b/basis/io/windows/nt/privileges/privileges.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/nt/sockets/sockets.factor b/basis/io/windows/nt/sockets/sockets.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/privileges/privileges.factor b/basis/io/windows/privileges/privileges.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/sockets/sockets.factor b/basis/io/windows/sockets/sockets.factor old mode 100755 new mode 100644 diff --git a/basis/io/windows/windows.factor b/basis/io/windows/windows.factor old mode 100755 new mode 100644 diff --git a/basis/json/reader/reader.factor b/basis/json/reader/reader.factor old mode 100755 new mode 100644 diff --git a/basis/lcs/lcs-docs.factor b/basis/lcs/lcs-docs.factor old mode 100755 new mode 100644 diff --git a/basis/lcs/lcs-tests.factor b/basis/lcs/lcs-tests.factor old mode 100755 new mode 100644 diff --git a/basis/lcs/lcs.factor b/basis/lcs/lcs.factor old mode 100755 new mode 100644 diff --git a/basis/libc/libc-tests.factor b/basis/libc/libc-tests.factor old mode 100755 new mode 100644 diff --git a/basis/libc/libc.factor b/basis/libc/libc.factor old mode 100755 new mode 100644 diff --git a/basis/listener/listener-docs.factor b/basis/listener/listener-docs.factor old mode 100755 new mode 100644 diff --git a/basis/listener/listener-tests.factor b/basis/listener/listener-tests.factor old mode 100755 new mode 100644 diff --git a/basis/listener/listener.factor b/basis/listener/listener.factor old mode 100755 new mode 100644 diff --git a/basis/locals/locals-tests.factor b/basis/locals/locals-tests.factor old mode 100755 new mode 100644 diff --git a/basis/locals/locals.factor b/basis/locals/locals.factor old mode 100755 new mode 100644 diff --git a/basis/logging/analysis/analysis.factor b/basis/logging/analysis/analysis.factor old mode 100755 new mode 100644 diff --git a/basis/logging/insomniac/insomniac-docs.factor b/basis/logging/insomniac/insomniac-docs.factor old mode 100755 new mode 100644 diff --git a/basis/logging/insomniac/insomniac.factor b/basis/logging/insomniac/insomniac.factor old mode 100755 new mode 100644 diff --git a/basis/logging/logging-docs.factor b/basis/logging/logging-docs.factor old mode 100755 new mode 100644 diff --git a/basis/logging/logging.factor b/basis/logging/logging.factor old mode 100755 new mode 100644 diff --git a/basis/logging/parser/parser.factor b/basis/logging/parser/parser.factor old mode 100755 new mode 100644 diff --git a/basis/logging/server/server.factor b/basis/logging/server/server.factor old mode 100755 new mode 100644 diff --git a/basis/macros/macros.factor b/basis/macros/macros.factor old mode 100755 new mode 100644 diff --git a/basis/match/match-tests.factor b/basis/match/match-tests.factor old mode 100755 new mode 100644 diff --git a/basis/match/match.factor b/basis/match/match.factor old mode 100755 new mode 100644 diff --git a/basis/math/bitwise/bitwise-tests.factor b/basis/math/bitwise/bitwise-tests.factor old mode 100755 new mode 100644 diff --git a/basis/math/complex/complex-docs.factor b/basis/math/complex/complex-docs.factor old mode 100755 new mode 100644 diff --git a/basis/math/complex/complex-tests.factor b/basis/math/complex/complex-tests.factor old mode 100755 new mode 100644 diff --git a/basis/math/complex/complex.factor b/basis/math/complex/complex.factor old mode 100755 new mode 100644 diff --git a/basis/math/constants/constants-docs.factor b/basis/math/constants/constants-docs.factor old mode 100755 new mode 100644 diff --git a/basis/math/constants/constants.factor b/basis/math/constants/constants.factor old mode 100755 new mode 100644 diff --git a/basis/math/functions/functions-docs.factor b/basis/math/functions/functions-docs.factor old mode 100755 new mode 100644 diff --git a/basis/math/functions/functions-tests.factor b/basis/math/functions/functions-tests.factor old mode 100755 new mode 100644 diff --git a/basis/math/functions/functions.factor b/basis/math/functions/functions.factor old mode 100755 new mode 100644 diff --git a/basis/math/intervals/intervals-tests.factor b/basis/math/intervals/intervals-tests.factor old mode 100755 new mode 100644 diff --git a/basis/math/intervals/intervals.factor b/basis/math/intervals/intervals.factor old mode 100755 new mode 100644 diff --git a/basis/math/libm/libm.factor b/basis/math/libm/libm.factor old mode 100755 new mode 100644 diff --git a/basis/math/ranges/ranges.factor b/basis/math/ranges/ranges.factor old mode 100755 new mode 100644 diff --git a/basis/math/ratios/ratios-docs.factor b/basis/math/ratios/ratios-docs.factor old mode 100755 new mode 100644 diff --git a/basis/math/ratios/ratios-tests.factor b/basis/math/ratios/ratios-tests.factor old mode 100755 new mode 100644 diff --git a/basis/math/ratios/ratios.factor b/basis/math/ratios/ratios.factor old mode 100755 new mode 100644 diff --git a/basis/math/vectors/vectors-docs.factor b/basis/math/vectors/vectors-docs.factor old mode 100755 new mode 100644 diff --git a/basis/math/vectors/vectors.factor b/basis/math/vectors/vectors.factor old mode 100755 new mode 100644 diff --git a/basis/memoize/memoize-docs.factor b/basis/memoize/memoize-docs.factor old mode 100755 new mode 100644 diff --git a/basis/memoize/memoize.factor b/basis/memoize/memoize.factor old mode 100755 new mode 100644 diff --git a/basis/mime-types/mime-types.factor b/basis/mime-types/mime-types.factor old mode 100755 new mode 100644 diff --git a/basis/mirrors/mirrors-docs.factor b/basis/mirrors/mirrors-docs.factor old mode 100755 new mode 100644 diff --git a/basis/mirrors/mirrors-tests.factor b/basis/mirrors/mirrors-tests.factor old mode 100755 new mode 100644 diff --git a/basis/mirrors/mirrors.factor b/basis/mirrors/mirrors.factor old mode 100755 new mode 100644 diff --git a/basis/models/compose/compose-docs.factor b/basis/models/compose/compose-docs.factor old mode 100755 new mode 100644 diff --git a/basis/models/compose/compose-tests.factor b/basis/models/compose/compose-tests.factor old mode 100755 new mode 100644 diff --git a/basis/models/compose/compose.factor b/basis/models/compose/compose.factor old mode 100755 new mode 100644 diff --git a/basis/models/delay/delay-docs.factor b/basis/models/delay/delay-docs.factor old mode 100755 new mode 100644 diff --git a/basis/models/delay/delay.factor b/basis/models/delay/delay.factor old mode 100755 new mode 100644 diff --git a/basis/models/filter/filter-docs.factor b/basis/models/filter/filter-docs.factor old mode 100755 new mode 100644 diff --git a/basis/models/filter/filter-tests.factor b/basis/models/filter/filter-tests.factor old mode 100755 new mode 100644 diff --git a/basis/models/filter/filter.factor b/basis/models/filter/filter.factor old mode 100755 new mode 100644 diff --git a/basis/models/history/history-docs.factor b/basis/models/history/history-docs.factor old mode 100755 new mode 100644 diff --git a/basis/models/history/history-tests.factor b/basis/models/history/history-tests.factor old mode 100755 new mode 100644 diff --git a/basis/models/history/history.factor b/basis/models/history/history.factor old mode 100755 new mode 100644 diff --git a/basis/models/mapping/mapping-tests.factor b/basis/models/mapping/mapping-tests.factor old mode 100755 new mode 100644 diff --git a/basis/models/mapping/mapping.factor b/basis/models/mapping/mapping.factor old mode 100755 new mode 100644 diff --git a/basis/models/models-docs.factor b/basis/models/models-docs.factor old mode 100755 new mode 100644 diff --git a/basis/models/models-tests.factor b/basis/models/models-tests.factor old mode 100755 new mode 100644 diff --git a/basis/models/models.factor b/basis/models/models.factor old mode 100755 new mode 100644 diff --git a/basis/models/range/range-docs.factor b/basis/models/range/range-docs.factor old mode 100755 new mode 100644 diff --git a/basis/models/range/range-tests.factor b/basis/models/range/range-tests.factor old mode 100755 new mode 100644 diff --git a/basis/models/range/range.factor b/basis/models/range/range.factor old mode 100755 new mode 100644 diff --git a/basis/multiline/multiline-tests.factor b/basis/multiline/multiline-tests.factor old mode 100755 new mode 100644 diff --git a/basis/multiline/multiline.factor b/basis/multiline/multiline.factor old mode 100755 new mode 100644 diff --git a/basis/opengl/gl/windows/windows.factor b/basis/opengl/gl/windows/windows.factor old mode 100755 new mode 100644 diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor old mode 100755 new mode 100644 diff --git a/basis/openssl/libcrypto/libcrypto.factor b/basis/openssl/libcrypto/libcrypto.factor old mode 100755 new mode 100644 diff --git a/basis/openssl/libssl/libssl.factor b/basis/openssl/libssl/libssl.factor old mode 100755 new mode 100644 diff --git a/basis/openssl/openssl-tests.factor b/basis/openssl/openssl-tests.factor old mode 100755 new mode 100644 diff --git a/basis/openssl/openssl.factor b/basis/openssl/openssl.factor old mode 100755 new mode 100644 diff --git a/basis/peg/parsers/parsers-docs.factor b/basis/peg/parsers/parsers-docs.factor old mode 100755 new mode 100644 diff --git a/basis/peg/parsers/parsers.factor b/basis/peg/parsers/parsers.factor old mode 100755 new mode 100644 diff --git a/basis/peg/peg.factor b/basis/peg/peg.factor old mode 100755 new mode 100644 diff --git a/basis/peg/search/search-docs.factor b/basis/peg/search/search-docs.factor old mode 100755 new mode 100644 diff --git a/basis/peg/search/search-tests.factor b/basis/peg/search/search-tests.factor old mode 100755 new mode 100644 diff --git a/basis/peg/search/search.factor b/basis/peg/search/search.factor old mode 100755 new mode 100644 diff --git a/basis/prettyprint/backend/backend-docs.factor b/basis/prettyprint/backend/backend-docs.factor old mode 100755 new mode 100644 diff --git a/basis/prettyprint/backend/backend.factor b/basis/prettyprint/backend/backend.factor old mode 100755 new mode 100644 diff --git a/basis/prettyprint/prettyprint-docs.factor b/basis/prettyprint/prettyprint-docs.factor old mode 100755 new mode 100644 diff --git a/basis/prettyprint/prettyprint-tests.factor b/basis/prettyprint/prettyprint-tests.factor old mode 100755 new mode 100644 diff --git a/basis/prettyprint/prettyprint.factor b/basis/prettyprint/prettyprint.factor old mode 100755 new mode 100644 diff --git a/basis/prettyprint/sections/sections-docs.factor b/basis/prettyprint/sections/sections-docs.factor old mode 100755 new mode 100644 diff --git a/basis/qualified/qualified-docs.factor b/basis/qualified/qualified-docs.factor old mode 100755 new mode 100644 diff --git a/basis/random/dummy/dummy.factor b/basis/random/dummy/dummy.factor old mode 100755 new mode 100644 diff --git a/basis/random/mersenne-twister/mersenne-twister-tests.factor b/basis/random/mersenne-twister/mersenne-twister-tests.factor old mode 100755 new mode 100644 diff --git a/basis/random/mersenne-twister/mersenne-twister.factor b/basis/random/mersenne-twister/mersenne-twister.factor old mode 100755 new mode 100644 diff --git a/basis/random/random.factor b/basis/random/random.factor old mode 100755 new mode 100644 diff --git a/basis/sequences/deep/deep-tests.factor b/basis/sequences/deep/deep-tests.factor old mode 100755 new mode 100644 diff --git a/basis/sequences/next/next.factor b/basis/sequences/next/next.factor old mode 100755 new mode 100644 diff --git a/basis/serialize/serialize-docs.factor b/basis/serialize/serialize-docs.factor old mode 100755 new mode 100644 diff --git a/basis/serialize/serialize-tests.factor b/basis/serialize/serialize-tests.factor old mode 100755 new mode 100644 diff --git a/basis/serialize/serialize.factor b/basis/serialize/serialize.factor old mode 100755 new mode 100644 diff --git a/basis/shuffle/shuffle-tests.factor b/basis/shuffle/shuffle-tests.factor old mode 100755 new mode 100644 diff --git a/basis/smtp/server/server.factor b/basis/smtp/server/server.factor old mode 100755 new mode 100644 diff --git a/basis/smtp/smtp-tests.factor b/basis/smtp/smtp-tests.factor old mode 100755 new mode 100644 diff --git a/basis/smtp/smtp.factor b/basis/smtp/smtp.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/backend/backend.factor b/basis/stack-checker/backend/backend.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/known-words/known-words.factor b/basis/stack-checker/known-words/known-words.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/stack-checker-docs.factor b/basis/stack-checker/stack-checker-docs.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/stack-checker-tests.factor b/basis/stack-checker/stack-checker-tests.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/stack-checker.factor b/basis/stack-checker/stack-checker.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/state/state.factor b/basis/stack-checker/state/state.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/transforms/transforms-docs.factor b/basis/stack-checker/transforms/transforms-docs.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/transforms/transforms-tests.factor b/basis/stack-checker/transforms/transforms-tests.factor old mode 100755 new mode 100644 diff --git a/basis/stack-checker/transforms/transforms.factor b/basis/stack-checker/transforms/transforms.factor old mode 100755 new mode 100644 diff --git a/basis/state-parser/state-parser-tests.factor b/basis/state-parser/state-parser-tests.factor old mode 100755 new mode 100644 diff --git a/basis/symbols/symbols-tests.factor b/basis/symbols/symbols-tests.factor old mode 100755 new mode 100644 diff --git a/basis/symbols/symbols.factor b/basis/symbols/symbols.factor old mode 100755 new mode 100644 diff --git a/basis/syndication/syndication-tests.factor b/basis/syndication/syndication-tests.factor old mode 100755 new mode 100644 diff --git a/basis/threads/threads-docs.factor b/basis/threads/threads-docs.factor old mode 100755 new mode 100644 diff --git a/basis/threads/threads-tests.factor b/basis/threads/threads-tests.factor old mode 100755 new mode 100644 diff --git a/basis/threads/threads.factor b/basis/threads/threads.factor old mode 100755 new mode 100644 diff --git a/basis/tools/annotations/annotations-docs.factor b/basis/tools/annotations/annotations-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/annotations/annotations-tests.factor b/basis/tools/annotations/annotations-tests.factor old mode 100755 new mode 100644 diff --git a/basis/tools/annotations/annotations.factor b/basis/tools/annotations/annotations.factor old mode 100755 new mode 100644 diff --git a/basis/tools/completion/completion.factor b/basis/tools/completion/completion.factor old mode 100755 new mode 100644 diff --git a/basis/tools/crossref/crossref-tests.factor b/basis/tools/crossref/crossref-tests.factor old mode 100755 new mode 100644 diff --git a/basis/tools/crossref/crossref.factor b/basis/tools/crossref/crossref.factor old mode 100755 new mode 100644 diff --git a/basis/tools/crossref/test/foo.factor b/basis/tools/crossref/test/foo.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/backend/backend.factor b/basis/tools/deploy/backend/backend.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/config/config-docs.factor b/basis/tools/deploy/config/config-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/config/config.factor b/basis/tools/deploy/config/config.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/deploy-docs.factor b/basis/tools/deploy/deploy-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/deploy-tests.factor b/basis/tools/deploy/deploy-tests.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/deploy.factor b/basis/tools/deploy/deploy.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/macosx/macosx.factor b/basis/tools/deploy/macosx/macosx.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/shaker/strip-cocoa.factor b/basis/tools/deploy/shaker/strip-cocoa.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/shaker/strip-debugger.factor b/basis/tools/deploy/shaker/strip-debugger.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/shaker/strip-libc.factor b/basis/tools/deploy/shaker/strip-libc.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/test/1/1.factor b/basis/tools/deploy/test/1/1.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/test/1/deploy.factor b/basis/tools/deploy/test/1/deploy.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/test/2/2.factor b/basis/tools/deploy/test/2/2.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/test/2/deploy.factor b/basis/tools/deploy/test/2/deploy.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/test/3/3.factor b/basis/tools/deploy/test/3/3.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/test/3/deploy.factor b/basis/tools/deploy/test/3/deploy.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/windows/windows-tests.factor b/basis/tools/deploy/windows/windows-tests.factor old mode 100755 new mode 100644 diff --git a/basis/tools/deploy/windows/windows.factor b/basis/tools/deploy/windows/windows.factor old mode 100755 new mode 100644 diff --git a/basis/tools/disassembler/disassembler-docs.factor b/basis/tools/disassembler/disassembler-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/disassembler/disassembler-tests.factor b/basis/tools/disassembler/disassembler-tests.factor old mode 100755 new mode 100644 diff --git a/basis/tools/disassembler/disassembler.factor b/basis/tools/disassembler/disassembler.factor old mode 100755 new mode 100644 diff --git a/basis/tools/memory/memory-docs.factor b/basis/tools/memory/memory-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/memory/memory.factor b/basis/tools/memory/memory.factor old mode 100755 new mode 100644 diff --git a/basis/tools/profiler/profiler-docs.factor b/basis/tools/profiler/profiler-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/profiler/profiler-tests.factor b/basis/tools/profiler/profiler-tests.factor old mode 100755 new mode 100644 diff --git a/basis/tools/profiler/profiler.factor b/basis/tools/profiler/profiler.factor old mode 100755 new mode 100644 diff --git a/basis/tools/test/test-docs.factor b/basis/tools/test/test-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/test/test.factor b/basis/tools/test/test.factor old mode 100755 new mode 100644 diff --git a/basis/tools/test/ui/ui.factor b/basis/tools/test/ui/ui.factor old mode 100755 new mode 100644 diff --git a/basis/tools/threads/threads.factor b/basis/tools/threads/threads.factor old mode 100755 new mode 100644 diff --git a/basis/tools/time/time-docs.factor b/basis/tools/time/time-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/vocabs/browser/browser-docs.factor b/basis/tools/vocabs/browser/browser-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/vocabs/browser/browser-tests.factor b/basis/tools/vocabs/browser/browser-tests.factor old mode 100755 new mode 100644 diff --git a/basis/tools/vocabs/browser/browser.factor b/basis/tools/vocabs/browser/browser.factor old mode 100755 new mode 100644 diff --git a/basis/tools/vocabs/monitor/monitor.factor b/basis/tools/vocabs/monitor/monitor.factor old mode 100755 new mode 100644 diff --git a/basis/tools/vocabs/vocabs-docs.factor b/basis/tools/vocabs/vocabs-docs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/vocabs/vocabs.factor b/basis/tools/vocabs/vocabs.factor old mode 100755 new mode 100644 diff --git a/basis/tools/walker/debug/debug.factor b/basis/tools/walker/debug/debug.factor old mode 100755 new mode 100644 diff --git a/basis/tools/walker/walker-tests.factor b/basis/tools/walker/walker-tests.factor old mode 100755 new mode 100644 diff --git a/basis/tools/walker/walker.factor b/basis/tools/walker/walker.factor old mode 100755 new mode 100644 diff --git a/basis/tuple-arrays/tuple-arrays-tests.factor b/basis/tuple-arrays/tuple-arrays-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/backend/backend.factor b/basis/ui/backend/backend.factor old mode 100755 new mode 100644 diff --git a/basis/ui/cocoa/cocoa.factor b/basis/ui/cocoa/cocoa.factor old mode 100755 new mode 100644 diff --git a/basis/ui/cocoa/tools/tools.factor b/basis/ui/cocoa/tools/tools.factor old mode 100755 new mode 100644 diff --git a/basis/ui/cocoa/views/views.factor b/basis/ui/cocoa/views/views.factor old mode 100755 new mode 100644 diff --git a/basis/ui/commands/commands.factor b/basis/ui/commands/commands.factor old mode 100755 new mode 100644 diff --git a/basis/ui/freetype/freetype-docs.factor b/basis/ui/freetype/freetype-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/freetype/freetype.factor b/basis/ui/freetype/freetype.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/books/books-docs.factor b/basis/ui/gadgets/books/books-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/books/books-tests.factor b/basis/ui/gadgets/books/books-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/books/books.factor b/basis/ui/gadgets/books/books.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/buttons/buttons-docs.factor b/basis/ui/gadgets/buttons/buttons-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/buttons/buttons-tests.factor b/basis/ui/gadgets/buttons/buttons-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/buttons/buttons.factor b/basis/ui/gadgets/buttons/buttons.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/canvas/canvas-tests.factor b/basis/ui/gadgets/canvas/canvas-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/canvas/canvas.factor b/basis/ui/gadgets/canvas/canvas.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/editors/editors-docs.factor b/basis/ui/gadgets/editors/editors-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/editors/editors-tests.factor b/basis/ui/gadgets/editors/editors-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/editors/editors.factor b/basis/ui/gadgets/editors/editors.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/frames/frames-docs.factor b/basis/ui/gadgets/frames/frames-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/gadgets-docs.factor b/basis/ui/gadgets/gadgets-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/gadgets-tests.factor b/basis/ui/gadgets/gadgets-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/gadgets.factor b/basis/ui/gadgets/gadgets.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/grid-lines/grid-lines-docs.factor b/basis/ui/gadgets/grid-lines/grid-lines-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/grid-lines/grid-lines.factor b/basis/ui/gadgets/grid-lines/grid-lines.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/grids/grids-docs.factor b/basis/ui/gadgets/grids/grids-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/incremental/incremental-docs.factor b/basis/ui/gadgets/incremental/incremental-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/incremental/incremental.factor b/basis/ui/gadgets/incremental/incremental.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/labelled/labelled-docs.factor b/basis/ui/gadgets/labelled/labelled-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/labelled/labelled.factor b/basis/ui/gadgets/labelled/labelled.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/labels/labels-docs.factor b/basis/ui/gadgets/labels/labels-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/labels/labels.factor b/basis/ui/gadgets/labels/labels.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/lists/lists-docs.factor b/basis/ui/gadgets/lists/lists-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/lists/lists.factor b/basis/ui/gadgets/lists/lists.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/menus/menus-docs.factor b/basis/ui/gadgets/menus/menus-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/packs/packs-docs.factor b/basis/ui/gadgets/packs/packs-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/packs/packs.factor b/basis/ui/gadgets/packs/packs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/panes/panes-docs.factor b/basis/ui/gadgets/panes/panes-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/panes/panes-tests.factor b/basis/ui/gadgets/panes/panes-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/panes/panes.factor b/basis/ui/gadgets/panes/panes.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/presentations/presentations-docs.factor b/basis/ui/gadgets/presentations/presentations-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/scrollers/scrollers-docs.factor b/basis/ui/gadgets/scrollers/scrollers-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/scrollers/scrollers-tests.factor b/basis/ui/gadgets/scrollers/scrollers-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/scrollers/scrollers.factor b/basis/ui/gadgets/scrollers/scrollers.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/sliders/sliders-docs.factor b/basis/ui/gadgets/sliders/sliders-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/sliders/sliders.factor b/basis/ui/gadgets/sliders/sliders.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/slots/slots.factor b/basis/ui/gadgets/slots/slots.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/status-bar/status-bar-docs.factor b/basis/ui/gadgets/status-bar/status-bar-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/status-bar/status-bar.factor b/basis/ui/gadgets/status-bar/status-bar.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/tracks/tracks-docs.factor b/basis/ui/gadgets/tracks/tracks-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/viewports/viewports-docs.factor b/basis/ui/gadgets/viewports/viewports-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/viewports/viewports.factor b/basis/ui/gadgets/viewports/viewports.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/worlds/worlds-docs.factor b/basis/ui/gadgets/worlds/worlds-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gadgets/worlds/worlds.factor b/basis/ui/gadgets/worlds/worlds.factor old mode 100755 new mode 100644 diff --git a/basis/ui/gestures/gestures.factor b/basis/ui/gestures/gestures.factor old mode 100755 new mode 100644 diff --git a/basis/ui/operations/operations-tests.factor b/basis/ui/operations/operations-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/operations/operations.factor b/basis/ui/operations/operations.factor old mode 100755 new mode 100644 diff --git a/basis/ui/render/render-docs.factor b/basis/ui/render/render-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/browser/browser-tests.factor b/basis/ui/tools/browser/browser-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/browser/browser.factor b/basis/ui/tools/browser/browser.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/debugger/debugger-docs.factor b/basis/ui/tools/debugger/debugger-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/deploy/deploy-docs.factor b/basis/ui/tools/deploy/deploy-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/deploy/deploy.factor b/basis/ui/tools/deploy/deploy.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/interactor/interactor-docs.factor b/basis/ui/tools/interactor/interactor-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/interactor/interactor-tests.factor b/basis/ui/tools/interactor/interactor-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/interactor/interactor.factor b/basis/ui/tools/interactor/interactor.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/listener/listener-tests.factor b/basis/ui/tools/listener/listener-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/listener/listener.factor b/basis/ui/tools/listener/listener.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/operations/operations.factor b/basis/ui/tools/operations/operations.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/profiler/profiler.factor b/basis/ui/tools/profiler/profiler.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/search/search-tests.factor b/basis/ui/tools/search/search-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/search/search.factor b/basis/ui/tools/search/search.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/tools-docs.factor b/basis/ui/tools/tools-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/tools-tests.factor b/basis/ui/tools/tools-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/tools.factor b/basis/ui/tools/tools.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/traceback/traceback.factor b/basis/ui/tools/traceback/traceback.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/walker/walker-docs.factor b/basis/ui/tools/walker/walker-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/walker/walker-tests.factor b/basis/ui/tools/walker/walker-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/walker/walker.factor b/basis/ui/tools/walker/walker.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/workspace/workspace-tests.factor b/basis/ui/tools/workspace/workspace-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/tools/workspace/workspace.factor b/basis/ui/tools/workspace/workspace.factor old mode 100755 new mode 100644 diff --git a/basis/ui/traverse/traverse-tests.factor b/basis/ui/traverse/traverse-tests.factor old mode 100755 new mode 100644 diff --git a/basis/ui/ui-docs.factor b/basis/ui/ui-docs.factor old mode 100755 new mode 100644 diff --git a/basis/ui/ui.factor b/basis/ui/ui.factor old mode 100755 new mode 100644 diff --git a/basis/ui/windows/windows.factor b/basis/ui/windows/windows.factor old mode 100755 new mode 100644 diff --git a/basis/ui/x11/x11.factor b/basis/ui/x11/x11.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/breaks/breaks-tests.factor b/basis/unicode/breaks/breaks-tests.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/breaks/breaks.factor b/basis/unicode/breaks/breaks.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/case/case-tests.factor b/basis/unicode/case/case-tests.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/case/case.factor b/basis/unicode/case/case.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/collation/collation-tests.factor b/basis/unicode/collation/collation-tests.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/collation/collation.factor b/basis/unicode/collation/collation.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/data/data.factor b/basis/unicode/data/data.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/normalize/normalize-tests.factor b/basis/unicode/normalize/normalize-tests.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/normalize/normalize.factor b/basis/unicode/normalize/normalize.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/script/script-docs.factor b/basis/unicode/script/script-docs.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/script/script-tests.factor b/basis/unicode/script/script-tests.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/script/script.factor b/basis/unicode/script/script.factor old mode 100755 new mode 100644 diff --git a/basis/unicode/syntax/syntax.factor b/basis/unicode/syntax/syntax.factor old mode 100755 new mode 100644 diff --git a/basis/unix/bsd/bsd.factor b/basis/unix/bsd/bsd.factor old mode 100755 new mode 100644 diff --git a/basis/unix/linux/ifreq/ifreq.factor b/basis/unix/linux/ifreq/ifreq.factor old mode 100755 new mode 100644 diff --git a/basis/unix/linux/linux.factor b/basis/unix/linux/linux.factor old mode 100755 new mode 100644 diff --git a/basis/unix/process/process.factor b/basis/unix/process/process.factor old mode 100755 new mode 100644 diff --git a/basis/unix/types/freebsd/freebsd.factor b/basis/unix/types/freebsd/freebsd.factor old mode 100755 new mode 100644 diff --git a/basis/unix/types/netbsd/32/32.factor b/basis/unix/types/netbsd/32/32.factor old mode 100755 new mode 100644 diff --git a/basis/unix/types/netbsd/64/64.factor b/basis/unix/types/netbsd/64/64.factor old mode 100755 new mode 100644 diff --git a/basis/unix/types/netbsd/netbsd.factor b/basis/unix/types/netbsd/netbsd.factor old mode 100755 new mode 100644 diff --git a/basis/unix/types/openbsd/openbsd.factor b/basis/unix/types/openbsd/openbsd.factor old mode 100755 new mode 100644 diff --git a/basis/unix/unix.factor b/basis/unix/unix.factor old mode 100755 new mode 100644 diff --git a/basis/values/values-docs.factor b/basis/values/values-docs.factor old mode 100755 new mode 100644 diff --git a/basis/values/values-tests.factor b/basis/values/values-tests.factor old mode 100755 new mode 100644 diff --git a/basis/values/values.factor b/basis/values/values.factor old mode 100755 new mode 100644 diff --git a/basis/windows/advapi32/advapi32.factor b/basis/windows/advapi32/advapi32.factor old mode 100755 new mode 100644 diff --git a/basis/windows/com/com-tests.factor b/basis/windows/com/com-tests.factor old mode 100755 new mode 100644 diff --git a/basis/windows/com/com.factor b/basis/windows/com/com.factor old mode 100755 new mode 100644 diff --git a/basis/windows/com/syntax/syntax-docs.factor b/basis/windows/com/syntax/syntax-docs.factor old mode 100755 new mode 100644 diff --git a/basis/windows/com/syntax/syntax.factor b/basis/windows/com/syntax/syntax.factor old mode 100755 new mode 100644 diff --git a/basis/windows/com/wrapper/wrapper-docs.factor b/basis/windows/com/wrapper/wrapper-docs.factor old mode 100755 new mode 100644 diff --git a/basis/windows/com/wrapper/wrapper.factor b/basis/windows/com/wrapper/wrapper.factor old mode 100755 new mode 100644 diff --git a/basis/windows/dinput/constants/constants.factor b/basis/windows/dinput/constants/constants.factor old mode 100755 new mode 100644 diff --git a/basis/windows/dinput/dinput.factor b/basis/windows/dinput/dinput.factor old mode 100755 new mode 100644 diff --git a/basis/windows/gdi32/gdi32.factor b/basis/windows/gdi32/gdi32.factor old mode 100755 new mode 100644 diff --git a/basis/windows/kernel32/kernel32.factor b/basis/windows/kernel32/kernel32.factor old mode 100755 new mode 100644 diff --git a/basis/windows/messages/messages.factor b/basis/windows/messages/messages.factor old mode 100755 new mode 100644 diff --git a/basis/windows/ole32/ole32.factor b/basis/windows/ole32/ole32.factor old mode 100755 new mode 100644 diff --git a/basis/windows/opengl32/opengl32.factor b/basis/windows/opengl32/opengl32.factor old mode 100755 new mode 100644 diff --git a/basis/windows/user32/user32.factor b/basis/windows/user32/user32.factor old mode 100755 new mode 100644 diff --git a/basis/windows/winsock/winsock.factor b/basis/windows/winsock/winsock.factor old mode 100755 new mode 100644 diff --git a/basis/x11/clipboard/clipboard.factor b/basis/x11/clipboard/clipboard.factor old mode 100755 new mode 100644 diff --git a/basis/x11/windows/windows.factor b/basis/x11/windows/windows.factor old mode 100755 new mode 100644 diff --git a/basis/x11/xim/xim.factor b/basis/x11/xim/xim.factor old mode 100755 new mode 100644 diff --git a/basis/x11/xlib/xlib.factor b/basis/x11/xlib/xlib.factor old mode 100755 new mode 100644 diff --git a/basis/xml-rpc/xml-rpc.factor b/basis/xml-rpc/xml-rpc.factor old mode 100755 new mode 100644 diff --git a/basis/xml/char-classes/char-classes.factor b/basis/xml/char-classes/char-classes.factor old mode 100755 new mode 100644 diff --git a/basis/xml/data/data.factor b/basis/xml/data/data.factor old mode 100755 new mode 100644 diff --git a/basis/xml/errors/errors-tests.factor b/basis/xml/errors/errors-tests.factor old mode 100755 new mode 100644 diff --git a/basis/xml/tests/soap.factor b/basis/xml/tests/soap.factor old mode 100755 new mode 100644 diff --git a/basis/xml/utilities/utilities.factor b/basis/xml/utilities/utilities.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/catalog/catalog.factor b/basis/xmode/catalog/catalog.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/code2html/code2html.factor b/basis/xmode/code2html/code2html.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/code2html/responder/responder.factor b/basis/xmode/code2html/responder/responder.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/loader/loader.factor b/basis/xmode/loader/loader.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/marker/marker-tests.factor b/basis/xmode/marker/marker-tests.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/marker/marker.factor b/basis/xmode/marker/marker.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/marker/state/state.factor b/basis/xmode/marker/state/state.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/rules/rules.factor b/basis/xmode/rules/rules.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/tokens/tokens.factor b/basis/xmode/tokens/tokens.factor old mode 100755 new mode 100644 diff --git a/basis/xmode/utilities/utilities-tests.factor b/basis/xmode/utilities/utilities-tests.factor old mode 100755 new mode 100644 diff --git a/core/alien/alien-docs.factor b/core/alien/alien-docs.factor old mode 100755 new mode 100644 diff --git a/core/alien/alien-tests.factor b/core/alien/alien-tests.factor old mode 100755 new mode 100644 diff --git a/core/alien/alien.factor b/core/alien/alien.factor old mode 100755 new mode 100644 diff --git a/core/arrays/arrays-docs.factor b/core/arrays/arrays-docs.factor old mode 100755 new mode 100644 diff --git a/core/arrays/arrays-tests.factor b/core/arrays/arrays-tests.factor old mode 100755 new mode 100644 diff --git a/core/arrays/arrays.factor b/core/arrays/arrays.factor old mode 100755 new mode 100644 diff --git a/core/assocs/assocs-docs.factor b/core/assocs/assocs-docs.factor old mode 100755 new mode 100644 diff --git a/core/assocs/assocs-tests.factor b/core/assocs/assocs-tests.factor old mode 100755 new mode 100644 diff --git a/core/assocs/assocs.factor b/core/assocs/assocs.factor old mode 100755 new mode 100644 diff --git a/core/bootstrap/layouts/layouts.factor b/core/bootstrap/layouts/layouts.factor old mode 100755 new mode 100644 diff --git a/core/bootstrap/primitives.factor b/core/bootstrap/primitives.factor old mode 100755 new mode 100644 diff --git a/core/bootstrap/stage1.factor b/core/bootstrap/stage1.factor old mode 100755 new mode 100644 diff --git a/core/bootstrap/syntax.factor b/core/bootstrap/syntax.factor old mode 100755 new mode 100644 diff --git a/core/byte-arrays/byte-arrays-docs.factor b/core/byte-arrays/byte-arrays-docs.factor old mode 100755 new mode 100644 diff --git a/core/byte-arrays/byte-arrays-tests.factor b/core/byte-arrays/byte-arrays-tests.factor old mode 100755 new mode 100644 diff --git a/core/byte-arrays/byte-arrays.factor b/core/byte-arrays/byte-arrays.factor old mode 100755 new mode 100644 diff --git a/core/byte-vectors/byte-vectors-docs.factor b/core/byte-vectors/byte-vectors-docs.factor old mode 100755 new mode 100644 diff --git a/core/byte-vectors/byte-vectors-tests.factor b/core/byte-vectors/byte-vectors-tests.factor old mode 100755 new mode 100644 diff --git a/core/byte-vectors/byte-vectors.factor b/core/byte-vectors/byte-vectors.factor old mode 100755 new mode 100644 diff --git a/core/checksums/crc32/crc32.factor b/core/checksums/crc32/crc32.factor old mode 100755 new mode 100644 diff --git a/core/classes/algebra/algebra-docs.factor b/core/classes/algebra/algebra-docs.factor old mode 100755 new mode 100644 diff --git a/core/classes/algebra/algebra-tests.factor b/core/classes/algebra/algebra-tests.factor old mode 100755 new mode 100644 diff --git a/core/classes/algebra/algebra.factor b/core/classes/algebra/algebra.factor old mode 100755 new mode 100644 diff --git a/core/classes/classes-docs.factor b/core/classes/classes-docs.factor old mode 100755 new mode 100644 diff --git a/core/classes/classes-tests.factor b/core/classes/classes-tests.factor old mode 100755 new mode 100644 diff --git a/core/classes/classes.factor b/core/classes/classes.factor old mode 100755 new mode 100644 diff --git a/core/classes/mixin/mixin-docs.factor b/core/classes/mixin/mixin-docs.factor old mode 100755 new mode 100644 diff --git a/core/classes/mixin/mixin.factor b/core/classes/mixin/mixin.factor old mode 100755 new mode 100644 diff --git a/core/classes/predicate/predicate-docs.factor b/core/classes/predicate/predicate-docs.factor old mode 100755 new mode 100644 diff --git a/core/classes/predicate/predicate.factor b/core/classes/predicate/predicate.factor old mode 100755 new mode 100644 diff --git a/core/classes/singleton/singleton.factor b/core/classes/singleton/singleton.factor old mode 100755 new mode 100644 diff --git a/core/classes/tuple/tuple-docs.factor b/core/classes/tuple/tuple-docs.factor old mode 100755 new mode 100644 diff --git a/core/classes/tuple/tuple-tests.factor b/core/classes/tuple/tuple-tests.factor old mode 100755 new mode 100644 diff --git a/core/classes/tuple/tuple.factor b/core/classes/tuple/tuple.factor old mode 100755 new mode 100644 diff --git a/core/classes/union/union-docs.factor b/core/classes/union/union-docs.factor old mode 100755 new mode 100644 diff --git a/core/classes/union/union.factor b/core/classes/union/union.factor old mode 100755 new mode 100644 diff --git a/core/combinators/combinators-docs.factor b/core/combinators/combinators-docs.factor old mode 100755 new mode 100644 diff --git a/core/combinators/combinators-tests.factor b/core/combinators/combinators-tests.factor old mode 100755 new mode 100644 diff --git a/core/combinators/combinators.factor b/core/combinators/combinators.factor old mode 100755 new mode 100644 diff --git a/core/compiler/errors/errors-docs.factor b/core/compiler/errors/errors-docs.factor old mode 100755 new mode 100644 diff --git a/core/compiler/errors/errors.factor b/core/compiler/errors/errors.factor old mode 100755 new mode 100644 diff --git a/core/compiler/units/units-docs.factor b/core/compiler/units/units-docs.factor old mode 100755 new mode 100644 diff --git a/core/compiler/units/units.factor b/core/compiler/units/units.factor old mode 100755 new mode 100644 diff --git a/core/continuations/continuations-docs.factor b/core/continuations/continuations-docs.factor old mode 100755 new mode 100644 diff --git a/core/continuations/continuations-tests.factor b/core/continuations/continuations-tests.factor old mode 100755 new mode 100644 diff --git a/core/continuations/continuations.factor b/core/continuations/continuations.factor old mode 100755 new mode 100644 diff --git a/core/definitions/definitions-docs.factor b/core/definitions/definitions-docs.factor old mode 100755 new mode 100644 diff --git a/core/definitions/definitions-tests.factor b/core/definitions/definitions-tests.factor old mode 100755 new mode 100644 diff --git a/core/definitions/definitions.factor b/core/definitions/definitions.factor old mode 100755 new mode 100644 diff --git a/core/destructors/destructors-docs.factor b/core/destructors/destructors-docs.factor old mode 100755 new mode 100644 diff --git a/core/destructors/destructors-tests.factor b/core/destructors/destructors-tests.factor old mode 100755 new mode 100644 diff --git a/core/destructors/destructors.factor b/core/destructors/destructors.factor old mode 100755 new mode 100644 diff --git a/core/effects/effects.factor b/core/effects/effects.factor old mode 100755 new mode 100644 diff --git a/core/generic/generic-docs.factor b/core/generic/generic-docs.factor old mode 100755 new mode 100644 diff --git a/core/generic/generic-tests.factor b/core/generic/generic-tests.factor old mode 100755 new mode 100644 diff --git a/core/generic/generic.factor b/core/generic/generic.factor old mode 100755 new mode 100644 diff --git a/core/generic/math/math-docs.factor b/core/generic/math/math-docs.factor old mode 100755 new mode 100644 diff --git a/core/generic/math/math.factor b/core/generic/math/math.factor old mode 100755 new mode 100644 diff --git a/core/growable/growable-docs.factor b/core/growable/growable-docs.factor old mode 100755 new mode 100644 diff --git a/core/growable/growable-tests.factor b/core/growable/growable-tests.factor old mode 100755 new mode 100644 diff --git a/core/hashtables/hashtables-docs.factor b/core/hashtables/hashtables-docs.factor old mode 100755 new mode 100644 diff --git a/core/hashtables/hashtables-tests.factor b/core/hashtables/hashtables-tests.factor old mode 100755 new mode 100644 diff --git a/core/hashtables/hashtables.factor b/core/hashtables/hashtables.factor old mode 100755 new mode 100644 diff --git a/core/init/init.factor b/core/init/init.factor old mode 100755 new mode 100644 diff --git a/core/io/backend/backend-tests.factor b/core/io/backend/backend-tests.factor old mode 100755 new mode 100644 diff --git a/core/io/backend/backend.factor b/core/io/backend/backend.factor old mode 100755 new mode 100644 diff --git a/core/io/binary/binary-tests.factor b/core/io/binary/binary-tests.factor old mode 100755 new mode 100644 diff --git a/core/io/binary/binary.factor b/core/io/binary/binary.factor old mode 100755 new mode 100644 diff --git a/core/io/encodings/binary/binary.factor b/core/io/encodings/binary/binary.factor old mode 100755 new mode 100644 diff --git a/core/io/encodings/encodings-tests.factor b/core/io/encodings/encodings-tests.factor old mode 100755 new mode 100644 diff --git a/core/io/encodings/encodings.factor b/core/io/encodings/encodings.factor old mode 100755 new mode 100644 diff --git a/core/io/encodings/utf8/utf8-docs.factor b/core/io/encodings/utf8/utf8-docs.factor old mode 100755 new mode 100644 diff --git a/core/io/encodings/utf8/utf8-tests.factor b/core/io/encodings/utf8/utf8-tests.factor old mode 100755 new mode 100644 diff --git a/core/io/encodings/utf8/utf8.factor b/core/io/encodings/utf8/utf8.factor old mode 100755 new mode 100644 diff --git a/core/io/files/files-docs.factor b/core/io/files/files-docs.factor old mode 100755 new mode 100644 diff --git a/core/io/files/files-tests.factor b/core/io/files/files-tests.factor old mode 100755 new mode 100644 diff --git a/core/io/files/files.factor b/core/io/files/files.factor old mode 100755 new mode 100644 diff --git a/core/io/io-docs.factor b/core/io/io-docs.factor old mode 100755 new mode 100644 diff --git a/core/io/io-tests.factor b/core/io/io-tests.factor old mode 100755 new mode 100644 diff --git a/core/io/io.factor b/core/io/io.factor old mode 100755 new mode 100644 diff --git a/core/io/streams/c/c-docs.factor b/core/io/streams/c/c-docs.factor old mode 100755 new mode 100644 diff --git a/core/io/streams/c/c-tests.factor b/core/io/streams/c/c-tests.factor old mode 100755 new mode 100644 diff --git a/core/io/streams/c/c.factor b/core/io/streams/c/c.factor old mode 100755 new mode 100644 diff --git a/core/io/streams/nested/nested.factor b/core/io/streams/nested/nested.factor old mode 100755 new mode 100644 diff --git a/core/io/streams/string/string.factor b/core/io/streams/string/string.factor old mode 100755 new mode 100644 diff --git a/core/kernel/kernel-docs.factor b/core/kernel/kernel-docs.factor old mode 100755 new mode 100644 diff --git a/core/kernel/kernel-tests.factor b/core/kernel/kernel-tests.factor old mode 100755 new mode 100644 diff --git a/core/kernel/kernel.factor b/core/kernel/kernel.factor old mode 100755 new mode 100644 diff --git a/core/layouts/layouts-docs.factor b/core/layouts/layouts-docs.factor old mode 100755 new mode 100644 diff --git a/core/layouts/layouts-tests.factor b/core/layouts/layouts-tests.factor old mode 100755 new mode 100644 diff --git a/core/layouts/layouts.factor b/core/layouts/layouts.factor old mode 100755 new mode 100644 diff --git a/core/math/floats/floats-tests.factor b/core/math/floats/floats-tests.factor old mode 100755 new mode 100644 diff --git a/core/math/floats/floats.factor b/core/math/floats/floats.factor old mode 100755 new mode 100644 diff --git a/core/math/integers/integers-docs.factor b/core/math/integers/integers-docs.factor old mode 100755 new mode 100644 diff --git a/core/math/integers/integers-tests.factor b/core/math/integers/integers-tests.factor old mode 100755 new mode 100644 diff --git a/core/math/integers/integers.factor b/core/math/integers/integers.factor old mode 100755 new mode 100644 diff --git a/core/math/math-docs.factor b/core/math/math-docs.factor old mode 100755 new mode 100644 diff --git a/core/math/math.factor b/core/math/math.factor old mode 100755 new mode 100644 diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor old mode 100755 new mode 100644 diff --git a/core/math/parser/parser.factor b/core/math/parser/parser.factor old mode 100755 new mode 100644 diff --git a/core/memory/memory-docs.factor b/core/memory/memory-docs.factor old mode 100755 new mode 100644 diff --git a/core/memory/memory-tests.factor b/core/memory/memory-tests.factor old mode 100755 new mode 100644 diff --git a/core/namespaces/namespaces-docs.factor b/core/namespaces/namespaces-docs.factor old mode 100755 new mode 100644 diff --git a/core/parser/parser-docs.factor b/core/parser/parser-docs.factor old mode 100755 new mode 100644 diff --git a/core/parser/parser-tests.factor b/core/parser/parser-tests.factor old mode 100755 new mode 100644 diff --git a/core/parser/parser.factor b/core/parser/parser.factor old mode 100755 new mode 100644 diff --git a/core/parser/test/assert-depth.factor b/core/parser/test/assert-depth.factor old mode 100755 new mode 100644 diff --git a/core/quotations/quotations-docs.factor b/core/quotations/quotations-docs.factor old mode 100755 new mode 100644 diff --git a/core/quotations/quotations-tests.factor b/core/quotations/quotations-tests.factor old mode 100755 new mode 100644 diff --git a/core/quotations/quotations.factor b/core/quotations/quotations.factor old mode 100755 new mode 100644 diff --git a/core/sbufs/sbufs.factor b/core/sbufs/sbufs.factor old mode 100755 new mode 100644 diff --git a/core/sequences/sequences-docs.factor b/core/sequences/sequences-docs.factor old mode 100755 new mode 100644 diff --git a/core/sequences/sequences-tests.factor b/core/sequences/sequences-tests.factor old mode 100755 new mode 100644 diff --git a/core/sequences/sequences.factor b/core/sequences/sequences.factor old mode 100755 new mode 100644 diff --git a/core/slots/slots-docs.factor b/core/slots/slots-docs.factor old mode 100755 new mode 100644 diff --git a/core/slots/slots.factor b/core/slots/slots.factor old mode 100755 new mode 100644 diff --git a/core/sorting/sorting-tests.factor b/core/sorting/sorting-tests.factor old mode 100755 new mode 100644 diff --git a/core/sorting/sorting.factor b/core/sorting/sorting.factor old mode 100755 new mode 100644 diff --git a/core/source-files/source-files-docs.factor b/core/source-files/source-files-docs.factor old mode 100755 new mode 100644 diff --git a/core/source-files/source-files.factor b/core/source-files/source-files.factor old mode 100755 new mode 100644 diff --git a/core/splitting/splitting.factor b/core/splitting/splitting.factor old mode 100755 new mode 100644 diff --git a/core/strings/strings-docs.factor b/core/strings/strings-docs.factor old mode 100755 new mode 100644 diff --git a/core/strings/strings-tests.factor b/core/strings/strings-tests.factor old mode 100755 new mode 100644 diff --git a/core/strings/strings.factor b/core/strings/strings.factor old mode 100755 new mode 100644 diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor old mode 100755 new mode 100644 diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor old mode 100755 new mode 100644 diff --git a/core/system/system-docs.factor b/core/system/system-docs.factor old mode 100755 new mode 100644 diff --git a/core/system/system-tests.factor b/core/system/system-tests.factor old mode 100755 new mode 100644 diff --git a/core/system/system.factor b/core/system/system.factor old mode 100755 new mode 100644 diff --git a/core/vectors/vectors-docs.factor b/core/vectors/vectors-docs.factor old mode 100755 new mode 100644 diff --git a/core/vectors/vectors-tests.factor b/core/vectors/vectors-tests.factor old mode 100755 new mode 100644 diff --git a/core/vectors/vectors.factor b/core/vectors/vectors.factor old mode 100755 new mode 100644 diff --git a/core/vocabs/loader/loader-docs.factor b/core/vocabs/loader/loader-docs.factor old mode 100755 new mode 100644 diff --git a/core/vocabs/loader/loader-tests.factor b/core/vocabs/loader/loader-tests.factor old mode 100755 new mode 100644 diff --git a/core/vocabs/loader/loader.factor b/core/vocabs/loader/loader.factor old mode 100755 new mode 100644 diff --git a/core/vocabs/loader/test/a/a.factor b/core/vocabs/loader/test/a/a.factor old mode 100755 new mode 100644 diff --git a/core/vocabs/loader/test/b/b.factor b/core/vocabs/loader/test/b/b.factor old mode 100755 new mode 100644 diff --git a/core/vocabs/vocabs-docs.factor b/core/vocabs/vocabs-docs.factor old mode 100755 new mode 100644 diff --git a/core/vocabs/vocabs.factor b/core/vocabs/vocabs.factor old mode 100755 new mode 100644 diff --git a/core/words/words-docs.factor b/core/words/words-docs.factor old mode 100755 new mode 100644 diff --git a/core/words/words-tests.factor b/core/words/words-tests.factor old mode 100755 new mode 100644 diff --git a/core/words/words.factor b/core/words/words.factor old mode 100755 new mode 100644 From d657b52eb1523d539e6b6046f0c3363f421c4a3f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 10:52:13 -0500 Subject: [PATCH 030/948] Remove really obsolete stuff from unmaintained --- .../assoc-heaps/assoc-heaps-tests.factor | 55 -------- unmaintained/assoc-heaps/assoc-heaps.factor | 45 ------ unmaintained/assoc-heaps/authors.txt | 1 - unmaintained/assoc-heaps/summary.txt | 1 - unmaintained/webapps/help/authors.txt | 1 - unmaintained/webapps/help/help.factor | 89 ------------ .../webapps/pastebin/annotate-paste.furnace | 47 ------- .../webapps/pastebin/annotation.furnace | 11 -- unmaintained/webapps/pastebin/authors.txt | 1 - unmaintained/webapps/pastebin/footer.furnace | 3 - unmaintained/webapps/pastebin/header.furnace | 23 ---- unmaintained/webapps/pastebin/modes.furnace | 7 - .../webapps/pastebin/new-paste.furnace | 51 ------- .../webapps/pastebin/paste-list.furnace | 33 ----- .../webapps/pastebin/paste-summary.furnace | 12 -- unmaintained/webapps/pastebin/pastebin.factor | 119 ---------------- .../webapps/pastebin/show-paste.furnace | 21 --- unmaintained/webapps/pastebin/style.css | 41 ------ unmaintained/webapps/pastebin/syntax.furnace | 3 - unmaintained/webapps/planet/authors.txt | 1 - unmaintained/webapps/planet/planet.factor | 129 ------------------ unmaintained/webapps/planet/planet.furnace | 45 ------ unmaintained/webapps/planet/style.css | 45 ------ unmaintained/wee-url/load.factor | 4 - unmaintained/wee-url/responder.factor | 91 ------------ unmaintained/wee-url/wee-url.factor | 89 ------------ 26 files changed, 968 deletions(-) delete mode 100644 unmaintained/assoc-heaps/assoc-heaps-tests.factor delete mode 100755 unmaintained/assoc-heaps/assoc-heaps.factor delete mode 100755 unmaintained/assoc-heaps/authors.txt delete mode 100755 unmaintained/assoc-heaps/summary.txt delete mode 100755 unmaintained/webapps/help/authors.txt delete mode 100644 unmaintained/webapps/help/help.factor delete mode 100755 unmaintained/webapps/pastebin/annotate-paste.furnace delete mode 100755 unmaintained/webapps/pastebin/annotation.furnace delete mode 100755 unmaintained/webapps/pastebin/authors.txt delete mode 100644 unmaintained/webapps/pastebin/footer.furnace delete mode 100644 unmaintained/webapps/pastebin/header.furnace delete mode 100644 unmaintained/webapps/pastebin/modes.furnace delete mode 100755 unmaintained/webapps/pastebin/new-paste.furnace delete mode 100644 unmaintained/webapps/pastebin/paste-list.furnace delete mode 100644 unmaintained/webapps/pastebin/paste-summary.furnace delete mode 100755 unmaintained/webapps/pastebin/pastebin.factor delete mode 100755 unmaintained/webapps/pastebin/show-paste.furnace delete mode 100644 unmaintained/webapps/pastebin/style.css delete mode 100755 unmaintained/webapps/pastebin/syntax.furnace delete mode 100755 unmaintained/webapps/planet/authors.txt delete mode 100755 unmaintained/webapps/planet/planet.factor delete mode 100644 unmaintained/webapps/planet/planet.furnace delete mode 100644 unmaintained/webapps/planet/style.css delete mode 100644 unmaintained/wee-url/load.factor delete mode 100644 unmaintained/wee-url/responder.factor delete mode 100644 unmaintained/wee-url/wee-url.factor diff --git a/unmaintained/assoc-heaps/assoc-heaps-tests.factor b/unmaintained/assoc-heaps/assoc-heaps-tests.factor deleted file mode 100644 index 24a7730847..0000000000 --- a/unmaintained/assoc-heaps/assoc-heaps-tests.factor +++ /dev/null @@ -1,55 +0,0 @@ -USING: assocs assoc-heaps heaps heaps.private kernel tools.test ; -IN: temporary - -[ -T{ - assoc-heap - f - H{ { 2 1 } } - T{ min-heap T{ heap f V{ { 1 2 } } } } -} -] [ H{ } clone 1 2 pick heap-push ] unit-test - -[ -T{ - assoc-heap - f - H{ { 1 0 } { 2 1 } } - T{ min-heap T{ heap f V{ { 0 1 } { 1 2 } } } } -} -] [ H{ } clone 1 2 pick heap-push 0 1 pick heap-push ] unit-test - -[ T{ assoc-heap f H{ } T{ min-heap T{ heap f V{ } } } } ] -[ - H{ } clone - 1 2 pick heap-push 0 1 pick heap-push - dup heap-pop 2drop dup heap-pop 2drop -] unit-test - - -[ 0 1 ] [ -T{ - assoc-heap - f - H{ { 1 0 } { 2 1 } } - T{ min-heap T{ heap f V{ { 0 1 } { 1 2 } } } } -} heap-pop -] unit-test - -[ 1 2 ] [ -T{ - assoc-heap - f - H{ { 1 0 } { 2 1 } } - T{ max-heap T{ heap f V{ { 1 2 } { 0 1 } } } } -} heap-pop -] unit-test - -[ -T{ - assoc-heap - f - H{ { 1 2 } { 3 4 } } - T{ min-heap T{ heap f V{ { 2 1 } { 4 3 } } } } -} -] [ H{ { 1 2 } { 3 4 } } H{ } clone [ heap-push-all ] keep ] unit-test diff --git a/unmaintained/assoc-heaps/assoc-heaps.factor b/unmaintained/assoc-heaps/assoc-heaps.factor deleted file mode 100755 index 55a5aa7f62..0000000000 --- a/unmaintained/assoc-heaps/assoc-heaps.factor +++ /dev/null @@ -1,45 +0,0 @@ -USING: assocs heaps kernel sequences ; -IN: assoc-heaps - -TUPLE: assoc-heap assoc heap ; - -INSTANCE: assoc-heap assoc -INSTANCE: assoc-heap priority-queue - -C: assoc-heap - -: ( assoc -- obj ) ; -: ( assoc -- obj ) ; - -M: assoc-heap at* ( key assoc-heap -- value ? ) - assoc-heap-assoc at* ; - -M: assoc-heap assoc-size ( assoc-heap -- n ) - assoc-heap-assoc assoc-size ; - -TUPLE: assoc-heap-key-exists ; - -: check-key-exists ( key assoc-heap -- ) - assoc-heap-assoc key? - [ \ assoc-heap-key-exists construct-empty throw ] when ; - -M: assoc-heap set-at ( value key assoc-heap -- ) - [ check-key-exists ] 2keep - [ assoc-heap-assoc set-at ] 3keep - assoc-heap-heap swapd heap-push ; - -M: assoc-heap heap-empty? ( assoc-heap -- ? ) - assoc-heap-assoc assoc-empty? ; - -M: assoc-heap heap-length ( assoc-heap -- n ) - assoc-heap-assoc assoc-size ; - -M: assoc-heap heap-peek ( assoc-heap -- value key ) - assoc-heap-heap heap-peek ; - -M: assoc-heap heap-push ( value key assoc-heap -- ) - set-at ; - -M: assoc-heap heap-pop ( assoc-heap -- value key ) - dup assoc-heap-heap heap-pop swap - rot dupd assoc-heap-assoc delete-at ; diff --git a/unmaintained/assoc-heaps/authors.txt b/unmaintained/assoc-heaps/authors.txt deleted file mode 100755 index 7c1b2f2279..0000000000 --- a/unmaintained/assoc-heaps/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Doug Coleman diff --git a/unmaintained/assoc-heaps/summary.txt b/unmaintained/assoc-heaps/summary.txt deleted file mode 100755 index 07ae2e33f8..0000000000 --- a/unmaintained/assoc-heaps/summary.txt +++ /dev/null @@ -1 +0,0 @@ -Priority search queues diff --git a/unmaintained/webapps/help/authors.txt b/unmaintained/webapps/help/authors.txt deleted file mode 100755 index 1901f27a24..0000000000 --- a/unmaintained/webapps/help/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Slava Pestov diff --git a/unmaintained/webapps/help/help.factor b/unmaintained/webapps/help/help.factor deleted file mode 100644 index 28d73607ba..0000000000 --- a/unmaintained/webapps/help/help.factor +++ /dev/null @@ -1,89 +0,0 @@ -! Copyright (C) 2005, 2007 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: kernel furnace furnace.validator http.server.responders - help help.topics html splitting sequences words strings - quotations macros vocabs tools.browser combinators - arrays io.files ; -IN: webapps.help - -! : string>topic ( string -- topic ) - ! " " split dup length 1 = [ first ] when ; - -: show-help ( topic -- ) - serving-html - dup article-title [ - [ help ] with-html-stream - ] simple-html-document ; - -\ show-help { - { "topic" } -} define-action -\ show-help { { "topic" "handbook" } } default-values - -M: link browser-link-href - link-name - dup word? over f eq? or [ - browser-link-href - ] [ - dup array? [ " " join ] when - [ show-help ] curry quot-link - ] if ; - -: show-word ( word vocab -- ) - lookup show-help ; - -\ show-word { - { "word" } - { "vocab" } -} define-action -\ show-word { { "word" "call" } { "vocab" "kernel" } } default-values - -M: f browser-link-href - drop \ f browser-link-href ; - -M: word browser-link-href - dup word-name swap word-vocabulary - [ show-word ] 2curry quot-link ; - -: show-vocab ( vocab -- ) - f >vocab-link show-help ; - -\ show-vocab { - { "vocab" } -} define-action - -\ show-vocab { { "vocab" "kernel" } } default-values - -M: vocab-spec browser-link-href - vocab-name [ show-vocab ] curry quot-link ; - -: show-vocabs-tagged ( tag -- ) - show-help ; - -\ show-vocabs-tagged { - { "tag" } -} define-action - -M: vocab-tag browser-link-href - vocab-tag-name [ show-vocabs-tagged ] curry quot-link ; - -: show-vocabs-by ( author -- ) - show-help ; - -\ show-vocabs-by { - { "author" } -} define-action - -M: vocab-author browser-link-href - vocab-author-name [ show-vocabs-by ] curry quot-link ; - -"help" "show-help" "extra/webapps/help" web-app - -! Hard-coding for factorcode.org -PREDICATE: pathname resource-pathname - pathname-string "resource:" head? ; - -M: resource-pathname browser-link-href - pathname-string - "resource:" ?head drop - "/responder/source/" swap append ; diff --git a/unmaintained/webapps/pastebin/annotate-paste.furnace b/unmaintained/webapps/pastebin/annotate-paste.furnace deleted file mode 100755 index 14a424f776..0000000000 --- a/unmaintained/webapps/pastebin/annotate-paste.furnace +++ /dev/null @@ -1,47 +0,0 @@ -<% USING: io math math.parser namespaces furnace ; %> - -

Annotate

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary:" /><% "summary" "*Required" render-error %>
Your name:" /><% "author" "*Required" render-error %>
File type:<% "modes" render-template %>
<% "contents" "*Required" render-error %>
Content:
- -string write %>" /> - - -
diff --git a/unmaintained/webapps/pastebin/annotation.furnace b/unmaintained/webapps/pastebin/annotation.furnace deleted file mode 100755 index e59db32484..0000000000 --- a/unmaintained/webapps/pastebin/annotation.furnace +++ /dev/null @@ -1,11 +0,0 @@ -<% USING: namespaces io furnace calendar ; %> - -

Annotation: <% "summary" get write %>

- - - - - -
Annotation by:<% "author" get write %>
File type:<% "mode" get write %>
Created:<% "date" get timestamp>string write %>
- -<% "syntax" render-template %> diff --git a/unmaintained/webapps/pastebin/authors.txt b/unmaintained/webapps/pastebin/authors.txt deleted file mode 100755 index 1901f27a24..0000000000 --- a/unmaintained/webapps/pastebin/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Slava Pestov diff --git a/unmaintained/webapps/pastebin/footer.furnace b/unmaintained/webapps/pastebin/footer.furnace deleted file mode 100644 index 15b90110a0..0000000000 --- a/unmaintained/webapps/pastebin/footer.furnace +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/unmaintained/webapps/pastebin/header.furnace b/unmaintained/webapps/pastebin/header.furnace deleted file mode 100644 index 2c8e79a18d..0000000000 --- a/unmaintained/webapps/pastebin/header.furnace +++ /dev/null @@ -1,23 +0,0 @@ -<% USING: namespaces io furnace sequences xmode.code2html webapps.pastebin ; %> - - - - - - - - <% "title" get write %> - - <% default-stylesheet %> - - - - - - -

<% "title" get write %>

diff --git a/unmaintained/webapps/pastebin/modes.furnace b/unmaintained/webapps/pastebin/modes.furnace deleted file mode 100644 index 18bbec180a..0000000000 --- a/unmaintained/webapps/pastebin/modes.furnace +++ /dev/null @@ -1,7 +0,0 @@ -<% USING: furnace xmode.catalog sequences kernel html.elements assocs io sorting continuations ; %> - - diff --git a/unmaintained/webapps/pastebin/new-paste.furnace b/unmaintained/webapps/pastebin/new-paste.furnace deleted file mode 100755 index b21e19734d..0000000000 --- a/unmaintained/webapps/pastebin/new-paste.furnace +++ /dev/null @@ -1,51 +0,0 @@ -<% USING: continuations furnace namespaces ; %> - -<% - "New paste" "title" set - "header" render-template -%> - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Summary:" /><% "summary" "*Required" render-error %>
Your name:" /><% "author" "*Required" render-error %>
File type:<% "modes" render-template %>
<% "contents" "*Required" render-error %>
Content:
- - - -
- -<% "footer" render-template %> diff --git a/unmaintained/webapps/pastebin/paste-list.furnace b/unmaintained/webapps/pastebin/paste-list.furnace deleted file mode 100644 index 51813ecf97..0000000000 --- a/unmaintained/webapps/pastebin/paste-list.furnace +++ /dev/null @@ -1,33 +0,0 @@ -<% USING: namespaces furnace sequences ; %> - -<% - "Pastebin" "title" set - "header" render-template -%> - - - - - - -
- - - - - - - <% "pastes" get [ "paste-summary" render-component ] each %> -
Summary:Paste by:Date:
-
-
-

This pastebin is written in Factor. It is inspired by lisppaste. -

-

It can be used for collaborative development over IRC. You can post code for review, and annotate other people's code. Syntax highlighting for over a hundred file types is supported. -

-

- <% "webapps.pastebin" browse-webapp-source %>

-
-
- -<% "footer" render-template %> diff --git a/unmaintained/webapps/pastebin/paste-summary.furnace b/unmaintained/webapps/pastebin/paste-summary.furnace deleted file mode 100644 index dc25fe1924..0000000000 --- a/unmaintained/webapps/pastebin/paste-summary.furnace +++ /dev/null @@ -1,12 +0,0 @@ -<% USING: continuations namespaces io kernel math math.parser -furnace webapps.pastebin calendar sequences ; %> - - - - - <% "summary" get write %> - - - <% "author" get write %> - <% "date" get timestamp>string write %> - diff --git a/unmaintained/webapps/pastebin/pastebin.factor b/unmaintained/webapps/pastebin/pastebin.factor deleted file mode 100755 index 36a72795db..0000000000 --- a/unmaintained/webapps/pastebin/pastebin.factor +++ /dev/null @@ -1,119 +0,0 @@ -USING: calendar furnace furnace.validator io.files kernel -namespaces sequences http.server.responders html math.parser rss -xml.writer xmode.code2html math calendar.format ; -IN: webapps.pastebin - -TUPLE: pastebin pastes ; - -: ( -- pastebin ) - V{ } clone pastebin construct-boa ; - - pastebin set-global - -TUPLE: paste -summary author channel mode contents date -annotations n ; - -: ( summary author channel mode contents -- paste ) - f V{ } clone f paste construct-boa ; - -TUPLE: annotation summary author mode contents ; - -C: annotation - -: get-paste ( n -- paste ) - pastebin get pastebin-pastes nth ; - -: show-paste ( n -- ) - serving-html - get-paste - [ "show-paste" render-component ] with-html-stream ; - -\ show-paste { { "n" v-number } } define-action - -: new-paste ( -- ) - serving-html - [ "new-paste" render-template ] with-html-stream ; - -\ new-paste { } define-action - -: paste-list ( -- ) - serving-html - [ - [ show-paste ] "show-paste-quot" set - [ new-paste ] "new-paste-quot" set - pastebin get "paste-list" render-component - ] with-html-stream ; - -\ paste-list { } define-action - -: paste-link ( paste -- link ) - paste-n number>string [ show-paste ] curry quot-link ; - -: safe-head ( seq n -- seq' ) - over length min head ; - -: paste-feed ( -- entries ) - pastebin get pastebin-pastes 20 safe-head [ - { - paste-summary - paste-link - paste-date - } get-slots timestamp>rfc3339 f swap - ] map ; - -: feed.xml ( -- ) - "text/xml" serving-content - "pastebin" - "http://pastebin.factorcode.org" - paste-feed feed>xml write-xml ; - -\ feed.xml { } define-action - -: add-paste ( paste pastebin -- ) - >r now over set-paste-date r> - pastebin-pastes 2dup length swap set-paste-n push ; - -: submit-paste ( summary author channel mode contents -- ) - [ pastebin get add-paste ] keep - paste-link permanent-redirect ; - -\ new-paste -\ submit-paste { - { "summary" v-required } - { "author" v-required } - { "channel" } - { "mode" v-required } - { "contents" v-required } -} define-form - -\ new-paste { - { "channel" "#concatenative" } - { "mode" "factor" } -} default-values - -: annotate-paste ( n summary author mode contents -- ) - swap get-paste - [ paste-annotations push ] keep - paste-link permanent-redirect ; - -[ "n" show-paste ] -\ annotate-paste { - { "n" v-required v-number } - { "summary" v-required } - { "author" v-required } - { "mode" v-required } - { "contents" v-required } -} define-form - -\ show-paste { - { "mode" "factor" } -} default-values - -: style.css ( -- ) - "text/css" serving-content - "style.css" send-resource ; - -\ style.css { } define-action - -"pastebin" "paste-list" "extra/webapps/pastebin" web-app diff --git a/unmaintained/webapps/pastebin/show-paste.furnace b/unmaintained/webapps/pastebin/show-paste.furnace deleted file mode 100755 index 30129eda24..0000000000 --- a/unmaintained/webapps/pastebin/show-paste.furnace +++ /dev/null @@ -1,21 +0,0 @@ -<% USING: namespaces io furnace sequences xmode.code2html calendar ; %> - -<% - "Paste: " "summary" get append "title" set - "header" render-template -%> - - - - - - -
Paste by:<% "author" get write %>
Created:<% "date" get timestamp>string write %>
File type:<% "mode" get write %>
- -<% "syntax" render-template %> - -<% "annotations" get [ "annotation" render-component ] each %> - -<% model get "annotate-paste" render-component %> - -<% "footer" render-template %> diff --git a/unmaintained/webapps/pastebin/style.css b/unmaintained/webapps/pastebin/style.css deleted file mode 100644 index 4a469f92cb..0000000000 --- a/unmaintained/webapps/pastebin/style.css +++ /dev/null @@ -1,41 +0,0 @@ -body { - font:75%/1.6em "Lucida Grande", "Lucida Sans Unicode", verdana, geneva, sans-serif; - color:#888; -} - -h1.pastebin-title { - font-size:300%; -} - -a { - color:#222; - border-bottom:1px dotted #ccc; - text-decoration:none; -} - -a:hover { - border-bottom:1px solid #ccc; -} - -pre.code { - border:1px dashed #ccc; - background-color:#f5f5f5; - padding:5px; - font-size:150%; - color:#000000; -} - -.navbar { - background-color:#eeeeee; - padding:5px; - border:1px solid #ccc; -} - -.infobox { - border: 1px solid #C1DAD7; - padding: 10px; -} - -.error { - color: red; -} diff --git a/unmaintained/webapps/pastebin/syntax.furnace b/unmaintained/webapps/pastebin/syntax.furnace deleted file mode 100755 index 17b64b920b..0000000000 --- a/unmaintained/webapps/pastebin/syntax.furnace +++ /dev/null @@ -1,3 +0,0 @@ -<% USING: xmode.code2html splitting namespaces ; %> - -
<% "contents" get string-lines "mode" get htmlize-lines %>
diff --git a/unmaintained/webapps/planet/authors.txt b/unmaintained/webapps/planet/authors.txt deleted file mode 100755 index 1901f27a24..0000000000 --- a/unmaintained/webapps/planet/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Slava Pestov diff --git a/unmaintained/webapps/planet/planet.factor b/unmaintained/webapps/planet/planet.factor deleted file mode 100755 index 9a5f8eeb97..0000000000 --- a/unmaintained/webapps/planet/planet.factor +++ /dev/null @@ -1,129 +0,0 @@ -USING: sequences rss arrays concurrency.combinators kernel -sorting html.elements io assocs namespaces math threads vocabs -html furnace http.server.templating calendar math.parser -splitting continuations debugger system http.server.responders -xml.writer prettyprint logging calendar.format ; -IN: webapps.planet - -: print-posting-summary ( posting -- ) -

- dup entry-title write
- - "Read More..." write - -

; - -: print-posting-summaries ( postings -- ) - [ print-posting-summary ] each ; - -: print-blogroll ( blogroll -- ) - ; - -: format-date ( date -- string ) - rfc3339>timestamp timestamp>string ; - -: print-posting ( posting -- ) -

- - dup entry-title write-html - -

-

- dup entry-description write-html -

-

- entry-pub-date format-date write -

; - -: print-postings ( postings -- ) - [ print-posting ] each ; - -SYMBOL: default-blogroll -SYMBOL: cached-postings - -: safe-head ( seq n -- seq' ) - over length min head ; - -: mini-planet-factor ( -- ) - cached-postings get 4 safe-head print-posting-summaries ; - -: planet-factor ( -- ) - serving-html [ "planet" render-template ] with-html-stream ; - -\ planet-factor { } define-action - -: planet-feed ( -- feed ) - "[ planet-factor ]" - "http://planet.factorcode.org" - cached-postings get 30 safe-head ; - -: feed.xml ( -- ) - "text/xml" serving-content - planet-feed feed>xml write-xml ; - -\ feed.xml { } define-action - -: style.css ( -- ) - "text/css" serving-content - "style.css" send-resource ; - -\ style.css { } define-action - -SYMBOL: last-update - -: ( author entry -- entry' ) - clone - [ ": " swap entry-title 3append ] keep - [ set-entry-title ] keep ; - -: fetch-feed ( url -- feed ) - download-feed feed-entries ; - -\ fetch-feed DEBUG add-error-logging - -: fetch-blogroll ( blogroll -- entries ) - dup 0 swap 1 - [ fetch-feed ] parallel-map - [ [ ] with map ] 2map concat ; - -: sort-entries ( entries -- entries' ) - [ [ entry-pub-date ] compare ] sort ; - -: update-cached-postings ( -- ) - default-blogroll get - fetch-blogroll sort-entries - cached-postings set-global ; - -: update-thread ( -- ) - millis last-update set-global - [ update-cached-postings ] "RSS feed update slave" spawn drop - 10 60 * 1000 * sleep - update-thread ; - -: start-update-thread ( -- ) - [ - "webapps.planet" [ - update-thread - ] with-logging - ] "RSS feed update master" spawn drop ; - -"planet" "planet-factor" "extra/webapps/planet" web-app - -{ - { "Berlin Brown" "http://factorlang-fornovices.blogspot.com/feeds/posts/default" "http://factorlang-fornovices.blogspot.com" } - { "Chris Double" "http://www.blogger.com/feeds/18561009/posts/full/-/factor" "http://www.bluishcoder.co.nz/" } - { "Elie Chaftari" "http://fun-factor.blogspot.com/feeds/posts/default" "http://fun-factor.blogspot.com/" } - { "Doug Coleman" "http://code-factor.blogspot.com/feeds/posts/default" "http://code-factor.blogspot.com/" } - { "Daniel Ehrenberg" "http://useless-factor.blogspot.com/feeds/posts/default" "http://useless-factor.blogspot.com/" } - { "Gavin Harrison" "http://gmh33.blogspot.com/feeds/posts/default" "http://gmh33.blogspot.com/" } - { "Kio M. Smallwood" - "http://sekenre.wordpress.com/feed/atom/" - "http://sekenre.wordpress.com/" } - { "Phil Dawes" "http://www.phildawes.net/blog/category/factor/feed/atom" "http://www.phildawes.net/blog/" } - { "Samuel Tardieu" "http://www.rfc1149.net/blog/tag/factor/feed/atom/" "http://www.rfc1149.net/blog/tag/factor/" } - { "Slava Pestov" "http://factor-language.blogspot.com/atom.xml" "http://factor-language.blogspot.com/" } -} default-blogroll set-global diff --git a/unmaintained/webapps/planet/planet.furnace b/unmaintained/webapps/planet/planet.furnace deleted file mode 100644 index 4c6676c0a2..0000000000 --- a/unmaintained/webapps/planet/planet.furnace +++ /dev/null @@ -1,45 +0,0 @@ -<% USING: namespaces html.elements webapps.planet sequences -furnace ; %> - - - - - - - - planet-factor - - - - - -

[ planet-factor ]

- - - - - -
<% cached-postings get 20 safe-head print-postings %> -

- planet-factor is an Atom/RSS aggregator that collects the - contents of Factor-related blogs. It is inspired by - Planet Lisp. -

-

- - Syndicate -

-

- This webapp is written in Factor.
- <% "webapps.planet" browse-webapp-source %> -

-

Blogroll

- <% default-blogroll get print-blogroll %> -

- If you want your weblog added to the blogroll, just ask. -

-
- - - diff --git a/unmaintained/webapps/planet/style.css b/unmaintained/webapps/planet/style.css deleted file mode 100644 index 7a66d8d495..0000000000 --- a/unmaintained/webapps/planet/style.css +++ /dev/null @@ -1,45 +0,0 @@ -body { - font:75%/1.6em "Lucida Grande", "Lucida Sans Unicode", verdana, geneva, sans-serif; - color:#888; -} - -h1.planet-title { - font-size:300%; -} - -a { - color:#222; - border-bottom:1px dotted #ccc; - text-decoration:none; -} - -a:hover { - border-bottom:1px solid #ccc; -} - -.posting-title { - background-color:#f5f5f5; -} - -pre, code { - color:#000000; - font-size:120%; -} - -.infobox { - border-left: 1px solid #C1DAD7; -} - -.posting-date { - text-align: right; - font-size:90%; -} - -a.more { - display:block; - padding:0 0 5px 0; - color:#333; - text-decoration:none; - text-align:right; - border:none; -} diff --git a/unmaintained/wee-url/load.factor b/unmaintained/wee-url/load.factor deleted file mode 100644 index 96d27164e8..0000000000 --- a/unmaintained/wee-url/load.factor +++ /dev/null @@ -1,4 +0,0 @@ -REQUIRES: apps/http-server libs/store ; - -PROVIDE: apps/wee-url -{ +files+ { "responder.factor" } } ; diff --git a/unmaintained/wee-url/responder.factor b/unmaintained/wee-url/responder.factor deleted file mode 100644 index 4d7b076cb6..0000000000 --- a/unmaintained/wee-url/responder.factor +++ /dev/null @@ -1,91 +0,0 @@ -! Copyright (C) 2006 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: generic assocs help html httpd -io kernel math namespaces prettyprint sequences store strings ; -IN: wee-url-responder - -SYMBOL: wee-shortcuts -SYMBOL: wee-store - -"wee-url.store" load-store wee-store set-global -H{ } clone wee-shortcuts wee-store get store-variable - -: responder-url "responder-url" get ; - -: wee-url ( string -- url ) - [ - "http://" % - host % - responder-url % - % - ] "" make ; - -: letter-bank - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ; - -: random-letter letter-bank length random letter-bank nth ; - -: random-url ( -- string ) - 6 random 1+ [ drop random-letter ] map >string - dup wee-shortcuts get key? [ drop random-url ] when ; - -: prepare-wee-url ( url -- url ) - CHAR: : over member? [ "http://" swap append ] unless ; - -: set-symmetric-hash ( obj1 obj2 hash -- ) - 3dup set-at swapd set-at ; - -: add-shortcut ( url-long -- url-short ) - dup wee-shortcuts get at* [ - nip - ] [ - drop - random-url [ wee-shortcuts get set-symmetric-hash ] keep - wee-store get save-store - ] if ; - -: url-prompt ( -- ) - serving-html - "wee-url.com - wee URLs since 2007" [ -
- "URL: " write - - -
- ] simple-html-document ; - -: url-submitted ( url-long url-short -- ) - "URL Submitted" [ - "URL: " write write nl - "wee-url: " write - wee-url write nl - "Back to " write - "wee-url" write nl - ] simple-html-document ; - -: url-submit ( url -- ) - serving-html - prepare-wee-url [ add-shortcut ] keep url-submitted ; - -: url-error ( -- ) - serving-html - "wee-url error" [ - "No such link." write - ] simple-html-document ; - -: wee-url-responder ( url -- ) - "url" query-param [ - url-submit drop - ] [ - dup empty? [ - drop url-prompt - ] [ - wee-shortcuts get at* - [ permanent-redirect ] [ drop url-error ] if - ] if - ] if* ; - -[ - "wee-url" "responder" set - [ wee-url-responder ] "get" set -] make-responder diff --git a/unmaintained/wee-url/wee-url.factor b/unmaintained/wee-url/wee-url.factor deleted file mode 100644 index ead2ee8976..0000000000 --- a/unmaintained/wee-url/wee-url.factor +++ /dev/null @@ -1,89 +0,0 @@ -! Copyright (C) 2007 Doug Coleman. -! See http://factorcode.org/license.txt for BSD license. -USING: assocs furnace html html.elements http.server -http.server.responders io kernel math math.ranges -namespaces random sequences store strings ; -IN: webapps.wee-url - -SYMBOL: shortcuts -SYMBOL: store - -! "wee-url.store" load-store store set-global -! H{ } clone shortcuts store get store-variable - -: set-at-once ( value key assoc -- ? ) - 2dup key? [ 3drop f ] [ set-at t ] if ; - -: responder-url "responder/wee-url" ; - -: wee-url ( string -- url ) - [ - "http://" % - host % - responder-url % - % - ] "" make ; - -: letter-bank - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" ; inline - -: random-url ( -- string ) - 1 6 [a,b] random [ drop letter-bank random ] "" map-as - dup shortcuts get key? [ drop random-url ] when ; - -: add-shortcut ( url-long url-short -- url-short ) - shortcuts get set-at-once [ - store get save-store - ] [ - drop - ] if ; - -: show-submit ( -- ) - serving-html - "wee-url.com - wee URLs since 2007" [ -
- "URL: " write - - -
- ] simple-html-document ; - -\ show-submit { } define-action - -: url-submitted ( url-long url-short -- ) - "URL Submitted" [ - "URL: " write write nl - "wee-url: " write - wee-url write nl - "Back to " write - "wee-url" write nl - ] simple-html-document ; - -: url-submit ( url -- ) - [ add-shortcut ] keep - url-submitted ; - -\ url-submit { - { "url" } -} define-action - -: url-error ( -- ) - serving-html - "wee-url error" [ - "No such link." write - ] simple-html-document ; - -: wee-url-responder ( url -- ) - "url" query-param [ - url-submit drop - ] [ - dup empty? [ - drop show-submit - ] [ - shortcuts get at* - [ permanent-redirect ] [ drop url-error ] if - ] if - ] if* ; - -! "wee-url" "wee-url-responder" "extra/webapps/wee-url" web-app -~ From dbae275dc221281e4ca8902aa0cc6d0d1b72685b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 10:52:57 -0500 Subject: [PATCH 031/948] Don't need cocoa.standalone --- basis/cocoa/standalone/standalone.factor | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 basis/cocoa/standalone/standalone.factor diff --git a/basis/cocoa/standalone/standalone.factor b/basis/cocoa/standalone/standalone.factor deleted file mode 100644 index 528736f172..0000000000 --- a/basis/cocoa/standalone/standalone.factor +++ /dev/null @@ -1,12 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: kernel cocoa.nibs cocoa.application cocoa ; -IN: cocoa.standalone - -: cocoa-app ( quot -- ) - [ - "MiniFactor.nib" load-nib - call - finish-launching - NSApp -> run - ] with-cocoa ; inline From efe0bf2ecd39a5c197d1b995b0541364eb1f8c0d Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 10:53:12 -0500 Subject: [PATCH 032/948] Document cocoa-app combinator --- basis/cocoa/application/application-docs.factor | 13 ++++++++++--- basis/cocoa/application/application.factor | 7 +++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/basis/cocoa/application/application-docs.factor b/basis/cocoa/application/application-docs.factor index 55fa5e10b8..791613e876 100644 --- a/basis/cocoa/application/application-docs.factor +++ b/basis/cocoa/application/application-docs.factor @@ -26,6 +26,10 @@ HELP: with-cocoa { $values { "quot" quotation } } { $description "Sets up an autorelease pool, initializes the " { $snippet "NSApplication" } " singleton, and calls the quotation." } ; +HELP: cocoa-app +{ $values { "quot" quotation } } +{ $description "Initializes Cocoa, calls the quotation, and starts the Cocoa event loop." } ; + HELP: do-event { $values { "app" "an " { $snippet "NSApplication" } } { "?" "a boolean" } } { $description "Processes a pending event in the queue, if any, returning a boolean indicating if there was one. Does not block." } ; @@ -46,13 +50,16 @@ HELP: objc-error { $error-description "Thrown by the Objective C runtime when an error occurs, for example, sending a message to an object with an unrecognized selector." } ; ARTICLE: "cocoa-application-utils" "Cocoa application utilities" +"Utilities:" { $subsection NSApp } -{ $subsection with-autorelease-pool } -{ $subsection with-cocoa } { $subsection do-event } { $subsection add-observer } { $subsection remove-observer } -{ $subsection install-delegate } ; +{ $subsection install-delegate } +"Combinators:" +{ $subsection cocoa-app } +{ $subsection with-autorelease-pool } +{ $subsection with-cocoa } ; IN: cocoa.application ABOUT: "cocoa-application-utils" diff --git a/basis/cocoa/application/application.factor b/basis/cocoa/application/application.factor index 065a4abc5a..8f32782d76 100644 --- a/basis/cocoa/application/application.factor +++ b/basis/cocoa/application/application.factor @@ -50,6 +50,13 @@ FUNCTION: void NSBeep ( ) ; : finish-launching ( -- ) NSApp -> finishLaunching ; +: cocoa-app ( quot -- ) + [ + call + finish-launching + NSApp -> run + ] with-cocoa ; inline + : install-delegate ( receiver delegate -- ) -> alloc -> init -> setDelegate: ; From d5bbbd90e4ccf3d286b31624eb5910234c89d18c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 10:53:19 -0500 Subject: [PATCH 033/948] Fix typo --- basis/tools/scaffold/scaffold-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/tools/scaffold/scaffold-docs.factor b/basis/tools/scaffold/scaffold-docs.factor index 479b636fcf..d2989d3cac 100644 --- a/basis/tools/scaffold/scaffold-docs.factor +++ b/basis/tools/scaffold/scaffold-docs.factor @@ -5,7 +5,7 @@ IN: tools.scaffold HELP: developer-name { $description "Set this symbol to hold your name so that the scaffold tools can generate the correct file header for copyright. Setting this variable in your .factor-boot-rc file is recommended." } -{ $unchecked-example "USING: namespaces tools.scaffold ;\n\"Stacky Guy\" developer-name set-global" } ; +{ $code "USING: namespaces tools.scaffold ;\n\"Stacky Guy\" developer-name set-global" } ; HELP: help. { $values From 00afda7f7e91ca8654119a07d3a2a8f773707e36 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Thu, 2 Oct 2008 10:53:30 -0500 Subject: [PATCH 034/948] Don't copy freetype over if UI is not deployed --- basis/tools/deploy/backend/backend.factor | 8 +++++--- basis/tools/deploy/macosx/macosx.factor | 24 ++++++++++++++++++----- basis/tools/deploy/windows/windows.factor | 23 ++++++++++++++-------- 3 files changed, 39 insertions(+), 16 deletions(-) diff --git a/basis/tools/deploy/backend/backend.factor b/basis/tools/deploy/backend/backend.factor index cb899f4b87..a0565c6bab 100644 --- a/basis/tools/deploy/backend/backend.factor +++ b/basis/tools/deploy/backend/backend.factor @@ -10,13 +10,15 @@ io.encodings.utf8 destructors accessors ; IN: tools.deploy.backend : copy-vm ( executable bundle-name extension -- vm ) - [ prepend-path ] dip append vm over copy-file ; + [ prepend-path ] dip append vm over copy-file ; : copy-fonts ( name dir -- ) - append-path "resource:fonts/" swap copy-tree-into ; + deploy-ui? get [ + append-path "resource:fonts/" swap copy-tree-into + ] [ 2drop ] if ; : image-name ( vocab bundle-name -- str ) - prepend-path ".image" append ; + prepend-path ".image" append ; : copy-lines ( -- ) readln [ print flush copy-lines ] when* ; diff --git a/basis/tools/deploy/macosx/macosx.factor b/basis/tools/deploy/macosx/macosx.factor index ee60ce3982..d3464993e1 100644 --- a/basis/tools/deploy/macosx/macosx.factor +++ b/basis/tools/deploy/macosx/macosx.factor @@ -4,7 +4,7 @@ USING: io io.files kernel namespaces make sequences system tools.deploy.backend tools.deploy.config assocs hashtables prettyprint io.unix.backend cocoa io.encodings.utf8 io.backend cocoa.application cocoa.classes cocoa.plists -qualified ; +qualified combinators ; IN: tools.deploy.macosx : bundle-dir ( -- dir ) @@ -30,12 +30,26 @@ IN: tools.deploy.macosx "Contents/Info.plist" append-path write-plist ; +: copy-dll ( bundle-name -- ) + "Frameworks/libfactor.dylib" copy-bundle-dir ; + +: copy-freetype ( bundle-name -- ) + deploy-ui? get [ "Frameworks" copy-bundle-dir ] [ drop ] if ; + +: copy-nib ( bundle-name -- ) + deploy-ui? get [ + "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir + ] [ drop ] if ; + : create-app-dir ( vocab bundle-name -- vm ) [ - nip - [ "Frameworks" copy-bundle-dir ] - [ "Resources/English.lproj/MiniFactor.nib" copy-bundle-dir ] - [ "Contents/Resources/" copy-fonts ] tri + nip { + [ copy-dll ] + [ copy-freetype ] + [ copy-nib ] + [ "Contents/Resources/" copy-fonts ] + [ "Contents/Resources" append-path make-directories ] + } cleave ] [ create-app-plist ] [ "Contents/MacOS/" append-path "" copy-vm ] 2tri ; diff --git a/basis/tools/deploy/windows/windows.factor b/basis/tools/deploy/windows/windows.factor index e0ce2c268a..ce4fee19d7 100644 --- a/basis/tools/deploy/windows/windows.factor +++ b/basis/tools/deploy/windows/windows.factor @@ -5,16 +5,23 @@ tools.deploy.backend tools.deploy.config assocs hashtables prettyprint combinators windows.shell32 windows.user32 ; IN: tools.deploy.windows -: copy-dlls ( bundle-name -- ) - { - "resource:freetype6.dll" - "resource:zlib1.dll" - "resource:factor.dll" - } swap copy-files-into ; +: copy-dll ( bundle-name -- ) + "resource:factor.dll" swap copy-file-into ; + +: copy-freetype ( bundle-name -- ) + deploy-ui? get [ + { + "resource:freetype6.dll" + "resource:zlib1.dll" + } swap copy-files-into + ] when ; : create-exe-dir ( vocab bundle-name -- vm ) - dup copy-dlls - dup "" copy-fonts + deploy-ui? get [ + dup copy-dll + dup copy-freetype + dup "" copy-fonts + ] when ".exe" copy-vm ; M: winnt deploy* From 67683dde20affbdc8c8897c95b614a66e3758dff Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 12:11:56 -0500 Subject: [PATCH 035/948] make-db is gone, use or instead. docs. use dip instead of >r r> --- basis/db/db-docs.factor | 113 ++++++++------------------ basis/db/db.factor | 13 +-- basis/db/pools/pools.factor | 8 +- basis/db/postgresql/postgresql.factor | 25 +++--- basis/db/sqlite/sqlite.factor | 18 ++-- basis/db/tuples/tuples-tests.factor | 39 +++++---- 6 files changed, 90 insertions(+), 126 deletions(-) diff --git a/basis/db/db-docs.factor b/basis/db/db-docs.factor index 74b72b8789..a4a948d07f 100644 --- a/basis/db/db-docs.factor +++ b/basis/db/db-docs.factor @@ -5,27 +5,19 @@ alien assocs strings math multiline quotations ; IN: db HELP: db -{ $description "The " { $snippet "db" } " class is the superclass of all other database classes. It stores a " { $snippet "handle" } " to the database as well as insert, update, and delete queries." } ; +{ $description "The " { $snippet "db" } " class is the superclass of all other database classes. It stores a " { $snippet "handle" } " to the database as well as insert, update, and delete queries." } ; HELP: new-db { $values { "class" class } { "obj" object } } -{ $description "Creates a new database object from a given class." } ; - -HELP: make-db* -{ $values { "object" object } { "db" object } { "db" object } } -{ $description "Takes a sequence of parameters specific to each database and a class name of the database, and constructs a new database object." } ; - -HELP: make-db -{ $values { "object" object } { "class" class } { "db" db } } -{ $description "Takes a sequence of parameters specific to each database and a class name of the database, and constructs a new database object." } ; +{ $description "Creates a new database object from a given class with caches for prepared statements. Does not actually connect to the database until " { $link db-open } " or " { $link with-db } " is called." } ; HELP: db-open { $values { "db" db } { "db" db } } -{ $description "Opens a database using the configuration data stored in a " { $link db } " tuple." } ; +{ $description "Opens a database using the configuration data stored in a " { $link db } " tuple. The database object now references a database handle that must be cleaned up. Therefore, it is better to use the " { $link with-db } " combinator than calling this word directly." } ; HELP: db-close { $values { "handle" alien } } -{ $description "Closes a database using the handle provided." } ; +{ $description "Closes a database using the handle provided. Use of the " { $link with-db } " combinator is preferred over manually opening and closing databases so that resources are not leaked." } ; HELP: dispose-statements { $values { "assoc" assoc } } @@ -38,30 +30,18 @@ HELP: db-dispose HELP: statement { $description "A " { $snippet "statement" } " stores the information about a statemen, such as the SQL statement text, the in/out parameters, and type information." } ; -HELP: simple-statement -{ $description } ; - -HELP: prepared-statement -{ $description } ; - HELP: result-set { $description "An object encapsulating a raw SQL result object. There are two ways in which a result set can be accessed, but they are specific to the database backend in use." { $subsection "db-random-access-result-set" } { $subsection "db-sequential-result-set" } } ; -HELP: init-result-set -{ $values - { "result-set" result-set } } -{ $description "" } ; - HELP: new-result-set { $values { "query" "a query" } { "handle" alien } { "class" class } { "result-set" result-set } } { $description "Creates a new " { $link result-set } " object of type " { $snippet "class" } "." } ; - HELP: new-statement { $values { "sql" string } { "in" sequence } { "out" sequence } { "class" class } { "statement" statement } } { $description "Makes a new statement object from the given parameters." } ; @@ -80,18 +60,6 @@ HELP: prepare-statement { $values { "statement" statement } } { $description "For databases which implement a method on this generic, it does some internal processing to ready the statement for execution." } ; -HELP: bind-statement* -{ $values { "statement" statement } } -{ $description "" } ; - -HELP: low-level-bind -{ $values { "statement" statement } } -{ $description "" } ; - -HELP: bind-tuple -{ $values { "tuple" tuple } { "statement" statement } } -{ $description "" } ; - HELP: query-results { $values { "query" object } { "result-set" result-set } @@ -125,41 +93,14 @@ HELP: more-rows? { $values { "result-set" result-set } { "?" "a boolean" } } { $description "Returns true if the " { $link result-set } " has more rows to traverse." } ; -HELP: execute-statement* -{ $values { "statement" statement } { "type" object } } -{ $description } ; - -HELP: execute-one-statement -{ $values - { "statement" null } } -{ $description "" } ; - -HELP: execute-statement -{ $values { "statement" statement } } -{ $description "" } ; - - - - HELP: begin-transaction { $description "Begins a new transaction. User code should make use of the " { $link with-transaction } " combinator." } ; -HELP: bind-statement -{ $values - { "obj" object } { "statement" null } } -{ $description "" } ; - HELP: commit-transaction { $description "Commits a transaction. User code should make use of the " { $link with-transaction } " combinator." } ; -HELP: default-query -{ $values - { "query" null } - { "result-set" null } } -{ $description "" } ; - HELP: in-transaction { $description "A variable that is set true when a transaction is in progress." } ; @@ -170,14 +111,14 @@ HELP: in-transaction? HELP: query-each { $values - { "statement" null } { "quot" quotation } } -{ $description "" } ; + { "statement" statement } { "quot" quotation } } +{ $description "A combinator that calls a quotation on a sequence of SQL statments to their results query results." } ; HELP: query-map { $values - { "statement" null } { "quot" quotation } + { "statement" statement } { "quot" quotation } { "seq" sequence } } -{ $description "" } ; +{ $description "A combinator that maps a sequence of SQL statments to their results query results." } ; HELP: rollback-transaction { $description "Rolls back a transaction; no data is committed to the database. User code should make use of the " { $link with-transaction } " combinator." } ; @@ -211,7 +152,7 @@ HELP: sql-row-typed HELP: with-db { $values - { "seq" sequence } { "class" class } { "quot" quotation } } + { "db" db } { "quot" quotation } } { $description "Calls the quotation with a database bound to the " { $link db } " symbol. The database called is based on the " { $snippet "class" } " with the " } ; HELP: with-transaction @@ -247,7 +188,7 @@ $nl { $subsection row-column-typed } ; ARTICLE: "db-sequential-result-set" "Sequential result sets" -"Sequential result sets can be iterated one element after the next. SQLite's result sets offer this method of traversal." +"Sequential result sets can be iterated one element after the next. SQLite's result sets offer this method of traversal." $nl "Databases which work in this way must provide methods for the following traversal words:" { $subsection more-rows? } @@ -272,26 +213,44 @@ $nl { $subsection row-column-typed } ; ARTICLE: "db-protocol" "Low-level database protocol" -"The high-level protocol (see " { $vocab-link "db.tuples" } ") uses this low-level protocol for executing statements and queries." -; +"The high-level protocol (see " { $vocab-link "db.tuples" } ") uses this low-level protocol for executing statements and queries." $nl +"Opening a database:" +{ $subsection db-open } +"Closing a database:" +{ $subsection db-close } + +"Performing a query:" +{ $subsection query-results } + +"Handling query results:" +{ $subsection "db-result-sets" } + + ; ARTICLE: "db-lowlevel-tutorial" "Low-level database tutorial" "Although Factor makes integrating a database with its object system easy (see " { $vocab-link "db.tuples" } "), sometimes you may want to write SQL directly and get the results back as arrays of strings, for instance, when interfacing with a legacy database that doesn't easily map to " { $snippet "tuples" } "." ; ARTICLE: "db-porting-the-library" "Porting the database library" -"This section is not yet written." +"There are two layers to implement when porting the database library." +{ $subsection "db-protocol" } ; ARTICLE: "db-custom-database-combinators" "Custom database combinators" -"Every database library requires some effort on the programmer's part to initialize and open a database. SQLite uses files on your harddisk, so a simple pathname is all the setup required. With PostgreSQL, you log in to a networked server as a user on a specfic port." $nl +"Every database library requires some effort on the programmer's part to initialize and open a database. SQLite uses files on your harddisk, so a simple pathname is all the setup required. With PostgreSQL, you log in to a networked server as a user on a specfic port." $nl -"Make a " { $snippet "with-" } " word to open, close, and use your database." +"Make a " { $snippet "with-" } " combinator to open and close a database so that resources are not leaked." { $code <" USING: db.sqlite db io.files ; -: with-my-database ( quot -- ) - { "my-database.db" temp-file } sqlite-db rot with-db ; -"> } +: with-sqlite-db ( quot -- ) + "my-database.db" temp-file sqlite-db rot with-db ;"> } + +{ $code <" +USING: db.postgresql db ; +: with-postgresql-db ( quot -- ) + { "localhost" "db-username" "db-password" "db-name" } + postgresql-db rot with-db ;"> +} ; diff --git a/basis/db/db.factor b/basis/db/db.factor index 87bf21d261..5b159d0ea1 100755 --- a/basis/db/db.factor +++ b/basis/db/db.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays assocs classes continuations destructors kernel math namespaces sequences classes.tuple words strings -tools.walker accessors combinators ; +tools.walker accessors combinators fry ; IN: db TUPLE: db @@ -17,10 +17,6 @@ TUPLE: db H{ } clone >>update-statements H{ } clone >>delete-statements ; inline -GENERIC: make-db* ( object db -- db ) - -: make-db ( object class -- db ) new-db make-db* ; - GENERIC: db-open ( db -- db ) HOOK: db-close db ( handle -- ) @@ -111,10 +107,9 @@ M: object execute-statement* ( statement type -- ) : query-map ( statement quot -- seq ) accumulator [ query-each ] dip { } like ; inline -: with-db ( seq class quot -- ) - [ make-db db-open db ] dip - [ db get swap [ drop ] prepose with-disposal ] curry with-variable ; - inline +: with-db ( db quot -- ) + [ db-open db ] dip + '[ db get [ drop @ ] with-disposal ] with-variable ; inline : default-query ( query -- result-set ) query-results [ [ sql-row ] query-map ] with-disposal ; diff --git a/basis/db/pools/pools.factor b/basis/db/pools/pools.factor index 63153c451e..45f37f8f7c 100644 --- a/basis/db/pools/pools.factor +++ b/basis/db/pools/pools.factor @@ -1,10 +1,10 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors kernel arrays namespaces sequences continuations -io.pools db ; +io.pools db fry ; IN: db.pools -TUPLE: db-pool < pool db params ; +TUPLE: db-pool < pool db ; : ( params db -- pool ) db-pool @@ -15,7 +15,7 @@ TUPLE: db-pool < pool db params ; >r r> with-pool ; inline M: db-pool make-connection ( pool -- ) - [ params>> ] [ db>> ] bi make-db db-open ; + db>> db-open ; : with-pooled-db ( pool quot -- ) - [ db swap with-variable ] curry with-pooled-connection ; inline + '[ db _ with-variable ] with-pooled-connection ; inline diff --git a/basis/db/postgresql/postgresql.factor b/basis/db/postgresql/postgresql.factor index 28548d1260..08df25c13a 100755 --- a/basis/db/postgresql/postgresql.factor +++ b/basis/db/postgresql/postgresql.factor @@ -10,28 +10,24 @@ USE: tools.walker IN: db.postgresql TUPLE: postgresql-db < db - host port pgopts pgtty db user pass ; + host port pgopts pgtty database username password ; + +: ( -- postgresql-db ) + postgresql-db new-db ; TUPLE: postgresql-statement < statement ; TUPLE: postgresql-result-set < result-set ; -M: postgresql-db make-db* ( seq db -- db ) - >r first4 r> - swap >>db - swap >>pass - swap >>user - swap >>host ; - M: postgresql-db db-open ( db -- db ) dup { [ host>> ] [ port>> ] [ pgopts>> ] [ pgtty>> ] - [ db>> ] - [ user>> ] - [ pass>> ] + [ database>> ] + [ username>> ] + [ password>> ] } cleave connect-postgres >>handle ; M: postgresql-db dispose ( db -- ) @@ -102,7 +98,7 @@ M: postgresql-result-set dispose ( result-set -- ) M: postgresql-statement prepare-statement ( statement -- ) dup - >r db get handle>> f r> + [ db get handle>> f ] dip [ sql>> ] [ in-params>> ] bi length f PQprepare postgresql-error >>handle drop ; @@ -121,7 +117,8 @@ M: postgresql-db bind% ( spec -- ) bind-name% 1, ; M: postgresql-db bind# ( spec object -- ) - >r bind-name% f swap type>> r> 1, ; + [ bind-name% f swap type>> ] dip + 1, ; : create-table-sql ( class -- statement ) [ @@ -143,7 +140,7 @@ M: postgresql-db bind# ( spec object -- ) : create-function-sql ( class -- statement ) [ - >r remove-id r> + [ remove-id ] dip "create function add_" 0% dup 0% "(" 0% over [ "," 0% ] diff --git a/basis/db/sqlite/sqlite.factor b/basis/db/sqlite/sqlite.factor index dfd9fab08c..dfe4fdf475 100755 --- a/basis/db/sqlite/sqlite.factor +++ b/basis/db/sqlite/sqlite.factor @@ -11,8 +11,9 @@ IN: db.sqlite TUPLE: sqlite-db < db path ; -M: sqlite-db make-db* ( path db -- db ) - swap >>path ; +: ( path -- sqlite-db ) + sqlite-db new-db + swap >>path ; M: sqlite-db db-open ( db -- db ) dup path>> sqlite-open >>handle ; @@ -78,7 +79,8 @@ M: generator-bind sqlite-bind-conversion ( tuple generate-bind -- array ) tuck [ generator-singleton>> eval-generator tuck ] [ slot-name>> ] bi rot set-slot-named - >r [ key>> ] [ type>> ] bi r> swap ; + [ [ key>> ] [ type>> ] bi ] dip + swap ; M: sqlite-statement bind-tuple ( tuple statement -- ) [ @@ -100,7 +102,7 @@ M: sqlite-result-set row-column ( result-set n -- obj ) M: sqlite-result-set row-column-typed ( result-set n -- obj ) dup pick out-params>> nth type>> - >r >r handle>> r> r> sqlite-column-typed ; + [ handle>> ] 2dip sqlite-column-typed ; M: sqlite-result-set advance-row ( result-set -- ) dup handle>> sqlite-next >>has-more? drop ; @@ -160,10 +162,10 @@ M: sqlite-db ( tuple -- statement ) ; M: sqlite-db bind# ( spec obj -- ) - >r - [ column-name>> ":" swap next-sql-counter 3append dup 0% ] - [ type>> ] bi - r> 1, ; + [ + [ column-name>> ":" swap next-sql-counter 3append dup 0% ] + [ type>> ] bi + ] dip 1, ; M: sqlite-db bind% ( spec -- ) dup 1, column-name>> ":" prepend 0% ; diff --git a/basis/db/tuples/tuples-tests.factor b/basis/db/tuples/tuples-tests.factor index 406d4756a2..f5569a97cd 100755 --- a/basis/db/tuples/tuples-tests.factor +++ b/basis/db/tuples/tuples-tests.factor @@ -7,16 +7,34 @@ db.postgresql accessors random math.bitwise math.ranges strings urls fry db.tuples.private ; IN: db.tuples.tests +: sqlite-db ( -- sqlite-db ) + "tuples-test.db" temp-file ; + : test-sqlite ( quot -- ) - [ ] swap '[ - "tuples-test.db" temp-file sqlite-db _ with-db - ] unit-test ; + '[ + [ ] [ + "tuples-test.db" temp-file _ with-db + ] unit-test + ] call ; inline + +: postgresql-db ( -- postgresql-db ) + + "localhost" >>host + "postgres" >>username + "thepasswordistrust" >>password + "factor-test" >>database ; : test-postgresql ( quot -- ) - [ ] swap '[ - { "localhost" "postgres" "foob" "factor-test" } - postgresql-db _ with-db - ] unit-test ; + '[ + [ ] [ postgresql-db _ with-db ] unit-test + ] call ; inline + +! These words leak resources, but are useful for interactivel testing +: sqlite-test-db ( -- ) + sqlite-db db-open db set ; + +: postgresql-test-db ( -- ) + postgresql-db db-open db set ; TUPLE: person the-id the-name the-number the-real ts date time blob factor-blob url ; @@ -639,10 +657,3 @@ compound-foo "COMPOUND_FOO" [ test-compound-primary-key ] test-sqlite [ test-compound-primary-key ] test-postgresql - -: sqlite-test-db ( -- ) - "tuples-test.db" temp-file sqlite-db make-db db-open db set ; - -: postgresql-test-db ( -- ) - { "localhost" "postgres" "foob" "factor-test" } postgresql-db - make-db db-open db set ; From a7027700d13fcd80816ceac22c3766981f1e5baf Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 12:51:21 -0500 Subject: [PATCH 036/948] update with-db usages --- basis/db/pools/pools.factor | 9 ++++---- basis/furnace/alloy/alloy.factor | 22 +++++++++---------- .../furnace/auth/providers/db/db-tests.factor | 2 +- basis/furnace/db/db.factor | 2 +- basis/furnace/sessions/sessions-tests.factor | 4 ++-- basis/http/http-tests.factor | 2 +- extra/webapps/planet/planet.factor | 4 ++-- .../concatenative/concatenative.factor | 2 +- 8 files changed, 22 insertions(+), 25 deletions(-) diff --git a/basis/db/pools/pools.factor b/basis/db/pools/pools.factor index 45f37f8f7c..8bc5e87f0e 100644 --- a/basis/db/pools/pools.factor +++ b/basis/db/pools/pools.factor @@ -6,13 +6,12 @@ IN: db.pools TUPLE: db-pool < pool db ; -: ( params db -- pool ) +: ( db -- pool ) db-pool - swap >>db - swap >>params ; + swap >>db ; -: with-db-pool ( db params quot -- ) - >r r> with-pool ; inline +: with-db-pool ( db quot -- ) + [ ] dip with-pool ; inline M: db-pool make-connection ( pool -- ) db>> db-open ; diff --git a/basis/furnace/alloy/alloy.factor b/basis/furnace/alloy/alloy.factor index decee690a3..128ec448b7 100644 --- a/basis/furnace/alloy/alloy.factor +++ b/basis/furnace/alloy/alloy.factor @@ -17,19 +17,17 @@ IN: furnace.alloy state-classes ensure-tables user ensure-table ; -: ( responder db params -- responder' ) - [ [ init-furnace-tables ] with-db ] +: ( responder db -- responder' ) + [ [ init-furnace-tables ] with-db ] keep [ - [ - - - - ] 2dip - - - ] 2bi ; + + + + ] dip + + ; -: start-expiring ( db params -- ) +: start-expiring ( db -- ) '[ - _ _ [ state-classes [ expire-state ] each ] with-db + _ [ state-classes [ expire-state ] each ] with-db ] 5 minutes every drop ; diff --git a/basis/furnace/auth/providers/db/db-tests.factor b/basis/furnace/auth/providers/db/db-tests.factor index fac5c23e4a..3bcd82a15d 100755 --- a/basis/furnace/auth/providers/db/db-tests.factor +++ b/basis/furnace/auth/providers/db/db-tests.factor @@ -11,7 +11,7 @@ io.files accessors kernel ; [ "auth-test.db" temp-file delete-file ] ignore-errors -"auth-test.db" temp-file sqlite-db [ +"auth-test.db" temp-file [ user ensure-table diff --git a/basis/furnace/db/db.factor b/basis/furnace/db/db.factor index b4a4386015..ed18e42a4f 100755 --- a/basis/furnace/db/db.factor +++ b/basis/furnace/db/db.factor @@ -6,7 +6,7 @@ IN: furnace.db TUPLE: db-persistence < filter-responder pool ; -: ( responder params db -- responder' ) +: ( responder db -- responder' ) db-persistence boa ; M: db-persistence call-responder* diff --git a/basis/furnace/sessions/sessions-tests.factor b/basis/furnace/sessions/sessions-tests.factor index ff089a92b2..6bb3c1cd69 100755 --- a/basis/furnace/sessions/sessions-tests.factor +++ b/basis/furnace/sessions/sessions-tests.factor @@ -48,9 +48,9 @@ M: foo call-responder* [ [ ] "text/plain" exit-with ] >>display ; -[ "auth-test.db" temp-file sqlite-db delete-file ] ignore-errors +[ "auth-test.db" temp-file delete-file ] ignore-errors -"auth-test.db" temp-file sqlite-db [ +"auth-test.db" temp-file [ init-request session ensure-table diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor index 9a1421a3ad..eb8ba34f9e 100755 --- a/basis/http/http-tests.factor +++ b/basis/http/http-tests.factor @@ -182,7 +182,7 @@ http.server.dispatchers db.tuples ; [ stop-server "Goodbye" "text/html" ] >>display "quit" add-responder ; -: test-db "test.db" temp-file sqlite-db ; +: test-db "test.db" temp-file ; [ test-db drop delete-file ] ignore-errors diff --git a/extra/webapps/planet/planet.factor b/extra/webapps/planet/planet.factor index 00d843573c..6c097d7faa 100755 --- a/extra/webapps/planet/planet.factor +++ b/extra/webapps/planet/planet.factor @@ -195,5 +195,5 @@ posting "POSTINGS" { planet "planet-common" } >>template ; -: start-update-task ( db params -- ) - '[ _ _ [ update-cached-postings ] with-db ] 10 minutes every drop ; +: start-update-task ( db -- ) + '[ _ [ update-cached-postings ] with-db ] 10 minutes every drop ; diff --git a/extra/websites/concatenative/concatenative.factor b/extra/websites/concatenative/concatenative.factor index 5553fda740..aa99493fa6 100644 --- a/extra/websites/concatenative/concatenative.factor +++ b/extra/websites/concatenative/concatenative.factor @@ -26,7 +26,7 @@ webapps.user-admin webapps.help ; IN: websites.concatenative -: test-db ( -- params db ) "resource:test.db" sqlite-db ; +: test-db ( -- params db ) "resource:test.db" ; : init-factor-db ( -- ) test-db [ From 1c189a479c62c6512b7f2b489394df3002ccc5f2 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 14:02:38 -0500 Subject: [PATCH 037/948] more docs, fix typos --- basis/db/db-docs.factor | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/basis/db/db-docs.factor b/basis/db/db-docs.factor index a4a948d07f..b0a01269ab 100644 --- a/basis/db/db-docs.factor +++ b/basis/db/db-docs.factor @@ -112,13 +112,13 @@ HELP: in-transaction? HELP: query-each { $values { "statement" statement } { "quot" quotation } } -{ $description "A combinator that calls a quotation on a sequence of SQL statments to their results query results." } ; +{ $description "A combinator that calls a quotation on a sequence of SQL statements to their results query results." } ; HELP: query-map { $values { "statement" statement } { "quot" quotation } { "seq" sequence } } -{ $description "A combinator that maps a sequence of SQL statments to their results query results." } ; +{ $description "A combinator that maps a sequence of SQL statements to their results query results." } ; HELP: rollback-transaction { $description "Rolls back a transaction; no data is committed to the database. User code should make use of the " { $link with-transaction } " combinator." } ; @@ -218,14 +218,19 @@ ARTICLE: "db-protocol" "Low-level database protocol" { $subsection db-open } "Closing a database:" { $subsection db-close } - +"Creating tatements:" +{ $subsection } +{ $subsection } +"Using statements with the database:" +{ $subsection prepare-statement } +{ $subsection bind-statement* } +{ $subsection low-level-bind } "Performing a query:" { $subsection query-results } - "Handling query results:" { $subsection "db-result-sets" } - - ; +; +! { $subsection bind-tuple } ARTICLE: "db-lowlevel-tutorial" "Low-level database tutorial" "Although Factor makes integrating a database with its object system easy (see " { $vocab-link "db.tuples" } "), sometimes you may want to write SQL directly and get the results back as arrays of strings, for instance, when interfacing with a legacy database that doesn't easily map to " { $snippet "tuples" } "." @@ -243,13 +248,16 @@ ARTICLE: "db-custom-database-combinators" "Custom database combinators" { $code <" USING: db.sqlite db io.files ; : with-sqlite-db ( quot -- ) - "my-database.db" temp-file sqlite-db rot with-db ;"> } + "my-database.db" temp-file rot with-db ;"> } -{ $code <" -USING: db.postgresql db ; +{ $code <" USING: db.postgresql db ; : with-postgresql-db ( quot -- ) - { "localhost" "db-username" "db-password" "db-name" } - postgresql-db rot with-db ;"> + + "localhost" >>host + "erg" >>username + "secrets?" >>password + "factor-test" >>database + swap with-db ;"> } ; From 50493ba446c42cc2ea0ff193fc13a9ac50e199e4 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 16:02:31 -0500 Subject: [PATCH 038/948] fix unit tests --- basis/db/db-tests.factor | 2 +- basis/db/pools/pools-tests.factor | 2 +- basis/db/postgresql/postgresql-tests.factor | 13 +++++++------ basis/db/sqlite/sqlite-tests.factor | 2 +- basis/db/tuples/tuples.factor | 3 ++- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/basis/db/db-tests.factor b/basis/db/db-tests.factor index 3f1dab2c37..56b6c25a19 100644 --- a/basis/db/db-tests.factor +++ b/basis/db/db-tests.factor @@ -3,4 +3,4 @@ IN: db.tests { 1 0 } [ [ drop ] query-each ] must-infer-as { 1 1 } [ [ ] query-map ] must-infer-as -{ 2 0 } [ [ ] with-db ] must-infer-as +{ 1 0 } [ [ ] with-db ] must-infer-as diff --git a/basis/db/pools/pools-tests.factor b/basis/db/pools/pools-tests.factor index f07d1e8468..0ea7b1a6f4 100644 --- a/basis/db/pools/pools-tests.factor +++ b/basis/db/pools/pools-tests.factor @@ -13,7 +13,7 @@ USE: db.sqlite [ "pool-test.db" temp-file delete-file ] ignore-errors -[ ] [ "pool-test.db" temp-file sqlite-db "pool" set ] unit-test +[ ] [ "pool-test.db" temp-file "pool" set ] unit-test [ ] [ "pool" get expired>> t >>expired drop ] unit-test diff --git a/basis/db/postgresql/postgresql-tests.factor b/basis/db/postgresql/postgresql-tests.factor index 65b75a63dc..fe53e2416e 100644 --- a/basis/db/postgresql/postgresql-tests.factor +++ b/basis/db/postgresql/postgresql-tests.factor @@ -1,13 +1,14 @@ -! You will need to run 'createdb factor-test' to create the database. -! Set username and password in the 'connect' word. - USING: kernel db.postgresql alien continuations io classes prettyprint sequences namespaces tools.test db -db.tuples db.types unicode.case ; +db.tuples db.types unicode.case accessors ; IN: db.postgresql.tests : test-db ( -- postgresql-db ) - { "localhost" "postgres" "foob" "factor-test" } postgresql-db ; + + "localhost" >>host + "postgres" >>username + "thepasswordistrust" >>password + "factor-test" >>database ; [ ] [ test-db [ ] with-db ] unit-test @@ -92,4 +93,4 @@ IN: db.postgresql.tests : with-dummy-db ( quot -- ) - >r T{ postgresql-db } db r> with-variable ; + [ T{ postgresql-db } db ] dip with-variable ; diff --git a/basis/db/sqlite/sqlite-tests.factor b/basis/db/sqlite/sqlite-tests.factor index 67eac2702b..fe95980bcf 100644 --- a/basis/db/sqlite/sqlite-tests.factor +++ b/basis/db/sqlite/sqlite-tests.factor @@ -4,7 +4,7 @@ continuations db.types db.tuples unicode.case ; IN: db.sqlite.tests : db-path "test.db" temp-file ; -: test.db db-path sqlite-db ; +: test.db db-path ; [ ] [ [ db-path delete-file ] ignore-errors ] unit-test diff --git a/basis/db/tuples/tuples.factor b/basis/db/tuples/tuples.factor index 7f567697d2..20d7ac4f84 100644 --- a/basis/db/tuples/tuples.factor +++ b/basis/db/tuples/tuples.factor @@ -7,7 +7,7 @@ destructors mirrors sets db.types ; IN: db.tuples From 414ddfe2138f6fc7e6c113df73e46353aa1beda0 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 2 Oct 2008 14:16:53 -0700 Subject: [PATCH 039/948] Fix typo in db-docs. --- basis/db/db-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/db/db-docs.factor b/basis/db/db-docs.factor index b0a01269ab..29a81b3621 100644 --- a/basis/db/db-docs.factor +++ b/basis/db/db-docs.factor @@ -218,7 +218,7 @@ ARTICLE: "db-protocol" "Low-level database protocol" { $subsection db-open } "Closing a database:" { $subsection db-close } -"Creating tatements:" +"Creating statements:" { $subsection } { $subsection } "Using statements with the database:" From 75c2283dd6b77be1d38868966dc29d15a34cedf6 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 16:36:29 -0500 Subject: [PATCH 040/948] fix stack effect --- extra/websites/concatenative/concatenative.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/websites/concatenative/concatenative.factor b/extra/websites/concatenative/concatenative.factor index aa99493fa6..d7fdfa2460 100644 --- a/extra/websites/concatenative/concatenative.factor +++ b/extra/websites/concatenative/concatenative.factor @@ -26,7 +26,7 @@ webapps.user-admin webapps.help ; IN: websites.concatenative -: test-db ( -- params db ) "resource:test.db" ; +: test-db ( -- db ) "resource:test.db" ; : init-factor-db ( -- ) test-db [ From aeb5d60d3ad0ae2336854d94ba394dcb32f92825 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 16:36:50 -0500 Subject: [PATCH 041/948] fix test --- basis/db/pools/pools-tests.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/db/pools/pools-tests.factor b/basis/db/pools/pools-tests.factor index 0ea7b1a6f4..0a68db501b 100644 --- a/basis/db/pools/pools-tests.factor +++ b/basis/db/pools/pools-tests.factor @@ -4,7 +4,7 @@ accessors kernel math destructors ; \ must-infer -{ 2 0 } [ [ ] with-db-pool ] must-infer-as +{ 1 0 } [ [ ] with-db-pool ] must-infer-as { 1 0 } [ [ ] with-pooled-db ] must-infer-as From 39eacca297cd0c96320b10d5fc70522c9186d403 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 16:37:04 -0500 Subject: [PATCH 042/948] fix test, something is still broken --- basis/http/http-tests.factor | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/basis/http/http-tests.factor b/basis/http/http-tests.factor index 608ba0c88f..b3930878ff 100644 --- a/basis/http/http-tests.factor +++ b/basis/http/http-tests.factor @@ -182,9 +182,11 @@ http.server.dispatchers db.tuples ; [ stop-this-server "Goodbye" "text/html" ] >>display "quit" add-responder ; -: test-db "test.db" temp-file ; +: test-db-file "test.db" temp-file ; -[ test-db drop delete-file ] ignore-errors +: test-db test-db-file ; + +[ test-db-file delete-file ] ignore-errors test-db [ init-furnace-tables From 84e267a2a999507d174477230a2b1ec0aab97200 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 17:24:55 -0500 Subject: [PATCH 043/948] remove lib usage --- extra/lisp/lisp.factor | 6 +++--- extra/lisp/parser/parser.factor | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/extra/lisp/lisp.factor b/extra/lisp/lisp.factor index 2866e63c69..e60529caab 100644 --- a/extra/lisp/lisp.factor +++ b/extra/lisp/lisp.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2008 James Cash ! See http://factorcode.org/license.txt for BSD license. -USING: kernel peg sequences arrays strings combinators.lib +USING: kernel peg sequences arrays strings namespaces combinators math locals locals.private locals.backend accessors -vectors syntax lisp.parser assocs parser sequences.lib words +vectors syntax lisp.parser assocs parser words quotations fry lists summary combinators.short-circuit continuations multiline ; IN: lisp @@ -180,4 +180,4 @@ M: no-such-var summary drop "No such variable" ; : " parse-multiline-string define-lisp-builtins - lisp-string>factor parsed \ call parsed ; parsing \ No newline at end of file + lisp-string>factor parsed \ call parsed ; parsing diff --git a/extra/lisp/parser/parser.factor b/extra/lisp/parser/parser.factor index 1b14f5bb34..72344fd0dc 100644 --- a/extra/lisp/parser/parser.factor +++ b/extra/lisp/parser/parser.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 James Cash ! See http://factorcode.org/license.txt for BSD license. USING: kernel peg peg.ebnf math.parser sequences arrays strings -combinators.lib math fry accessors lists combinators.short-circuit ; +math fry accessors lists combinators.short-circuit ; IN: lisp.parser @@ -36,4 +36,4 @@ atom = number | string s-expression = LPAREN (list-item)* RPAREN => [[ second seq>cons ]] list-item = _ ( atom | s-expression ) _ => [[ second ]] -;EBNF \ No newline at end of file +;EBNF From c0dab60dc72f075195566079d4f0262a7b4ae087 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 17:33:26 -0500 Subject: [PATCH 044/948] dont use lib --- extra/descriptive/descriptive.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/descriptive/descriptive.factor b/extra/descriptive/descriptive.factor index 4b40747e9f..d02983d7fd 100755 --- a/extra/descriptive/descriptive.factor +++ b/extra/descriptive/descriptive.factor @@ -1,4 +1,4 @@ -USING: words kernel sequences combinators.lib locals +USING: words kernel sequences locals locals.private accessors parser namespaces continuations summary definitions generalizations arrays ; IN: descriptive From 4e81c83e642d5c0fcb423782c589485a53acc496 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 17:34:42 -0500 Subject: [PATCH 045/948] remove lib usage --- extra/parser-combinators/regexp/regexp.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/parser-combinators/regexp/regexp.factor b/extra/parser-combinators/regexp/regexp.factor index 40d4603fb6..b13321d991 100755 --- a/extra/parser-combinators/regexp/regexp.factor +++ b/extra/parser-combinators/regexp/regexp.factor @@ -1,6 +1,6 @@ USING: arrays combinators kernel lists math math.parser namespaces parser lexer parser-combinators parser-combinators.simple -promises quotations sequences combinators.lib strings math.order +promises quotations sequences strings math.order assocs prettyprint.backend memoize unicode.case unicode.categories combinators.short-circuit accessors make io ; IN: parser-combinators.regexp From d99be8bf77edb567cdd9465174dfe64f6d7f6d28 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 17:37:03 -0500 Subject: [PATCH 046/948] dont use lib --- extra/faq/faq.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/faq/faq.factor b/extra/faq/faq.factor index 1ab348e434..c0636c5fd7 100644 --- a/extra/faq/faq.factor +++ b/extra/faq/faq.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2007 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. -USING: xml kernel sequences xml.utilities combinators.lib -math xml.data arrays assocs xml.generator xml.writer namespaces +USING: xml kernel sequences xml.utilities math xml.data +arrays assocs xml.generator xml.writer namespaces make math.parser io accessors ; IN: faq From 6e7aa21cb58877a935e7a820b270c3c13fcadee8 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 17:40:49 -0500 Subject: [PATCH 047/948] dont use lib --- extra/project-euler/014/014.factor | 2 +- extra/project-euler/021/021.factor | 4 ++-- extra/project-euler/032/032.factor | 2 +- extra/project-euler/036/036.factor | 2 +- extra/project-euler/043/043.factor | 4 ++-- extra/project-euler/047/047.factor | 2 +- extra/project-euler/052/052.factor | 2 +- extra/project-euler/075/075.factor | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/extra/project-euler/014/014.factor b/extra/project-euler/014/014.factor index fcbc956de8..dc0c060b22 100644 --- a/extra/project-euler/014/014.factor +++ b/extra/project-euler/014/014.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2007 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays combinators.lib combinators.short-circuit kernel +USING: arrays combinators.short-circuit kernel math math.ranges namespaces make sequences sorting ; IN: project-euler.014 diff --git a/extra/project-euler/021/021.factor b/extra/project-euler/021/021.factor index 9ae5f6af10..af6bb3270b 100644 --- a/extra/project-euler/021/021.factor +++ b/extra/project-euler/021/021.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2007 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators.lib combinators.short-circuit kernel math math.functions - math.ranges namespaces project-euler.common sequences sequences.lib ; +USING: combinators.short-circuit kernel math math.functions + math.ranges namespaces project-euler.common sequences ; IN: project-euler.021 ! http://projecteuler.net/index.php?section=problems&id=21 diff --git a/extra/project-euler/032/032.factor b/extra/project-euler/032/032.factor index 8a54c595a9..f9667c75fe 100755 --- a/extra/project-euler/032/032.factor +++ b/extra/project-euler/032/032.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators.lib hashtables kernel math math.combinatorics math.functions +USING: hashtables kernel math math.combinatorics math.functions math.parser math.ranges project-euler.common sequences sets ; IN: project-euler.032 diff --git a/extra/project-euler/036/036.factor b/extra/project-euler/036/036.factor index f3a9f738bf..fc9df9a8fe 100644 --- a/extra/project-euler/036/036.factor +++ b/extra/project-euler/036/036.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators.lib combinators.short-circuit kernel math.parser math.ranges +USING: combinators.short-circuit kernel math.parser math.ranges project-euler.common sequences ; IN: project-euler.036 diff --git a/extra/project-euler/043/043.factor b/extra/project-euler/043/043.factor index a2f4ad5c61..84ed7a830f 100644 --- a/extra/project-euler/043/043.factor +++ b/extra/project-euler/043/043.factor @@ -1,8 +1,8 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators.lib combinators.short-circuit hashtables kernel math +USING: combinators.short-circuit hashtables kernel math math.combinatorics math.parser math.ranges project-euler.common sequences - sequences.lib sorting sets ; + sorting sets ; IN: project-euler.043 ! http://projecteuler.net/index.php?section=problems&id=43 diff --git a/extra/project-euler/047/047.factor b/extra/project-euler/047/047.factor index e59ca56f39..87a1387887 100644 --- a/extra/project-euler/047/047.factor +++ b/extra/project-euler/047/047.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays combinators.lib kernel math math.primes math.primes.factors +USING: arrays kernel math math.primes math.primes.factors math.ranges namespaces sequences ; IN: project-euler.047 diff --git a/extra/project-euler/052/052.factor b/extra/project-euler/052/052.factor index aec8015f94..3f562baa85 100644 --- a/extra/project-euler/052/052.factor +++ b/extra/project-euler/052/052.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: combinators.lib combinators.short-circuit kernel math +USING: combinators.short-circuit kernel math project-euler.common sequences sorting ; IN: project-euler.052 diff --git a/extra/project-euler/075/075.factor b/extra/project-euler/075/075.factor index 8e5b849de5..76f2a2a26e 100755 --- a/extra/project-euler/075/075.factor +++ b/extra/project-euler/075/075.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays combinators.lib kernel math math.ranges - namespaces project-euler.common sequences sequences.lib ; +USING: arrays kernel math math.ranges + namespaces project-euler.common sequences ; IN: project-euler.075 ! http://projecteuler.net/index.php?section=problems&id=75 From 86cdfa3a4c81086b2e19771cfe5a126e8bf85f55 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 17:49:04 -0500 Subject: [PATCH 048/948] remove lib usage, fix compile errors --- extra/project-euler/017/017.factor | 2 +- extra/project-euler/019/019.factor | 4 ++-- extra/project-euler/022/022.factor | 2 +- extra/project-euler/030/030.factor | 2 +- extra/project-euler/034/034.factor | 2 +- extra/project-euler/035/035.factor | 2 +- extra/project-euler/039/039.factor | 2 +- extra/project-euler/042/042.factor | 2 +- extra/project-euler/055/055.factor | 6 +++--- extra/project-euler/059/059.factor | 2 +- extra/project-euler/116/116.factor | 2 +- extra/project-euler/148/148.factor | 2 +- extra/project-euler/151/151.factor | 3 +-- extra/project-euler/186/186.factor | 2 +- extra/project-euler/190/190.factor | 2 +- 15 files changed, 18 insertions(+), 19 deletions(-) diff --git a/extra/project-euler/017/017.factor b/extra/project-euler/017/017.factor index cf58e88ffe..5f6541873a 100644 --- a/extra/project-euler/017/017.factor +++ b/extra/project-euler/017/017.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2007 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math.ranges math.text.english sequences sequences.lib strings +USING: kernel math.ranges math.text.english sequences strings ascii combinators.short-circuit ; IN: project-euler.017 diff --git a/extra/project-euler/019/019.factor b/extra/project-euler/019/019.factor index b29495f913..9482b337bb 100644 --- a/extra/project-euler/019/019.factor +++ b/extra/project-euler/019/019.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2007 Samuel Tardieu, Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. USING: calendar combinators kernel math math.ranges namespaces sequences - sequences.lib math.order ; + math.order ; IN: project-euler.019 ! http://projecteuler.net/index.php?section=problems&id=19 @@ -32,7 +32,7 @@ IN: project-euler.019 : euler019 ( -- answer ) 1901 2000 [a,b] [ - 12 [1,b] [ 1 zeller-congruence ] map-with + 12 [1,b] [ 1 zeller-congruence ] with map ] map concat [ zero? ] count ; ! [ euler019 ] 100 ave-time diff --git a/extra/project-euler/022/022.factor b/extra/project-euler/022/022.factor index 82054ce014..a508ddea6c 100644 --- a/extra/project-euler/022/022.factor +++ b/extra/project-euler/022/022.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2007 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. USING: ascii io.encodings.ascii io.files kernel math project-euler.common - sequences sequences.lib sorting splitting ; + sequences sorting splitting ; IN: project-euler.022 ! http://projecteuler.net/index.php?section=problems&id=22 diff --git a/extra/project-euler/030/030.factor b/extra/project-euler/030/030.factor index 53d6b199fb..250494c0dc 100644 --- a/extra/project-euler/030/030.factor +++ b/extra/project-euler/030/030.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math math.functions project-euler.common sequences sequences.lib ; +USING: kernel math math.functions project-euler.common sequences ; IN: project-euler.030 ! http://projecteuler.net/index.php?section=problems&id=30 diff --git a/extra/project-euler/034/034.factor b/extra/project-euler/034/034.factor index cf73ee828b..28c4fa5dc7 100644 --- a/extra/project-euler/034/034.factor +++ b/extra/project-euler/034/034.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math.ranges project-euler.common sequences sequences.lib ; +USING: kernel math.ranges project-euler.common sequences ; IN: project-euler.034 ! http://projecteuler.net/index.php?section=problems&id=34 diff --git a/extra/project-euler/035/035.factor b/extra/project-euler/035/035.factor index cec9bc6957..8e8b654d28 100755 --- a/extra/project-euler/035/035.factor +++ b/extra/project-euler/035/035.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math math.combinatorics math.parser math.primes - project-euler.common sequences sequences.lib sets ; + project-euler.common sequences sets ; IN: project-euler.035 ! http://projecteuler.net/index.php?section=problems&id=35 diff --git a/extra/project-euler/039/039.factor b/extra/project-euler/039/039.factor index 7a9f51f1d3..d0caa6d0e4 100755 --- a/extra/project-euler/039/039.factor +++ b/extra/project-euler/039/039.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays combinators.lib kernel math math.ranges +USING: arrays kernel math math.ranges namespaces project-euler.common sequences ; IN: project-euler.039 diff --git a/extra/project-euler/042/042.factor b/extra/project-euler/042/042.factor index da26e34927..8ae95d6db7 100644 --- a/extra/project-euler/042/042.factor +++ b/extra/project-euler/042/042.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. USING: ascii io.files kernel math math.functions namespaces make - project-euler.common sequences sequences.lib splitting io.encodings.ascii ; + project-euler.common sequences splitting io.encodings.ascii ; IN: project-euler.042 ! http://projecteuler.net/index.php?section=problems&id=42 diff --git a/extra/project-euler/055/055.factor b/extra/project-euler/055/055.factor index 289f3a002a..bf1dd43b97 100644 --- a/extra/project-euler/055/055.factor +++ b/extra/project-euler/055/055.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math math.parser project-euler.common sequences sequences.lib ; +USING: kernel math math.parser project-euler.common sequences ; IN: project-euler.055 ! http://projecteuler.net/index.php?section=problems&id=55 @@ -49,8 +49,8 @@ IN: project-euler.055 : (lychrel?) ( n iteration -- ? ) dup 50 < [ - >r add-reverse dup palindrome? - [ r> 2drop f ] [ r> 1+ (lychrel?) ] if + [ add-reverse ] dip over palindrome? + [ 2drop f ] [ 1+ (lychrel?) ] if ] [ 2drop t ] if ; diff --git a/extra/project-euler/059/059.factor b/extra/project-euler/059/059.factor index f209b50a46..e3ab9762d8 100644 --- a/extra/project-euler/059/059.factor +++ b/extra/project-euler/059/059.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2008 Aaron Schaefer, Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: arrays ascii assocs hashtables io.encodings.ascii io.files kernel math - math.parser namespaces make sequences sequences.lib sequences.private sorting + math.parser namespaces make sequences sequences.private sorting splitting grouping strings sets accessors ; IN: project-euler.059 diff --git a/extra/project-euler/116/116.factor b/extra/project-euler/116/116.factor index 5e2059ad9a..0e3633dc9a 100644 --- a/extra/project-euler/116/116.factor +++ b/extra/project-euler/116/116.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Eric Mertens. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math math.ranges sequences sequences.lib ; +USING: kernel math math.ranges sequences ; IN: project-euler.116 ! http://projecteuler.net/index.php?section=problems&id=116 diff --git a/extra/project-euler/148/148.factor b/extra/project-euler/148/148.factor index 49fd9a4895..0509936e52 100644 --- a/extra/project-euler/148/148.factor +++ b/extra/project-euler/148/148.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Eric Mertens. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math math.functions sequences sequences.lib ; +USING: kernel math math.functions sequences ; IN: project-euler.148 ! http://projecteuler.net/index.php?section=problems&id=148 diff --git a/extra/project-euler/151/151.factor b/extra/project-euler/151/151.factor index b64ae3d49f..7913cf9540 100644 --- a/extra/project-euler/151/151.factor +++ b/extra/project-euler/151/151.factor @@ -1,7 +1,6 @@ ! Copyright (c) 2008 Eric Mertens. ! See http://factorcode.org/license.txt for BSD license. -USING: assocs combinators kernel math math.order namespaces sequences - sequences.lib ; +USING: assocs combinators kernel math math.order namespaces sequences ; IN: project-euler.151 ! http://projecteuler.net/index.php?section=problems&id=151 diff --git a/extra/project-euler/186/186.factor b/extra/project-euler/186/186.factor index 5308662daf..7504e09a81 100644 --- a/extra/project-euler/186/186.factor +++ b/extra/project-euler/186/186.factor @@ -1,5 +1,5 @@ USING: circular disjoint-sets kernel math math.ranges - sequences sequences.lib ; +sequences ; IN: project-euler.186 : (generator) ( k -- n ) diff --git a/extra/project-euler/190/190.factor b/extra/project-euler/190/190.factor index 35b9344362..c0b7cb577f 100644 --- a/extra/project-euler/190/190.factor +++ b/extra/project-euler/190/190.factor @@ -1,6 +1,6 @@ ! Copyright (c) 2008 Eric Mertens. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel sequences sequences.lib math math.functions math.ranges locals ; +USING: kernel sequences math math.functions math.ranges locals ; IN: project-euler.190 ! http://projecteuler.net/index.php?section=problems&id=190 From b8f8d1f159d0d6490182f11afb96d73f2f5f1354 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 17:51:08 -0500 Subject: [PATCH 049/948] dont use lib --- extra/money/money.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/money/money.factor b/extra/money/money.factor index 76bc2bae18..5fa76d5f53 100644 --- a/extra/money/money.factor +++ b/extra/money/money.factor @@ -1,6 +1,6 @@ USING: io kernel math math.functions math.parser parser lexer namespaces make sequences splitting grouping combinators -continuations sequences.lib ; +continuations ; IN: money : dollars/cents ( dollars -- dollars cents ) From 3ee55eb341936cc78e0e9d41b28a7925b88931af Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 18:08:21 -0500 Subject: [PATCH 050/948] remove lib usage, update docs --- extra/hexdump/hexdump-docs.factor | 14 ++++++++++++-- extra/hexdump/hexdump.factor | 12 ++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/extra/hexdump/hexdump-docs.factor b/extra/hexdump/hexdump-docs.factor index adf31d3787..a83f64e8db 100644 --- a/extra/hexdump/hexdump-docs.factor +++ b/extra/hexdump/hexdump-docs.factor @@ -1,12 +1,22 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: help.markup help.syntax kernel ; IN: hexdump HELP: hexdump. -{ $values { "seq" "a sequence" } } +{ $values { "sequence" "a sequence" } } { $description "Converts a sequence to its hexadecimal and ASCII representation sixteen characters at a time and writes it to standard out." } ; HELP: hexdump -{ $values { "seq" "a sequence" } { "str" "a string" } } +{ $values { "sequence" "a sequence" } { "string" "a string" } } { $description "Converts a sequence to its hexadecimal and ASCII representation sixteen characters at a time. Lines are separated by a newline character." } { $see-also hexdump. } ; +ARTICLE: "hexdump" "Hexdump" +"The " { $vocab-link "hexdump" } " vocabulary provides a traditional hexdump view of a sequence." $nl +"Write hexdump to string:" +{ $subsection hexdump } +"Write the hexdump to the output stream:" +{ $subsection hexdump. } ; + +ABOUT: "hexdump" diff --git a/extra/hexdump/hexdump.factor b/extra/hexdump/hexdump.factor index f444f5a4f2..618ed00802 100644 --- a/extra/hexdump/hexdump.factor +++ b/extra/hexdump/hexdump.factor @@ -1,5 +1,8 @@ -USING: arrays io io.streams.string kernel math math.parser namespaces -prettyprint sequences sequences.lib splitting grouping strings ascii ; +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: arrays io io.streams.string kernel math math.parser +namespaces prettyprint sequences splitting grouping strings +ascii ; IN: hexdump -: hexdump ( seq -- str ) + +: hexdump ( sequence -- string ) [ dup length header. 16 [ line. ] each-index ] with-string-writer ; -: hexdump. ( seq -- ) +: hexdump. ( sequence -- ) hexdump write ; From 17c8846e9f8e89986b5e4f2ec3354f695128dc63 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 18:11:03 -0500 Subject: [PATCH 051/948] move hexdump to basis --- {extra => basis}/hexdump/authors.txt | 0 {extra => basis}/hexdump/hexdump-docs.factor | 0 {extra => basis}/hexdump/hexdump-tests.factor | 0 {extra => basis}/hexdump/hexdump.factor | 0 {extra => basis}/hexdump/summary.txt | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {extra => basis}/hexdump/authors.txt (100%) rename {extra => basis}/hexdump/hexdump-docs.factor (100%) rename {extra => basis}/hexdump/hexdump-tests.factor (100%) rename {extra => basis}/hexdump/hexdump.factor (100%) rename {extra => basis}/hexdump/summary.txt (100%) diff --git a/extra/hexdump/authors.txt b/basis/hexdump/authors.txt similarity index 100% rename from extra/hexdump/authors.txt rename to basis/hexdump/authors.txt diff --git a/extra/hexdump/hexdump-docs.factor b/basis/hexdump/hexdump-docs.factor similarity index 100% rename from extra/hexdump/hexdump-docs.factor rename to basis/hexdump/hexdump-docs.factor diff --git a/extra/hexdump/hexdump-tests.factor b/basis/hexdump/hexdump-tests.factor similarity index 100% rename from extra/hexdump/hexdump-tests.factor rename to basis/hexdump/hexdump-tests.factor diff --git a/extra/hexdump/hexdump.factor b/basis/hexdump/hexdump.factor similarity index 100% rename from extra/hexdump/hexdump.factor rename to basis/hexdump/hexdump.factor diff --git a/extra/hexdump/summary.txt b/basis/hexdump/summary.txt similarity index 100% rename from extra/hexdump/summary.txt rename to basis/hexdump/summary.txt From f9661a469931dc2834ffedb331fa560e0dfe8ef0 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 18:26:56 -0500 Subject: [PATCH 052/948] fix io.paths --- extra/io/paths/paths.factor | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/extra/io/paths/paths.factor b/extra/io/paths/paths.factor index fb4f6d3a6d..58b3518edd 100755 --- a/extra/io/paths/paths.factor +++ b/extra/io/paths/paths.factor @@ -1,14 +1,16 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: io.files kernel sequences accessors -dlists deques arrays sequences.lib ; +dlists deques arrays ; IN: io.paths TUPLE: directory-iterator path bfs queue ; : qualified-directory ( path -- seq ) - dup directory [ first2 >r append-path r> 2array ] with map ; + dup directory [ first2 [ append-path ] dip 2array ] with map ; : push-directory ( path iter -- ) - >r qualified-directory r> [ + [ qualified-directory ] dip [ dup queue>> swap bfs>> [ push-front ] [ push-back ] if ] curry each ; @@ -24,27 +26,24 @@ TUPLE: directory-iterator path bfs queue ; ] if ; : iterate-directory ( iter quot -- obj ) - 2dup >r >r >r next-file dup [ - r> call dup [ - r> r> 2drop - ] [ - drop r> r> iterate-directory - ] if + over next-file [ + over call + [ 2drop ] [ iterate-directory ] if ] [ - drop r> r> r> 3drop f - ] if ; inline + 2drop f + ] if* ; inline recursive : find-file ( path bfs? quot -- path/f ) - >r r> + [ ] dip [ keep and ] curry iterate-directory ; inline : each-file ( path bfs? quot -- ) - >r r> + [ ] dip [ f ] compose iterate-directory drop ; inline : find-all-files ( path bfs? quot -- paths ) - >r r> - pusher >r [ f ] compose iterate-directory drop r> ; inline + [ ] dip + pusher [ [ f ] compose iterate-directory drop ] dip ; inline : recursive-directory ( path bfs? -- paths ) - [ ] accumulator >r each-file r> ; + [ ] accumulator [ each-file ] dip ; From 426ec8a08b7166dcaedde8b3f0fc7bf58d8fe6d6 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 18:34:42 -0500 Subject: [PATCH 053/948] remove dead file --- extra/crypto/random.factor | 40 -------------------------------------- 1 file changed, 40 deletions(-) delete mode 100755 extra/crypto/random.factor diff --git a/extra/crypto/random.factor b/extra/crypto/random.factor deleted file mode 100755 index f2d3b0555a..0000000000 --- a/extra/crypto/random.factor +++ /dev/null @@ -1,40 +0,0 @@ -USING: kernel math math-contrib sequences namespaces errors -hashtables words arrays parser compiler syntax io ; -IN: crypto -: make-bits ( quot numbits -- n | quot: -- 0/1 ) - 0 -rot [ drop dup call rot 1 shift bitor swap ] each drop ; - -: random-bytes ( m -- n ) - >r [ 2 random ] r> 8 * make-bits ; - -! DEFER: random-bits -: add-bit ( bit integer -- integer ) 1 shift bitor ; -: append-bits ( inta intb nbits -- int ) swapd shift bitor ; -: large-random-bits ( n -- int ) - #! random number with high bit and low bit enabled (odd) - 2 swap ^ [ random ] keep -1 shift 1 bitor bitor ; -! : next-double ( -- f ) 53 random-bits 9007199254740992 /f ; - -: 0count ( integer -- n ) 0 swap [ 0 = [ 1+ ] when ] each-bit ; -: 1count ( integer -- n ) 0 swap [ 1 = [ 1+ ] when ] each-bit ; - -: bit-reverse-table -{ - HEX: 00 HEX: 80 HEX: 40 HEX: C0 HEX: 20 HEX: A0 HEX: 60 HEX: E0 HEX: 10 HEX: 90 HEX: 50 HEX: D0 HEX: 30 HEX: B0 HEX: 70 HEX: F0 - HEX: 08 HEX: 88 HEX: 48 HEX: C8 HEX: 28 HEX: A8 HEX: 68 HEX: E8 HEX: 18 HEX: 98 HEX: 58 HEX: D8 HEX: 38 HEX: B8 HEX: 78 HEX: F8 - HEX: 04 HEX: 84 HEX: 44 HEX: C4 HEX: 24 HEX: A4 HEX: 64 HEX: E4 HEX: 14 HEX: 94 HEX: 54 HEX: D4 HEX: 34 HEX: B4 HEX: 74 HEX: F4 - HEX: 0C HEX: 8C HEX: 4C HEX: CC HEX: 2C HEX: AC HEX: 6C HEX: EC HEX: 1C HEX: 9C HEX: 5C HEX: DC HEX: 3C HEX: BC HEX: 7C HEX: FC - HEX: 02 HEX: 82 HEX: 42 HEX: C2 HEX: 22 HEX: A2 HEX: 62 HEX: E2 HEX: 12 HEX: 92 HEX: 52 HEX: D2 HEX: 32 HEX: B2 HEX: 72 HEX: F2 - HEX: 0A HEX: 8A HEX: 4A HEX: CA HEX: 2A HEX: AA HEX: 6A HEX: EA HEX: 1A HEX: 9A HEX: 5A HEX: DA HEX: 3A HEX: BA HEX: 7A HEX: FA - HEX: 06 HEX: 86 HEX: 46 HEX: C6 HEX: 26 HEX: A6 HEX: 66 HEX: E6 HEX: 16 HEX: 96 HEX: 56 HEX: D6 HEX: 36 HEX: B6 HEX: 76 HEX: F6 - HEX: 0E HEX: 8E HEX: 4E HEX: CE HEX: 2E HEX: AE HEX: 6E HEX: EE HEX: 1E HEX: 9E HEX: 5E HEX: DE HEX: 3E HEX: BE HEX: 7E HEX: FE - HEX: 01 HEX: 81 HEX: 41 HEX: C1 HEX: 21 HEX: A1 HEX: 61 HEX: E1 HEX: 11 HEX: 91 HEX: 51 HEX: D1 HEX: 31 HEX: B1 HEX: 71 HEX: F1 - HEX: 09 HEX: 89 HEX: 49 HEX: C9 HEX: 29 HEX: A9 HEX: 69 HEX: E9 HEX: 19 HEX: 99 HEX: 59 HEX: D9 HEX: 39 HEX: B9 HEX: 79 HEX: F9 - HEX: 05 HEX: 85 HEX: 45 HEX: C5 HEX: 25 HEX: A5 HEX: 65 HEX: E5 HEX: 15 HEX: 95 HEX: 55 HEX: D5 HEX: 35 HEX: B5 HEX: 75 HEX: F5 - HEX: 0D HEX: 8D HEX: 4D HEX: CD HEX: 2D HEX: AD HEX: 6D HEX: ED HEX: 1D HEX: 9D HEX: 5D HEX: DD HEX: 3D HEX: BD HEX: 7D HEX: FD - HEX: 03 HEX: 83 HEX: 43 HEX: C3 HEX: 23 HEX: A3 HEX: 63 HEX: E3 HEX: 13 HEX: 93 HEX: 53 HEX: D3 HEX: 33 HEX: B3 HEX: 73 HEX: F3 - HEX: 0B HEX: 8B HEX: 4B HEX: CB HEX: 2B HEX: AB HEX: 6B HEX: EB HEX: 1B HEX: 9B HEX: 5B HEX: DB HEX: 3B HEX: BB HEX: 7B HEX: FB - HEX: 07 HEX: 87 HEX: 47 HEX: C7 HEX: 27 HEX: A7 HEX: 67 HEX: E7 HEX: 17 HEX: 97 HEX: 57 HEX: D7 HEX: 37 HEX: B7 HEX: 77 HEX: F7 - HEX: 0F HEX: 8F HEX: 4F HEX: CF HEX: 2F HEX: AF HEX: 6F HEX: EF HEX: 1F HEX: 9F HEX: 5F HEX: DF HEX: 3F HEX: BF HEX: 7F HEX: FF -} ; inline - From b35db385d345ff0448b38a3d2c61fdb78528bed0 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 18:45:51 -0500 Subject: [PATCH 054/948] fix up extra/crypto --- extra/crypto/barrett/barrett-tests.factor | 3 +++ extra/crypto/barrett/barrett.factor | 10 ++++------ extra/crypto/common/authors.txt | 1 - extra/crypto/common/common.factor | 17 ----------------- extra/crypto/hmac/hmac.factor | 2 +- extra/crypto/rsa/rsa-tests.factor | 1 + extra/crypto/rsa/rsa.factor | 2 ++ extra/crypto/summary.txt | 2 +- extra/crypto/xor/xor-tests.factor | 19 ++++++++++--------- extra/crypto/xor/xor.factor | 14 +++++++++----- 10 files changed, 31 insertions(+), 40 deletions(-) delete mode 100755 extra/crypto/common/authors.txt delete mode 100644 extra/crypto/common/common.factor diff --git a/extra/crypto/barrett/barrett-tests.factor b/extra/crypto/barrett/barrett-tests.factor index be52240372..01163f730f 100644 --- a/extra/crypto/barrett/barrett-tests.factor +++ b/extra/crypto/barrett/barrett-tests.factor @@ -1,4 +1,7 @@ +! Copyright (C) 2008 DoDoug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: crypto.barrett kernel math namespaces tools.test ; +IN: crypto.barrett.tests [ HEX: 1f63edfb7e838622c7412eafaf0439cf0cdf3aae8bdd09e2de69b509a53883a83560d5ce50ea039e4 ] [ HEX: 827c67f31b2b46afa49ed95d7f7a3011e5875f7052d4c55437ce726d3c6ce0dc9c445fda63b6dc4e 16 barrett-mu ] unit-test diff --git a/extra/crypto/barrett/barrett.factor b/extra/crypto/barrett/barrett.factor index 4a070190e3..25e67d01ce 100644 --- a/extra/crypto/barrett/barrett.factor +++ b/extra/crypto/barrett/barrett.factor @@ -1,14 +1,12 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: kernel math math.functions ; IN: crypto.barrett : barrett-mu ( n size -- mu ) #! Calculates Barrett's reduction parameter mu #! size = word size in bits (8, 16, 32, 64, ...) - ! over log2 1+ over / 2 * >r 2 swap ^ r> ^ swap / floor ; - [ - [ log2 1+ ] [ / 2 * ] bi* - ] [ - 2^ rot ^ swap /i - ] 2bi ; + [ [ log2 1+ ] [ / 2 * ] bi* ] + [ 2^ rot ^ swap /i ] 2bi ; diff --git a/extra/crypto/common/authors.txt b/extra/crypto/common/authors.txt deleted file mode 100755 index 7c1b2f2279..0000000000 --- a/extra/crypto/common/authors.txt +++ /dev/null @@ -1 +0,0 @@ -Doug Coleman diff --git a/extra/crypto/common/common.factor b/extra/crypto/common/common.factor deleted file mode 100644 index 61cc11f959..0000000000 --- a/extra/crypto/common/common.factor +++ /dev/null @@ -1,17 +0,0 @@ -USING: arrays kernel io io.binary sbufs splitting grouping -strings sequences namespaces math math.parser parser -hints math.bitwise assocs ; -IN: crypto.common - -: (nth-int) ( string n -- int ) - 2 shift dup 4 + rot ; inline - -: nth-int ( string n -- int ) (nth-int) le> ; inline - -: update ( num var -- ) [ w+ ] change ; inline - -SYMBOL: big-endian? - -: mod-nth ( n seq -- elt ) - #! 5 "abcd" -> b - [ length mod ] [ nth ] bi ; diff --git a/extra/crypto/hmac/hmac.factor b/extra/crypto/hmac/hmac.factor index 6e30f19775..d98e8a9798 100755 --- a/extra/crypto/hmac/hmac.factor +++ b/extra/crypto/hmac/hmac.factor @@ -1,4 +1,4 @@ -USING: arrays combinators crypto.common checksums checksums.md5 +USING: arrays combinators checksums checksums.md5 checksums.sha1 checksums.md5.private io io.binary io.files io.streams.byte-array kernel math math.vectors memoize sequences io.encodings.binary ; diff --git a/extra/crypto/rsa/rsa-tests.factor b/extra/crypto/rsa/rsa-tests.factor index 7de6bed76f..03aca0578b 100644 --- a/extra/crypto/rsa/rsa-tests.factor +++ b/extra/crypto/rsa/rsa-tests.factor @@ -1,4 +1,5 @@ USING: kernel math namespaces crypto.rsa tools.test ; +IN: crypto.rsa.tests [ 123456789 ] [ 128 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test [ 123456789 ] [ 129 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test diff --git a/extra/crypto/rsa/rsa.factor b/extra/crypto/rsa/rsa.factor index 5d3228db10..b1eb907547 100644 --- a/extra/crypto/rsa/rsa.factor +++ b/extra/crypto/rsa/rsa.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: math.miller-rabin kernel math math.functions namespaces sequences accessors ; IN: crypto.rsa diff --git a/extra/crypto/summary.txt b/extra/crypto/summary.txt index edd7c44333..0421c07ca0 100644 --- a/extra/crypto/summary.txt +++ b/extra/crypto/summary.txt @@ -1 +1 @@ -Cryptographic algorithms implemented in Factor, such as MD5 and SHA1 +HMAC, XOR, Barrett, RSA, Timing diff --git a/extra/crypto/xor/xor-tests.factor b/extra/crypto/xor/xor-tests.factor index ef781b9f25..f3a13e086f 100644 --- a/extra/crypto/xor/xor-tests.factor +++ b/extra/crypto/xor/xor-tests.factor @@ -2,23 +2,24 @@ USING: continuations crypto.xor kernel strings tools.test ; IN: crypto.xor.tests ! No key -[ "" dup xor-crypt ] [ T{ no-xor-key f } = ] must-fail-with -[ { } dup xor-crypt ] [ T{ no-xor-key f } = ] must-fail-with -[ V{ } dup xor-crypt ] [ T{ no-xor-key f } = ] must-fail-with -[ "" "asdf" dupd xor-crypt xor-crypt ] [ T{ no-xor-key f } = ] must-fail-with +[ "" dup xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with +[ { } dup xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with +[ V{ } dup xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with +[ "" "asdf" dupd xor-crypt xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with ! a xor a = 0 [ "\0\0\0\0\0\0\0" ] [ "abcdefg" dup xor-crypt ] unit-test [ { 15 15 15 15 } ] [ { 10 10 10 10 } { 5 5 5 5 } xor-crypt ] unit-test -[ "asdf" ] [ "key" "asdf" dupd xor-crypt xor-crypt >string ] unit-test -[ "" ] [ "key" "" xor-crypt >string ] unit-test +[ "asdf" ] [ "asdf" "key" [ xor-crypt ] [ xor-crypt ] bi >string ] unit-test +[ "" ] [ "" "key" xor-crypt >string ] unit-test [ "a longer message...!" ] [ - "." - "a longer message...!" dupd xor-crypt xor-crypt >string + "a longer message...!" + "." [ xor-crypt ] [ xor-crypt ] bi >string ] unit-test [ "a longer message...!" ] [ + "a longer message...!" "a very long key, longer than the message even." - "a longer message...!" dupd xor-crypt xor-crypt >string + [ xor-crypt ] [ xor-crypt ] bi >string ] unit-test diff --git a/extra/crypto/xor/xor.factor b/extra/crypto/xor/xor.factor index 247387ebdf..6e3a605f5c 100644 --- a/extra/crypto/xor/xor.factor +++ b/extra/crypto/xor/xor.factor @@ -1,8 +1,12 @@ -USING: crypto.common kernel math sequences ; +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel math sequences fry ; IN: crypto.xor -ERROR: no-xor-key ; +: mod-nth ( n seq -- elt ) [ length mod ] [ nth ] bi ; -: xor-crypt ( key seq -- seq' ) - over empty? [ no-xor-key ] when - dup length rot [ mod-nth bitxor ] curry 2map ; +ERROR: empty-xor-key ; + +: xor-crypt ( seq key -- seq' ) + dup empty? [ empty-xor-key ] when + [ dup length ] dip '[ _ mod-nth bitxor ] 2map ; From 4c8ff1e2897a6409525b5c21994454110aab856c Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 19:03:57 -0500 Subject: [PATCH 055/948] fix taxes --- extra/taxes/usa/federal/federal.factor | 12 ++++++++++++ extra/taxes/usa/fica/fica.factor | 2 +- extra/taxes/usa/usa-tests.factor | 4 ++-- extra/taxes/usa/usa.factor | 13 ++----------- 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/extra/taxes/usa/federal/federal.factor b/extra/taxes/usa/federal/federal.factor index 5274535f81..b71b831ca6 100644 --- a/extra/taxes/usa/federal/federal.factor +++ b/extra/taxes/usa/federal/federal.factor @@ -45,3 +45,15 @@ M: federal withholding* ( salary w4 tax-table entity -- x ) [ federal-tax ] 3keep drop [ fica-tax ] 2keep medicare-tax + + ; + +: total-withholding ( salary w4 tax-table -- x ) + dup entity>> dup federal = [ + withholding* + ] [ + drop + [ drop federal withholding* ] + [ dup entity>> withholding* ] 3bi + + ] if ; + +: net ( salary w4 collector -- x ) + >r dupd r> total-withholding - ; diff --git a/extra/taxes/usa/fica/fica.factor b/extra/taxes/usa/fica/fica.factor index e71b2723a3..c1e85b75b4 100644 --- a/extra/taxes/usa/fica/fica.factor +++ b/extra/taxes/usa/fica/fica.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors math math.order money ; +USING: accessors assocs.lib math math.order money ; IN: taxes.usa.fica : fica-tax-rate ( -- x ) DECIMAL: .062 ; inline diff --git a/extra/taxes/usa/usa-tests.factor b/extra/taxes/usa/usa-tests.factor index 6aac4b928c..a529762c81 100644 --- a/extra/taxes/usa/usa-tests.factor +++ b/extra/taxes/usa/usa-tests.factor @@ -110,9 +110,9 @@ IN: taxes.usa.tests [ 138 69 ] [ - 24000 2008 2 f withholding biweekly dollars/cents + 24000 2008 2 f total-withholding biweekly dollars/cents ] unit-test [ 754 72 ] [ - 78250 2008 2 f withholding biweekly dollars/cents + 78250 2008 2 f total-withholding biweekly dollars/cents ] unit-test diff --git a/extra/taxes/usa/usa.factor b/extra/taxes/usa/usa.factor index 1d21524b45..27ff4aef98 100644 --- a/extra/taxes/usa/usa.factor +++ b/extra/taxes/usa/usa.factor @@ -1,8 +1,7 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays assocs kernel math math.intervals -namespaces sequences money math.order taxes.usa.w4 -taxes.usa.federal ; +namespaces sequences money math.order taxes.usa.w4 ; IN: taxes.usa ! Withhold: FICA, Medicare, Federal (FICA is social security) @@ -17,12 +16,7 @@ GENERIC: withholding* ( salary w4 tax-table entity -- x ) dup entity>> adjust-allowances* ; : withholding ( salary w4 tax-table -- x ) - dup entity>> federal = [ - dup entity>> withholding* - ] [ - [ dup entity>> withholding* ] - [ drop federal withholding* ] 3bi + - ] if ; + dup entity>> withholding* ; : tax-bracket-range ( pair -- n ) first2 swap - ; @@ -36,6 +30,3 @@ GENERIC: withholding* ( salary w4 tax-table entity -- x ) : marriage-table ( w4 tax-table -- triples ) swap married?>> [ married>> ] [ single>> ] if ; - -: net ( salary w4 collector -- x ) - >r dupd r> withholding - ; From ec31e23ca7e8b86a42a8527fc8a3f5bb23564603 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Thu, 2 Oct 2008 19:35:03 -0500 Subject: [PATCH 056/948] trivial lint changes --- unmaintained/lint/lint.factor | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/unmaintained/lint/lint.factor b/unmaintained/lint/lint.factor index 644346d29e..ab1a67a83e 100644 --- a/unmaintained/lint/lint.factor +++ b/unmaintained/lint/lint.factor @@ -3,14 +3,15 @@ USING: accessors alien alien.accessors arrays assocs combinators.lib io kernel macros math namespaces prettyprint quotations sequences vectors vocabs words html.elements sets -slots.private combinators.short-circuit ; +slots.private combinators.short-circuit math.order hashtables +sequences.deep ; IN: lint SYMBOL: def-hash SYMBOL: def-hash-keys : set-hash-vector ( val key hash -- ) - 2dup at -rot >r >r ?push r> r> set-at ; + 2dup at -rot [ ?push ] 2dip set-at ; : add-word-def ( word quot -- ) dup callable? [ @@ -67,7 +68,7 @@ def-hash get-global [ ! Remove constants [ 1 ] [ - drop dup length 1 = swap first number? and not + drop { [ length 1 = ] [ first number? ] } 1&& not ] assoc-filter ! Remove set-alien-cell, etc. @@ -80,6 +81,13 @@ def-hash get-global [ drop trivial-defs member? not ] assoc-filter +[ + drop { + [ [ wrapper? ] deep-contains? ] + [ [ hashtable? ] deep-contains? ] + } 1|| not +] assoc-filter + ! Remove n m shift defs [ drop dup length 3 = [ From 743ec65b4fe1729fd39ab409ef7a4d105d3b3c79 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 3 Oct 2008 01:12:09 -0500 Subject: [PATCH 057/948] Move hexdump back to extra --- {basis => extra}/hexdump/authors.txt | 0 {basis => extra}/hexdump/hexdump-docs.factor | 0 {basis => extra}/hexdump/hexdump-tests.factor | 0 {basis => extra}/hexdump/hexdump.factor | 0 {basis => extra}/hexdump/summary.txt | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {basis => extra}/hexdump/authors.txt (100%) rename {basis => extra}/hexdump/hexdump-docs.factor (100%) rename {basis => extra}/hexdump/hexdump-tests.factor (100%) rename {basis => extra}/hexdump/hexdump.factor (100%) rename {basis => extra}/hexdump/summary.txt (100%) diff --git a/basis/hexdump/authors.txt b/extra/hexdump/authors.txt similarity index 100% rename from basis/hexdump/authors.txt rename to extra/hexdump/authors.txt diff --git a/basis/hexdump/hexdump-docs.factor b/extra/hexdump/hexdump-docs.factor similarity index 100% rename from basis/hexdump/hexdump-docs.factor rename to extra/hexdump/hexdump-docs.factor diff --git a/basis/hexdump/hexdump-tests.factor b/extra/hexdump/hexdump-tests.factor similarity index 100% rename from basis/hexdump/hexdump-tests.factor rename to extra/hexdump/hexdump-tests.factor diff --git a/basis/hexdump/hexdump.factor b/extra/hexdump/hexdump.factor similarity index 100% rename from basis/hexdump/hexdump.factor rename to extra/hexdump/hexdump.factor diff --git a/basis/hexdump/summary.txt b/extra/hexdump/summary.txt similarity index 100% rename from basis/hexdump/summary.txt rename to extra/hexdump/summary.txt From 196c91709f4cb5e0582f5f88b21c473bece9ce1e Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 3 Oct 2008 01:12:50 -0500 Subject: [PATCH 058/948] stop-server word --- basis/io/servers/connection/connection.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/io/servers/connection/connection.factor b/basis/io/servers/connection/connection.factor index 0516f24402..674ed8803c 100644 --- a/basis/io/servers/connection/connection.factor +++ b/basis/io/servers/connection/connection.factor @@ -105,7 +105,7 @@ M: threaded-server handle-client* handler>> call ; threaded-server get encoding>> [ started-accept-loop ] [ [ accept-loop ] with-disposal ] bi ; -\ start-accept-loop ERROR add-error-logging +\ start-accept-loop NOTICE add-error-logging : init-server ( threaded-server -- threaded-server ) dup semaphore>> [ From ce8b1e3fff3e911ba1fc199c578c23e83b2a72dc Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 3 Oct 2008 01:13:01 -0500 Subject: [PATCH 059/948] Fix permissions --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) mode change 100755 => 100644 Makefile diff --git a/Makefile b/Makefile old mode 100755 new mode 100644 index 769aeacb8c..aa520063e3 --- a/Makefile +++ b/Makefile @@ -149,14 +149,11 @@ macosx.app: factor ln -s Factor.app/Contents/MacOS/factor ./factor cp $(ENGINE) $(BUNDLE)/Contents/Frameworks - install_name_tool \ - -id @executable_path/../Frameworks/libfreetype.6.dylib \ - Factor.app/Contents/Frameworks/libfreetype.6.dylib install_name_tool \ -change libfactor.dylib \ @executable_path/../Frameworks/libfactor.dylib \ Factor.app/Contents/MacOS/factor - + factor: $(DLL_OBJS) $(EXE_OBJS) $(LINKER) $(ENGINE) $(DLL_OBJS) $(CC) $(LIBS) $(LIBPATH) -L. $(LINK_WITH_ENGINE) \ From 56a0af9628c7817202729b881387b6da92ac2d77 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 3 Oct 2008 02:19:03 -0500 Subject: [PATCH 060/948] initial math cleanup --- extra/math/algebra/algebra.factor | 6 ++- extra/math/analysis/analysis.factor | 12 +++-- extra/math/combinatorics/combinatorics.factor | 11 ++-- extra/math/compare/compare.factor | 1 - extra/math/derivatives/derivatives.factor | 13 +++-- extra/math/erato/erato.factor | 4 +- extra/math/fft/fft.factor | 2 +- extra/math/miller-rabin/miller-rabin.factor | 2 + .../math/newtons-method/newtons-method.factor | 14 +++-- .../numerical-integration.factor | 14 ++--- extra/math/polynomials/polynomials.factor | 4 +- extra/math/primes/primes.factor | 51 ++++++++++--------- extra/math/quaternions/quaternions.factor | 2 +- extra/math/secant-method/secant-method.factor | 24 ++++++--- extra/math/statistics/statistics.factor | 6 ++- extra/math/text/english/english.factor | 11 ++-- extra/math/trig/trig.factor | 4 +- 17 files changed, 101 insertions(+), 80 deletions(-) diff --git a/extra/math/algebra/algebra.factor b/extra/math/algebra/algebra.factor index 8bb8420d1a..8cccded26a 100644 --- a/extra/math/algebra/algebra.factor +++ b/extra/math/algebra/algebra.factor @@ -1,8 +1,10 @@ ! Copyright (c) 2007 Samuel Tardieu ! See http://factorcode.org/license.txt for BSD license. -USING: kernel math math.functions sequences ; +USING: kernel math math.functions sequences fry ; IN: math.algebra : chinese-remainder ( aseq nseq -- x ) dup product - [ [ over / [ swap gcd drop ] keep * * ] curry 2map sum ] keep rem ; foldable + [ + '[ _ over / [ swap gcd drop ] keep * * ] 2map sum + ] keep rem ; foldable diff --git a/extra/math/analysis/analysis.factor b/extra/math/analysis/analysis.factor index a41281d779..7da1c96b61 100755 --- a/extra/math/analysis/analysis.factor +++ b/extra/math/analysis/analysis.factor @@ -1,5 +1,7 @@ +! Copyright (C) 2008 Doug Coleman, Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. USING: kernel math math.constants math.functions math.intervals -math.vectors namespaces sequences ; +math.vectors namespaces sequences combinators.short-circuit ; IN: math.analysis r log * r> - - swap 6 gamma-z gamma-p6 v. log + ; + [ 0.5 + dup gamma-g6 + dup [ log * ] dip - ] + [ 6 gamma-z gamma-p6 v. log ] bi + ; : gamma-lanczos6 ( x -- gamma[x] ) #! gamma(x) = gamma(x+1) / x @@ -39,7 +41,7 @@ PRIVATE> : gamma ( x -- y ) #! gamma(x) = integral 0..inf [ t^(x-1) exp(-t) ] dt #! gamma(n+1) = n! for n > 0 - dup 0.0 <= over 1.0 mod zero? and [ + dup { [ 0.0 <= ] [ 1.0 mod zero? ] } 1&& [ drop 1./0. ] [ dup abs gamma-lanczos6 swap dup 0 > [ drop ] [ gamma-neg ] if @@ -55,7 +57,7 @@ PRIVATE> ] if ; : nth-root ( n x -- y ) - over 0 = [ "0th root is undefined" throw ] when >r recip r> swap ^ ; + [ recip ] dip swap ^ ; ! Forth Scientific Library Algorithm #1 ! diff --git a/extra/math/combinatorics/combinatorics.factor b/extra/math/combinatorics/combinatorics.factor index a0c6df083b..b1c49b8ab5 100644 --- a/extra/math/combinatorics/combinatorics.factor +++ b/extra/math/combinatorics/combinatorics.factor @@ -1,7 +1,7 @@ ! Copyright (c) 2007, 2008 Slava Pestov, Doug Coleman, Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. USING: assocs kernel math math.order math.ranges mirrors -namespaces make sequences sequences.lib sorting ; +namespaces sequences sorting fry ; IN: math.combinatorics [ dupd - ] when ; inline ! See this article for explanation of the factoradic-based permutation methodology: -! http://msdn2.microsoft.com/en-us/library/aa302371.aspx +! http://msdn2.microsoft.com/en-us/library/aa302371.aspx : factoradic ( n -- factoradic ) 0 [ over 0 > ] [ 1+ [ /mod ] keep swap ] [ ] produce reverse 2nip ; @@ -39,13 +39,10 @@ PRIVATE> twiddle [ nPk ] keep factorial / ; : permutation ( n seq -- seq ) - tuck permutation-indices swap nths ; + [ permutation-indices ] keep nths ; : all-permutations ( seq -- seq ) - [ - [ length factorial ] keep [ permutation , ] curry each - ] { } make ; + [ length factorial ] keep '[ _ permutation ] map ; : inverse-permutation ( seq -- permutation ) >alist sort-values keys ; - diff --git a/extra/math/compare/compare.factor b/extra/math/compare/compare.factor index 28a8eadc81..d19dac3d2b 100644 --- a/extra/math/compare/compare.factor +++ b/extra/math/compare/compare.factor @@ -19,4 +19,3 @@ IN: math.compare : clamp ( a value b -- x ) min max ; - diff --git a/extra/math/derivatives/derivatives.factor b/extra/math/derivatives/derivatives.factor index ad8d944bfe..b7612e112b 100644 --- a/extra/math/derivatives/derivatives.factor +++ b/extra/math/derivatives/derivatives.factor @@ -1,4 +1,3 @@ - USING: kernel continuations combinators sequences math math.order math.ranges accessors float-arrays ; @@ -7,11 +6,11 @@ IN: math.derivatives TUPLE: state x func h err i j errt fac hh ans a done ; : largest-float ( -- x ) HEX: 7fefffffffffffff bits>double ; foldable -: ntab ( -- val ) 8 ; -: con ( -- val ) 1.6 ; -: con2 ( -- val ) con con * ; -: big ( -- val ) largest-float ; -: safe ( -- val ) 2.0 ; +: ntab ( -- val ) 8 ; inline +: con ( -- val ) 1.6 ; inline +: con2 ( -- val ) con con * ; inline +: big ( -- val ) largest-float ; inline +: safe ( -- val ) 2.0 ; inline ! Yes, this was ported from C code. : a[i][i] ( state -- elt ) [ i>> ] [ i>> ] [ a>> ] tri nth nth ; @@ -120,4 +119,4 @@ TUPLE: state x func h err i j errt fac hh ans a done ; bi ; : derivative ( x func -- m ) 0.01 2.0 (derivative) drop ; -: derivative-func ( func -- der ) [ derivative ] curry ; \ No newline at end of file +: derivative-func ( func -- der ) [ derivative ] curry ; diff --git a/extra/math/erato/erato.factor b/extra/math/erato/erato.factor index f836d71a99..4c6675e8f1 100644 --- a/extra/math/erato/erato.factor +++ b/extra/math/erato/erato.factor @@ -11,8 +11,8 @@ TUPLE: erato limit bits latest ; : ind ( n -- i ) 2/ 1- ; inline -: is-prime ( n erato -- bool ) - >r ind r> bits>> nth ; inline +: is-prime ( n limit -- bool ) + [ ind ] [ bits>> ] bi* nth ; inline : indices ( n erato -- range ) limit>> ind over 3 * ind swap rot ; diff --git a/extra/math/fft/fft.factor b/extra/math/fft/fft.factor index 682d2a49db..b82ecb6b2c 100644 --- a/extra/math/fft/fft.factor +++ b/extra/math/fft/fft.factor @@ -9,7 +9,7 @@ IN: math.fft : odd ( seq -- seq ) 2 group 1 ; DEFER: fft : two ( seq -- seq ) fft 2 v/n dup append ; -: omega ( n -- n ) recip -2 pi i* * * exp ; +: omega ( n -- n' ) recip -2 pi i* * * exp ; : twiddle ( seq -- seq ) dup length dup omega swap n^v v* ; : (fft) ( seq -- seq ) dup odd two twiddle swap even two v+ ; : fft ( seq -- seq ) dup length 1 = [ (fft) ] unless ; diff --git a/extra/math/miller-rabin/miller-rabin.factor b/extra/math/miller-rabin/miller-rabin.factor index f1953340db..45665c701d 100755 --- a/extra/math/miller-rabin/miller-rabin.factor +++ b/extra/math/miller-rabin/miller-rabin.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: combinators combinators.lib io locals kernel math math.functions math.ranges namespaces random sequences hashtables sets ; diff --git a/extra/math/newtons-method/newtons-method.factor b/extra/math/newtons-method/newtons-method.factor index 5bf71deac8..269eae2538 100644 --- a/extra/math/newtons-method/newtons-method.factor +++ b/extra/math/newtons-method/newtons-method.factor @@ -1,11 +1,17 @@ ! Copyright © 2008 Reginald Keith Ford II +! See http://factorcode.org/license.txt for BSD license. ! Newton's Method of approximating roots - USING: kernel math math.derivatives ; IN: math.newtons-method -: newtons-method ( guess function -- x ) newton-precision [ [ newton-step ] keep ] times drop ; + +: newtons-method ( guess function -- x ) + newton-precision [ [ newton-step ] keep ] times drop ; diff --git a/extra/math/numerical-integration/numerical-integration.factor b/extra/math/numerical-integration/numerical-integration.factor index 798d3a5e71..dfaa618b53 100644 --- a/extra/math/numerical-integration/numerical-integration.factor +++ b/extra/math/numerical-integration/numerical-integration.factor @@ -1,18 +1,20 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel sequences namespaces make math math.ranges math.vectors vectors ; IN: math.numerical-integration SYMBOL: num-steps 180 num-steps set-global + : setup-simpson-range ( from to -- frange ) 2dup swap - num-steps get / ; : generate-simpson-weights ( seq -- seq ) - [ - { 1 4 } % length 2 / 2 - { 2 4 } concat % 1 , - ] { } make ; + { 1 4 } + swap length 2 / 2 - { 2 4 } concat + { 1 } 3append ; : integrate-simpson ( from to f -- x ) - >r setup-simpson-range r> - dupd map dup generate-simpson-weights + [ setup-simpson-range dup ] dip + map dup generate-simpson-weights v. swap [ third ] keep first - 6 / * ; - diff --git a/extra/math/polynomials/polynomials.factor b/extra/math/polynomials/polynomials.factor index 8662bbb089..51512ca2e3 100644 --- a/extra/math/polynomials/polynomials.factor +++ b/extra/math/polynomials/polynomials.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel sequences vectors math math.vectors namespaces make shuffle splitting sequences.lib math.order ; IN: math.polynomials @@ -82,5 +84,5 @@ PRIVATE> : polyval ( p x -- p[x] ) #! Evaluate a polynomial. - >r dup length r> powers v. ; + [ dup length ] dip powers v. ; diff --git a/extra/math/primes/primes.factor b/extra/math/primes/primes.factor index f3a515e72b..feb60c555d 100644 --- a/extra/math/primes/primes.factor +++ b/extra/math/primes/primes.factor @@ -8,44 +8,45 @@ IN: math.primes : next-prime ( n -- p ) - dup 999983 < [ - primes-under-million [ natural-search drop 1+ ] keep nth - ] [ - next-odd find-prime-miller-rabin - ] if ; foldable + dup 999983 < [ + primes-under-million [ natural-search drop 1+ ] keep nth + ] [ + next-odd find-prime-miller-rabin + ] if ; foldable : prime? ( n -- ? ) - dup 1000000 < [ - dup primes-under-million natural-search nip = - ] [ - miller-rabin - ] if ; foldable + dup 1000000 < [ + dup primes-under-million natural-search nip = + ] [ + miller-rabin + ] if ; foldable : lprimes ( -- list ) - 0 primes-under-million seq>list - 1000003 [ 2 + find-prime-miller-rabin ] lfrom-by - lappend ; + 0 primes-under-million seq>list + 1000003 [ 2 + find-prime-miller-rabin ] lfrom-by + lappend ; : lprimes-from ( n -- list ) - dup 3 < [ drop lprimes ] [ 1- next-prime [ next-prime ] lfrom-by ] if ; + dup 3 < [ drop lprimes ] [ 1- next-prime [ next-prime ] lfrom-by ] if ; : primes-upto ( n -- seq ) - { - { [ dup 2 < ] [ drop { } ] } - { [ dup 1000003 < ] - [ primes-under-million [ natural-search drop 1+ 0 swap ] keep ] } - [ primes-under-million 1000003 lprimes-from - rot [ <= ] curry lwhile list>array append ] - } cond ; foldable + { + { [ dup 2 < ] [ drop { } ] } + { [ dup 1000003 < ] [ + primes-under-million [ natural-search drop 1+ 0 swap ] keep + ] } + [ primes-under-million 1000003 lprimes-from + rot [ <= ] curry lwhile list>array append ] + } cond ; foldable : primes-between ( low high -- seq ) - primes-upto - [ 1- next-prime ] dip - [ natural-search drop ] keep [ length ] keep ; foldable + primes-upto + [ 1- next-prime ] dip + [ natural-search drop ] keep [ length ] keep ; foldable : coprime? ( a b -- ? ) gcd nip 1 = ; foldable diff --git a/extra/math/quaternions/quaternions.factor b/extra/math/quaternions/quaternions.factor index 3c450f1c05..65f18d3568 100755 --- a/extra/math/quaternions/quaternions.factor +++ b/extra/math/quaternions/quaternions.factor @@ -28,7 +28,7 @@ PRIVATE> : qconjugate ( u -- u' ) #! Quaternion conjugate. - first2 neg >r conjugate r> 2array ; + first2 [ conjugate ] [ neg ] bi* 2array ; : qrecip ( u -- 1/u ) #! Quaternion inverse. diff --git a/extra/math/secant-method/secant-method.factor b/extra/math/secant-method/secant-method.factor index e039b42bbd..ad52c0cd4a 100644 --- a/extra/math/secant-method/secant-method.factor +++ b/extra/math/secant-method/secant-method.factor @@ -1,14 +1,26 @@ ! Copyright © 2008 Reginald Keith Ford II +! See http://factorcode.org/license.txt for BSD license. ! Secant Method of approximating roots - USING: kernel math math.function-tools math.points math.vectors ; IN: math.secant-method -: secant-method ( left right function -- x ) secant-precision [ secant-step ] times drop + 2 / ; + +: secant-method ( left right function -- x ) + secant-precision [ secant-step ] times drop + 2 / ; + ! : close-enough? ( a b -- t/f ) - abs tiny-amount < ; -! : secant-method2 ( left right function -- x ) 2over close-enough? [ drop average ] [ secant-step secant-method ] if ; \ No newline at end of file + +! : secant-method2 ( left right function -- x ) + ! 2over close-enough? + ! [ drop average ] [ secant-step secant-method ] if ; diff --git a/extra/math/statistics/statistics.factor b/extra/math/statistics/statistics.factor index 28cc05151b..8cd6d26c1c 100644 --- a/extra/math/statistics/statistics.factor +++ b/extra/math/statistics/statistics.factor @@ -1,5 +1,7 @@ +! Copyright (C) 2008 Doug Coleman, Michael Judge. +! See http://factorcode.org/license.txt for BSD license. USING: kernel math math.analysis math.functions math.vectors sequences - sequences.lib sorting ; +sequences.lib sorting ; IN: math.statistics : mean ( seq -- n ) @@ -18,7 +20,7 @@ IN: math.statistics : median ( seq -- n ) #! middle number if odd, avg of two middle numbers if even natural-sort dup length dup even? [ - 1- 2 / swap [ nth ] [ >r 1+ r> nth ] 2bi + 2 / + 1- 2 / swap [ nth ] [ [ 1+ ] dip nth ] 2bi + 2 / ] [ 2 / swap nth ] if ; diff --git a/extra/math/text/english/english.factor b/extra/math/text/english/english.factor index 387be4d791..439d0a75fe 100755 --- a/extra/math/text/english/english.factor +++ b/extra/math/text/english/english.factor @@ -1,8 +1,7 @@ ! Copyright (c) 2007 Aaron Schaefer. ! See http://factorcode.org/license.txt for BSD license. USING: combinators.lib kernel math math.functions math.parser namespaces - sequences splitting grouping sequences.lib - combinators.short-circuit ; +sequences splitting grouping combinators.short-circuit ; IN: math.text.english text) ( n -- str ) - dup negative-text swap abs 3digit-groups recombine append ; + [ negative-text ] [ abs 3digit-groups recombine ] bi append ; PRIVATE> : number>text ( n -- str ) - dup zero? [ - small-numbers - ] [ - [ (number>text) ] with-scope - ] if ; + dup zero? [ small-numbers ] [ [ (number>text) ] with-scope ] if ; diff --git a/extra/math/trig/trig.factor b/extra/math/trig/trig.factor index be9ec6a56c..3d9428adda 100644 --- a/extra/math/trig/trig.factor +++ b/extra/math/trig/trig.factor @@ -1,6 +1,6 @@ - +! Copyright (C) 2008 Eduardo Cavazos. +! See http://factorcode.org/license.txt for BSD license. USING: math math.constants ; - IN: math.trig : deg>rad pi * 180 / ; inline From dc4e989002a01bbe8af9d9d46b6296ac6a18587e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 3 Oct 2008 20:19:20 -0500 Subject: [PATCH 061/948] clean up the db code some, more docs --- basis/db/db-docs.factor | 70 ++++++++++++++++++++++-------- basis/db/db.factor | 16 +++---- basis/db/sqlite/sqlite.factor | 4 +- basis/db/tuples/tuples-docs.factor | 55 ++++++++++++++++++++++- basis/db/tuples/tuples.factor | 7 ++- 5 files changed, 118 insertions(+), 34 deletions(-) diff --git a/basis/db/db-docs.factor b/basis/db/db-docs.factor index b0a01269ab..250e21fdaa 100644 --- a/basis/db/db-docs.factor +++ b/basis/db/db-docs.factor @@ -9,7 +9,8 @@ HELP: db HELP: new-db { $values { "class" class } { "obj" object } } -{ $description "Creates a new database object from a given class with caches for prepared statements. Does not actually connect to the database until " { $link db-open } " or " { $link with-db } " is called." } ; +{ $description "Creates a new database object from a given class with caches for prepared statements. Does not actually connect to the database until " { $link db-open } " or " { $link with-db } " is called." } +{ $notes "User-defined databases must call this constructor word instead of " { $link new } "." } ; HELP: db-open { $values { "db" db } { "db" db } } @@ -19,6 +20,8 @@ HELP: db-close { $values { "handle" alien } } { $description "Closes a database using the handle provided. Use of the " { $link with-db } " combinator is preferred over manually opening and closing databases so that resources are not leaked." } ; +{ db-open db-close with-db } related-words + HELP: dispose-statements { $values { "assoc" assoc } } { $description "Disposes an associative list of statements." } ; @@ -49,22 +52,28 @@ HELP: new-statement HELP: { $values { "string" string } { "in" sequence } { "out" sequence } { "statement" statement } } -{ $description "Makes a new simple statement object from the given parameters." } ; +{ $description "Makes a new simple statement object from the given parameters.." } +{ $warning "Using a simple statement can lead to SQL injection attacks in PostgreSQL. The Factor database implementation for SQLite only uses " { $link } " as the sole kind of statement; simple statements alias to prepared ones." } ; HELP: { $values { "string" string } { "in" sequence } { "out" sequence } { "statement" statement } } -{ $description "Makes a new prepared statement object from the given parameters." } ; +{ $description "Makes a new prepared statement object from the given parameters. A prepared statement's parameters will be escaped by the database backend to avoid SQL injection attacks. Prepared statements should be preferred over simple statements." } ; HELP: prepare-statement { $values { "statement" statement } } { $description "For databases which implement a method on this generic, it does some internal processing to ready the statement for execution." } ; +HELP: low-level-bind +{ $values + { "statement" statement } } +{ $description "For use with prepared statements, methods on this word should bind the datatype in the SQL spec to its identifier in the SQL string. To name bound variables, SQLite uses identifiers in the form of " { $snippet ":name" } ", while PostgreSQL uses increasing numbers beginning with a dollar sign, e.g. " { $snippet "$1" } "." } ; + HELP: query-results { $values { "query" object } { "result-set" result-set } } -{ $description "Returns a " { $link result-set } " object representing the reults of a SQL query." } ; +{ $description "Returns a " { $link result-set } " object representing the results of a SQL query. See " { $link "db-result-sets" } "." } ; HELP: #rows { $values { "result-set" result-set } { "n" integer } } @@ -161,22 +170,20 @@ HELP: with-transaction { $description "" } ; ARTICLE: "db" "Database library" +"Accessing a database:" { $subsection "db-custom-database-combinators" } +"Higher-level database help:" +{ $vocab-subsection "Database types" "db.types" } +{ $vocab-subsection "High-level tuple/database integration" "db.tuples" } +"Low-level database help:" { $subsection "db-protocol" } { $subsection "db-result-sets" } { $subsection "db-lowlevel-tutorial" } -"Higher-level database:" -{ $vocab-subsection "Database types" "db.types" } -{ $vocab-subsection "High-level tuple/database integration" "db.tuples" } -! { $subsection "db-tuples" } -! { $subsection "db-tuples-protocol" } -! { $subsection "db-tuples-tutorial" } "Supported database backends:" { $vocab-subsection "SQLite" "db.sqlite" } { $vocab-subsection "PostgreSQL" "db.postgresql" } "To add support for another database to Factor:" -{ $subsection "db-porting-the-library" } -; +{ $subsection "db-porting-the-library" } ; ARTICLE: "db-random-access-result-set" "Random access result sets" "Random-access result sets do not have to be traversed in order. For instance, PostgreSQL's result set object can be accessed as a matrix with i,j coordinates." @@ -234,7 +241,32 @@ ARTICLE: "db-protocol" "Low-level database protocol" ARTICLE: "db-lowlevel-tutorial" "Low-level database tutorial" "Although Factor makes integrating a database with its object system easy (see " { $vocab-link "db.tuples" } "), sometimes you may want to write SQL directly and get the results back as arrays of strings, for instance, when interfacing with a legacy database that doesn't easily map to " { $snippet "tuples" } "." -; +"Executing a SQL command:" +{ $subsection sql-command } +"Executing a query directly:" +{ $subsection sql-query } +"Here's an example usage where we'll make a book table, insert some objects, and query them." $nl +"First, let's set up a custom combinator for using our database. See " { $link "db-custom-database-combinators" } " for more details." +{ $code <" +USING: db.sqlite db io.files ; +: with-book-db ( quot -- ) + "book.db" temp-file swap with-db ;"> } +"Now let's create the table manually:" +{ $code <" "create table books + (id integer primary key, title text, author text, date_published timestamp, + edition integer, cover_price double, condition text)" + [ sql-command ] with-book-db" "> } +"Time to insert some books:" +{ $code <" +"insert into books + (title, author, date_published, edition, cover_price, condition) + values('Factor for Sheeple', 'Mister Stacky Pants', date('now'), 1, 13.37, 'mint')" +[ sql-command ] with-book-db"> } +"Now let's select the book:" +{ $code <" +"select id, title, cover_price from books;" [ sql-query ] with-book-db "> } +"Notice that the result of this query is a Factor array containing the database rows as arrays of strings. We would have to convert the " { $snippet "cover_price" } " from a string to a number in order to use it in a calculation." $nl +"In conclusion, this method of accessing a database is supported, but it is fairly low-level and generally specific to a single database. The " { $vocab-link "db.tuples" } " vocabulary is a good alternative to writing SQL by hand." ; ARTICLE: "db-porting-the-library" "Porting the database library" "There are two layers to implement when porting the database library." @@ -244,22 +276,24 @@ ARTICLE: "db-porting-the-library" "Porting the database library" ARTICLE: "db-custom-database-combinators" "Custom database combinators" "Every database library requires some effort on the programmer's part to initialize and open a database. SQLite uses files on your harddisk, so a simple pathname is all the setup required. With PostgreSQL, you log in to a networked server as a user on a specfic port." $nl -"Make a " { $snippet "with-" } " combinator to open and close a database so that resources are not leaked." +"Make a " { $snippet "with-" } " combinator to open and close a database so that resources are not leaked." $nl + +"SQLite example combinator:" { $code <" USING: db.sqlite db io.files ; : with-sqlite-db ( quot -- ) - "my-database.db" temp-file rot with-db ;"> } + "my-database.db" temp-file swap with-db ;"> } +"PostgreSQL example combinator:" { $code <" USING: db.postgresql db ; : with-postgresql-db ( quot -- ) "localhost" >>host + 5432 >>port "erg" >>username "secrets?" >>password "factor-test" >>database swap with-db ;"> -} - -; +} ; ABOUT: "db" diff --git a/basis/db/db.factor b/basis/db/db.factor index 5b159d0ea1..bf23005bc2 100644 --- a/basis/db/db.factor +++ b/basis/db/db.factor @@ -111,22 +111,22 @@ M: object execute-statement* ( statement type -- ) [ db-open db ] dip '[ db get [ drop @ ] with-disposal ] with-variable ; inline +! Words for working with raw SQL statements : default-query ( query -- result-set ) query-results [ [ sql-row ] query-map ] with-disposal ; : sql-query ( sql -- rows ) f f [ default-query ] with-disposal ; -: sql-command ( sql -- ) - dup string? [ - f f [ execute-statement ] with-disposal - ] [ - ! [ - [ sql-command ] each - ! ] with-transaction - ] if ; +: (sql-command) ( string -- ) + f f [ execute-statement ] with-disposal ; +: sql-command ( sql -- ) + dup string? [ (sql-command) ] [ [ (sql-command) ] each ] if ; + +! Transactions SYMBOL: in-transaction + HOOK: begin-transaction db ( -- ) HOOK: commit-transaction db ( -- ) HOOK: rollback-transaction db ( -- ) diff --git a/basis/db/sqlite/sqlite.factor b/basis/db/sqlite/sqlite.factor index dfe4fdf475..8580b9012c 100644 --- a/basis/db/sqlite/sqlite.factor +++ b/basis/db/sqlite/sqlite.factor @@ -49,8 +49,8 @@ M: sqlite-result-set dispose ( result-set -- ) handle>> [ sqlite3_reset drop ] [ sqlite3_clear_bindings drop ] bi ; M: sqlite-statement low-level-bind ( statement -- ) - [ bind-params>> ] [ handle>> ] bi - [ swap [ key>> ] [ value>> ] [ type>> ] tri sqlite-bind-type ] curry each ; + [ handle>> ] [ bind-params>> ] bi + [ [ key>> ] [ value>> ] [ type>> ] tri sqlite-bind-type ] with each ; M: sqlite-statement bind-statement* ( statement -- ) sqlite-maybe-prepare diff --git a/basis/db/tuples/tuples-docs.factor b/basis/db/tuples/tuples-docs.factor index 497cc2e8c5..8b1c8cbb49 100644 --- a/basis/db/tuples/tuples-docs.factor +++ b/basis/db/tuples/tuples-docs.factor @@ -1,9 +1,46 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: classes help.markup help.syntax io.streams.string kernel -quotations sequences strings multiline math db.types ; +quotations sequences strings multiline math db.types db ; IN: db.tuples +HELP: +{ $values + { "query" query } + { "statement" statement } } +{ $description "A database-specific hook for generating the SQL for a count statement." } ; + +HELP: +{ $values + { "tuple" tuple } { "class" class } + { "object" object } } +{ $description "A database-specific hook for generating the SQL for an delete statement." } ; + +HELP: +{ $values + { "class" class } + { "object" object } } +{ $description "A database-specific hook for generating the SQL for an insert statement with a database-assigned primary key." } ; + +HELP: +{ $values + { "class" class } + { "object" object } } +{ $description "A database-specific hook for generating the SQL for an insert statement with a user-assigned primary key." } ; + +HELP: +{ $values + { "tuple" tuple } { "class" class } + { "tuple" tuple } } +{ $description "A database-specific hook for generating the SQL for a select statement." } ; + +HELP: +{ $values + { "class" class } + { "object" object } } +{ $description "A database-specific hook for generating the SQL for an update statement." } ; + + HELP: define-persistent { $values { "class" class } { "table" string } { "columns" "an array of slot specifiers" } } @@ -128,7 +165,21 @@ ARTICLE: "db-tuples-words" "High-level tuple/database words" { $subsection count-tuples } ; ARTICLE: "db-tuples-protocol" "Tuple database protocol" -; +"Creating a table:" +{ $subsection create-sql-statement } +"Dropping a table:" +{ $subsection drop-sql-statement } +"Inserting a tuple:" +{ $subsection } +{ $subsection } +"Updating a tuple:" +{ $subsection } +"Deleting tuples:" +{ $subsection } +"Selecting tuples:" +{ $subsection } +"Counting tuples:" +{ $subsection } ; ARTICLE: "db-tuples-tutorial" "Tuple database tutorial" "Let's make a tuple and store it in a database. To follow along, click on each code example and run it in the listener. If you forget to run an example, just start at the top and run them all again in order." $nl diff --git a/basis/db/tuples/tuples.factor b/basis/db/tuples/tuples.factor index 20d7ac4f84..7a5c9e41e6 100644 --- a/basis/db/tuples/tuples.factor +++ b/basis/db/tuples/tuples.factor @@ -6,8 +6,6 @@ math.parser io prettyprint db.types continuations destructors mirrors sets db.types ; IN: db.tuples - db ( tuple class -- object ) HOOK: db ( tuple class -- tuple ) HOOK: db ( query -- statement ) HOOK: query>statement db ( query -- statement ) - HOOK: insert-tuple-set-key db ( tuple statement -- ) +string ; @@ -68,7 +68,6 @@ GENERIC: eval-generator ( singleton -- object ) PRIVATE> - ! High level ERROR: no-slots-named class seq ; : check-columns ( class columns -- ) From 3d92ef87fe275ea4e45dfeda56d4dcb1fc9800e5 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Fri, 3 Oct 2008 20:21:23 -0500 Subject: [PATCH 062/948] remove redundant section --- basis/db/db-docs.factor | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/basis/db/db-docs.factor b/basis/db/db-docs.factor index 250e21fdaa..509391579e 100644 --- a/basis/db/db-docs.factor +++ b/basis/db/db-docs.factor @@ -181,9 +181,7 @@ ARTICLE: "db" "Database library" { $subsection "db-lowlevel-tutorial" } "Supported database backends:" { $vocab-subsection "SQLite" "db.sqlite" } -{ $vocab-subsection "PostgreSQL" "db.postgresql" } -"To add support for another database to Factor:" -{ $subsection "db-porting-the-library" } ; +{ $vocab-subsection "PostgreSQL" "db.postgresql" } ; ARTICLE: "db-random-access-result-set" "Random access result sets" "Random-access result sets do not have to be traversed in order. For instance, PostgreSQL's result set object can be accessed as a matrix with i,j coordinates." @@ -268,11 +266,6 @@ USING: db.sqlite db io.files ; "Notice that the result of this query is a Factor array containing the database rows as arrays of strings. We would have to convert the " { $snippet "cover_price" } " from a string to a number in order to use it in a calculation." $nl "In conclusion, this method of accessing a database is supported, but it is fairly low-level and generally specific to a single database. The " { $vocab-link "db.tuples" } " vocabulary is a good alternative to writing SQL by hand." ; -ARTICLE: "db-porting-the-library" "Porting the database library" -"There are two layers to implement when porting the database library." -{ $subsection "db-protocol" } -; - ARTICLE: "db-custom-database-combinators" "Custom database combinators" "Every database library requires some effort on the programmer's part to initialize and open a database. SQLite uses files on your harddisk, so a simple pathname is all the setup required. With PostgreSQL, you log in to a networked server as a user on a specfic port." $nl From 96d6db5b9d2b8f1f9c233e40e1ba79848dd2f11b Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Fri, 3 Oct 2008 21:58:57 -0700 Subject: [PATCH 063/948] Fix copyright in crypto/barrett/tests. --- extra/crypto/barrett/barrett-tests.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/crypto/barrett/barrett-tests.factor b/extra/crypto/barrett/barrett-tests.factor index 01163f730f..13dae69dce 100644 --- a/extra/crypto/barrett/barrett-tests.factor +++ b/extra/crypto/barrett/barrett-tests.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008 DoDoug Coleman. +! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: crypto.barrett kernel math namespaces tools.test ; IN: crypto.barrett.tests From 6b3b48a106405c482a2ecc9bbe58f40fb4fd7b06 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 11:44:12 -0500 Subject: [PATCH 064/948] random is generic, better random docs, cleanups --- .../mersenne-twister-tests.factor | 8 ++-- basis/random/random-docs.factor | 46 +++++++++++++++---- basis/random/random-tests.factor | 6 ++- basis/random/random.factor | 40 +++++++++++----- 4 files changed, 74 insertions(+), 26 deletions(-) diff --git a/basis/random/mersenne-twister/mersenne-twister-tests.factor b/basis/random/mersenne-twister/mersenne-twister-tests.factor index 3f0ebf692a..8a2a5031fa 100644 --- a/basis/random/mersenne-twister/mersenne-twister-tests.factor +++ b/basis/random/mersenne-twister/mersenne-twister-tests.factor @@ -3,17 +3,17 @@ random.mersenne-twister sequences tools.test math.order ; IN: random.mersenne-twister.tests : check-random ( max -- ? ) - dup >r random 0 r> between? ; + [ random 0 ] keep between? ; [ t ] [ 100 [ drop 674 check-random ] all? ] unit-test -: make-100-randoms - [ 100 [ 100 random , ] times ] { } make ; +: randoms ( -- seq ) + 100 [ 100 random ] replicate ; : test-rng ( seed quot -- ) >r r> with-random ; -[ f ] [ 1234 [ make-100-randoms make-100-randoms = ] test-rng ] unit-test +[ f ] [ 1234 [ randoms randoms = ] test-rng ] unit-test [ 1333075495 ] [ 0 [ 1000 [ drop random-generator get random-32* drop ] each random-generator get random-32* ] test-rng diff --git a/basis/random/random-docs.factor b/basis/random/random-docs.factor index 74751328d5..c5daee783e 100644 --- a/basis/random/random-docs.factor +++ b/basis/random/random-docs.factor @@ -1,12 +1,6 @@ -USING: help.markup help.syntax math ; +USING: help.markup help.syntax math kernel sequences ; IN: random -ARTICLE: "random-numbers" "Generating random integers" -"The " { $vocab-link "random" } " vocabulary implements the ``Mersenne Twister'' pseudo-random number generator algorithm." -{ $subsection random } ; - -ABOUT: "random-numbers" - HELP: seed-random { $values { "tuple" "a random number generator" } { "seed" "an integer between 0 and 2^32-1" } } { $description "Seed the random number generator." } @@ -21,8 +15,8 @@ HELP: random-bytes* { $description "Generates a byte-array of random bytes." } ; HELP: random -{ $values { "seq" "a sequence" } { "elt" "a random element" } } -{ $description "Outputs a random element of the sequence. If the sequence is empty, always outputs " { $link f } "." } +{ $values { "obj" object } { "elt" "a random element" } } +{ $description "Outputs a random element of the input object. If the object is an integer, an input of zero always returns a zero, a negative integer throws an error, and positive integers yield a random integer in the interval " { $snippet "[0,n)" } ". On a sequence, an empty sequence always outputs " { $link f } " while any other sequence outputs a random element." } { $notes "Since integers are sequences, passing an integer " { $snippet "n" } " yields a random integer in the interval " { $snippet "[0,n)" } "." } ; HELP: random-bytes @@ -47,4 +41,36 @@ HELP: with-secure-random { $values { "quot" "a quotation" } } { $description "Calls the quotation with the secure random generator in a dynamic variable. All random numbers will be generated using this random generator." } ; -{ with-random with-secure-random } related-words +HELP: with-system-random +{ $values { "quot" "a quotation" } } +{ $description "Calls the quotation with the system's random generator in a dynamic variable. All random numbers will be generated using this random generator." } ; + +{ with-random with-secure-random with-system-random } related-words + +HELP: delete-random +{ $values + { "seq" sequence } + { "elt" object } } +{ $description "Delete a random number from a sequence using " { $link delete-nth } " and returns the deleted object." } ; + +ARTICLE: "random-protocol" "Random protocol" +"A random number generator must implement one of these two words:" +{ $subsection random-32* } +{ $subsection random-bytes* } +"Optional, to seed a random number generator:" +{ $subsection seed-random } ; + +ARTICLE: "random" "Generating random integers" +"The " { $vocab-link "random" } " vocabulary contains a protocol for generating random or pseudorandom numbers. The ``Mersenne Twister'' pseudorandom number generator algorithm is the default generator stored in " { $link random-generator } "." +"Generate a random object:" +{ $subsection random } +"Combinators to change the random number generator:" +{ $subsection with-random } +{ $subsection with-system-random } +{ $subsection with-secure-random } +"Implementation:" +{ $subsection "random-protocol" } +"Deleting a random element from a sequence:" +{ $subsection delete-random } ; + +ABOUT: "random" diff --git a/basis/random/random-tests.factor b/basis/random/random-tests.factor index 89c0c02c4a..7300a0dac4 100644 --- a/basis/random/random-tests.factor +++ b/basis/random/random-tests.factor @@ -1,5 +1,5 @@ USING: random sequences tools.test kernel math math.functions -sets ; +sets math.constants ; IN: random.tests [ 4 ] [ 4 random-bytes length ] unit-test @@ -15,3 +15,7 @@ IN: random.tests [ t ] [ 10000 [ 0 [ drop 400 random + ] reduce ] keep / 2 * 400 10 ~ ] unit-test [ t ] [ 1000 [ 400 random ] replicate prune length 256 > ] unit-test + +[ t ] [ pi random float? ] unit-test + +[ 0 ] [ 0 random ] unit-test diff --git a/basis/random/random.factor b/basis/random/random.factor index 5ee45e6729..673a97caa3 100644 --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -33,20 +33,38 @@ M: f random-32* ( obj -- * ) no-random-number-generator ; random-generator get random-bytes* ] keep head ; -: random ( seq -- elt ) - [ f ] [ - [ - length dup log2 7 + 8 /i 1+ - [ random-bytes byte-array>bignum ] - [ 3 shift 2^ ] bi / * >integer - ] keep nth - ] if-empty ; - -: delete-random ( seq -- elt ) - [ length random ] keep [ nth ] 2keep delete-nth ; +GENERIC: random ( obj -- elt ) : random-bits ( n -- r ) 2^ random ; +bignum ] + [ 3 shift 2^ ] bi / * >integer ; + +PRIVATE> + +M: sequence random ( seq -- elt ) + [ f ] [ + [ length random-integer ] keep nth + ] if-empty ; + +ERROR: negative-random n ; +M: integer random ( integer -- integer' ) + { + { [ dup 0 = ] [ ] } + { [ dup 0 < ] [ negative-random ] } + [ random-integer ] + } cond ; + +M: float random ( float -- elt ) + 64 random-bits 64 2^ 1- / * ; + +: delete-random ( seq -- elt ) + [ length random-integer ] keep [ nth ] 2keep delete-nth ; + : with-random ( tuple quot -- ) random-generator swap with-variable ; inline From efb5fa0814034ffc8036dfc61adc1f1ce787dc15 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 11:45:21 -0500 Subject: [PATCH 065/948] don't redefine delete-random --- basis/heaps/authors.txt | 1 + basis/heaps/heaps-tests.factor | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/basis/heaps/authors.txt b/basis/heaps/authors.txt index 1229a590fa..d0c12d9aa4 100755 --- a/basis/heaps/authors.txt +++ b/basis/heaps/authors.txt @@ -1,2 +1,3 @@ Doug Coleman Ryan Murphy +Slava Pestov diff --git a/basis/heaps/heaps-tests.factor b/basis/heaps/heaps-tests.factor index 13b6a97654..e28eb3007a 100644 --- a/basis/heaps/heaps-tests.factor +++ b/basis/heaps/heaps-tests.factor @@ -1,6 +1,5 @@ ! Copyright 2007, 2008 Ryan Murphy, Slava Pestov ! See http://factorcode.org/license.txt for BSD license. - USING: arrays kernel math namespaces tools.test heaps heaps.private math.parser random assocs sequences sorting accessors math.order ; @@ -54,9 +53,6 @@ IN: heaps.tests [ t ] swap [ 2^ test-entry-indices ] curry unit-test ] each -: delete-random ( seq -- elt ) - dup length random dup pick nth >r swap delete-nth r> ; - : sort-entries ( entries -- entries' ) [ [ key>> ] compare ] sort ; From aebb58263478d27eeee495620021ad75f8a06ada Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 11:45:48 -0500 Subject: [PATCH 066/948] remove ?first etc --- extra/sequences/lib/lib-tests.factor | 7 ------- extra/sequences/lib/lib.factor | 9 --------- 2 files changed, 16 deletions(-) diff --git a/extra/sequences/lib/lib-tests.factor b/extra/sequences/lib/lib-tests.factor index a44d41d98a..509d9b1432 100755 --- a/extra/sequences/lib/lib-tests.factor +++ b/extra/sequences/lib/lib-tests.factor @@ -47,13 +47,6 @@ IN: sequences.lib.tests [ t ] [ "ab" 4 strings [ >string ] map "abab" swap member? ] unit-test [ { { } { 1 } { 2 } { 1 2 } } ] [ { 1 2 } power-set ] unit-test -[ f ] [ { } ?first ] unit-test -[ f ] [ { } ?fourth ] unit-test -[ 1 ] [ { 1 2 3 } ?first ] unit-test -[ 2 ] [ { 1 2 3 } ?second ] unit-test -[ 3 ] [ { 1 2 3 } ?third ] unit-test -[ f ] [ { 1 2 3 } ?fourth ] unit-test - [ 1 2 { 3 4 } [ + + ] 2 map-withn ] must-infer { { 6 7 } } [ 1 2 { 3 4 } [ + + ] 2 map-withn ] unit-test { { 16 17 18 19 20 } } [ 1 2 3 4 { 6 7 8 9 10 } [ + + + + ] 4 map-withn ] unit-test diff --git a/extra/sequences/lib/lib.factor b/extra/sequences/lib/lib.factor index fe9d9bb587..ed7f40598c 100755 --- a/extra/sequences/lib/lib.factor +++ b/extra/sequences/lib/lib.factor @@ -131,15 +131,6 @@ PRIVATE> : power-set ( seq -- subsets ) 2 over length exact-number-strings swap [ switches ] curry map ; -: ?first ( seq -- first/f ) 0 swap ?nth ; inline -: ?second ( seq -- second/f ) 1 swap ?nth ; inline -: ?third ( seq -- third/f ) 2 swap ?nth ; inline -: ?fourth ( seq -- fourth/f ) 3 swap ?nth ; inline - -: ?first2 ( seq -- 1st/f 2nd/f ) dup ?first swap ?second ; inline -: ?first3 ( seq -- 1st/f 2nd/f 3rd/f ) dup ?first2 rot ?third ; inline -: ?first4 ( seq -- 1st/f 2nd/f 3rd/f 4th/f ) dup ?first3 roll ?fourth ; inline - USE: continuations : ?subseq ( from to seq -- subseq ) >r >r 0 max r> r> From 5ca60480c51aff0d7dbf0f00b106999a8f9e416e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 12:40:58 -0500 Subject: [PATCH 067/948] put a random method on intervals, works for float and integer intervals --- basis/math/intervals/intervals.factor | 39 +++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/basis/math/intervals/intervals.factor b/basis/math/intervals/intervals.factor index 7c3bf27e9d..f359cfb7c4 100644 --- a/basis/math/intervals/intervals.factor +++ b/basis/math/intervals/intervals.factor @@ -1,8 +1,9 @@ -! Copyright (C) 2007, 2008 Slava Pestov. +! Copyright (C) 2007, 2008 Slava Pestov, Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. ! Based on Slate's src/unfinished/interval.slate by Brian Rice. USING: accessors kernel sequences arrays math math.order -combinators generic ; +combinators generic random math.constants qualified ; +FROM: math.ranges => ; IN: math.intervals SYMBOL: empty-interval @@ -396,3 +397,37 @@ SYMBOL: incomparable [ to>> first2 [ 1- ] unless ] bi [a,b] ] unless ; + +> second not ; + +: open-right? ( interval -- ? ) to>> second not ; + +: integral-interval? ( interval -- ? ) + [ from>> ] [ to>> ] bi [ first integer? ] both? ; + +PRIVATE> + +ERROR: empty-random-interval ; + +: random-interval-integer ( interval -- n ) + [ [ to>> first ] [ open-right? [ 1- ] when ] bi ] + [ + [ from>> first ] + [ open-left? [ 1+ ] when ] bi + tuck - 1+ random + + ] bi ; + +: random-interval-float ( interval -- x ) + [ [ from>> first ] [ open-left? [ epsilon + ] when ] bi ] + [ [ to>> first ] [ open-right? [ epsilon - ] when ] bi ] bi + epsilon random [ empty-random-interval ] unless* ; + +M: interval random ( interval -- x ) + dup empty-interval = [ empty-random-interval ] when + dup integral-interval? [ + random-interval-integer + ] [ + random-interval-float + ] if ; From ce7cf8122435c2e8be6386a388faf5dab476e65f Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 12:45:10 -0500 Subject: [PATCH 068/948] add more unit tests --- basis/math/intervals/intervals-tests.factor | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/basis/math/intervals/intervals-tests.factor b/basis/math/intervals/intervals-tests.factor index 7d8d496737..481b065a1c 100644 --- a/basis/math/intervals/intervals-tests.factor +++ b/basis/math/intervals/intervals-tests.factor @@ -1,6 +1,6 @@ USING: math.intervals kernel sequences words math math.order arrays prettyprint tools.test random vocabs combinators -accessors ; +accessors math.constants ; IN: math.intervals.tests [ empty-interval ] [ 2 2 (a,b) ] unit-test @@ -334,3 +334,13 @@ IN: math.intervals.tests [ execute ] [ swapd execute ] 3bi = ] all? ] unit-test + +[ t ] [ 1.0 1.0 epsilon + [a,b] random float? ] unit-test +[ t ] [ 1.0 1.0 epsilon + [a,b) random float? ] unit-test +[ t ] [ 1.0 1.0 epsilon + (a,b] random float? ] unit-test +[ 1.0 1.0 (a,b) random float? ] must-fail + +[ 3 4 + (a,b) random ] must-fail +[ 3 ] [ 3 4 [a,b) random ] unit-test +[ 4 ] [ 3 4 (a,b] random ] unit-test +[ t ] [ 3 4 [a,b] random { 3 4 } member? ] unit-test From a057da4116ea7871679920048dd7484da09147f5 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 13:21:06 -0500 Subject: [PATCH 069/948] "finish" database docs --- basis/db/db-docs.factor | 10 ++++++++++ basis/db/tuples/tuples-docs.factor | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/basis/db/db-docs.factor b/basis/db/db-docs.factor index 509391579e..0acd1f0245 100644 --- a/basis/db/db-docs.factor +++ b/basis/db/db-docs.factor @@ -49,6 +49,16 @@ HELP: new-statement { $values { "sql" string } { "in" sequence } { "out" sequence } { "class" class } { "statement" statement } } { $description "Makes a new statement object from the given parameters." } ; +HELP: bind-statement +{ $values + { "obj" object } { "statement" statement } } +{ $description "Sets the statement's " { $slot "bind-params" } " and calls " { $link bind-statement* } " to do the database-specific bind. Sets " { $slot "bound?" } " to true if binding succeeds." } ; + +HELP: bind-statement* +{ $values + { "statement" statement } } +{ $description "Does a low-level bind of the SQL statement's tuple parameters if the database requires. Some databases should treat this as a no-op and bind instead when the actual statement is run." } ; + HELP: { $values { "string" string } { "in" sequence } { "out" sequence } { "statement" statement } } diff --git a/basis/db/tuples/tuples-docs.factor b/basis/db/tuples/tuples-docs.factor index 8b1c8cbb49..02f5dfa38c 100644 --- a/basis/db/tuples/tuples-docs.factor +++ b/basis/db/tuples/tuples-docs.factor @@ -4,6 +4,23 @@ USING: classes help.markup help.syntax io.streams.string kernel quotations sequences strings multiline math db.types db ; IN: db.tuples +HELP: create-sql-statement +{ $values + { "class" class } + { "object" object } } +{ $description "Generates the SQL code for creating a table for a given class." } ; + +HELP: drop-sql-statement +{ $values + { "class" class } + { "object" object } } +{ $description "Generates the SQL code for dropping a table for a given class." } ; + +HELP: insert-tuple-set-key +{ $values + { "tuple" tuple } { "statement" statement } } +{ $description "Inserts a tuple and sets its primary key in one word. This is necessary for some databases." } ; + HELP: { $values { "query" query } From 12afcd2c2c0e2d0062db8d88a4399576bbde3895 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 13:26:17 -0500 Subject: [PATCH 070/948] add relative-url to urls --- basis/urls/urls-docs.factor | 6 ++++++ basis/urls/urls.factor | 2 ++ 2 files changed, 8 insertions(+) diff --git a/basis/urls/urls-docs.factor b/basis/urls/urls-docs.factor index 03ffaded05..dc61623571 100644 --- a/basis/urls/urls-docs.factor +++ b/basis/urls/urls-docs.factor @@ -135,6 +135,12 @@ HELP: relative-url } } ; +HELP: relative-url? +{ $values + { "url" url } + { "?" "a boolean" } } +{ $description "Tests whether a given url is relative to a domain." } ; + HELP: secure-protocol? { $values { "protocol" string } { "?" "a boolean" } } { $description "Tests if protocol connections must be made with secure sockets (SSL/TLS)." } diff --git a/basis/urls/urls.factor b/basis/urls/urls.factor index 30e8c68f9d..597cdfdb7f 100644 --- a/basis/urls/urls.factor +++ b/basis/urls/urls.factor @@ -155,6 +155,8 @@ PRIVATE> f >>host f >>port ; +: relative-url? ( url -- ? ) protocol>> not ; + ! Half-baked stuff follows : secure-protocol? ( protocol -- ? ) "https" = ; From af37d280422de00a9106339ff05662d9bd5b54d7 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 13:27:29 -0500 Subject: [PATCH 071/948] remove relative-urls? word and some dead code --- extra/spider/spider.factor | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/extra/spider/spider.factor b/extra/spider/spider.factor index 64ee081ecc..bd5b2668be 100644 --- a/extra/spider/spider.factor +++ b/extra/spider/spider.factor @@ -9,7 +9,6 @@ IN: spider TUPLE: spider base count max-count sleep max-depth initial-links filters spidered todo nonmatching quiet ; -! secure? agent page-timeout data-timeout overall-timeout TUPLE: spider-result url depth headers fetch-time parsed-html links processing-time timestamp ; @@ -27,8 +26,6 @@ links processing-time timestamp ; > not ; - : apply-filters ( links spider -- links' ) filters>> [ '[ _ 1&& ] filter ] when* ; @@ -82,10 +79,10 @@ links processing-time timestamp ; [ initial-links>> normalize-hrefs 0 ] keep [ add-todo ] keep ; -: slurp-heap-when ( heap quot1 quot2: ( value key -- ) -- ) +: slurp-heap-while ( heap quot1 quot2: ( value key -- ) -- ) pick heap-empty? [ 3drop ] [ [ [ heap-pop dup ] 2dip slip [ t ] compose [ 2drop f ] if ] - [ roll [ slurp-heap-when ] [ 3drop ] if ] 3bi + [ roll [ slurp-heap-while ] [ 3drop ] if ] 3bi ] if ; inline recursive PRIVATE> @@ -98,7 +95,7 @@ PRIVATE> '[ _ <= spider get [ count>> ] [ max-count>> ] bi < and - ] [ spider-page spider-sleep ] slurp-heap-when + ] [ spider-page spider-sleep ] slurp-heap-while spider get ] with-variable ] with-logging ; From a130928ec248874b03aaff802c357689a53bad68 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 13:28:42 -0500 Subject: [PATCH 072/948] fix docs --- extra/spider/spider-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/spider/spider-docs.factor b/extra/spider/spider-docs.factor index 5f820ca368..41dd13e918 100644 --- a/extra/spider/spider-docs.factor +++ b/extra/spider/spider-docs.factor @@ -16,7 +16,7 @@ HELP: run-spider { "spider" spider } } { $description "Runs a spider until completion. See the " { $subsection "spider-tutorial" } " for a complete description of the tuple slots that affect how thet spider works." } ; -HELP: slurp-heap-when +HELP: slurp-heap-while { $values { "heap" "a heap" } { "quot1" quotation } { "quot2" quotation } } { $description "Removes values from a heap that match the predicate quotation " { $snippet "quot1" } " and processes them with " { $snippet "quot2" } " until the predicate quotation no longer matches." } ; From 7dc77903629356e69fe5e317b02bcda2868dce16 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sat, 4 Oct 2008 14:18:16 -0500 Subject: [PATCH 073/948] fix link --- basis/help/handbook/handbook.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/help/handbook/handbook.factor b/basis/help/handbook/handbook.factor index 51750d772f..c1505705da 100644 --- a/basis/help/handbook/handbook.factor +++ b/basis/help/handbook/handbook.factor @@ -90,7 +90,7 @@ ARTICLE: "numbers" "Numbers" { $subsection "math-constants" } { $subsection "math-functions" } { $subsection "number-strings" } -{ $subsection "random-numbers" } +{ $subsection "random" } "Number implementations:" { $subsection "integers" } { $subsection "rationals" } From 54f28c0751cd9df7c283724e67b2cd5be69cb756 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 5 Oct 2008 14:11:11 -0500 Subject: [PATCH 074/948] Fix terminology --- basis/urls/urls-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/urls/urls-docs.factor b/basis/urls/urls-docs.factor index dc61623571..204dc2ff08 100644 --- a/basis/urls/urls-docs.factor +++ b/basis/urls/urls-docs.factor @@ -139,7 +139,7 @@ HELP: relative-url? { $values { "url" url } { "?" "a boolean" } } -{ $description "Tests whether a given url is relative to a domain." } ; +{ $description "Tests whether a given URL is relative to a domain." } ; HELP: secure-protocol? { $values { "protocol" string } { "?" "a boolean" } } From 503963580b2e2d09ae41130604eebbee4b2ab252 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 5 Oct 2008 14:33:06 -0500 Subject: [PATCH 075/948] Cut down on vergbiage --- basis/urls/urls-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/urls/urls-docs.factor b/basis/urls/urls-docs.factor index 204dc2ff08..b423e6b751 100644 --- a/basis/urls/urls-docs.factor +++ b/basis/urls/urls-docs.factor @@ -139,7 +139,7 @@ HELP: relative-url? { $values { "url" url } { "?" "a boolean" } } -{ $description "Tests whether a given URL is relative to a domain." } ; +{ $description "Tests whether a URL is relative." } ; HELP: secure-protocol? { $values { "protocol" string } { "?" "a boolean" } } From fad3d52bc147af98cf1e9a263607286025698067 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 15:14:05 -0500 Subject: [PATCH 076/948] remove random floats, better docs --- basis/random/random-docs.factor | 19 ++++++++++++++++--- basis/random/random.factor | 5 +---- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/basis/random/random-docs.factor b/basis/random/random-docs.factor index c5daee783e..51656a77dd 100644 --- a/basis/random/random-docs.factor +++ b/basis/random/random-docs.factor @@ -16,8 +16,21 @@ HELP: random-bytes* HELP: random { $values { "obj" object } { "elt" "a random element" } } -{ $description "Outputs a random element of the input object. If the object is an integer, an input of zero always returns a zero, a negative integer throws an error, and positive integers yield a random integer in the interval " { $snippet "[0,n)" } ". On a sequence, an empty sequence always outputs " { $link f } " while any other sequence outputs a random element." } -{ $notes "Since integers are sequences, passing an integer " { $snippet "n" } " yields a random integer in the interval " { $snippet "[0,n)" } "." } ; +{ $description "Outputs a random element of the input object. If the object is an integer, an input of zero always returns a zero, while any other integer integers yield a random integer in the interval between itself and zero, inclusive of zero. On a sequence, an empty sequence always outputs " { $link f } "." } +{ $examples + { $unchecked-example "USING: random prettyprint ;" + "10 random ." + "3" } + { $example "USING: random prettyprint ;" + "0 random ." + "0" } + { $unchecked-example "USING: random prettyprint ;" + "-10 random ." + "-8" } + { $unchecked-example "USING: random prettyprint ;" + "{ \"a\" \"b\" \"c\" } random ." + "\"a\"" } +} ; HELP: random-bytes { $values { "n" "an integer" } { "byte-array" "a random integer" } } @@ -51,7 +64,7 @@ HELP: delete-random { $values { "seq" sequence } { "elt" object } } -{ $description "Delete a random number from a sequence using " { $link delete-nth } " and returns the deleted object." } ; +{ $description "Deletes a random number from a sequence using " { $link delete-nth } " and returns the deleted object." } ; ARTICLE: "random-protocol" "Random protocol" "A random number generator must implement one of these two words:" diff --git a/basis/random/random.factor b/basis/random/random.factor index 673a97caa3..8a69b28171 100644 --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -55,13 +55,10 @@ ERROR: negative-random n ; M: integer random ( integer -- integer' ) { { [ dup 0 = ] [ ] } - { [ dup 0 < ] [ negative-random ] } + { [ dup 0 < ] [ neg random-integer neg ] } [ random-integer ] } cond ; -M: float random ( float -- elt ) - 64 random-bits 64 2^ 1- / * ; - : delete-random ( seq -- elt ) [ length random-integer ] keep [ nth ] 2keep delete-nth ; From 4e88005bf4b362d81b578789fd619524fef27e38 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 15:14:18 -0500 Subject: [PATCH 077/948] remove random intervals for now --- basis/math/intervals/intervals.factor | 34 --------------------------- 1 file changed, 34 deletions(-) diff --git a/basis/math/intervals/intervals.factor b/basis/math/intervals/intervals.factor index f359cfb7c4..38d67aa043 100644 --- a/basis/math/intervals/intervals.factor +++ b/basis/math/intervals/intervals.factor @@ -397,37 +397,3 @@ SYMBOL: incomparable [ to>> first2 [ 1- ] unless ] bi [a,b] ] unless ; - -> second not ; - -: open-right? ( interval -- ? ) to>> second not ; - -: integral-interval? ( interval -- ? ) - [ from>> ] [ to>> ] bi [ first integer? ] both? ; - -PRIVATE> - -ERROR: empty-random-interval ; - -: random-interval-integer ( interval -- n ) - [ [ to>> first ] [ open-right? [ 1- ] when ] bi ] - [ - [ from>> first ] - [ open-left? [ 1+ ] when ] bi - tuck - 1+ random + - ] bi ; - -: random-interval-float ( interval -- x ) - [ [ from>> first ] [ open-left? [ epsilon + ] when ] bi ] - [ [ to>> first ] [ open-right? [ epsilon - ] when ] bi ] bi - epsilon random [ empty-random-interval ] unless* ; - -M: interval random ( interval -- x ) - dup empty-interval = [ empty-random-interval ] when - dup integral-interval? [ - random-interval-integer - ] [ - random-interval-float - ] if ; From 02bb3063ffcb35ec074016460bf9c307902d27da Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 15:21:23 -0500 Subject: [PATCH 078/948] add word to convert timevals to unix time, add utility words --- basis/calendar/calendar-docs.factor | 38 ++++++++++++++++++++++++++--- basis/calendar/calendar.factor | 10 +++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/basis/calendar/calendar-docs.factor b/basis/calendar/calendar-docs.factor index c3d84fc783..f1cdafb476 100644 --- a/basis/calendar/calendar-docs.factor +++ b/basis/calendar/calendar-docs.factor @@ -165,7 +165,15 @@ HELP: milliseconds { $values { "x" number } { "duration" duration } } { $description "Creates a duration object with the specified number of milliseconds." } ; -{ years months days hours minutes seconds milliseconds } related-words +HELP: microseconds +{ $values { "x" number } { "duration" duration } } +{ $description "Creates a duration object with the specified number of microseconds." } ; + +HELP: nanoseconds +{ $values { "x" number } { "duration" duration } } +{ $description "Creates a duration object with the specified number of nanoseconds." } ; + +{ years months days hours minutes seconds milliseconds microseconds nanoseconds } related-words HELP: leap-year? { $values { "obj" object } { "?" "a boolean" } } @@ -263,7 +271,27 @@ HELP: duration>milliseconds } } ; -{ duration>years duration>months duration>days duration>hours duration>minutes duration>seconds duration>milliseconds } related-words +HELP: duration>microseconds +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in microseconds." } +{ $examples + { $example "USING: calendar prettyprint ;" + "6 seconds duration>microseconds ." + "6000000" + } +} ; + +HELP: duration>nanoseconds +{ $values { "duration" duration } { "x" number } } +{ $description "Calculates the length of a duration in nanoseconds." } +{ $examples + { $example "USING: calendar prettyprint ;" + "6 seconds duration>nanoseconds ." + "6000000000" + } +} ; + +{ duration>years duration>months duration>days duration>hours duration>minutes duration>seconds duration>milliseconds duration>microseconds duration>nanoseconds } related-words HELP: time- @@ -528,6 +556,8 @@ ARTICLE: "using-durations" "Using durations" { $subsection minutes } { $subsection seconds } { $subsection milliseconds } +{ $subsection microseconds } +{ $subsection nanoseconds } { $subsection instant } "Converting a duration to a number:" { $subsection duration>years } @@ -536,7 +566,9 @@ ARTICLE: "using-durations" "Using durations" { $subsection duration>hours } { $subsection duration>minutes } { $subsection duration>seconds } -{ $subsection duration>milliseconds } ; +{ $subsection duration>milliseconds } +{ $subsection duration>microseconds } +{ $subsection duration>nanoseconds } ; ARTICLE: "relative-timestamps" "Relative timestamps" "In the future:" diff --git a/basis/calendar/calendar.factor b/basis/calendar/calendar.factor index c2c386a790..31c835aada 100644 --- a/basis/calendar/calendar.factor +++ b/basis/calendar/calendar.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel math math.functions namespaces sequences strings system vocabs.loader threads accessors combinators -locals classes.tuple math.order summary +locals classes.tuple math.order summary structs combinators.short-circuit ; IN: calendar @@ -129,6 +129,8 @@ PRIVATE> : minutes ( x -- duration ) instant clone swap >>minute ; : seconds ( x -- duration ) instant clone swap >>second ; : milliseconds ( x -- duration ) 1000 / seconds ; +: microseconds ( x -- duration ) 1000000 / seconds ; +: nanoseconds ( x -- duration ) 1000000000 / seconds ; GENERIC: leap-year? ( obj -- ? ) @@ -261,6 +263,8 @@ M: duration <=> [ duration>years ] compare ; : duration>minutes ( duration -- x ) duration>years minutes-per-year * ; : duration>seconds ( duration -- x ) duration>years seconds-per-year * ; : duration>milliseconds ( duration -- x ) duration>seconds 1000 * ; +: duration>microseconds ( duration -- x ) duration>seconds 1000000 * ; +: duration>nanoseconds ( duration -- x ) duration>seconds 1000000000 * ; GENERIC: time- ( time1 time2 -- time3 ) @@ -398,6 +402,10 @@ PRIVATE> : time-since-midnight ( timestamp -- duration ) dup midnight time- ; +: timeval>unix-time ( timeval -- timestamp ) + [ timeval-sec seconds ] [ timeval-usec microseconds ] bi + time+ unix-1970 time+ >local-time ; + M: timestamp sleep-until timestamp>millis sleep-until ; M: duration sleep hence sleep-until ; From 5c8de440852a2bcc927d0553518094961e8c90e3 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 15:23:04 -0500 Subject: [PATCH 079/948] more unix ffi functions --- basis/unix/linux/linux.factor | 2 +- basis/unix/unix.factor | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/basis/unix/linux/linux.factor b/basis/unix/linux/linux.factor index 0c08cf0f2b..457d96c7d8 100644 --- a/basis/unix/linux/linux.factor +++ b/basis/unix/linux/linux.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -IN: unix USING: alien.syntax ; +IN: unix ! Linux. diff --git a/basis/unix/unix.factor b/basis/unix/unix.factor index 2011fa0dcb..4c572a6be0 100644 --- a/basis/unix/unix.factor +++ b/basis/unix/unix.factor @@ -1,12 +1,10 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. - -USING: alien alien.c-types alien.syntax kernel libc structs sequences - continuations byte-arrays strings - math namespaces system combinators vocabs.loader qualified - accessors stack-checker macros locals generalizations - unix.types debugger io prettyprint ; - +USING: alien alien.c-types alien.syntax kernel libc structs +sequences continuations byte-arrays strings math namespaces +system combinators vocabs.loader qualified accessors +stack-checker macros locals generalizations unix.types +debugger io prettyprint ; IN: unix TYPEDEF: uint in_addr_t @@ -109,8 +107,12 @@ FUNCTION: uid_t geteuid ; FUNCTION: gid_t getgid ; FUNCTION: int getgrgid_r ( gid_t gid, group* grp, char* buffer, size_t bufsize, group** result ) ; FUNCTION: int getgrnam_r ( char* name, group* grp, char* buffer, size_t bufsize, group** result ) ; +FUNCTION: passwd* getpwent ( ) ; FUNCTION: int getpwnam_r ( char* login, passwd* pwd, char* buffer, size_t bufsize, passwd** result ) ; FUNCTION: int getgroups ( int gidsetlen, gid_t* gidset ) ; +FUNCTION: int getgrouplist ( char* name, int basegid, int* groups, int* ngroups ) ; + +FUNCTION: group* getgrent ; FUNCTION: int gethostname ( char* name, int len ) ; FUNCTION: int getsockname ( int socket, sockaddr* address, socklen_t* address_len ) ; FUNCTION: int getpeername ( int socket, sockaddr* address, socklen_t* address_len ) ; From 6d8bfa4bf4728514b4bbc0da639329e53bb23072 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 15:38:31 -0500 Subject: [PATCH 080/948] remove some dead usings --- basis/math/intervals/intervals.factor | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/basis/math/intervals/intervals.factor b/basis/math/intervals/intervals.factor index 38d67aa043..213bfce354 100644 --- a/basis/math/intervals/intervals.factor +++ b/basis/math/intervals/intervals.factor @@ -2,8 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. ! Based on Slate's src/unfinished/interval.slate by Brian Rice. USING: accessors kernel sequences arrays math math.order -combinators generic random math.constants qualified ; -FROM: math.ranges => ; +combinators generic ; IN: math.intervals SYMBOL: empty-interval From 7bf5a3a077f74ca787c5805390fd819d18f25b6d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 16:41:42 -0500 Subject: [PATCH 081/948] remove unit test --- basis/random/random-tests.factor | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/basis/random/random-tests.factor b/basis/random/random-tests.factor index 7300a0dac4..c6d88c5525 100644 --- a/basis/random/random-tests.factor +++ b/basis/random/random-tests.factor @@ -1,5 +1,5 @@ USING: random sequences tools.test kernel math math.functions -sets math.constants ; +sets ; IN: random.tests [ 4 ] [ 4 random-bytes length ] unit-test @@ -16,6 +16,4 @@ IN: random.tests [ t ] [ 1000 [ 400 random ] replicate prune length 256 > ] unit-test -[ t ] [ pi random float? ] unit-test - [ 0 ] [ 0 random ] unit-test From ccdcacfd0419afabeb42fba76d4d1fbaaf8d5594 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 16:41:51 -0500 Subject: [PATCH 082/948] remove unit tests --- basis/math/intervals/intervals-tests.factor | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/basis/math/intervals/intervals-tests.factor b/basis/math/intervals/intervals-tests.factor index 481b065a1c..ad2fb53dc4 100644 --- a/basis/math/intervals/intervals-tests.factor +++ b/basis/math/intervals/intervals-tests.factor @@ -334,13 +334,3 @@ IN: math.intervals.tests [ execute ] [ swapd execute ] 3bi = ] all? ] unit-test - -[ t ] [ 1.0 1.0 epsilon + [a,b] random float? ] unit-test -[ t ] [ 1.0 1.0 epsilon + [a,b) random float? ] unit-test -[ t ] [ 1.0 1.0 epsilon + (a,b] random float? ] unit-test -[ 1.0 1.0 (a,b) random float? ] must-fail - -[ 3 4 + (a,b) random ] must-fail -[ 3 ] [ 3 4 [a,b) random ] unit-test -[ 4 ] [ 3 4 (a,b] random ] unit-test -[ t ] [ 3 4 [a,b] random { 3 4 } member? ] unit-test From 94d7772c1352c5db0c57b5431d86dff47034e90c Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 18:26:24 -0500 Subject: [PATCH 083/948] remove unused word, make some stuff compile --- basis/unicode/collation/collation-tests.factor | 6 +----- basis/unicode/collation/collation.factor | 9 ++++----- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/basis/unicode/collation/collation-tests.factor b/basis/unicode/collation/collation-tests.factor index bf87c6b7da..be6af2d920 100644 --- a/basis/unicode/collation/collation-tests.factor +++ b/basis/unicode/collation/collation-tests.factor @@ -11,11 +11,7 @@ IN: unicode.collation.tests : test-two ( str1 str2 -- ) [ +lt+ ] -rot [ string<=> ] 2curry unit-test ; -: failures - parse-test dup 2 - [ string<=> +lt+ = not ] assoc-filter dup assoc-size ; - -: test-equality +: test-equality ( str1 str2 -- ) { primary= secondary= tertiary= quaternary= } [ execute ] with with each ; diff --git a/basis/unicode/collation/collation.factor b/basis/unicode/collation/collation.factor index 8e9e2963a8..65786ede5d 100644 --- a/basis/unicode/collation/collation.factor +++ b/basis/unicode/collation/collation.factor @@ -100,8 +100,8 @@ ducet insert-helpers ] { } map-as concat ; : append-weights ( weights quot -- ) - swap [ ignorable?>> not ] filter - swap map [ zero? not ] filter % 0 , ; + [ [ ignorable?>> not ] filter ] dip + map [ zero? not ] filter % 0 , ; inline : variable-weight ( weight -- ) dup ignorable?>> [ primary>> ] [ drop HEX: FFFF ] if , ; @@ -135,7 +135,7 @@ PRIVATE> @@ -158,8 +158,7 @@ PRIVATE> PRIVATE> : sort-strings ( strings -- sorted ) - [ w/collation-key ] map - natural-sort values ; + [ w/collation-key ] map natural-sort values ; : string<=> ( str1 str2 -- <=> ) [ w/collation-key ] compare ; From a712fd3d0b4d6a0ebd52656ef8ea05976a3e6849 Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Sun, 5 Oct 2008 21:18:58 -0200 Subject: [PATCH 084/948] irc.client: Rename listeners to chats, rename some words, better handling of channel joins for chats attached before login, fixes, etc --- extra/irc/client/client-docs.factor | 75 ++++++------ extra/irc/client/client-tests.factor | 54 ++++----- extra/irc/client/client.factor | 167 ++++++++++++++------------- 3 files changed, 146 insertions(+), 150 deletions(-) diff --git a/extra/irc/client/client-docs.factor b/extra/irc/client/client-docs.factor index d150e6d36f..1b9204c4f1 100644 --- a/extra/irc/client/client-docs.factor +++ b/extra/irc/client/client-docs.factor @@ -3,11 +3,11 @@ IN: irc.client HELP: irc-client "IRC Client object" ; -HELP: irc-server-listener "Listener for server messages unmanaged by other listeners" ; +HELP: irc-server-chat "Chat for server messages unmanaged by other chats" ; -HELP: irc-channel-listener "Listener for irc channels" ; +HELP: irc-channel-chat "Chat for irc channels" ; -HELP: irc-nick-listener "Listener for irc users" ; +HELP: irc-nick-chat "Chat for irc users" ; HELP: irc-profile "IRC Client profile object" ; @@ -15,48 +15,43 @@ HELP: connect-irc "Connecting to an irc server" { $values { "irc-client" "an irc client object" } } { $description "Connects and logins " { $link irc-client } " using the settings specified on its " { $link irc-profile } "." } ; -HELP: add-listener "Listening to irc channels/users/etc" -{ $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } } -{ $description "Registers " { $snippet "irc-listener" } " with " { $snippet "irc-client" } " and starts listening." } ; +HELP: attach-chat "Chatting with irc channels/users/etc" +{ $values { "irc-chat" "an irc chat object" } { "irc-client" "an irc client object" } } +{ $description "Registers " { $snippet "irc-chat" } " with " { $snippet "irc-client" } " and starts listening." } ; -HELP: join-irc-channel "Joining channels" -{ $values { "irc-client-listener" "an irc client listener object" } } -{ $description "Joins to the channel being listened by " { $snippet "irc-listener" } "." } ; - -HELP: remove-listener "Stop an unregister listener" -{ $values { "irc-listener" "an irc listener object" } { "irc-client" "an irc client object" } } -{ $description "Unregisters " { $snippet "irc-listener" } " from " { $snippet "irc-client" } " and stops listening. This is how you part from a channel." } ; +HELP: dettach-chat "Stop an unregister chat" +{ $values { "irc-chat" "an irc chat object" } { "irc-client" "an irc client object" } } +{ $description "Unregisters " { $snippet "irc-chat" } " from " { $snippet "irc-client" } " and stops listening. This is how you part from a channel." } ; HELP: terminate-irc "Terminates an irc client" { $values { "irc-client" "an irc client object" } } -{ $description "Terminates all activity by " { $link irc-client } " cleaning up resources and notifying listeners." } ; +{ $description "Terminates all activity by " { $link irc-client } " cleaning up resources and notifying chats." } ; -HELP: write-message "Sends a message through a listener" -{ $values { "message" "a string or irc message object" } { "irc-listener" "an irc listener object" } } -{ $description "Sends " { $snippet "message" } " through " { $snippet "irc-listener" } ". Strings are automatically promoted to privmsg objects." } ; +HELP: speak "Sends a message through a chat" +{ $values { "message" "a string or irc message object" } { "irc-chat" "an irc chat object" } } +{ $description "Sends " { $snippet "message" } " through " { $snippet "irc-chat" } ". Strings are automatically promoted to privmsg objects." } ; -HELP: read-message "Reads a message from a listener" -{ $values { "irc-listener" "an irc listener object" } { "message" "an irc message object" } } -{ $description "Reads " { $snippet "message" } " from " { $snippet "irc-listener" } "." } ; +HELP: hear "Reads a message from a chat" +{ $values { "irc-chat" "an irc chat object" } { "message" "an irc message object" } } +{ $description "Reads " { $snippet "message" } " from " { $snippet "irc-chat" } "." } ; ARTICLE: "irc.client" "IRC Client" "An IRC Client library" { $heading "IRC objects:" } { $subsection irc-client } -{ $heading "Listener objects:" } -{ $subsection irc-server-listener } -{ $subsection irc-channel-listener } -{ $subsection irc-nick-listener } +{ $heading "Chat objects:" } +{ $subsection irc-server-chat } +{ $subsection irc-channel-chat } +{ $subsection irc-nick-chat } { $heading "Setup objects:" } { $subsection irc-profile } { $heading "Words:" } { $subsection connect-irc } { $subsection terminate-irc } -{ $subsection add-listener } -{ $subsection remove-listener } -{ $subsection join-irc-channel } -{ $subsection read-message } -{ $subsection write-message } +{ $subsection attach-chat } +{ $subsection dettach-chat } +{ $subsection hear } +{ $subsection speak } { $heading "IRC messages" } "Some of the RFC defined irc messages as objects:" { $table @@ -77,10 +72,10 @@ ARTICLE: "irc.client" "IRC Client" { $heading "Special messages" } "Some special messages that are created by the library and not by the irc server." { $table - { { $link irc-listener-end } "sent to a listener when it has been dettached from the client, the listener should stop after it receives this message. " } - { { $link irc-end } " sent when the client isn't running anymore, listeners should stop after it receives this message." } - { { $link irc-disconnected } " sent to notify listeners that connection was lost." } - { { $link irc-connected } " sent to notify listeners that a connection with the irc server was established." } } + { { $link irc-chat-end } "sent to a chat when it has been dettached from the client, the chat should stop after it receives this message. " } + { { $link irc-end } " sent when the client isn't running anymore, chats should stop after it receives this message." } + { { $link irc-disconnected } " sent to notify chats that connection was lost." } + { { $link irc-connected } " sent to notify chats that a connection with the irc server was established." } } { $heading "Example:" } { $code @@ -91,16 +86,14 @@ ARTICLE: "irc.client" "IRC Client" "\"irc.freenode.org\" irc-port \"mybot123\" f bot set" "! Connect to the server" "bot get connect-irc" - "! Create a channel listener" - "\"#mychannel123\" mychannel set" - "! Register and start listener (this joins the channel)" - "mychannel get bot get add-listener" - "! Join to the channel" - "mychannel get join-irc-channel" + "! Create a channel chat" + "\"#mychannel123\" mychannel set" + "! Register and start chat (this joins the channel)" + "mychannel get bot get attach-chat" "! Send a message to the channel" - "\"what's up?\" mychannel get write-message" + "\"what's up?\" mychannel get speak" "! Read a message from the channel" - "mychannel get read-message" + "mychannel get hear" } ; diff --git a/extra/irc/client/client-tests.factor b/extra/irc/client/client-tests.factor index acd5a783db..fe85d6c375 100644 --- a/extra/irc/client/client-tests.factor +++ b/extra/irc/client/client-tests.factor @@ -1,5 +1,5 @@ USING: kernel tools.test accessors arrays sequences qualified - io io.streams.duplex namespaces threads + io io.streams.duplex namespaces threads destructors calendar irc.client.private irc.client irc.messages.private concurrency.mailboxes classes assocs combinators ; EXCLUDE: irc.messages => join ; @@ -19,22 +19,23 @@ M: mb-reader stream-readln ( mb-reader -- str/f ) lines>> mailbox-get ; M: mb-writer stream-nl ( mb-writer -- ) [ [ last-line>> concat ] [ lines>> ] bi push ] keep V{ } clone >>last-line drop ; +M: mb-reader dispose drop ; +M: mb-writer dispose drop ; : spawn-client ( -- irc-client ) "someserver" irc-port "factorbot" f + t >>is-ready t >>is-running >>stream dup [ spawn-irc yield ] with-irc-client ; ! to be used inside with-irc-client quotations -: %add-named-listener ( listener -- ) irc> add-listener ; +: %add-named-chat ( chat -- ) irc> attach-chat ; : %push-line ( line -- ) irc> stream>> in>> push-line yield ; -: %join ( channel -- ) - - [ irc> add-listener ] [ join-irc-channel ] bi ; +: %join ( channel -- ) irc> attach-chat ; -: read-matching-message ( listener quot: ( msg -- ? ) -- irc-message ) +: read-matching-message ( chat quot: ( msg -- ? ) -- irc-message ) [ in-messages>> 0.1 seconds ] dip mailbox-get-timeout? ; : with-irc ( quot: ( -- ) -- ) @@ -68,7 +69,8 @@ M: mb-writer stream-nl ( mb-writer -- ) { V{ "NICK factorbot" "USER factorbot hostname servername :irc.factor" } } [ "someserver" irc-port "factorbot" f [ 2drop t ] >>connect - [ connect-irc ] keep stream>> out>> lines>> + [ connect-irc ] keep + stream>> [ in>> [ f ] dip push-line ] [ out>> lines>> ] bi ] unit-test ! Test join @@ -79,7 +81,7 @@ M: mb-writer stream-nl ( mb-writer -- ) ] with-irc [ { join_ "#factortest" } [ - "#factortest" [ %add-named-listener ] keep + "#factortest" [ %add-named-chat ] keep { ":factorbot!n=factorbo@some.where JOIN :#factortest" ":ircserver.net 353 factorbot @ #factortest :@factorbot " ":ircserver.net 366 factorbot #factortest :End of /NAMES list." @@ -91,14 +93,14 @@ M: mb-writer stream-nl ( mb-writer -- ) ] with-irc [ { T{ participant-changed f "somebody" +join+ } } [ - "#factortest" [ %add-named-listener ] keep + "#factortest" [ %add-named-chat ] keep ":somebody!n=somebody@some.where JOIN :#factortest" %push-line [ participant-changed? ] read-matching-message ] unit-test ] with-irc [ { privmsg "#factortest" "hello" } [ - "#factortest" [ %add-named-listener ] keep + "#factortest" [ %add-named-chat ] keep ":somebody!n=somebody@some.where PRIVMSG #factortest :hello" %push-line [ privmsg? ] read-matching-message [ class ] [ name>> ] [ trailing>> ] tri @@ -106,7 +108,7 @@ M: mb-writer stream-nl ( mb-writer -- ) ] with-irc [ { privmsg "factorbot" "hello" } [ - "ircuser" [ %add-named-listener ] keep + "ircuser" [ %add-named-chat ] keep ":ircuser!n=user@isp.net PRIVMSG factorbot :hello" %push-line [ privmsg? ] read-matching-message [ class ] [ name>> ] [ trailing>> ] tri @@ -114,7 +116,7 @@ M: mb-writer stream-nl ( mb-writer -- ) ] with-irc [ { mode } [ - "#factortest" [ %add-named-listener ] keep + "#factortest" [ %add-named-chat ] keep ":ircserver.net MODE #factortest +ns" %push-line [ mode? ] read-matching-message class ] unit-test @@ -122,46 +124,46 @@ M: mb-writer stream-nl ( mb-writer -- ) ! Participant lists tests [ { H{ { "ircuser" +normal+ } } } [ - "#factortest" [ %add-named-listener ] keep + "#factortest" [ %add-named-chat ] keep ":ircuser!n=user@isp.net JOIN :#factortest" %push-line participants>> ] unit-test ] with-irc [ { H{ { "ircuser2" +normal+ } } } [ - "#factortest" + "#factortest" H{ { "ircuser2" +normal+ } { "ircuser" +normal+ } } clone >>participants - [ %add-named-listener ] keep + [ %add-named-chat ] keep ":ircuser!n=user@isp.net PART #factortest" %push-line participants>> ] unit-test ] with-irc [ { H{ { "ircuser2" +normal+ } } } [ - "#factortest" + "#factortest" H{ { "ircuser2" +normal+ } { "ircuser" +normal+ } } clone >>participants - [ %add-named-listener ] keep + [ %add-named-chat ] keep ":ircuser!n=user@isp.net QUIT" %push-line participants>> ] unit-test ] with-irc [ { H{ { "ircuser2" +normal+ } } } [ - "#factortest" + "#factortest" H{ { "ircuser2" +normal+ } { "ircuser" +normal+ } } clone >>participants - [ %add-named-listener ] keep + [ %add-named-chat ] keep ":ircuser2!n=user2@isp.net KICK #factortest ircuser" %push-line participants>> ] unit-test ] with-irc [ { H{ { "ircuser2" +normal+ } } } [ - "#factortest" + "#factortest" H{ { "ircuser" +normal+ } } clone >>participants - [ %add-named-listener ] keep + [ %add-named-chat ] keep ":ircuser!n=user2@isp.net NICK :ircuser2" %push-line participants>> ] unit-test @@ -169,7 +171,7 @@ M: mb-writer stream-nl ( mb-writer -- ) ! Namelist change notification [ { T{ participant-changed f f f f } } [ - "#factortest" [ %add-named-listener ] keep + "#factortest" [ %add-named-chat ] keep ":ircserver.net 353 factorbot @ #factortest :@factorbot " %push-line ":ircserver.net 366 factorbot #factortest :End of /NAMES list." %push-line [ participant-changed? ] read-matching-message @@ -177,18 +179,18 @@ M: mb-writer stream-nl ( mb-writer -- ) ] with-irc [ { T{ participant-changed f "ircuser" +part+ f } } [ - "#factortest" + "#factortest" H{ { "ircuser" +normal+ } } clone >>participants - [ %add-named-listener ] keep + [ %add-named-chat ] keep ":ircuser!n=user@isp.net QUIT" %push-line [ participant-changed? ] read-matching-message ] unit-test ] with-irc [ { T{ participant-changed f "ircuser" +nick+ "ircuser2" } } [ - "#factortest" + "#factortest" H{ { "ircuser" +normal+ } } clone >>participants - [ %add-named-listener ] keep + [ %add-named-chat ] keep ":ircuser!n=user2@isp.net NICK :ircuser2" %push-line [ participant-changed? ] read-matching-message ] unit-test diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor index 606a8206da..d40c7d400d 100755 --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -18,16 +18,16 @@ TUPLE: irc-profile server port nickname password ; C: irc-profile TUPLE: irc-client profile stream in-messages out-messages - listeners is-running nick connect reconnect-time ; + chats is-running nick connect reconnect-time is-ready ; : ( profile -- irc-client ) [ f H{ } clone f ] keep nickname>> - [ latin1 ] 15 seconds irc-client boa ; + [ latin1 ] 15 seconds f irc-client boa ; -TUPLE: irc-listener in-messages client ; -TUPLE: irc-server-listener < irc-listener ; -TUPLE: irc-channel-listener < irc-listener name password timeout participants ; -TUPLE: irc-nick-listener < irc-listener name ; -SYMBOL: +server-listener+ +TUPLE: irc-chat in-messages client ; +TUPLE: irc-server-chat < irc-chat ; +TUPLE: irc-channel-chat < irc-chat name password timeout participants ; +TUPLE: irc-nick-chat < irc-chat name ; +SYMBOL: +server-chat+ ! participant modes SYMBOL: +operator+ @@ -43,18 +43,16 @@ SYMBOL: +part+ SYMBOL: +mode+ SYMBOL: +nick+ -! listener objects -: ( -- irc-listener ) irc-listener boa ; +! chat objects +: ( -- irc-server-chat ) + f irc-server-chat boa ; -: ( -- irc-server-listener ) - f irc-server-listener boa ; - -: ( name -- irc-channel-listener ) +: ( name -- irc-channel-chat ) [ f ] dip f 60 seconds H{ } clone - irc-channel-listener boa ; + irc-channel-chat boa ; -: ( name -- irc-nick-listener ) - [ f ] dip irc-nick-listener boa ; +: ( name -- irc-nick-chat ) + [ f ] dip irc-nick-chat boa ; ! ====================================== ! Message objects @@ -63,15 +61,15 @@ SYMBOL: +nick+ TUPLE: participant-changed nick action parameter ; C: participant-changed -SINGLETON: irc-listener-end ! send to a listener to stop its execution +SINGLETON: irc-chat-end ! sent to a chat to stop its execution SINGLETON: irc-end ! sent when the client isn't running anymore SINGLETON: irc-disconnected ! sent when connection is lost SINGLETON: irc-connected ! sent when connection is established -SINGLETON: irc-ready ! sent after the client is logged in : terminate-irc ( irc-client -- ) [ is-running>> ] keep and [ f >>is-running + [ stream>> dispose ] keep [ in-messages>> ] [ out-messages>> ] bi 2array [ irc-end swap mailbox-put ] each ] when* ; @@ -85,66 +83,65 @@ SYMBOL: current-irc-client ! ====================================== : irc> ( -- irc-client ) current-irc-client get ; -: irc-stream> ( -- stream ) irc> stream>> ; -: irc-write ( s -- ) irc-stream> stream-write ; -: irc-print ( s -- ) irc-stream> [ stream-print ] keep stream-flush ; +: irc-write ( s -- ) irc> stream>> stream-write ; +: irc-print ( s -- ) irc> stream>> [ stream-print ] keep stream-flush ; : irc-send ( irc-message -- ) irc> out-messages>> mailbox-put ; -: listener> ( name -- listener/f ) irc> listeners>> at ; +: chat> ( name -- chat/f ) irc> chats>> at ; : channel-mode? ( mode -- ? ) name>> first "#&" member? ; : me? ( string -- ? ) irc> nick>> = ; -GENERIC: to-listener ( message obj -- ) +GENERIC: to-chat ( message obj -- ) -M: string to-listener - listener> [ +server-listener+ listener> ] unless* - [ to-listener ] [ drop ] if* ; +M: string to-chat + chat> [ +server-chat+ chat> ] unless* + [ to-chat ] [ drop ] if* ; -M: irc-listener to-listener in-messages>> mailbox-put ; +M: irc-chat to-chat in-messages>> mailbox-put ; -: unregister-listener ( name -- ) - irc> listeners>> - [ at [ irc-listener-end ] dip to-listener ] +: unregister-chat ( name -- ) + irc> chats>> + [ at [ irc-chat-end ] dip to-chat ] [ delete-at ] 2bi ; -: (remove-participant) ( nick listener -- ) +: (remove-participant) ( nick chat -- ) [ participants>> delete-at ] - [ [ +part+ f ] dip to-listener ] 2bi ; + [ [ +part+ f ] dip to-chat ] 2bi ; : remove-participant ( nick channel -- ) - listener> [ (remove-participant) ] [ drop ] if* ; + chat> [ (remove-participant) ] [ drop ] if* ; -: listeners-with-participant ( nick -- seq ) - irc> listeners>> values - [ [ irc-channel-listener? ] keep and [ participants>> key? ] [ drop f ] if* ] +: chats-with-participant ( nick -- seq ) + irc> chats>> values + [ [ irc-channel-chat? ] keep and [ participants>> key? ] [ drop f ] if* ] with filter ; -: to-listeners-with-participant ( message nickname -- ) - listeners-with-participant [ to-listener ] with each ; +: to-chats-with-participant ( message nickname -- ) + chats-with-participant [ to-chat ] with each ; : remove-participant-from-all ( nick -- ) - dup listeners-with-participant [ (remove-participant) ] with each ; + dup chats-with-participant [ (remove-participant) ] with each ; -: notify-rename ( newnick oldnick listener -- ) +: notify-rename ( newnick oldnick chat -- ) [ participant-changed new +nick+ >>action - [ (>>nick) ] [ (>>parameter) ] [ ] tri ] dip to-listener ; + [ (>>nick) ] [ (>>parameter) ] [ ] tri ] dip to-chat ; -: rename-participant ( newnick oldnick listener -- ) - [ participants>> [ delete-at* drop ] [ [ swap ] dip set-at ] bi ] +: rename-participant ( newnick oldnick chat -- ) + [ participants>> [ delete-at* drop ] [ swapd set-at ] bi ] [ notify-rename ] 3bi ; : rename-participant-in-all ( oldnick newnick -- ) - swap dup listeners-with-participant [ rename-participant ] with with each ; + swap dup chats-with-participant [ rename-participant ] with with each ; : add-participant ( mode nick channel -- ) - listener> + chat> [ participants>> set-at ] - [ [ +join+ f ] dip to-listener ] 2bi ; + [ [ +join+ f ] dip to-chat ] 2bi ; : change-participant-mode ( channel mode nick -- ) - rot listener> + rot chat> [ participants>> set-at ] - [ [ [ +mode+ ] dip ] dip to-listener ] 3bi ; ! FIXME + [ [ [ +mode+ ] dip ] dip to-chat ] 3bi ; ! FIXME DEFER: me? @@ -174,6 +171,10 @@ DEFER: me? ! Server message handling ! ====================================== +GENERIC: initialize-chat ( chat -- ) +M: irc-chat initialize-chat drop ; +M: irc-channel-chat initialize-chat [ name>> ] [ password>> ] bi /JOIN ; + GENERIC: forward-name ( irc-message -- name ) M: join forward-name trailing>> ; M: part forward-name channel>> ; @@ -187,32 +188,34 @@ UNION: broadcast-forward irc-end irc-disconnected irc-connected ; GENERIC: forward-message ( irc-message -- ) M: irc-message forward-message - +server-listener+ listener> [ to-listener ] [ drop ] if* ; + +server-chat+ chat> [ to-chat ] [ drop ] if* ; -M: single-forward forward-message dup forward-name to-listener ; +M: single-forward forward-message dup forward-name to-chat ; M: multiple-forward forward-message - dup irc-message-sender to-listeners-with-participant ; + dup irc-message-sender to-chats-with-participant ; M: broadcast-forward forward-message - irc> listeners>> values [ to-listener ] with each ; + irc> chats>> values [ to-chat ] with each ; GENERIC: process-message ( irc-message -- ) M: object process-message drop ; -M: logged-in process-message name>> irc> (>>nick) ; +M: logged-in process-message + name>> f irc> [ (>>is-ready) ] [ (>>nick) ] [ chats>> ] tri + values [ initialize-chat ] each ; M: ping process-message trailing>> /PONG ; M: nick-in-use process-message name>> "_" append /NICK ; M: join process-message [ drop +normal+ ] [ irc-message-sender ] [ trailing>> ] tri - dup listener> [ add-participant ] [ 3drop ] if ; + dup chat> [ add-participant ] [ 3drop ] if ; M: part process-message [ irc-message-sender ] [ channel>> ] bi remove-participant ; M: kick process-message [ [ who>> ] [ channel>> ] bi remove-participant ] - [ dup who>> me? [ unregister-listener ] [ drop ] if ] + [ dup who>> me? [ unregister-chat ] [ drop ] if ] bi ; M: quit process-message @@ -235,9 +238,9 @@ M: nick process-message [ >nick/mode 2array ] map >hashtable ; M: names-reply process-message - [ names-reply>participants ] [ channel>> listener> ] bi [ + [ names-reply>participants ] [ channel>> chat> ] bi [ [ (>>participants) ] - [ [ f f f ] dip name>> to-listener ] bi + [ [ f f f ] dip name>> to-chat ] bi ] [ drop ] if* ; ! ====================================== @@ -265,8 +268,8 @@ DEFER: (connect-irc) tri ; ! FIXME: do something with the exception, store somewhere to help debugging -: handle-disconnect ( error -- ) - drop irc> is-running>> [ (handle-disconnect) ] when ; +: handle-disconnect ( error -- ? ) + drop irc> is-running>> [ (handle-disconnect) t ] [ f ] if ; : (reader-loop) ( -- ? ) irc> stream>> [ @@ -278,7 +281,7 @@ DEFER: (connect-irc) ] with-destructors ; : reader-loop ( -- ? ) - [ (reader-loop) ] [ handle-disconnect t ] recover ; + [ (reader-loop) ] [ handle-disconnect ] recover ; : writer-loop ( -- ? ) irc> out-messages>> mailbox-get handle-outgoing-irc ; @@ -300,7 +303,7 @@ DEFER: (connect-irc) [ nip ] } cond ; -GENERIC: annotate-message ( listener object -- object ) +GENERIC: annotate-message ( chat object -- object ) M: object annotate-message nip ; M: part annotate-message swap name>> >>channel ; M: privmsg annotate-message swap name>> >>name ; @@ -312,25 +315,27 @@ M: string annotate-message [ name>> ] dip strings>privmsg ; [ in-multiplexer-loop ] "in-multiplexer-loop" spawn-server 3drop ; -GENERIC: (add-listener) ( irc-listener -- ) +GENERIC: (attach-chat) ( irc-chat -- ) +USE: prettyprint +M: irc-chat (attach-chat) + [ [ irc> >>client ] [ name>> ] bi irc> chats>> set-at ] + [ [ irc> is-ready>> ] dip and [ initialize-chat ] when* ] + bi ; -M: irc-listener (add-listener) - [ irc> >>client ] [ name>> ] bi irc> listeners>> set-at ; +M: irc-server-chat (attach-chat) + irc> >>client +server-chat+ irc> chats>> set-at ; -M: irc-server-listener (add-listener) - irc> >>client +server-listener+ irc> listeners>> set-at ; +GENERIC: (remove-chat) ( irc-chat -- ) -GENERIC: (remove-listener) ( irc-listener -- ) +M: irc-nick-chat (remove-chat) + name>> unregister-chat ; -M: irc-nick-listener (remove-listener) - name>> unregister-listener ; - -M: irc-channel-listener (remove-listener) +M: irc-channel-chat (remove-chat) [ part new annotate-message irc> out-messages>> mailbox-put ] keep - name>> unregister-listener ; + name>> unregister-chat ; -M: irc-server-listener (remove-listener) - drop +server-listener+ unregister-listener ; +M: irc-server-chat (remove-chat) + drop +server-chat+ unregister-chat ; : (connect-irc) ( irc-client -- ) { @@ -348,16 +353,12 @@ PRIVATE> : connect-irc ( irc-client -- ) dup [ [ (connect-irc) ] [ nick>> /LOGIN ] bi spawn-irc ] with-irc-client ; -: add-listener ( irc-listener irc-client -- ) - swap '[ _ (add-listener) ] with-irc-client ; +: attach-chat ( irc-chat irc-client -- ) [ (attach-chat) ] with-irc-client ; -: remove-listener ( irc-listener -- ) - [ client>> ] keep '[ _ (remove-listener) ] with-irc-client ; +: dettach-chat ( irc-chat -- ) + [ client>> ] keep '[ _ (remove-chat) ] with-irc-client ; -: join-irc-channel ( irc-channel-listener -- ) - dup client>> [ [ name>> ] [ password>> ] bi /JOIN ] with-irc-client ; - -: write-message ( message irc-listener -- ) +: speak ( message irc-chat -- ) [ swap annotate-message ] [ client>> out-messages>> mailbox-put ] bi ; -: read-message ( irc-listener -- message ) in-messages>> mailbox-get ; +: hear ( irc-chat -- message ) in-messages>> mailbox-get ; From 14dcf83993495b41e30c4a65aa42019af4d57ccc Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Sun, 5 Oct 2008 21:33:53 -0200 Subject: [PATCH 085/948] irc.ui: Update to work with the latest irc.client changes --- extra/irc/ui/commands/commands.factor | 4 +-- extra/irc/ui/ui.factor | 44 ++++++++++++--------------- 2 files changed, 21 insertions(+), 27 deletions(-) diff --git a/extra/irc/ui/commands/commands.factor b/extra/irc/ui/commands/commands.factor index 184a2b4de8..4bb77e7490 100755 --- a/extra/irc/ui/commands/commands.factor +++ b/extra/irc/ui/commands/commands.factor @@ -8,7 +8,7 @@ IN: irc.ui.commands : say ( string -- ) irc-tab get [ window>> client>> profile>> nickname>> print-irc ] - [ listener>> write-message ] 2bi ; + [ chat>> speak ] 2bi ; : join ( string -- ) irc-tab get window>> join-channel ; @@ -18,7 +18,7 @@ IN: irc.ui.commands : whois ( string -- ) "WHOIS" swap { } clone swap - irc-tab get listener>> write-message ; + irc-tab get listener>> speak ; : quote ( string -- ) drop ; ! THIS WILL CHANGE diff --git a/extra/irc/ui/ui.factor b/extra/irc/ui/ui.factor index c171fef0b6..50dc9378a2 100755 --- a/extra/irc/ui/ui.factor +++ b/extra/irc/ui/ui.factor @@ -15,7 +15,7 @@ RENAME: join sequences => sjoin IN: irc.ui -SYMBOL: listener +SYMBOL: chat SYMBOL: client @@ -24,7 +24,7 @@ TUPLE: ui-window < tabbed client ; M: ui-window ungraft* client>> terminate-irc ; -TUPLE: irc-tab < frame listener client window ; +TUPLE: irc-tab < frame chat client window ; : write-color ( str color -- ) foreground associate format ; @@ -117,7 +117,7 @@ M: irc-disconnected write-irc M: irc-connected write-irc drop "* Connected" dark-green write-color ; -M: irc-listener-end write-irc +M: irc-chat-end write-irc drop ; M: irc-message write-irc @@ -135,7 +135,7 @@ M: object time-happened drop now ; : send-message ( message -- ) [ print-irc ] - [ listener get write-message ] bi ; + [ chat get speak ] bi ; GENERIC: handle-inbox ( tab message -- ) @@ -150,7 +150,7 @@ M: object handle-inbox : display ( stream tab -- ) '[ _ [ [ t ] - [ _ dup listener>> read-message handle-inbox ] + [ _ dup chat>> hear handle-inbox ] [ ] while ] with-output-stream ] "ircv" spawn drop ; : ( tab -- tab pane ) @@ -175,33 +175,28 @@ irc-editor "general" f { { T{ key-down f f "ENTER" } editor-send } } define-command-map -: new-irc-tab ( listener ui-window class -- irc-tab ) +: new-irc-tab ( chat ui-window class -- irc-tab ) new-frame swap >>window - swap >>listener + swap >>chat [ @center grid-add ] keep @bottom grid-add ; -GENERIC: init-listener ( listener -- ) -M: object init-listener drop ; -M: irc-channel-listener init-listener join-irc-channel ; - M: irc-tab graft* - [ listener>> dup ] [ window>> client>> ] bi add-listener - init-listener ; + [ chat>> ] [ window>> client>> ] bi attach-chat ; M: irc-tab ungraft* - listener>> remove-listener ; + chat>> dettach-chat ; TUPLE: irc-channel-tab < irc-tab userlist ; -: ( listener ui-window -- irc-tab ) +: ( chat ui-window -- irc-tab ) irc-channel-tab new-irc-tab [ @right grid-add ] keep >>userlist ; : update-participants ( tab -- ) [ userlist>> [ clear-gadget ] keep ] - [ listener>> participants>> ] bi + [ chat>> participants>> ] bi [ +operator+ value-labels dark-green add-gadget-color ] [ +voice+ value-labels blue add-gadget-color ] [ +normal+ value-labels black add-gadget-color ] tri drop ; @@ -211,22 +206,22 @@ M: participant-changed handle-inbox TUPLE: irc-server-tab < irc-tab ; -: ( listener -- irc-tab ) +: ( chat -- irc-tab ) f irc-server-tab new-irc-tab ; -: ( listener ui-window -- irc-tab ) +: ( chat ui-window -- irc-tab ) irc-tab new-irc-tab ; M: irc-tab pref-dim* drop { 480 480 } ; : join-channel ( name ui-window -- ) - [ dup ] dip + [ dup ] dip [ swap ] keep add-page ; : query-nick ( nick ui-window -- ) - [ dup ] dip + [ dup ] dip [ swap ] keep add-page ; @@ -237,16 +232,15 @@ M: irc-tab pref-dim* : ui-connect ( profile -- ui-window ) - { [ [ ] dip add-listener ] - [ listeners>> +server-listener+ swap at dup + { [ [ ] dip attach-chat ] + [ chats>> +server-chat+ swap at dup "Server" associate ui-window new-tabbed [ swap (>>window) ] keep ] [ >>client ] [ connect-irc ] } cleave ; : server-open ( server port nick password channels -- ) - [ ui-connect [ irc-window ] keep ] dip 2drop ; -! FIXME: should join channels only after we have been logged in -! [ over join-channel ] each drop ; + [ ui-connect [ irc-window ] keep ] dip + [ over join-channel ] each drop ; : main-run ( -- ) run-ircui ; From a30dbec5fba4d68bd67c96bc450994c06564eb16 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Sun, 5 Oct 2008 18:36:56 -0500 Subject: [PATCH 086/948] remove dead code, add copyright --- basis/unicode/breaks/breaks.factor | 2 ++ basis/unicode/case/case.factor | 13 ++----------- basis/unicode/categories/categories.factor | 2 ++ basis/unicode/collation/collation.factor | 2 ++ basis/unicode/data/data.factor | 2 ++ basis/unicode/normalize/normalize.factor | 2 ++ basis/unicode/script/script.factor | 2 ++ basis/unicode/syntax/syntax.factor | 2 ++ 8 files changed, 16 insertions(+), 11 deletions(-) diff --git a/basis/unicode/breaks/breaks.factor b/basis/unicode/breaks/breaks.factor index 6aa3e60647..0f2e12119d 100644 --- a/basis/unicode/breaks/breaks.factor +++ b/basis/unicode/breaks/breaks.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. USING: combinators.short-circuit unicode.categories kernel math combinators splitting sequences math.parser io.files io assocs arrays namespaces make math.ranges unicode.normalize values diff --git a/basis/unicode/case/case.factor b/basis/unicode/case/case.factor index 5e961e2d67..3def7b5f48 100644 --- a/basis/unicode/case/case.factor +++ b/basis/unicode/case/case.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. USING: unicode.data sequences sequences.next namespaces make unicode.normalize math unicode.categories combinators assocs strings splitting kernel accessors ; @@ -70,17 +72,6 @@ SYMBOL: locale ! Just casing locale, or overall? : final-sigma ( string -- string ) HEX: 3A3 over member? [ sigma-map ] when ; -! : map-case ( string string-quot char-quot -- case ) -! [ -! rot [ -! -rot [ -! rot dup special-casing at -! [ -rot drop call % ] -! [ -rot nip call , ] ?if -! ] 2keep -! ] each 2drop -! ] "" make ; inline - : map-case ( string string-quot char-quot -- case ) [ [ diff --git a/basis/unicode/categories/categories.factor b/basis/unicode/categories/categories.factor index 4ba96fb9c4..0464e31b12 100644 --- a/basis/unicode/categories/categories.factor +++ b/basis/unicode/categories/categories.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. USING: unicode.syntax ; IN: unicode.categories diff --git a/basis/unicode/collation/collation.factor b/basis/unicode/collation/collation.factor index 65786ede5d..7f445b8513 100644 --- a/basis/unicode/collation/collation.factor +++ b/basis/unicode/collation/collation.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. USING: combinators.short-circuit sequences io.files io.encodings.ascii kernel values splitting accessors math.parser ascii io assocs strings math namespaces make sorting combinators diff --git a/basis/unicode/data/data.factor b/basis/unicode/data/data.factor index cd54b93f2a..31d0be799f 100644 --- a/basis/unicode/data/data.factor +++ b/basis/unicode/data/data.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. USING: combinators.short-circuit assocs math kernel sequences io.files hashtables quotations splitting grouping arrays math.parser hash2 math.order byte-arrays words namespaces words diff --git a/basis/unicode/normalize/normalize.factor b/basis/unicode/normalize/normalize.factor index 53a38faed4..8d6f6e888a 100644 --- a/basis/unicode/normalize/normalize.factor +++ b/basis/unicode/normalize/normalize.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. USING: sequences namespaces make unicode.data kernel math arrays locals sorting.insertion accessors ; IN: unicode.normalize diff --git a/basis/unicode/script/script.factor b/basis/unicode/script/script.factor index 103beb4d2a..9691797128 100644 --- a/basis/unicode/script/script.factor +++ b/basis/unicode/script/script.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. USING: accessors values kernel sequences assocs io.files io.encodings ascii math.ranges io splitting math.parser namespaces make byte-arrays locals math sets io.encodings.ascii diff --git a/basis/unicode/syntax/syntax.factor b/basis/unicode/syntax/syntax.factor index 1ba76fd380..bf4610ab0d 100644 --- a/basis/unicode/syntax/syntax.factor +++ b/basis/unicode/syntax/syntax.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Daniel Ehrenberg. +! See http://factorcode.org/license.txt for BSD license. USING: unicode.data kernel math sequences parser lexer bit-arrays namespaces make sequences.private arrays quotations assocs classes.predicate math.order eval ; From 46c3f0def1ca86400df0ce7c82f2ed6ee8ef1a49 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 5 Oct 2008 20:31:48 -0500 Subject: [PATCH 087/948] Remove unused error class --- basis/random/random.factor | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/basis/random/random.factor b/basis/random/random.factor index 8a69b28171..b5f8ac48b8 100644 --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -51,13 +51,12 @@ M: sequence random ( seq -- elt ) [ length random-integer ] keep nth ] if-empty ; -ERROR: negative-random n ; M: integer random ( integer -- integer' ) - { - { [ dup 0 = ] [ ] } - { [ dup 0 < ] [ neg random-integer neg ] } - [ random-integer ] - } cond ; + dup sgn { + { 0 [ ] } + { -1 [ neg random-integer neg ] } + { 1 [ random-integer ] } + } case ; : delete-random ( seq -- elt ) [ length random-integer ] keep [ nth ] 2keep delete-nth ; From d5112a0ced6aebdde1cd76e388a1632cb352f1de Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 5 Oct 2008 21:30:29 -0500 Subject: [PATCH 088/948] Working on stack frame cleanup --- basis/compiler/generator/generator.factor | 7 +- .../cpu/ppc/architecture/architecture.factor | 27 ++--- basis/cpu/x86/32/32.factor | 106 ++++++++---------- basis/cpu/x86/64/64.factor | 32 +++--- .../cpu/x86/architecture/architecture.factor | 14 ++- 5 files changed, 88 insertions(+), 98 deletions(-) diff --git a/basis/compiler/generator/generator.factor b/basis/compiler/generator/generator.factor index 0a9885357e..2b398eaeea 100644 --- a/basis/compiler/generator/generator.factor +++ b/basis/compiler/generator/generator.factor @@ -296,16 +296,13 @@ M: #return-recursive generate-node : return-size ( ctype -- n ) #! Amount of space we reserve for a return value. - dup large-struct? [ heap-size ] [ drop 0 ] if ; + dup large-struct? [ heap-size ] [ drop 2 cells ] if ; : alien-stack-frame ( params -- n ) alien-parameters parameter-sizes drop ; : alien-invoke-frame ( params -- n ) - #! Two cells for temporary storage, temp@ and on x86.64, - #! small struct return value unpacking - [ return>> return-size ] [ alien-stack-frame ] bi - + 2 cells + ; + [ return>> return-size ] [ alien-stack-frame ] bi + ; : set-stack-frame ( n -- ) dup [ frame-required ] when* \ stack-frame set ; diff --git a/basis/cpu/ppc/architecture/architecture.factor b/basis/cpu/ppc/architecture/architecture.factor index 80ee1802e1..aab104fa6e 100644 --- a/basis/cpu/ppc/architecture/architecture.factor +++ b/basis/cpu/ppc/architecture/architecture.factor @@ -44,7 +44,7 @@ IN: cpu.ppc.architecture : xt-save ( n -- i ) 2 cells - ; M: ppc stack-frame ( n -- i ) - local@ factor-area-size + 4 cells align ; + local@ factor-area-size + cell + 4 cells align ; M: temp-reg v>operand drop 11 ; @@ -166,11 +166,13 @@ M: float-regs %load-param-reg >r 1 rot local@ r> LF ; M: stack-params %load-param-reg ( stack reg reg-class -- ) drop >r 0 1 rot local@ LWZ 0 1 r> param@ STW ; +: next-param@ ( n -- x ) param@ stack-frame* + ; + M: stack-params %save-param-reg ( stack reg reg-class -- ) #! Funky. Read the parameter from the caller's stack frame. #! This word is used in callbacks drop - 0 1 rot param@ stack-frame* + LWZ + 0 1 rot next-param@ LWZ 0 1 rot local@ STW ; M: ppc %prepare-unbox ( -- ) @@ -197,10 +199,8 @@ M: ppc %unbox-long-long ( n func -- ) M: ppc %unbox-large-struct ( n c-type -- ) ! Value must be in r3 - ! Compute destination address - 4 1 roll local@ ADDI - ! Load struct size - heap-size 5 LI + ! Compute destination address and load struct size + [ 4 1 rot local@ ADDI ] [ heap-size 5 LI ] bi* ! Call the function "to_value_struct" f %alien-invoke ; @@ -218,9 +218,8 @@ M: ppc %box-long-long ( n func -- ) 4 1 rot cell + local@ LWZ ] when* r> f %alien-invoke ; -: temp@ ( m -- n ) stack-frame* factor-area-size - swap - ; - -: struct-return@ ( size n -- n ) [ local@ ] [ temp@ ] ?if ; +: struct-return@ ( size n -- n ) + [ local@ ] [ stack-frame* factor-area-size - swap - ] ?if ; M: ppc %prepare-box-struct ( size -- ) #! Compute target address for value struct return @@ -231,10 +230,8 @@ M: ppc %box-large-struct ( n c-type -- ) #! If n = f, then we're boxing a returned struct heap-size [ swap struct-return@ ] keep - ! Compute destination address - 3 1 roll ADDI - ! Load struct size - 4 LI + ! Compute destination address and load struct size + [ 3 1 rot ADDI ] [ 4 LI ] bi* ! Call the function "box_value_struct" f %alien-invoke ; @@ -256,10 +253,10 @@ M: ppc %alien-callback ( quot -- ) M: ppc %prepare-alien-indirect ( -- ) "unbox_alien" f %alien-invoke - 3 1 cell temp@ STW ; + 3 11 MR ; M: ppc %alien-indirect ( -- ) - 11 1 cell temp@ LWZ (%call) ; + (%call) ; M: ppc %callback-value ( ctype -- ) ! Save top of data stack diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index 50d8025b38..1173b9e68e 100644 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -1,13 +1,12 @@ ! Copyright (C) 2005, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types arrays cpu.x86.assembler +USING: locals alien.c-types arrays cpu.x86.assembler cpu.x86.architecture cpu.x86.intrinsics cpu.x86.allot cpu.architecture kernel kernel.private math namespaces sequences -stack-checker.known-words -compiler.generator.registers compiler.generator.fixup -compiler.generator system layouts combinators -command-line compiler compiler.units io vocabs.loader accessors -init ; +stack-checker.known-words compiler.generator.registers +compiler.generator.fixup compiler.generator system layouts +combinators command-line compiler compiler.units io +vocabs.loader accessors init ; IN: cpu.x86.32 ! We implement the FFI for Linux, OS X and Windows all at once. @@ -18,7 +17,6 @@ IN: cpu.x86.32 M: x86.32 ds-reg ESI ; M: x86.32 rs-reg EDI ; M: x86.32 stack-reg ESP ; -M: x86.32 stack-save-reg EDX ; M: x86.32 temp-reg-1 EAX ; M: x86.32 temp-reg-2 ECX ; @@ -32,15 +30,20 @@ M: x86.32 struct-small-enough? ( size -- ? ) heap-size { 1 2 4 8 } member? os { linux netbsd solaris } member? not and ; +: struct-return@ ( size n -- operand ) + [ next-stack@ ] [ \ stack-frame get swap - stack@ ] ?if ; + ! On x86, parameters are never passed in registers. M: int-regs return-reg drop EAX ; M: int-regs param-regs drop { } ; M: int-regs vregs drop { EAX ECX EDX EBP } ; M: int-regs push-return-reg return-reg PUSH ; -: load/store-int-return ( n reg-class -- src dst ) - return-reg stack-reg rot [+] ; -M: int-regs load-return-reg load/store-int-return MOV ; -M: int-regs store-return-reg load/store-int-return swap MOV ; + +M: int-regs load-return-reg + return-reg swap next-stack@ MOV ; + +M: int-regs store-return-reg + [ stack@ ] [ return-reg ] bi* MOV ; M: float-regs param-regs drop { } ; M: float-regs vregs drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ; @@ -48,14 +51,16 @@ M: float-regs vregs drop { XMM0 XMM1 XMM2 XMM3 XMM4 XMM5 XMM6 XMM7 } ; : FSTP ( operand size -- ) 4 = [ FSTPS ] [ FSTPL ] if ; M: float-regs push-return-reg - stack-reg swap reg-size [ SUB stack-reg [] ] keep FSTP ; + stack-reg swap reg-size + [ SUB ] [ [ [] ] dip FSTP ] 2bi ; : FLD ( operand size -- ) 4 = [ FLDS ] [ FLDL ] if ; -: load/store-float-return ( n reg-class -- op size ) - [ stack@ ] [ reg-size ] bi* ; -M: float-regs load-return-reg load/store-float-return FLD ; -M: float-regs store-return-reg load/store-float-return FSTP ; +M: float-regs load-return-reg + [ next-stack@ ] [ reg-size ] bi* FLD ; + +M: float-regs store-return-reg + [ stack@ ] [ reg-size ] bi* FSTP ; : align-sub ( n -- ) dup 16 align swap - ESP swap SUB ; @@ -64,7 +69,8 @@ M: float-regs store-return-reg load/store-float-return FSTP ; 16 align ESP swap ADD ; : with-aligned-stack ( n quot -- ) - swap dup align-sub slip align-add ; inline + [ [ align-sub ] [ call ] bi* ] + [ [ align-add ] [ drop ] bi* ] 2bi ; inline M: x86.32 fixnum>slot@ 1 SHR ; @@ -77,57 +83,40 @@ M: object %load-param-reg 3drop ; M: object %save-param-reg 3drop ; -: box@ ( n reg-class -- stack@ ) - #! Used for callbacks; we want to box the values given to - #! us by the C function caller. Computes stack location of - #! nth parameter; note that we must go back one more stack - #! frame, since %box sets one up to call the one-arg boxer - #! function. The size of this stack frame so far depends on - #! the reg-class of the boxer's arg. - reg-size neg + stack-frame* + 20 + ; - : (%box) ( n reg-class -- ) #! If n is f, push the return register onto the stack; we #! are boxing a return value of a C function. If n is an #! integer, push [ESP+n] on the stack; we are boxing a #! parameter being passed to a callback from C. - over [ [ box@ ] keep [ load-return-reg ] keep ] [ nip ] if - push-return-reg ; + over [ load-return-reg ] [ 2drop ] if ; -M: x86.32 %box ( n reg-class func -- ) - over reg-size [ - >r (%box) r> f %alien-invoke +M:: x86.32 %box ( n reg-class func -- ) + n reg-class (%box) + reg-class reg-size [ + reg-class push-return-reg + func f %alien-invoke ] with-aligned-stack ; : (%box-long-long) ( n -- ) - #! If n is f, push the return registers onto the stack; we - #! are boxing a return value of a C function. If n is an - #! integer, push [ESP+n]:[ESP+n+4] on the stack; we are - #! boxing a parameter being passed to a callback from C. [ - int-regs box@ - EDX over stack@ MOV - EAX swap cell - stack@ MOV - ] when* - EDX PUSH - EAX PUSH ; + EDX over next-stack@ MOV + EAX swap cell - next-stack@ MOV + ] when* ; M: x86.32 %box-long-long ( n func -- ) + [ (%box-long-long) ] dip 8 [ - [ (%box-long-long) ] [ f %alien-invoke ] bi* + EDX PUSH + EAX PUSH + f %alien-invoke ] with-aligned-stack ; -: struct-return@ ( size n -- n ) - [ stack-frame* cell + + ] [ \ stack-frame get swap - ] ?if ; - -M: x86.32 %box-large-struct ( n c-type -- ) +M:: x86.32 %box-large-struct ( n c-type -- ) ! Compute destination address - heap-size - [ swap struct-return@ ] keep - ECX ESP roll [+] LEA + ECX c-type heap-size n struct-return@ LEA 8 [ ! Push struct size - PUSH + c-type heap-size PUSH ! Push destination address ECX PUSH ! Copy the struct from the C stack @@ -136,9 +125,9 @@ M: x86.32 %box-large-struct ( n c-type -- ) M: x86.32 %prepare-box-struct ( size -- ) ! Compute target address for value struct return - EAX ESP rot f struct-return@ [+] LEA + EAX swap f struct-return@ LEA ! Store it as the first parameter - ESP [] EAX MOV ; + 0 stack@ EAX MOV ; M: x86.32 %box-small-struct ( c-type -- ) #! Box a <= 8-byte struct returned in EAX:EDX. OS X only. @@ -207,13 +196,12 @@ M: x86 %unbox-small-struct ( size -- ) } case ; M: x86.32 %unbox-large-struct ( n c-type -- ) - #! Alien must be in EAX. - heap-size + ! Alien must be in EAX. ! Compute destination address - ECX ESP roll [+] LEA + ECX rot stack@ LEA 12 [ ! Push struct size - PUSH + heap-size PUSH ! Push destination address ECX PUSH ! Push source address @@ -224,10 +212,10 @@ M: x86.32 %unbox-large-struct ( n c-type -- ) M: x86.32 %prepare-alien-indirect ( -- ) "unbox_alien" f %alien-invoke - cell temp@ EAX MOV ; + EBP EAX MOV ; M: x86.32 %alien-indirect ( -- ) - cell temp@ CALL ; + EBP CALL ; M: x86.32 %alien-callback ( quot -- ) 4 [ @@ -239,7 +227,7 @@ M: x86.32 %alien-callback ( quot -- ) M: x86.32 %callback-value ( ctype -- ) ! Align C stack ESP 12 SUB - ! Save top of data stack + ! Save top of data stack in non-volatile register %prepare-unbox EAX PUSH ! Restore data/call/retain stacks diff --git a/basis/cpu/x86/64/64.factor b/basis/cpu/x86/64/64.factor index 01b8935e39..8c9762630b 100644 --- a/basis/cpu/x86/64/64.factor +++ b/basis/cpu/x86/64/64.factor @@ -12,7 +12,6 @@ IN: cpu.x86.64 M: x86.64 ds-reg R14 ; M: x86.64 rs-reg R15 ; M: x86.64 stack-reg RSP ; -M: x86.64 stack-save-reg RSI ; M: x86.64 temp-reg-1 RAX ; M: x86.64 temp-reg-2 RCX ; @@ -46,7 +45,9 @@ M: stack-params %load-param-reg r> stack@ R11 MOV ; M: stack-params %save-param-reg - >r stack-frame* + cell + swap r> %load-param-reg ; + drop + R11 swap next-stack@ MOV + stack@ R11 MOV ; : with-return-regs ( quot -- ) [ @@ -121,7 +122,7 @@ M: x86.64 %unbox-large-struct ( n c-type -- ) ! Source is in RDI heap-size ! Load destination address - RSI RSP roll [+] LEA + RSI rot stack@ LEA ! Load structure size RDX swap MOV ! Copy the struct to the C stack @@ -145,7 +146,7 @@ M: x86.64 %box-long-long ( n func -- ) M: x86.64 struct-small-enough? ( size -- ? ) heap-size 2 cells <= ; -: box-struct-field@ ( i -- operand ) RSP swap 1+ cells [+] ; +: box-struct-field@ ( i -- operand ) 1+ cells stack@ ; : %box-struct-field ( c-type i -- ) box-struct-field@ swap reg-class>> { @@ -164,21 +165,22 @@ M: x86.64 %box-small-struct ( c-type -- ) ] with-return-regs ; : struct-return@ ( size n -- n ) - [ ] [ \ stack-frame get swap - ] ?if ; + [ ] [ \ stack-frame get swap - ] ?if stack@ ; M: x86.64 %box-large-struct ( n c-type -- ) ! Struct size is parameter 2 heap-size RSI over MOV ! Compute destination address - swap struct-return@ RDI RSP rot [+] LEA + RDI spin struct-return@ LEA ! Copy the struct from the C stack "box_value_struct" f %alien-invoke ; M: x86.64 %prepare-box-struct ( size -- ) - ! Compute target address for value struct return - RAX RSP rot f struct-return@ [+] LEA - RSP 0 [+] RAX MOV ; + ! Compute target address for value struct return, store it + ! as the first parameter + RAX swap f struct-return@ LEA + 0 stack@ RAX MOV ; M: x86.64 %prepare-var-args RAX RAX XOR ; @@ -192,10 +194,10 @@ M: x86.64 %alien-invoke M: x86.64 %prepare-alien-indirect ( -- ) "unbox_alien" f %alien-invoke - cell temp@ RAX MOV ; + RBP RAX MOV ; M: x86.64 %alien-indirect ( -- ) - cell temp@ CALL ; + RBP CALL ; M: x86.64 %alien-callback ( quot -- ) RDI load-indirect "c_to_factor" f %alien-invoke ; @@ -203,12 +205,14 @@ M: x86.64 %alien-callback ( quot -- ) M: x86.64 %callback-value ( ctype -- ) ! Save top of data stack %prepare-unbox - ! Put former top of data stack in RDI - cell temp@ RDI MOV + ! Save top of data stack + RSP 8 SUB + RDI PUSH ! Restore data/call/retain stacks "unnest_stacks" f %alien-invoke ! Put former top of data stack in RDI - RDI cell temp@ MOV + RDI POP + RSP 8 ADD ! Unbox former top of data stack to return registers unbox-return ; diff --git a/basis/cpu/x86/architecture/architecture.factor b/basis/cpu/x86/architecture/architecture.factor index c97552a649..4770400434 100644 --- a/basis/cpu/x86/architecture/architecture.factor +++ b/basis/cpu/x86/architecture/architecture.factor @@ -10,10 +10,16 @@ IN: cpu.x86.architecture HOOK: ds-reg cpu ( -- reg ) HOOK: rs-reg cpu ( -- reg ) HOOK: stack-reg cpu ( -- reg ) -HOOK: stack-save-reg cpu ( -- reg ) : stack@ ( n -- op ) stack-reg swap [+] ; +: next-stack@ ( n -- operand ) + #! nth parameter from the next stack frame. Used to box + #! input values to callbacks; the callback has its own + #! stack frame set up, and we want to read the frame + #! set up by the caller. + stack-frame* + cell + stack@ ; + : reg-stack ( n reg -- op ) swap cells neg [+] ; M: ds-loc v>operand n>> ds-reg reg-stack ; @@ -32,8 +38,8 @@ M: float-regs %save-param-reg >r >r stack@ r> r> MOVSS/D ; M: float-regs %load-param-reg >r swap stack@ r> MOVSS/D ; GENERIC: push-return-reg ( reg-class -- ) -GENERIC: load-return-reg ( stack@ reg-class -- ) -GENERIC: store-return-reg ( stack@ reg-class -- ) +GENERIC: load-return-reg ( n reg-class -- ) +GENERIC: store-return-reg ( n reg-class -- ) ! Only used by inline allocation HOOK: temp-reg-1 cpu ( -- reg ) @@ -137,8 +143,6 @@ M: x86 small-enough? ( n -- ? ) : %tag-fixnum ( reg -- ) tag-bits get SHL ; -: temp@ ( n -- op ) stack-reg \ stack-frame get rot - [+] ; - M: x86 %return ( -- ) 0 %unwind ; ! Alien intrinsics From cf135e08b382e63c43f44905492ccc1598457556 Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Sun, 5 Oct 2008 22:00:35 -0500 Subject: [PATCH 089/948] Tweak deploy descriptor to speed up tools.deploy test --- basis/tools/deploy/test/6/deploy.factor | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/basis/tools/deploy/test/6/deploy.factor b/basis/tools/deploy/test/6/deploy.factor index 410bb770be..e7d3764d39 100644 --- a/basis/tools/deploy/test/6/deploy.factor +++ b/basis/tools/deploy/test/6/deploy.factor @@ -1,15 +1,15 @@ USING: tools.deploy.config ; H{ - { deploy-threads? f } - { deploy-ui? f } - { deploy-io 1 } - { deploy-c-types? f } - { deploy-name "tools.deploy.test.6" } - { deploy-compiler? t } { deploy-reflection 1 } { deploy-word-props? f } + { deploy-io 1 } + { deploy-name "tools.deploy.test.6" } + { deploy-math? t } + { deploy-random? f } + { deploy-compiler? t } + { deploy-ui? f } + { deploy-c-types? f } { deploy-word-defs? f } { "stop-after-last-window?" t } - { deploy-random? f } - { deploy-math? f } + { deploy-threads? f } } From 66ae62638d74f983d923ba08daef139b64be838c Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Sun, 5 Oct 2008 22:00:52 -0500 Subject: [PATCH 090/948] Fix Windows deployment --- basis/tools/deploy/shaker/shaker.factor | 2 +- basis/tools/deploy/windows/windows.factor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 basis/tools/deploy/shaker/shaker.factor mode change 100644 => 100755 basis/tools/deploy/windows/windows.factor diff --git a/basis/tools/deploy/shaker/shaker.factor b/basis/tools/deploy/shaker/shaker.factor old mode 100644 new mode 100755 index 7c02e87209..d9348bedd5 --- a/basis/tools/deploy/shaker/shaker.factor +++ b/basis/tools/deploy/shaker/shaker.factor @@ -321,7 +321,7 @@ IN: tools.deploy.shaker ] [ drop ] if ; : strip-c-io ( -- ) - deploy-io get 2 = [ + deploy-io get 2 = os windows? or [ [ c-io-backend forget "io.streams.c" forget-vocab diff --git a/basis/tools/deploy/windows/windows.factor b/basis/tools/deploy/windows/windows.factor old mode 100644 new mode 100755 index ce4fee19d7..ad1b3cbd84 --- a/basis/tools/deploy/windows/windows.factor +++ b/basis/tools/deploy/windows/windows.factor @@ -14,7 +14,7 @@ IN: tools.deploy.windows "resource:freetype6.dll" "resource:zlib1.dll" } swap copy-files-into - ] when ; + ] [ drop ] if ; : create-exe-dir ( vocab bundle-name -- vm ) deploy-ui? get [ From 0cfedcdc8d788064abc544eeea946b41cc8b4fde Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Sun, 5 Oct 2008 22:08:13 -0500 Subject: [PATCH 091/948] Fix deploy size regresson --- basis/random/random-docs.factor | 22 +++++++++++----------- basis/random/random.factor | 15 +++------------ 2 files changed, 14 insertions(+), 23 deletions(-) mode change 100644 => 100755 basis/random/random-docs.factor mode change 100644 => 100755 basis/random/random.factor diff --git a/basis/random/random-docs.factor b/basis/random/random-docs.factor old mode 100644 new mode 100755 index 51656a77dd..18c9ca781c --- a/basis/random/random-docs.factor +++ b/basis/random/random-docs.factor @@ -15,21 +15,18 @@ HELP: random-bytes* { $description "Generates a byte-array of random bytes." } ; HELP: random -{ $values { "obj" object } { "elt" "a random element" } } -{ $description "Outputs a random element of the input object. If the object is an integer, an input of zero always returns a zero, while any other integer integers yield a random integer in the interval between itself and zero, inclusive of zero. On a sequence, an empty sequence always outputs " { $link f } "." } +{ $values { "seq" sequence } { "elt" "a random element" } } +{ $description "Outputs a random element of the input sequence. Outputs " { $link f } " if the sequence is empty." } +{ $notes "Since integers are sequences, passing an integer " { $snippet "n" } " outputs an integer in the interval " { $snippet "[0,n)" } "." } { $examples { $unchecked-example "USING: random prettyprint ;" "10 random ." "3" } - { $example "USING: random prettyprint ;" - "0 random ." - "0" } { $unchecked-example "USING: random prettyprint ;" - "-10 random ." - "-8" } - { $unchecked-example "USING: random prettyprint ;" - "{ \"a\" \"b\" \"c\" } random ." - "\"a\"" } + "SYMBOL: heads" + "SYMBOL: tails" + "{ heads tails } random ." + "heads" } } ; HELP: random-bytes @@ -74,7 +71,10 @@ ARTICLE: "random-protocol" "Random protocol" { $subsection seed-random } ; ARTICLE: "random" "Generating random integers" -"The " { $vocab-link "random" } " vocabulary contains a protocol for generating random or pseudorandom numbers. The ``Mersenne Twister'' pseudorandom number generator algorithm is the default generator stored in " { $link random-generator } "." +"The " { $vocab-link "random" } " vocabulary contains a protocol for generating random or pseudorandom numbers." +$nl +"The ``Mersenne Twister'' pseudorandom number generator algorithm is the default generator stored in " { $link random-generator } "." +$nl "Generate a random object:" { $subsection random } "Combinators to change the random number generator:" diff --git a/basis/random/random.factor b/basis/random/random.factor old mode 100644 new mode 100755 index b5f8ac48b8..845f8e004f --- a/basis/random/random.factor +++ b/basis/random/random.factor @@ -33,10 +33,6 @@ M: f random-32* ( obj -- * ) no-random-number-generator ; random-generator get random-bytes* ] keep head ; -GENERIC: random ( obj -- elt ) - -: random-bits ( n -- r ) 2^ random ; - -M: sequence random ( seq -- elt ) +: random-bits ( n -- r ) 2^ random-integer ; + +: random ( seq -- elt ) [ f ] [ [ length random-integer ] keep nth ] if-empty ; -M: integer random ( integer -- integer' ) - dup sgn { - { 0 [ ] } - { -1 [ neg random-integer neg ] } - { 1 [ random-integer ] } - } case ; - : delete-random ( seq -- elt ) [ length random-integer ] keep [ nth ] 2keep delete-nth ; From a5fcb006fbd58d8d0dba442a70495cc33efcc1b4 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 5 Oct 2008 22:17:56 -0500 Subject: [PATCH 092/948] Clean up x86 stack frame code a bit more --- basis/cpu/x86/architecture/architecture.factor | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/basis/cpu/x86/architecture/architecture.factor b/basis/cpu/x86/architecture/architecture.factor index 4770400434..ea54ef85af 100644 --- a/basis/cpu/x86/architecture/architecture.factor +++ b/basis/cpu/x86/architecture/architecture.factor @@ -18,7 +18,7 @@ HOOK: stack-reg cpu ( -- reg ) #! input values to callbacks; the callback has its own #! stack frame set up, and we want to read the frame #! set up by the caller. - stack-frame* + cell + stack@ ; + stack-frame* + stack@ ; : reg-stack ( n reg -- op ) swap cells neg [+] ; @@ -52,20 +52,18 @@ HOOK: prepare-division cpu ( -- ) M: immediate load-literal v>operand swap v>operand MOV ; M: x86 stack-frame ( n -- i ) - 3 cells + 16 align cell - ; + 3 cells + 16 align ; M: x86 %save-word-xt ( -- ) temp-reg v>operand 0 MOV rc-absolute-cell rel-this ; -: factor-area-size ( -- n ) 4 cells ; - M: x86 %prologue ( n -- ) - dup cell + PUSH + dup PUSH temp-reg v>operand PUSH - stack-reg swap 2 cells - SUB ; + stack-reg swap 3 cells - SUB ; M: x86 %epilogue ( n -- ) - stack-reg swap ADD ; + stack-reg swap cell - ADD ; HOOK: %alien-global cpu ( symbol dll register -- ) From b0d57ead863995421f0a259294e3c53e5deed5ad Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sun, 5 Oct 2008 23:09:10 -0500 Subject: [PATCH 093/948] Fix unit test --- basis/random/random-tests.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/random/random-tests.factor b/basis/random/random-tests.factor index c6d88c5525..e686dd7301 100644 --- a/basis/random/random-tests.factor +++ b/basis/random/random-tests.factor @@ -16,4 +16,4 @@ IN: random.tests [ t ] [ 1000 [ 400 random ] replicate prune length 256 > ] unit-test -[ 0 ] [ 0 random ] unit-test +[ f ] [ 0 random ] unit-test From 33d775890cfe24d95fc295cfe6da4399b36c25fd Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 6 Oct 2008 00:20:00 -0500 Subject: [PATCH 094/948] More stack frame refactoring --- basis/compiler/generator/fixup/fixup.factor | 6 ++-- basis/compiler/generator/generator.factor | 31 +++++++++---------- basis/cpu/architecture/architecture.factor | 13 ++++---- .../cpu/ppc/architecture/architecture.factor | 20 ++++++------ basis/cpu/x86/32/32.factor | 16 +++++----- basis/cpu/x86/64/64.factor | 17 +++++----- .../cpu/x86/architecture/architecture.factor | 20 ++++++++---- 7 files changed, 63 insertions(+), 60 deletions(-) diff --git a/basis/compiler/generator/fixup/fixup.factor b/basis/compiler/generator/fixup/fixup.factor index ecc88a7a5e..e8bdc561b7 100644 --- a/basis/compiler/generator/fixup/fixup.factor +++ b/basis/compiler/generator/fixup/fixup.factor @@ -13,7 +13,7 @@ TUPLE: frame-required n ; : frame-required ( n -- ) \ frame-required boa , ; -: stack-frame-size ( code -- n ) +: compute-stack-frame-size ( code -- n ) no-stack-frame [ dup frame-required? [ n>> max ] [ drop ] if ] reduce ; @@ -37,7 +37,7 @@ M: label fixup* : if-stack-frame ( frame-size quot -- ) swap dup no-stack-frame = - [ 2drop ] [ stack-frame swap call ] if ; inline + [ 2drop ] [ stack-frame-size swap call ] if ; inline M: word fixup* { @@ -146,7 +146,7 @@ SYMBOL: literal-table : fixup ( code -- literals relocation labels code ) [ init-fixup - dup stack-frame-size swap [ fixup* ] each drop + dup compute-stack-frame-size swap [ fixup* ] each drop literal-table get >array relocation-table get >byte-array diff --git a/basis/compiler/generator/generator.factor b/basis/compiler/generator/generator.factor index 2b398eaeea..22de9d3587 100644 --- a/basis/compiler/generator/generator.factor +++ b/basis/compiler/generator/generator.factor @@ -299,18 +299,17 @@ M: #return-recursive generate-node dup large-struct? [ heap-size ] [ drop 2 cells ] if ; : alien-stack-frame ( params -- n ) - alien-parameters parameter-sizes drop ; + stack-frame new + swap + [ return>> return-size >>return ] + [ alien-parameters parameter-sizes drop >>params ] bi + dup [ params>> ] [ return>> ] bi + >>size + dup size>> stack-frame-size >>total-size ; -: alien-invoke-frame ( params -- n ) - [ return>> return-size ] [ alien-stack-frame ] bi + ; - -: set-stack-frame ( n -- ) - dup [ frame-required ] when* \ stack-frame set ; - -: with-stack-frame ( n quot -- ) - swap set-stack-frame +: with-stack-frame ( params quot -- ) + swap alien-stack-frame [ size>> frame-required ] [ stack-frame set ] bi call - f set-stack-frame ; inline + stack-frame off ; inline GENERIC: reg-size ( register-class -- n ) @@ -413,8 +412,8 @@ M: long-long-type flatten-value-type ( type -- types ) #! parameters. If the C function is returning a structure, #! the first parameter is an implicit target area pointer, #! so we need to use a different offset. - return>> dup large-struct? - [ heap-size %prepare-box-struct cell ] [ drop 0 ] if ; + return>> large-struct? + [ %prepare-box-struct cell ] [ 0 ] if ; : objects>registers ( params -- ) #! Generate code for unboxing a list of C types, then @@ -473,7 +472,7 @@ M: no-such-symbol compiler-error-type M: #alien-invoke generate-node params>> - dup alien-invoke-frame [ + dup [ end-basic-block %prepare-alien-invoke dup objects>registers @@ -487,7 +486,7 @@ M: #alien-invoke generate-node ! #alien-indirect M: #alien-indirect generate-node params>> - dup alien-invoke-frame [ + dup [ ! Flush registers end-basic-block ! Save registers for GC @@ -553,7 +552,7 @@ TUPLE: callback-context ; : callback-unwind ( params -- n ) { - { [ dup abi>> "stdcall" = ] [ alien-stack-frame ] } + { [ dup abi>> "stdcall" = ] [ drop stack-frame get params>> ] } { [ dup return>> large-struct? ] [ drop 4 ] } [ drop 0 ] } cond ; @@ -569,7 +568,7 @@ TUPLE: callback-context ; dup xt>> dup [ init-templates %prologue-later - dup alien-stack-frame [ + dup [ [ registers>objects ] [ wrap-callback-quot %alien-callback ] [ %callback-return ] diff --git a/basis/cpu/architecture/architecture.factor b/basis/cpu/architecture/architecture.factor index 63c52d1025..f22d4a2a90 100644 --- a/basis/cpu/architecture/architecture.factor +++ b/basis/cpu/architecture/architecture.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2006, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays generic kernel kernel.private math memory -namespaces make sequences layouts system hashtables classes -alien byte-arrays combinators words sets ; +USING: accessors arrays generic kernel kernel.private math +memory namespaces make sequences layouts system hashtables +classes alien byte-arrays combinators words sets ; IN: cpu.architecture ! Register classes @@ -33,10 +33,9 @@ GENERIC# load-literal 1 ( obj vreg -- ) HOOK: load-indirect cpu ( obj reg -- ) -HOOK: stack-frame cpu ( frame-size -- n ) +HOOK: stack-frame-size cpu ( frame-size -- n ) -: stack-frame* ( -- n ) - \ stack-frame get stack-frame ; +TUPLE: stack-frame total-size size params return ; ! Set up caller stack frame HOOK: %prologue cpu ( n -- ) @@ -117,7 +116,7 @@ HOOK: %box cpu ( n reg-class func -- ) HOOK: %box-long-long cpu ( n func -- ) -HOOK: %prepare-box-struct cpu ( size -- ) +HOOK: %prepare-box-struct cpu ( -- ) HOOK: %box-small-struct cpu ( c-type -- ) diff --git a/basis/cpu/ppc/architecture/architecture.factor b/basis/cpu/ppc/architecture/architecture.factor index aab104fa6e..357349193e 100644 --- a/basis/cpu/ppc/architecture/architecture.factor +++ b/basis/cpu/ppc/architecture/architecture.factor @@ -43,8 +43,8 @@ IN: cpu.ppc.architecture : xt-save ( n -- i ) 2 cells - ; -M: ppc stack-frame ( n -- i ) - local@ factor-area-size + cell + 4 cells align ; +M: ppc stack-frame-size ( n -- i ) + local@ factor-area-size + 4 cells align ; M: temp-reg v>operand drop 11 ; @@ -166,7 +166,7 @@ M: float-regs %load-param-reg >r 1 rot local@ r> LF ; M: stack-params %load-param-reg ( stack reg reg-class -- ) drop >r 0 1 rot local@ LWZ 0 1 r> param@ STW ; -: next-param@ ( n -- x ) param@ stack-frame* + ; +: next-param@ ( n -- x ) param@ stack-frame get total-size>> + ; M: stack-params %save-param-reg ( stack reg reg-class -- ) #! Funky. Read the parameter from the caller's stack frame. @@ -218,20 +218,18 @@ M: ppc %box-long-long ( n func -- ) 4 1 rot cell + local@ LWZ ] when* r> f %alien-invoke ; -: struct-return@ ( size n -- n ) - [ local@ ] [ stack-frame* factor-area-size - swap - ] ?if ; +: struct-return@ ( n -- n ) + [ stack-frame get params>> ] unless* local@ ; -M: ppc %prepare-box-struct ( size -- ) +M: ppc %prepare-box-struct ( -- ) #! Compute target address for value struct return - 3 1 rot f struct-return@ ADDI + 3 1 f struct-return@ ADDI 3 1 0 local@ STW ; M: ppc %box-large-struct ( n c-type -- ) - #! If n = f, then we're boxing a returned struct - heap-size - [ swap struct-return@ ] keep + ! If n = f, then we're boxing a returned struct ! Compute destination address and load struct size - [ 3 1 rot ADDI ] [ 4 LI ] bi* + [ 3 1 rot struct-return@ ADDI ] [ heap-size 4 LI ] bi* ! Call the function "box_value_struct" f %alien-invoke ; diff --git a/basis/cpu/x86/32/32.factor b/basis/cpu/x86/32/32.factor index 1173b9e68e..dc891a8178 100644 --- a/basis/cpu/x86/32/32.factor +++ b/basis/cpu/x86/32/32.factor @@ -30,8 +30,8 @@ M: x86.32 struct-small-enough? ( size -- ? ) heap-size { 1 2 4 8 } member? os { linux netbsd solaris } member? not and ; -: struct-return@ ( size n -- operand ) - [ next-stack@ ] [ \ stack-frame get swap - stack@ ] ?if ; +: struct-return@ ( n -- operand ) + [ next-stack@ ] [ stack-frame get params>> stack@ ] if* ; ! On x86, parameters are never passed in registers. M: int-regs return-reg drop EAX ; @@ -63,10 +63,10 @@ M: float-regs store-return-reg [ stack@ ] [ reg-size ] bi* FSTP ; : align-sub ( n -- ) - dup 16 align swap - ESP swap SUB ; + [ align-stack ] keep - decr-stack-reg ; : align-add ( n -- ) - 16 align ESP swap ADD ; + align-stack incr-stack-reg ; : with-aligned-stack ( n quot -- ) [ [ align-sub ] [ call ] bi* ] @@ -113,7 +113,7 @@ M: x86.32 %box-long-long ( n func -- ) M:: x86.32 %box-large-struct ( n c-type -- ) ! Compute destination address - ECX c-type heap-size n struct-return@ LEA + ECX n struct-return@ LEA 8 [ ! Push struct size c-type heap-size PUSH @@ -123,9 +123,9 @@ M:: x86.32 %box-large-struct ( n c-type -- ) "box_value_struct" f %alien-invoke ] with-aligned-stack ; -M: x86.32 %prepare-box-struct ( size -- ) +M: x86.32 %prepare-box-struct ( -- ) ! Compute target address for value struct return - EAX swap f struct-return@ LEA + EAX f struct-return@ LEA ! Store it as the first parameter 0 stack@ EAX MOV ; @@ -248,7 +248,7 @@ M: x86.32 %cleanup ( alien-node -- ) { { [ dup abi>> "stdcall" = ] - [ alien-stack-frame ESP swap SUB ] + [ drop ESP stack-frame get params>> SUB ] } { [ dup return>> large-struct? ] [ drop EAX PUSH ] diff --git a/basis/cpu/x86/64/64.factor b/basis/cpu/x86/64/64.factor index 8c9762630b..5bcd733eaa 100644 --- a/basis/cpu/x86/64/64.factor +++ b/basis/cpu/x86/64/64.factor @@ -164,22 +164,21 @@ M: x86.64 %box-small-struct ( c-type -- ) "box_small_struct" f %alien-invoke ] with-return-regs ; -: struct-return@ ( size n -- n ) - [ ] [ \ stack-frame get swap - ] ?if stack@ ; +: struct-return@ ( n -- operand ) + [ stack-frame get params>> ] unless* stack@ ; M: x86.64 %box-large-struct ( n c-type -- ) ! Struct size is parameter 2 - heap-size - RSI over MOV + RSI swap heap-size MOV ! Compute destination address - RDI spin struct-return@ LEA + RDI swap struct-return@ LEA ! Copy the struct from the C stack "box_value_struct" f %alien-invoke ; -M: x86.64 %prepare-box-struct ( size -- ) - ! Compute target address for value struct return, store it - ! as the first parameter - RAX swap f struct-return@ LEA +M: x86.64 %prepare-box-struct ( -- ) + ! Compute target address for value struct return + RAX f struct-return@ LEA + ! Store it as the first parameter 0 stack@ RAX MOV ; M: x86.64 %prepare-var-args RAX RAX XOR ; diff --git a/basis/cpu/x86/architecture/architecture.factor b/basis/cpu/x86/architecture/architecture.factor index ea54ef85af..d10397de3b 100644 --- a/basis/cpu/x86/architecture/architecture.factor +++ b/basis/cpu/x86/architecture/architecture.factor @@ -18,7 +18,7 @@ HOOK: stack-reg cpu ( -- reg ) #! input values to callbacks; the callback has its own #! stack frame set up, and we want to read the frame #! set up by the caller. - stack-frame* + stack@ ; + stack-frame get total-size>> + stack@ ; : reg-stack ( n reg -- op ) swap cells neg [+] ; @@ -51,19 +51,27 @@ HOOK: prepare-division cpu ( -- ) M: immediate load-literal v>operand swap v>operand MOV ; -M: x86 stack-frame ( n -- i ) - 3 cells + 16 align ; +: align-stack ( n -- n' ) + os macosx? [ 16 align ] when ; + +M: x86 stack-frame-size ( n -- i ) + 3 cells + align-stack ; M: x86 %save-word-xt ( -- ) temp-reg v>operand 0 MOV rc-absolute-cell rel-this ; +: decr-stack-reg ( n -- ) + dup 0 = [ drop ] [ stack-reg swap SUB ] if ; + M: x86 %prologue ( n -- ) dup PUSH temp-reg v>operand PUSH - stack-reg swap 3 cells - SUB ; + 3 cells - decr-stack-reg ; -M: x86 %epilogue ( n -- ) - stack-reg swap cell - ADD ; +: incr-stack-reg ( n -- ) + dup 0 = [ ] [ stack-reg swap ADD ] if ; + +M: x86 %epilogue ( n -- ) cell - incr-stack-reg ; HOOK: %alien-global cpu ( symbol dll register -- ) From 4ca06ae50ff25eb93a5214914645eb1381393969 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 6 Oct 2008 00:20:24 -0500 Subject: [PATCH 095/948] Typo --- basis/cpu/x86/architecture/architecture.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/cpu/x86/architecture/architecture.factor b/basis/cpu/x86/architecture/architecture.factor index d10397de3b..417f90c9f9 100644 --- a/basis/cpu/x86/architecture/architecture.factor +++ b/basis/cpu/x86/architecture/architecture.factor @@ -69,7 +69,7 @@ M: x86 %prologue ( n -- ) 3 cells - decr-stack-reg ; : incr-stack-reg ( n -- ) - dup 0 = [ ] [ stack-reg swap ADD ] if ; + dup 0 = [ drop ] [ stack-reg swap ADD ] if ; M: x86 %epilogue ( n -- ) cell - incr-stack-reg ; From 3c2caf948ae4c58a56d211597c7ab4fa9d284bd2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 6 Oct 2008 00:33:47 -0500 Subject: [PATCH 096/948] 16-align stack on x86-64 --- basis/cpu/x86/architecture/architecture.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/cpu/x86/architecture/architecture.factor b/basis/cpu/x86/architecture/architecture.factor index 417f90c9f9..01256fb4c5 100644 --- a/basis/cpu/x86/architecture/architecture.factor +++ b/basis/cpu/x86/architecture/architecture.factor @@ -52,7 +52,7 @@ HOOK: prepare-division cpu ( -- ) M: immediate load-literal v>operand swap v>operand MOV ; : align-stack ( n -- n' ) - os macosx? [ 16 align ] when ; + os macosx? cpu x86.64? or [ 16 align ] when ; M: x86 stack-frame-size ( n -- i ) 3 cells + align-stack ; From d142b3283772fa54998f4f4c6c709a51d45f6503 Mon Sep 17 00:00:00 2001 From: erg Date: Mon, 6 Oct 2008 14:54:27 -0500 Subject: [PATCH 097/948] cleaner irc.messages --- extra/irc/messages/messages.factor | 168 +++++++++++++++++------------ 1 file changed, 98 insertions(+), 70 deletions(-) diff --git a/extra/irc/messages/messages.factor b/extra/irc/messages/messages.factor index 882cec5c8d..14c8633f6f 100755 --- a/extra/irc/messages/messages.factor +++ b/extra/irc/messages/messages.factor @@ -4,7 +4,6 @@ USING: kernel fry splitting ascii calendar accessors combinators qualified arrays classes.tuple math.order ; RENAME: join sequences => sjoin EXCLUDE: sequences => join ; -EXCLUDE: inverse => _ ; IN: irc.messages TUPLE: irc-message line prefix command parameters trailing timestamp ; @@ -17,75 +16,99 @@ TUPLE: nick < irc-message ; TUPLE: privmsg < irc-message name ; TUPLE: kick < irc-message channel who ; TUPLE: roomlist < irc-message channel names ; -TUPLE: nick-in-use < irc-message name ; +TUPLE: nick-in-use < irc-message asterisk name ; TUPLE: notice < irc-message type ; TUPLE: mode < irc-message name mode parameter ; TUPLE: names-reply < irc-message who channel ; TUPLE: unhandled < irc-message ; : ( command parameters trailing -- irc-message ) - irc-message new now >>timestamp - [ [ (>>trailing) ] [ (>>parameters) ] [ (>>command) ] tri ] keep ; + irc-message new + now >>timestamp + swap >>trailing + swap >>parameters + swap >>command ; > ( irc-message -- string ) -M: irc-message command-string>> command>> ; -M: ping command-string>> drop "PING" ; -M: join command-string>> drop "JOIN" ; -M: part command-string>> drop "PART" ; -M: quit command-string>> drop "QUIT" ; -M: nick command-string>> drop "NICK" ; -M: privmsg command-string>> drop "PRIVMSG" ; -M: notice command-string>> drop "NOTICE" ; -M: mode command-string>> drop "MODE" ; -M: kick command-string>> drop "KICK" ; +M: irc-message command-string>> ( irc-message -- string ) command>> ; +M: ping command-string>> ( ping -- string ) drop "PING" ; +M: join command-string>> ( join -- string ) drop "JOIN" ; +M: part command-string>> ( part -- string ) drop "PART" ; +M: quit command-string>> ( quit -- string ) drop "QUIT" ; +M: nick command-string>> ( nick -- string ) drop "NICK" ; +M: privmsg command-string>> ( privmsg -- string ) drop "PRIVMSG" ; +M: notice command-string>> ( notice -- string ) drop "NOTICE" ; +M: mode command-string>> ( mode -- string ) drop "MODE" ; +M: kick command-string>> ( kick -- string ) drop "KICK" ; GENERIC: command-parameters>> ( irc-message -- seq ) -M: irc-message command-parameters>> parameters>> ; -M: ping command-parameters>> drop { } ; -M: join command-parameters>> drop { } ; -M: part command-parameters>> channel>> 1array ; -M: quit command-parameters>> drop { } ; -M: nick command-parameters>> drop { } ; -M: privmsg command-parameters>> name>> 1array ; -M: notice command-parameters>> type>> 1array ; -M: kick command-parameters>> [ channel>> ] [ who>> ] bi 2array ; -M: mode command-parameters>> [ name>> ] [ channel>> ] [ mode>> ] tri 3array ; +M: irc-message command-parameters>> ( irc-message -- seq ) parameters>> ; +M: ping command-parameters>> ( ping -- seq ) drop { } ; +M: join command-parameters>> ( join -- seq ) drop { } ; +M: part command-parameters>> ( part -- seq ) channel>> 1array ; +M: quit command-parameters>> ( quit -- seq ) drop { } ; +M: nick command-parameters>> ( nick -- seq ) drop { } ; +M: privmsg command-parameters>> ( privmsg -- seq ) name>> 1array ; +M: notice command-parameters>> ( norice -- seq ) type>> 1array ; +M: kick command-parameters>> ( kick -- seq ) + [ channel>> ] [ who>> ] bi 2array ; +M: mode command-parameters>> ( mode -- seq ) + [ name>> ] [ channel>> ] [ mode>> ] tri 3array ; -GENERIC: (>>command-parameters) ( params irc-message -- ) +GENERIC# >>command-parameters 1 ( irc-message params -- irc-message ) -M: irc-message (>>command-parameters) 2drop ; -M: logged-in (>>command-parameters) [ first ] dip (>>name) ; -M: privmsg (>>command-parameters) [ first ] dip (>>name) ; -M: notice (>>command-parameters) [ first ] dip (>>type) ; -M: part (>>command-parameters) [ first ] dip (>>channel) ; -M: nick-in-use (>>command-parameters) [ second ] dip (>>name) ; -M: kick (>>command-parameters) - [ first2 ] dip [ (>>who) ] [ (>>channel) ] bi ; -M: names-reply (>>command-parameters) - [ [ first ] dip (>>who) ] [ [ third ] dip (>>channel) ] 2bi ; -M: mode (>>command-parameters) - { { [ >r 2array r> ] [ [ (>>mode) ] [ (>>name) ] bi ] } - { [ >r 3array r> ] [ [ (>>parameter) ] [ (>>mode) ] [ (>>name) ] tri ] } - } switch ; +M: irc-message >>command-parameters ( irc-message params -- irc-message ) + drop ; + +M: logged-in >>command-parameters ( part params -- part ) + first >>name ; + +M: privmsg >>command-parameters ( privmsg params -- privmsg ) + first >>name ; + +M: notice >>command-parameters ( notice params -- notice ) + first >>type ; + +M: part >>command-parameters ( part params -- part ) + first >>channel ; + +M: kick >>command-parameters ( kick params -- kick ) + first2 [ >>channel ] [ >>who ] bi* ; + +M: nick-in-use >>command-parameters ( nick-in-use params -- nick-in-use ) + second >>name ; + +M: names-reply >>command-parameters ( names-reply params -- names-reply ) + first3 nip [ >>who ] [ >>channel ] bi* ; + +M: mode >>command-parameters ( mode params -- mode ) + dup length 3 = [ + first3 [ >>name ] [ >>mode ] [ >>parameter ] tri* + ] [ + first2 [ >>name ] [ >>mode ] bi* + ] if ; PRIVATE> GENERIC: irc-message>client-line ( irc-message -- string ) -M: irc-message irc-message>client-line +M: irc-message irc-message>client-line ( irc-message -- string ) [ command-string>> ] [ command-parameters>> " " sjoin ] [ trailing>> [ CHAR: : prefix ] [ "" ] if* ] tri 3array " " sjoin ; GENERIC: irc-message>server-line ( irc-message -- string ) -M: irc-message irc-message>server-line drop "not implemented yet" ; + +M: irc-message irc-message>server-line ( irc-message -- string ) + drop "not implemented yet" ; server-line drop "not implemented yet" ; : split-at-first ( seq separators -- before after ) dupd '[ _ member? ] find [ cut 1 tail ] [ swap ] if ; -: remove-heading-: ( seq -- seq ) dup ":" head? [ 1 tail ] when ; +: remove-heading-: ( seq -- seq ) + ":" ?head drop ; : parse-name ( string -- string ) remove-heading-: "!" split-at-first drop ; : split-prefix ( string -- string/f string ) dup ":" head? - [ remove-heading-: " " split1 ] - [ f swap ] - if ; + [ remove-heading-: " " split1 ] [ f swap ] if ; : split-trailing ( string -- string string/f ) ":" split1 ; -: copy-message-in ( origin dest -- ) - { [ [ parameters>> ] dip [ (>>command-parameters) ] [ (>>parameters) ] 2bi ] - [ [ line>> ] dip (>>line) ] - [ [ prefix>> ] dip (>>prefix) ] - [ [ command>> ] dip (>>command) ] - [ [ trailing>> ] dip (>>trailing) ] - [ [ timestamp>> ] dip (>>timestamp) ] - } 2cleave ; +: copy-message-in ( command irc-message -- command ) + { + [ parameters>> [ >>parameters ] [ >>command-parameters ] bi ] + [ line>> >>line ] + [ prefix>> >>prefix ] + [ command>> >>command ] + [ trailing>> >>trailing ] + [ timestamp>> >>timestamp ] + } cleave ; PRIVATE> UNION: sender-in-prefix privmsg join part quit kick mode nick ; GENERIC: irc-message-sender ( irc-message -- sender ) -M: sender-in-prefix irc-message-sender prefix>> parse-name ; +M: sender-in-prefix irc-message-sender ( sender-in-prefix -- sender ) + prefix>> parse-name ; : string>irc-message ( string -- object ) dup split-prefix split-trailing [ [ blank? ] trim " " split unclip swap ] dip now irc-message boa ; +: irc-message>command ( irc-message -- command ) + [ + command>> { + { "PING" [ ping ] } + { "NOTICE" [ notice ] } + { "001" [ logged-in ] } + { "433" [ nick-in-use ] } + { "353" [ names-reply ] } + { "JOIN" [ join ] } + { "PART" [ part ] } + { "NICK" [ nick ] } + { "PRIVMSG" [ privmsg ] } + { "QUIT" [ quit ] } + { "MODE" [ mode ] } + { "KICK" [ kick ] } + [ drop unhandled ] + } case new + ] keep copy-message-in ; + : parse-irc-line ( string -- message ) - string>irc-message - dup command>> { - { "PING" [ ping ] } - { "NOTICE" [ notice ] } - { "001" [ logged-in ] } - { "433" [ nick-in-use ] } - { "353" [ names-reply ] } - { "JOIN" [ join ] } - { "PART" [ part ] } - { "NICK" [ nick ] } - { "PRIVMSG" [ privmsg ] } - { "QUIT" [ quit ] } - { "MODE" [ mode ] } - { "KICK" [ kick ] } - [ drop unhandled ] - } case new [ copy-message-in ] keep ; + string>irc-message irc-message>command ; From e42a2d8825a7a280a11610ca9910de643576654d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 6 Oct 2008 15:01:01 -0500 Subject: [PATCH 098/948] clean up constructor --- extra/irc/client/client.factor | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor index d40c7d400d..463e35f415 100755 --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -19,9 +19,16 @@ C: irc-profile TUPLE: irc-client profile stream in-messages out-messages chats is-running nick connect reconnect-time is-ready ; + : ( profile -- irc-client ) - [ f H{ } clone f ] keep nickname>> - [ latin1 ] 15 seconds f irc-client boa ; + irc-client new + swap >>profile + >>in-messages + >>out-messages + H{ } clone >>chats + dup profile>> nickname>> >>nick + [ latin1 ] >>connect + 15 seconds >>reconnect-time ; TUPLE: irc-chat in-messages client ; TUPLE: irc-server-chat < irc-chat ; From 03043a7cfdba7ee943c5adadd210e3cbb83ca1e7 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 6 Oct 2008 15:25:17 -0500 Subject: [PATCH 099/948] remove slot --- extra/irc/messages/messages.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/irc/messages/messages.factor b/extra/irc/messages/messages.factor index 14c8633f6f..32533c102a 100755 --- a/extra/irc/messages/messages.factor +++ b/extra/irc/messages/messages.factor @@ -16,7 +16,7 @@ TUPLE: nick < irc-message ; TUPLE: privmsg < irc-message name ; TUPLE: kick < irc-message channel who ; TUPLE: roomlist < irc-message channel names ; -TUPLE: nick-in-use < irc-message asterisk name ; +TUPLE: nick-in-use < irc-message name ; TUPLE: notice < irc-message type ; TUPLE: mode < irc-message name mode parameter ; TUPLE: names-reply < irc-message who channel ; From a0a17646c5e4f4b16be73556570336d6dfc346fd Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 6 Oct 2008 15:56:54 -0500 Subject: [PATCH 100/948] dettach -> detach (spelling), fix docs --- extra/irc/client/client-docs.factor | 10 +++++----- extra/irc/client/client.factor | 2 +- extra/irc/ui/ui.factor | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/extra/irc/client/client-docs.factor b/extra/irc/client/client-docs.factor index 1b9204c4f1..6d4fae9b83 100644 --- a/extra/irc/client/client-docs.factor +++ b/extra/irc/client/client-docs.factor @@ -19,8 +19,8 @@ HELP: attach-chat "Chatting with irc channels/users/etc" { $values { "irc-chat" "an irc chat object" } { "irc-client" "an irc client object" } } { $description "Registers " { $snippet "irc-chat" } " with " { $snippet "irc-client" } " and starts listening." } ; -HELP: dettach-chat "Stop an unregister chat" -{ $values { "irc-chat" "an irc chat object" } { "irc-client" "an irc client object" } } +HELP: detach-chat "Stop an unregister chat" +{ $values { "irc-chat" "an irc chat object" } } { $description "Unregisters " { $snippet "irc-chat" } " from " { $snippet "irc-client" } " and stops listening. This is how you part from a channel." } ; HELP: terminate-irc "Terminates an irc client" @@ -49,7 +49,7 @@ ARTICLE: "irc.client" "IRC Client" { $subsection connect-irc } { $subsection terminate-irc } { $subsection attach-chat } -{ $subsection dettach-chat } +{ $subsection detach-chat } { $subsection hear } { $subsection speak } { $heading "IRC messages" } @@ -72,7 +72,7 @@ ARTICLE: "irc.client" "IRC Client" { $heading "Special messages" } "Some special messages that are created by the library and not by the irc server." { $table - { { $link irc-chat-end } "sent to a chat when it has been dettached from the client, the chat should stop after it receives this message. " } + { { $link irc-chat-end } "sent to a chat when it has been detached from the client, the chat should stop after it receives this message. " } { { $link irc-end } " sent when the client isn't running anymore, chats should stop after it receives this message." } { { $link irc-disconnected } " sent to notify chats that connection was lost." } { { $link irc-connected } " sent to notify chats that a connection with the irc server was established." } } @@ -97,4 +97,4 @@ ARTICLE: "irc.client" "IRC Client" } ; -ABOUT: "irc.client" \ No newline at end of file +ABOUT: "irc.client" diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor index 463e35f415..ce7a6e5373 100755 --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -362,7 +362,7 @@ PRIVATE> : attach-chat ( irc-chat irc-client -- ) [ (attach-chat) ] with-irc-client ; -: dettach-chat ( irc-chat -- ) +: detach-chat ( irc-chat -- ) [ client>> ] keep '[ _ (remove-chat) ] with-irc-client ; : speak ( message irc-chat -- ) diff --git a/extra/irc/ui/ui.factor b/extra/irc/ui/ui.factor index 50dc9378a2..e854d285b7 100755 --- a/extra/irc/ui/ui.factor +++ b/extra/irc/ui/ui.factor @@ -186,7 +186,7 @@ M: irc-tab graft* [ chat>> ] [ window>> client>> ] bi attach-chat ; M: irc-tab ungraft* - chat>> dettach-chat ; + chat>> detach-chat ; TUPLE: irc-channel-tab < irc-tab userlist ; From e0d6aadc8e7c8af2819907f4156f9dd7db7528fc Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 6 Oct 2008 17:17:14 -0500 Subject: [PATCH 101/948] complete file-info across *bsd, linux --- basis/io/unix/files/files.factor | 71 +++++++++++++++------- basis/io/unix/files/freebsd/freebsd.factor | 17 ++++++ basis/io/unix/files/freebsd/tags.txt | 1 + basis/io/unix/files/macosx/macosx.factor | 16 +++++ basis/io/unix/files/macosx/tags.txt | 1 + basis/io/unix/files/netbsd/netbsd.factor | 17 ++++++ basis/io/unix/files/netbsd/tags.txt | 1 + basis/io/unix/files/openbsd/openbsd.factor | 17 ++++++ basis/io/unix/files/openbsd/tags.txt | 1 + basis/io/unix/files/unique/unique.factor | 2 + 10 files changed, 123 insertions(+), 21 deletions(-) create mode 100644 basis/io/unix/files/freebsd/freebsd.factor create mode 100644 basis/io/unix/files/freebsd/tags.txt create mode 100644 basis/io/unix/files/macosx/macosx.factor create mode 100644 basis/io/unix/files/macosx/tags.txt create mode 100644 basis/io/unix/files/netbsd/netbsd.factor create mode 100644 basis/io/unix/files/netbsd/tags.txt create mode 100644 basis/io/unix/files/openbsd/openbsd.factor create mode 100644 basis/io/unix/files/openbsd/tags.txt diff --git a/basis/io/unix/files/files.factor b/basis/io/unix/files/files.factor index c6eda50855..4319b6c8de 100644 --- a/basis/io/unix/files/files.factor +++ b/basis/io/unix/files/files.factor @@ -4,7 +4,7 @@ USING: io.backend io.ports io.unix.backend io.files io unix unix.stat unix.time kernel math continuations math.bitwise byte-arrays alien combinators calendar io.encodings.binary accessors sequences strings system -io.files.private destructors ; +io.files.private destructors vocabs.loader ; IN: io.unix.files @@ -74,26 +74,14 @@ M: unix copy-file ( from to -- ) [ swap file-info permissions>> chmod io-error ] 2bi ; -: stat>type ( stat -- type ) - stat-st_mode S_IFMT bitand { - { S_IFREG [ +regular-file+ ] } - { S_IFDIR [ +directory+ ] } - { S_IFCHR [ +character-device+ ] } - { S_IFBLK [ +block-device+ ] } - { S_IFIFO [ +fifo+ ] } - { S_IFLNK [ +symbolic-link+ ] } - { S_IFSOCK [ +socket+ ] } - [ drop +unknown+ ] - } case ; +HOOK: stat>file-info os ( stat -- file-info ) -: stat>file-info ( stat -- info ) - { - [ stat>type ] - [ stat-st_size ] - [ stat-st_mode ] - [ stat-st_mtim timespec-sec seconds unix-1970 time+ ] - } cleave - \ file-info boa ; +HOOK: stat>type os ( stat -- file-info ) + +HOOK: new-file-info os ( -- class ) + +TUPLE: unix-file-info < file-info uid gid dev ino +nlink rdev blocks blocksize ; M: unix file-info ( path -- info ) normalize-path file-status stat>file-info ; @@ -105,4 +93,45 @@ M: unix make-link ( path1 path2 -- ) normalize-path symlink io-error ; M: unix read-link ( path -- path' ) - normalize-path read-symbolic-link ; \ No newline at end of file + normalize-path read-symbolic-link ; + +M: unix new-file-info ( -- class ) unix-file-info new ; + +M: unix stat>file-info ( stat -- file-info ) + [ new-file-info ] dip + { + [ stat>type >>type ] + [ stat-st_size >>size ] + [ stat-st_mode >>permissions ] + [ stat-st_ctim timespec>unix-time >>created ] + [ stat-st_mtim timespec>unix-time >>modified ] + [ stat-st_atim timespec>unix-time >>accessed ] + [ stat-st_uid >>uid ] + [ stat-st_gid >>gid ] + [ stat-st_dev >>dev ] + [ stat-st_ino >>ino ] + [ stat-st_nlink >>nlink ] + [ stat-st_rdev >>rdev ] + [ stat-st_blocks >>blocks ] + [ stat-st_blksize >>blocksize ] + } cleave ; + +M: unix stat>type ( stat -- type ) + stat-st_mode S_IFMT bitand { + { S_IFREG [ +regular-file+ ] } + { S_IFDIR [ +directory+ ] } + { S_IFCHR [ +character-device+ ] } + { S_IFBLK [ +block-device+ ] } + { S_IFIFO [ +fifo+ ] } + { S_IFLNK [ +symbolic-link+ ] } + { S_IFSOCK [ +socket+ ] } + [ drop +unknown+ ] + } case ; + +! Linux has no extra fields in its stat struct +os { + { macosx [ "io.unix.files.macosx" require ] } + { freebsd [ "io.unix.files.freebsd" require ] } + { netbsd [ "io.unix.files.netbsd" require ] } + { openbsd [ "io.unix.files.openbsd" require ] } +} case diff --git a/basis/io/unix/files/freebsd/freebsd.factor b/basis/io/unix/files/freebsd/freebsd.factor new file mode 100644 index 0000000000..14d15bc93d --- /dev/null +++ b/basis/io/unix/files/freebsd/freebsd.factor @@ -0,0 +1,17 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel alien.syntax math io.unix.files system +unix.stat accessors combinators calendar ; +IN: io.unix.files.freebsd + +TUPLE: freebsd-file-info < unix-file-info birth-time flags gen ; + +M: freebsd new-file-info ( -- class ) freebsd-file-info new ; + +M: freebsd stat>file-info ( stat -- file-info ) + [ call-next-method ] keep + { + [ stat-st_flags >>flags ] + [ stat-st_gen >>gen ] + [ stat-st_birthtimepsec timespec>timestamp >>birth-time ] + } cleave ; diff --git a/basis/io/unix/files/freebsd/tags.txt b/basis/io/unix/files/freebsd/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/basis/io/unix/files/freebsd/tags.txt @@ -0,0 +1 @@ +unportable diff --git a/basis/io/unix/files/macosx/macosx.factor b/basis/io/unix/files/macosx/macosx.factor new file mode 100644 index 0000000000..4173123e45 --- /dev/null +++ b/basis/io/unix/files/macosx/macosx.factor @@ -0,0 +1,16 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel alien.syntax math io.unix.files system +unix.stat accessors combinators ; +IN: io.unix.files.macosx + +TUPLE: macosx-file-info < unix-file-info flags gen ; + +M: macosx new-file-info ( -- class ) macosx-file-info new ; + +M: macosx stat>file-info ( stat -- file-info ) + [ call-next-method ] keep + { + [ stat-st_flags >>flags ] + [ stat-st_gen >>gen ] + } cleave ; diff --git a/basis/io/unix/files/macosx/tags.txt b/basis/io/unix/files/macosx/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/basis/io/unix/files/macosx/tags.txt @@ -0,0 +1 @@ +unportable diff --git a/basis/io/unix/files/netbsd/netbsd.factor b/basis/io/unix/files/netbsd/netbsd.factor new file mode 100644 index 0000000000..c61304c128 --- /dev/null +++ b/basis/io/unix/files/netbsd/netbsd.factor @@ -0,0 +1,17 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel alien.syntax math io.unix.files system +unix.stat accessors combinators calendar ; +IN: io.unix.files.netbsd + +TUPLE: netbsd-file-info < unix-file-info birth-time flags gen ; + +M: netbsd new-file-info ( -- class ) netbsd-file-info new ; + +M: netbsd stat>file-info ( stat -- file-info ) + [ call-next-method ] keep + { + [ stat-st_flags >>flags ] + [ stat-st_gen >>gen ] + [ stat-st_birthtim timespec>timestamp >>birth-time ] + } cleave ; diff --git a/basis/io/unix/files/netbsd/tags.txt b/basis/io/unix/files/netbsd/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/basis/io/unix/files/netbsd/tags.txt @@ -0,0 +1 @@ +unportable diff --git a/basis/io/unix/files/openbsd/openbsd.factor b/basis/io/unix/files/openbsd/openbsd.factor new file mode 100644 index 0000000000..e1473eed4d --- /dev/null +++ b/basis/io/unix/files/openbsd/openbsd.factor @@ -0,0 +1,17 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel alien.syntax math io.unix.files system +unix.stat accessors combinators calendar ; +IN: io.unix.files.openbsd + +TUPLE: openbsd-file-info < unix-file-info birth-time flags gen ; + +M: openbsd new-file-info ( -- class ) openbsd-file-info new ; + +M: openbsd stat>file-info ( stat -- file-info ) + [ call-next-method ] keep + { + [ stat-st_flags >>flags ] + [ stat-st_gen >>gen ] + [ stat-st_birthtim timespec>timestamp >>birth-time ] + } cleave ; diff --git a/basis/io/unix/files/openbsd/tags.txt b/basis/io/unix/files/openbsd/tags.txt new file mode 100644 index 0000000000..6bf68304bb --- /dev/null +++ b/basis/io/unix/files/openbsd/tags.txt @@ -0,0 +1 @@ +unportable diff --git a/basis/io/unix/files/unique/unique.factor b/basis/io/unix/files/unique/unique.factor index 95e321fd93..e47ac6a2e3 100644 --- a/basis/io/unix/files/unique/unique.factor +++ b/basis/io/unix/files/unique/unique.factor @@ -1,3 +1,5 @@ +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. USING: kernel io.ports io.unix.backend math.bitwise unix io.files.unique.backend system ; IN: io.unix.files.unique From b168d75a46747ccc64f45dc18ee02b0f6d6c1825 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 6 Oct 2008 17:17:49 -0500 Subject: [PATCH 102/948] add timespec>timestamp word --- basis/calendar/calendar.factor | 9 ++++++++- basis/structs/structs.factor | 10 ++++++++++ basis/unix/time/time.factor | 12 ------------ 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/basis/calendar/calendar.factor b/basis/calendar/calendar.factor index 31c835aada..8a27a46aa2 100644 --- a/basis/calendar/calendar.factor +++ b/basis/calendar/calendar.factor @@ -402,9 +402,16 @@ PRIVATE> : time-since-midnight ( timestamp -- duration ) dup midnight time- ; +: since-1970 ( time -- timestamp ) + unix-1970 time+ >local-time ; + : timeval>unix-time ( timeval -- timestamp ) [ timeval-sec seconds ] [ timeval-usec microseconds ] bi - time+ unix-1970 time+ >local-time ; + time+ since-1970 ; + +: timespec>unix-time ( timeval -- timestamp ) + [ timespec-sec seconds ] [ timespec-nsec nanoseconds ] bi + time+ since-1970 ; M: timestamp sleep-until timestamp>millis sleep-until ; diff --git a/basis/structs/structs.factor b/basis/structs/structs.factor index f54917dc47..51ac517af3 100644 --- a/basis/structs/structs.factor +++ b/basis/structs/structs.factor @@ -10,3 +10,13 @@ C-STRUCT: timeval "timeval" [ set-timeval-usec ] keep [ set-timeval-sec ] keep ; + +C-STRUCT: timespec + { "time_t" "sec" } + { "long" "nsec" } ; + +: make-timespec ( ms -- timespec ) + 1000 /mod 1000000 * + "timespec" + [ set-timespec-nsec ] keep + [ set-timespec-sec ] keep ; diff --git a/basis/unix/time/time.factor b/basis/unix/time/time.factor index 4fbb20dca0..26b42ddfe7 100644 --- a/basis/unix/time/time.factor +++ b/basis/unix/time/time.factor @@ -1,6 +1,4 @@ - USING: kernel alien.syntax alien.c-types math ; - IN: unix.time TYPEDEF: uint time_t @@ -18,16 +16,6 @@ C-STRUCT: tm { "long" "gmtoff" } ! Seconds: 0-59 (K&R says 0-61?) { "char*" "zone" } ; -C-STRUCT: timespec - { "time_t" "sec" } - { "long" "nsec" } ; - -: make-timespec ( ms -- timespec ) - 1000 /mod 1000000 * - "timespec" - [ set-timespec-nsec ] keep - [ set-timespec-sec ] keep ; - FUNCTION: time_t time ( time_t* t ) ; FUNCTION: tm* localtime ( time_t* clock ) ; FUNCTION: int gettimeofday ( timespec* TP, void* TZP ) ; From 9459eaab4b81c1a9f060393c2cef594b72873523 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 6 Oct 2008 17:28:11 -0500 Subject: [PATCH 103/948] all platforms support the file-info structure --- core/io/files/files.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/io/files/files.factor b/core/io/files/files.factor index 1634b7a3f1..bc84aa5d21 100644 --- a/core/io/files/files.factor +++ b/core/io/files/files.factor @@ -153,7 +153,7 @@ PRIVATE> "." last-split1 nip ; ! File info -TUPLE: file-info type size permissions modified ; +TUPLE: file-info type size permissions created modified accessed ; HOOK: file-info io-backend ( path -- info ) From 0294308c4c40e3ed49f446b1e45e5e1370bd008e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 6 Oct 2008 17:28:42 -0500 Subject: [PATCH 104/948] work on windows file-info --- basis/io/windows/files/files.factor | 41 ++++++++++++++++++----------- 1 file changed, 25 insertions(+), 16 deletions(-) diff --git a/basis/io/windows/files/files.factor b/basis/io/windows/files/files.factor index 40e7e17402..f4bb3c71dc 100644 --- a/basis/io/windows/files/files.factor +++ b/basis/io/windows/files/files.factor @@ -147,18 +147,18 @@ SYMBOLS: +read-only+ +hidden+ +system+ FILE_ATTRIBUTE_DIRECTORY mask? +directory+ +regular-file+ ? ; : WIN32_FIND_DATA>file-info ( WIN32_FIND_DATA -- file-info ) + [ file-info new ] dip { - [ WIN32_FIND_DATA-dwFileAttributes win32-file-type ] + [ WIN32_FIND_DATA-dwFileAttributes win32-file-type >>type ] [ [ WIN32_FIND_DATA-nFileSizeLow ] - [ WIN32_FIND_DATA-nFileSizeHigh ] bi >64bit + [ WIN32_FIND_DATA-nFileSizeHigh ] bi >64bit >>size ] - [ WIN32_FIND_DATA-dwFileAttributes ] - ! [ WIN32_FIND_DATA-ftCreationTime FILETIME>timestamp ] - [ WIN32_FIND_DATA-ftLastWriteTime FILETIME>timestamp ] - ! [ WIN32_FIND_DATA-ftLastAccessTime FILETIME>timestamp ] - } cleave - \ file-info boa ; + [ WIN32_FIND_DATA-dwFileAttributes >>mode ] + [ WIN32_FIND_DATA-ftCreationTime FILETIME>timestamp >>created ] + [ WIN32_FIND_DATA-ftLastWriteTime FILETIME>timestamp >>modified ] + [ WIN32_FIND_DATA-ftLastAccessTime FILETIME>timestamp >>accessed ] + } cleave ; : find-first-file-stat ( path -- WIN32_FIND_DATA ) "WIN32_FIND_DATA" [ @@ -168,23 +168,32 @@ SYMBOLS: +read-only+ +hidden+ +system+ ] keep ; : BY_HANDLE_FILE_INFORMATION>file-info ( HANDLE_FILE_INFORMATION -- file-info ) + [ file-info new ] dip { - [ BY_HANDLE_FILE_INFORMATION-dwFileAttributes win32-file-type ] + [ BY_HANDLE_FILE_INFORMATION-dwFileAttributes win32-file-type >>type ] [ [ BY_HANDLE_FILE_INFORMATION-nFileSizeLow ] - [ BY_HANDLE_FILE_INFORMATION-nFileSizeHigh ] bi >64bit + [ BY_HANDLE_FILE_INFORMATION-nFileSizeHigh ] bi >64bit >>size + ] + [ BY_HANDLE_FILE_INFORMATION-dwFileAttributes >>mode ] + [ + BY_HANDLE_FILE_INFORMATION-ftCreationTime + FILETIME>timestamp >>created + ] + [ + BY_HANDLE_FILE_INFORMATION-ftLastWriteTime + FILETIME>timestamp >>modified + ] + [ + BY_HANDLE_FILE_INFORMATION-ftLastAccessTime + FILETIME>timestamp >>accessed ] - [ BY_HANDLE_FILE_INFORMATION-dwFileAttributes ] - ! [ BY_HANDLE_FILE_INFORMATION-ftCreationTime FILETIME>timestamp ] - [ BY_HANDLE_FILE_INFORMATION-ftLastWriteTime FILETIME>timestamp ] - ! [ BY_HANDLE_FILE_INFORMATION-ftLastAccessTime FILETIME>timestamp ] ! [ BY_HANDLE_FILE_INFORMATION-nNumberOfLinks ] ! [ ! [ BY_HANDLE_FILE_INFORMATION-nFileIndexLow ] ! [ BY_HANDLE_FILE_INFORMATION-nFileIndexHigh ] bi >64bit ! ] - } cleave - \ file-info boa ; + } cleave ; : get-file-information ( handle -- BY_HANDLE_FILE_INFORMATION ) [ From 847205432fe1d234f028aa6f2527d8713f17c4de Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 6 Oct 2008 17:34:58 -0500 Subject: [PATCH 105/948] fix load error --- basis/structs/structs.factor | 2 +- basis/unix/time/time.factor | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/basis/structs/structs.factor b/basis/structs/structs.factor index 51ac517af3..6aef757eb4 100644 --- a/basis/structs/structs.factor +++ b/basis/structs/structs.factor @@ -1,4 +1,4 @@ -USING: alien.c-types alien.syntax kernel math ; +USING: alien.c-types alien.syntax kernel math unix.types ; IN: structs C-STRUCT: timeval diff --git a/basis/unix/time/time.factor b/basis/unix/time/time.factor index 26b42ddfe7..67611ae193 100644 --- a/basis/unix/time/time.factor +++ b/basis/unix/time/time.factor @@ -1,8 +1,8 @@ -USING: kernel alien.syntax alien.c-types math ; +! Copyright (C) 2008 Doug Coleman. +! See http://factorcode.org/license.txt for BSD license. +USING: kernel alien.syntax alien.c-types math unix.types ; IN: unix.time -TYPEDEF: uint time_t - C-STRUCT: tm { "int" "sec" } ! Seconds: 0-59 (K&R says 0-61?) { "int" "min" } ! Minutes: 0-59 From 15f15d4553083bb06909c97e16eeac906849357a Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 9 Oct 2008 13:23:43 -0700 Subject: [PATCH 106/948] Adding strftime library. --- extra/time/authors.txt | 1 + extra/time/time-docs.factor | 43 ++++++++++++++++++++++++ extra/time/time-tests.factor | 24 ++++++++++++++ extra/time/time.factor | 63 ++++++++++++++++++++++++++++++++++++ 4 files changed, 131 insertions(+) create mode 100644 extra/time/authors.txt create mode 100644 extra/time/time-docs.factor create mode 100644 extra/time/time-tests.factor create mode 100644 extra/time/time.factor diff --git a/extra/time/authors.txt b/extra/time/authors.txt new file mode 100644 index 0000000000..e091bb8164 --- /dev/null +++ b/extra/time/authors.txt @@ -0,0 +1 @@ +John Benediktsson diff --git a/extra/time/time-docs.factor b/extra/time/time-docs.factor new file mode 100644 index 0000000000..b0ca12e9c6 --- /dev/null +++ b/extra/time/time-docs.factor @@ -0,0 +1,43 @@ + +USING: help.syntax help.markup kernel prettyprint sequences strings ; + +IN: time + +HELP: strftime +{ $values { "format-string" string } } +{ $description "Writes the timestamp (specified on the stack) formatted according to the format string." } +; + +ARTICLE: "strftime" "Formatted timestamps" +"The " { $vocab-link "time" } " vocabulary is used for formatted timestamps.\n" +{ $subsection strftime } +"\n" +"Several format specifications exist for handling arguments of different types, and specifying attributes for the result string, including such things as maximum width, padding, and decimals.\n" +{ $table + { "%a" "Abbreviated weekday name." } + { "%A" "Full weekday name." } + { "%b" "Abbreviated month name." } + { "%B" "Full month name." } + { "%c" "Date and time representation." } + { "%d" "Day of the month as a decimal number [01,31]." } + { "%H" "Hour (24-hour clock) as a decimal number [00,23]." } + { "%I" "Hour (12-hour clock) as a decimal number [01,12]." } + { "%j" "Day of the year as a decimal number [001,366]." } + { "%m" "Month as a decimal number [01,12]." } + { "%M" "Minute as a decimal number [00,59]." } + { "%p" "Either AM or PM." } + { "%S" "Second as a decimal number [00,59]." } + { "%U" "Week number of the year (Sunday as the first day of the week) as a decimal numberb [00,53]." } + { "%w" "Weekday as a decimal number [0(Sunday),6]." } + { "%W" "Week number of the year (Monday as the first day of the week) as a decimal numberb [00,53]." } + { "%x" "Date representation." } + { "%X" "Time representation." } + { "%y" "Year without century as a decimal number [00,99]." } + { "%Y" "Year with century as a decimal number." } + { "%Z" "Time zone name (no characters if no time zone exists)." } + { "%%" "A literal '%' character." } +} ; + +ABOUT: "strftime" + + diff --git a/extra/time/time-tests.factor b/extra/time/time-tests.factor new file mode 100644 index 0000000000..0b0602bd62 --- /dev/null +++ b/extra/time/time-tests.factor @@ -0,0 +1,24 @@ +! Copyright (C) 2008 John Benediktsson +! See http://factorcode.org/license.txt for BSD license + +USING: kernel time tools.test calendar ; + +IN: time.tests + +[ "%H:%M:%S" strftime ] must-infer + +: testtime ( -- timestamp ) + 2008 10 9 12 3 15 instant ; + +[ t ] [ "12:03:15" testtime "%H:%M:%S" strftime = ] unit-test +[ t ] [ "12:03:15" testtime "%X" strftime = ] unit-test + +[ t ] [ "10/09/2008" testtime "%m/%d/%Y" strftime = ] unit-test +[ t ] [ "10/09/2008" testtime "%x" strftime = ] unit-test + +[ t ] [ "Thu" testtime "%a" strftime = ] unit-test +[ t ] [ "Thursday" testtime "%A" strftime = ] unit-test + +[ t ] [ "Oct" testtime "%b" strftime = ] unit-test +[ t ] [ "October" testtime "%B" strftime = ] unit-test + diff --git a/extra/time/time.factor b/extra/time/time.factor new file mode 100644 index 0000000000..e609bf381b --- /dev/null +++ b/extra/time/time.factor @@ -0,0 +1,63 @@ +! Copyright (C) 2008 John Benediktsson +! See http://factorcode.org/license.txt for BSD license + +USING: accessors arrays calendar io kernel fry macros math +math.functions math.parser peg.ebnf sequences strings vectors ; + +IN: time + +: timestring ( timestamp -- string ) + [ hour>> ] keep [ minute>> ] keep second>> 3array + [ number>string 2 CHAR: 0 pad-left ] map ":" join ; inline + +: datestring ( timestamp -- string ) + [ month>> ] keep [ day>> ] keep year>> 3array + [ number>string 2 CHAR: 0 pad-left ] map "/" join ; inline + + [[ [ "%" ] ]] +fmt-a = "a" => [[ [ dup day-of-week day-abbreviation3 ] ]] +fmt-A = "A" => [[ [ dup day-of-week day-name ] ]] +fmt-b = "b" => [[ [ dup month>> month-abbreviation ] ]] +fmt-B = "B" => [[ [ dup month>> month-name ] ]] +fmt-c = "c" => [[ [ "Not yet implemented" throw ] ]] +fmt-d = "d" => [[ [ dup day>> number>string 2 CHAR: 0 pad-left ] ]] +fmt-H = "H" => [[ [ dup hour>> number>string 2 CHAR: 0 pad-left ] ]] +fmt-I = "I" => [[ [ dup hour>> 12 > [ 12 - ] when number>string 2 CHAR: 0 pad-left ] ]] +fmt-j = "j" => [[ [ dup day-of-year number>string ] ]] +fmt-m = "m" => [[ [ dup month>> number>string 2 CHAR: 0 pad-left ] ]] +fmt-M = "M" => [[ [ dup minute>> number>string 2 CHAR: 0 pad-left ] ]] +fmt-p = "p" => [[ [ dup hour>> 12 < [ "AM" ] [ "PM" ] ? ] ]] +fmt-S = "S" => [[ [ dup second>> round number>string 2 CHAR: 0 pad-left ] ]] +fmt-U = "U" => [[ [ "Not yet implemented" throw ] ]] +fmt-w = "w" => [[ [ dup day-of-week number>string ] ]] +fmt-W = "W" => [[ [ "Not yet implemented" throw ] ]] +fmt-x = "x" => [[ [ dup datestring ] ]] +fmt-X = "X" => [[ [ dup timestring ] ]] +fmt-y = "y" => [[ [ dup year>> 100 mod number>string ] ]] +fmt-Y = "Y" => [[ [ dup year>> number>string ] ]] +fmt-Z = "Z" => [[ [ "Not yet implemented" throw ] ]] +unknown = (.)* => [[ "Unknown directive" throw ]] + +formats_ = fmt-%|fmt-a|fmt-A|fmt-b|fmt-B|fmt-c|fmt-d|fmt-H|fmt-I| + fmt-j|fmt-m|fmt-M|fmt-p|fmt-S|fmt-U|fmt-w|fmt-W|fmt-x| + fmt-X|fmt-y|fmt-Y|fmt-Z|unknown + +formats = "%" (formats_) => [[ second '[ _ dip ] ]] + +plain-text = (!("%").)+ => [[ >string '[ _ swap ] ]] + +text = (formats|plain-text)* => [[ reverse [ [ [ push ] keep ] append ] map ]] + +;EBNF + +PRIVATE> + +MACRO: strftime ( format-string -- ) + parse-format-string [ length ] keep [ ] join + '[ _ @ reverse concat nip ] ; + + From 6d2ade1173da8e7a65d0cf431d1893296f10c98b Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Thu, 9 Oct 2008 19:48:05 -0700 Subject: [PATCH 107/948] Adding week-of-year words. --- extra/time/time.factor | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/extra/time/time.factor b/extra/time/time.factor index e609bf381b..d0411bd5bf 100644 --- a/extra/time/time.factor +++ b/extra/time/time.factor @@ -6,14 +6,23 @@ math.functions math.parser peg.ebnf sequences strings vectors ; IN: time -: timestring ( timestamp -- string ) +: >timestring ( timestamp -- string ) [ hour>> ] keep [ minute>> ] keep second>> 3array [ number>string 2 CHAR: 0 pad-left ] map ":" join ; inline -: datestring ( timestamp -- string ) +: >datestring ( timestamp -- string ) [ month>> ] keep [ day>> ] keep year>> 3array [ number>string 2 CHAR: 0 pad-left ] map "/" join ; inline +: week-of-year-sunday ( timestamp -- n ) + dup clone 1 >>month 1 >>day day-of-week dup 0 > [ 7 swap - ] when + [ day-of-year ] dip 2dup < [ 0 2nip ] [ - 7 / 1+ >fixnum ] if ; + +: week-of-year-monday ( timestamp -- n ) + dup clone 1 >>month 1 >>day day-of-week dup 1 > [ 7 swap - ] when + [ day-of-year ] dip 2dup < [ 0 2nip ] [ - 7 / 1+ >fixnum ] if ; + + [[ [ dup second>> round number>string 2 CHAR fmt-U = "U" => [[ [ "Not yet implemented" throw ] ]] fmt-w = "w" => [[ [ dup day-of-week number>string ] ]] fmt-W = "W" => [[ [ "Not yet implemented" throw ] ]] -fmt-x = "x" => [[ [ dup datestring ] ]] -fmt-X = "X" => [[ [ dup timestring ] ]] +fmt-x = "x" => [[ [ dup >datestring ] ]] +fmt-X = "X" => [[ [ dup >timestring ] ]] fmt-y = "y" => [[ [ dup year>> 100 mod number>string ] ]] fmt-Y = "Y" => [[ [ dup year>> number>string ] ]] fmt-Z = "Z" => [[ [ "Not yet implemented" throw ] ]] From e9a36ebda33d2d55659f7e7d328821a337e9b788 Mon Sep 17 00:00:00 2001 From: John Benediktsson Date: Mon, 13 Oct 2008 06:19:21 -0700 Subject: [PATCH 108/948] strftime: Some fixes to support week-of-year. --- extra/time/time-docs.factor | 4 ++-- extra/time/time.factor | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/extra/time/time-docs.factor b/extra/time/time-docs.factor index b0ca12e9c6..8fbc59e315 100644 --- a/extra/time/time-docs.factor +++ b/extra/time/time-docs.factor @@ -27,9 +27,9 @@ ARTICLE: "strftime" "Formatted timestamps" { "%M" "Minute as a decimal number [00,59]." } { "%p" "Either AM or PM." } { "%S" "Second as a decimal number [00,59]." } - { "%U" "Week number of the year (Sunday as the first day of the week) as a decimal numberb [00,53]." } + { "%U" "Week number of the year (Sunday as the first day of the week) as a decimal number [00,53]." } { "%w" "Weekday as a decimal number [0(Sunday),6]." } - { "%W" "Week number of the year (Monday as the first day of the week) as a decimal numberb [00,53]." } + { "%W" "Week number of the year (Monday as the first day of the week) as a decimal number [00,53]." } { "%x" "Date representation." } { "%X" "Time representation." } { "%y" "Year without century as a decimal number [00,99]." } diff --git a/extra/time/time.factor b/extra/time/time.factor index d0411bd5bf..be19fb0919 100644 --- a/extra/time/time.factor +++ b/extra/time/time.factor @@ -14,13 +14,13 @@ IN: time [ month>> ] keep [ day>> ] keep year>> 3array [ number>string 2 CHAR: 0 pad-left ] map "/" join ; inline -: week-of-year-sunday ( timestamp -- n ) - dup clone 1 >>month 1 >>day day-of-week dup 0 > [ 7 swap - ] when +: (week-of-year) ( timestamp day -- n ) + [ dup clone 1 >>month 1 >>day day-of-week dup ] dip > [ 7 swap - ] when [ day-of-year ] dip 2dup < [ 0 2nip ] [ - 7 / 1+ >fixnum ] if ; -: week-of-year-monday ( timestamp -- n ) - dup clone 1 >>month 1 >>day day-of-week dup 1 > [ 7 swap - ] when - [ day-of-year ] dip 2dup < [ 0 2nip ] [ - 7 / 1+ >fixnum ] if ; +: week-of-year-sunday ( timestamp -- n ) 0 (week-of-year) ; inline + +: week-of-year-monday ( timestamp -- n ) 1 (week-of-year) ; inline [[ [ dup month>> number>string 2 CHAR: 0 pad fmt-M = "M" => [[ [ dup minute>> number>string 2 CHAR: 0 pad-left ] ]] fmt-p = "p" => [[ [ dup hour>> 12 < [ "AM" ] [ "PM" ] ? ] ]] fmt-S = "S" => [[ [ dup second>> round number>string 2 CHAR: 0 pad-left ] ]] -fmt-U = "U" => [[ [ "Not yet implemented" throw ] ]] +fmt-U = "U" => [[ [ dup week-of-year-sunday ] ]] fmt-w = "w" => [[ [ dup day-of-week number>string ] ]] -fmt-W = "W" => [[ [ "Not yet implemented" throw ] ]] +fmt-W = "W" => [[ [ dup week-of-year-monday ] ]] fmt-x = "x" => [[ [ dup >datestring ] ]] fmt-X = "X" => [[ [ dup >timestring ] ]] fmt-y = "y" => [[ [ dup year>> 100 mod number>string ] ]] From d7affa7c50fa5be84a152df02bb2f688c9252f16 Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Sat, 25 Oct 2008 20:41:33 -0200 Subject: [PATCH 109/948] irc.client: Notify mode change --- extra/irc/client/client-tests.factor | 8 ++++++++ extra/irc/client/client.factor | 14 ++++++++------ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/extra/irc/client/client-tests.factor b/extra/irc/client/client-tests.factor index fe85d6c375..3cf51ecc42 100644 --- a/extra/irc/client/client-tests.factor +++ b/extra/irc/client/client-tests.factor @@ -195,3 +195,11 @@ M: mb-writer dispose drop ; [ participant-changed? ] read-matching-message ] unit-test ] with-irc + +! Mode change +[ { T{ participant-changed f "ircuser" +mode+ "+o" } } [ + "#factortest" [ %add-named-chat ] keep + ":ircserver.net MODE #factortest +o ircuser" %push-line + [ participant-changed? ] read-matching-message + ] unit-test +] with-irc diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor index d40c7d400d..d11823b344 100755 --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -141,7 +141,9 @@ M: irc-chat to-chat in-messages>> mailbox-put ; : change-participant-mode ( channel mode nick -- ) rot chat> [ participants>> set-at ] - [ [ [ +mode+ ] dip ] dip to-chat ] 3bi ; ! FIXME + [ [ participant-changed new + [ (>>nick) ] [ (>>parameter) ] [ +mode+ >>action ] tri ] dip to-chat ] + 3bi ; ! FIXME DEFER: me? @@ -224,11 +226,11 @@ M: quit process-message M: nick process-message [ irc-message-sender ] [ trailing>> ] bi rename-participant-in-all ; -! M: mode process-message ( mode -- ) -! [ channel-mode? ] keep and [ -! [ name>> ] [ mode>> ] [ parameter>> ] tri -! [ change-participant-mode ] [ 2drop ] if* -! ] when* ; +M: mode process-message ( mode -- ) + [ channel-mode? ] keep and [ + [ name>> ] [ mode>> ] [ parameter>> ] tri + [ change-participant-mode ] [ 2drop ] if* + ] when* ; : >nick/mode ( string -- nick mode ) dup first "+@" member? [ unclip ] [ 0 ] if participant-mode ; From ee22964c4952c435a290002e2f0aab327eaa2ebc Mon Sep 17 00:00:00 2001 From: Bruno Deferrari Date: Wed, 12 Nov 2008 00:56:01 -0200 Subject: [PATCH 110/948] irc.client: correctly handle multiple name-replys --- extra/irc/client/client-tests.factor | 14 ++++++++++++++ extra/irc/client/client.factor | 20 ++++++++++++++++---- extra/irc/messages/messages.factor | 5 +++++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/extra/irc/client/client-tests.factor b/extra/irc/client/client-tests.factor index 3cf51ecc42..327bfc6292 100644 --- a/extra/irc/client/client-tests.factor +++ b/extra/irc/client/client-tests.factor @@ -169,6 +169,20 @@ M: mb-writer dispose drop ; ] unit-test ] with-irc +[ { H{ { "factorbot" +operator+ } { "ircuser" +normal+ } } } [ + "#factortest" + H{ { "ircuser" +normal+ } } clone >>participants + [ %add-named-chat ] keep + ":ircserver.net 353 factorbot @ #factortest :@factorbot " %push-line + ":ircserver.net 353 factorbot @ #factortest :ircuser2 " %push-line + ":ircserver.net 366 factorbot #factortest :End of /NAMES list." %push-line + ":ircserver.net 353 factorbot @ #factortest :@factorbot " %push-line + ":ircserver.net 353 factorbot @ #factortest :ircuser " %push-line + ":ircserver.net 366 factorbot #factortest :End of /NAMES list." %push-line + participants>> + ] unit-test +] with-irc + ! Namelist change notification [ { T{ participant-changed f f f f } } [ "#factortest" [ %add-named-chat ] keep diff --git a/extra/irc/client/client.factor b/extra/irc/client/client.factor index d24d0c615f..be600133b7 100755 --- a/extra/irc/client/client.factor +++ b/extra/irc/client/client.factor @@ -32,7 +32,7 @@ TUPLE: irc-client profile stream in-messages out-messages TUPLE: irc-chat in-messages client ; TUPLE: irc-server-chat < irc-chat ; -TUPLE: irc-channel-chat < irc-chat name password timeout participants ; +TUPLE: irc-channel-chat < irc-chat name password timeout participants clean-participants ; TUPLE: irc-nick-chat < irc-chat name ; SYMBOL: +server-chat+ @@ -55,7 +55,7 @@ SYMBOL: +nick+ f irc-server-chat boa ; : ( name -- irc-channel-chat ) - [ f ] dip f 60 seconds H{ } clone + [ f ] dip f 60 seconds H{ } clone t irc-channel-chat boa ; : ( name -- irc-nick-chat ) @@ -246,12 +246,24 @@ M: mode process-message ( mode -- ) trailing>> [ blank? ] trim " " split [ >nick/mode 2array ] map >hashtable ; +: maybe-clean-participants ( channel-chat -- ) + dup clean-participants>> [ + H{ } clone >>participants f >>clean-participants + ] when drop ; + M: names-reply process-message [ names-reply>participants ] [ channel>> chat> ] bi [ - [ (>>participants) ] - [ [ f f f ] dip name>> to-chat ] bi + [ maybe-clean-participants ] + [ participants>> 2array assoc-combine ] + [ (>>participants) ] tri ] [ drop ] if* ; +M: end-of-names process-message + channel>> chat> [ + t >>clean-participants + [ f f f ] dip name>> to-chat + ] when* ; + ! ====================================== ! Client message handling ! ====================================== diff --git a/extra/irc/messages/messages.factor b/extra/irc/messages/messages.factor index 32533c102a..bea9bf37b1 100755 --- a/extra/irc/messages/messages.factor +++ b/extra/irc/messages/messages.factor @@ -20,6 +20,7 @@ TUPLE: nick-in-use < irc-message name ; TUPLE: notice < irc-message type ; TUPLE: mode < irc-message name mode parameter ; TUPLE: names-reply < irc-message who channel ; +TUPLE: end-of-names < irc-message who channel ; TUPLE: unhandled < irc-message ; : ( command parameters trailing -- irc-message ) @@ -85,6 +86,9 @@ M: nick-in-use >>command-parameters ( nick-in-use params -- nick-in-use ) M: names-reply >>command-parameters ( names-reply params -- names-reply ) first3 nip [ >>who ] [ >>channel ] bi* ; +M: end-of-names >>command-parameters ( names-reply params -- names-reply ) + first2 [ >>who ] [ >>channel ] bi* ; + M: mode >>command-parameters ( mode params -- mode ) dup length 3 = [ first3 [ >>name ] [ >>mode ] [ >>parameter ] tri* @@ -159,6 +163,7 @@ M: sender-in-prefix irc-message-sender ( sender-in-prefix -- sender ) { "001" [ logged-in ] } { "433" [ nick-in-use ] } { "353" [ names-reply ] } + { "366" [ end-of-names ] } { "JOIN" [ join ] } { "PART" [ part ] } { "NICK" [ nick ] } From f0824b64b67d8faf9964b23fc3369be54067c617 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Thu, 13 Nov 2008 09:48:42 -0800 Subject: [PATCH 111/948] change cairo-gadget so it can handle constantly updating content --- extra/cairo/gadgets/gadgets.factor | 58 +++++++++-------------------- extra/opengl/gadgets/gadgets.factor | 5 +++ 2 files changed, 22 insertions(+), 41 deletions(-) diff --git a/extra/cairo/gadgets/gadgets.factor b/extra/cairo/gadgets/gadgets.factor index d160740c44..8ed7a3c31b 100644 --- a/extra/cairo/gadgets/gadgets.factor +++ b/extra/cairo/gadgets/gadgets.factor @@ -1,58 +1,34 @@ ! Copyright (C) 2008 Matthew Willis. ! See http://factorcode.org/license.txt for BSD license. -USING: sequences math opengl.gadgets kernel -byte-arrays cairo.ffi cairo io.backend -ui.gadgets accessors opengl.gl -arrays fry classes ; +USING: sequences math kernel byte-arrays cairo.ffi cairo +io.backend ui.gadgets accessors opengl.gl arrays fry +classes ui.render namespaces ; IN: cairo.gadgets : width>stride ( width -- stride ) 4 * ; -: copy-cairo ( dim quot -- byte-array ) - >r first2 over width>stride - [ * nip dup CAIRO_FORMAT_ARGB32 ] - [ cairo_image_surface_create_for_data ] 3bi - r> with-cairo-from-surface ; inline +GENERIC: render-cairo* ( gadget -- ) -TUPLE: cairo-gadget < texture-gadget ; +: render-cairo ( gadget -- byte-array ) + dup dim>> first2 over width>stride + [ * nip dup CAIRO_FORMAT_ARGB32 ] + [ cairo_image_surface_create_for_data ] 3bi + rot '[ _ render-cairo* ] with-cairo-from-surface ; inline + +TUPLE: cairo-gadget < gadget ; : ( dim -- gadget ) cairo-gadget new-gadget swap >>dim ; -M: cairo-gadget cache-key* [ dim>> ] [ class ] bi 2array ; - -: render-cairo ( dim quot -- bytes format ) - >r 2^-bounds r> copy-cairo GL_BGRA ; inline - -GENERIC: render-cairo* ( gadget -- ) - -M: cairo-gadget render* - [ dim>> dup ] [ '[ _ render-cairo* ] ] bi - render-cairo render-bytes* ; - -! maybe also texture>png -! : cairo>png ( gadget path -- ) -! >r [ cairo>bytes CAIRO_FORMAT_ARGB32 ] [ width>> ] -! [ height>> ] tri over width>stride -! cairo_image_surface_create_for_data -! r> [ cairo_surface_write_to_png check-cairo ] curry with-surface ; +M: cairo-gadget draw-gadget* + [ dim>> ] [ render-cairo ] bi + origin get first2 glRasterPos2i + 1.0 -1.0 glPixelZoom + >r first2 GL_BGRA GL_UNSIGNED_BYTE r> + glDrawPixels ; : copy-surface ( surface -- ) cr swap 0 0 cairo_set_source_surface cr cairo_paint ; - -TUPLE: png-gadget < texture-gadget path ; -: ( path -- gadget ) - png-gadget new-gadget - swap >>path ; - -M: png-gadget render* - path>> normalize-path cairo_image_surface_create_from_png - [ cairo_image_surface_get_width ] - [ cairo_image_surface_get_height 2array dup 2^-bounds ] - [ [ copy-surface ] curry copy-cairo ] tri - GL_BGRA render-bytes* ; - -M: png-gadget cache-key* path>> ; diff --git a/extra/opengl/gadgets/gadgets.factor b/extra/opengl/gadgets/gadgets.factor index cfedf32079..1fefcd5665 100644 --- a/extra/opengl/gadgets/gadgets.factor +++ b/extra/opengl/gadgets/gadgets.factor @@ -47,6 +47,11 @@ C: cache-entry cache-key* textures get delete-at* [ tex>> delete-texture ] [ drop ] if ; +: clear-textures ( -- ) + textures get values [ tex>> delete-texture ] each + H{ } clone textures set-global + H{ } clone refcounts set-global ; + M: texture-gadget graft* ( gadget -- ) [ 1+ ] refcount-change ; M: texture-gadget ungraft* ( gadget -- ) From a9f8856b0d7c4cb757fa6c9e5e5871618e973621 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Thu, 13 Nov 2008 09:49:18 -0800 Subject: [PATCH 112/948] make shader code in spheres a little more readable --- basis/io/encodings/utf16/.utf16.factor.swo | Bin 16384 -> 0 bytes extra/spheres/spheres.factor | 22 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) delete mode 100644 basis/io/encodings/utf16/.utf16.factor.swo diff --git a/basis/io/encodings/utf16/.utf16.factor.swo b/basis/io/encodings/utf16/.utf16.factor.swo deleted file mode 100644 index 01be8fdab2946825bf902b05af5135496b67501b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI2O^h5z6~~JZJ2)Xgk^>yynghG?_Uz0o*wI+KE7mc=!kZA*YZ+E6rDwW&rnNoY z)iI3Oil$N>d};6Q}Pkxwa+V&wxN1rQP!j)@fhue!RYyLY^- zk3rSeZ`RZO>Q%jey{hi6nr`#rxivb~XbK!36XLVK`tgImeC~w!?FWPi1EoUgxe;GG z;8=5eL8Rhz;Iu#82;-g`PB;E);c&rsdn!&AdT}Bbf_Onjz1Rz)e!4JLe(PlR*~pBh z`?6=P0#<=rRp9Q8#dfRt$>TG0-@O~RTG-lK1*`&A0jq#jz$#!BunJfOtOD;4@$rdfj;oT61WGv^1%If@|OsSOj;0x9<|-1#k^0kb-s40!<*m zjXQ;S5quLo3eJF4a1Z#`F(G~iz5~7u*1;M$0gi$q_{UKp{s4XtehRLGC%^!F2`m8uN5S8ZAWrZycosYZ z6iC5&@CD$2Bj9%M>g__j0)7IX2Tz0R;1ZYz$H2Q-$ax3+4m=H>0#`vBw7`GR?>E3} z;8}1TJOM6(4WRP^@=lHpr6ac|X_gY129LYlP?Fac`SasT@y+vhOO13nec>6euVEl?bZNycU(9ep8=guAmWz zb?eFO$0vt$J45FpQUgi;Sd9}okN*cLrGt1JdgMtZdy3r1qo5z**Dd7I>ceZ~DqW;2 z`#}`phc4p6#uv|@ou~vA;8)QVH>F-Y3ZzGV5)Ube8+p`e10mk8U7O0fXhU#SdMJ8f zAW;|E;YJj9)1Hh_^DrJqieeugJxShp6b3z41#v`doe8vui)id=trjb`OPi!<3!hpS z>BuCB6P(zqm}t4Xa;0o(&P}%sr`RGra=*KxlUJzSaA(NNoLJ~kPAQ`mSE(Mni$?4=I*(){&lk4{q%g+T<}JGuA5&M)lCcHFE@{Ob+eWI1ox7D=}^fNm(f zM?-g;M@qF}Xm`D7?27wzu-skfW>L-4JWd5Z8YcKMA4Y@}BLV@#Lg>@@K=$NU{UAwI z<)RL@)x<%LF2UCNaI=geByKU7YA(D&<=(<6)8s zSs!MDTvurN<4{#`Pfn_GTFtC66Yn|)GUuB#Yi0_QqI2lG>BVEd zp%oRI?^S1d8i$RS#3QO%@I4pU{Jbg+`P?tQ28j($(VOoVa|bMDrEV}L#RpU+pbKOwACcu#eMNs!!_M_ zsAy{`-<1cXd^SlPCgsfo!vRW_Z^8Kh`Cr{$%Wp2mL#EWpZ9Uu8ec#exsds(ZS!J;3 zFWF7DRO`Mm!-`gW;*ev;iyb3lE&rAi$}>J$u4maKyB2F%lb0#Y!g+qx#|q1cHk&by zaWZXW7n23wcZ)nOW|DH_OIK?no%^swTZKU}4EPS*G`9&J3y;erUeRWH$WIvpW~}H~ zs(n+E|0ZL;oO#)N&o?lB6e-UGB|i}4Ca$W(oSl@N*HzVzT9clhWv>&lF$0(sz;odG zm)BMwKHo8Cim!U`RKB$<-&)1Dtiy!hyEPuh^({`6pUUz4JnROMi~BO(0`Q2f6rS%P z#K!u$haT+U2~7=XTPBeV`8jcn2M`HEO#LZ6hIa)n7P&*IU#e2BgS{m?c&J~Ok_JkR zIt%9a^86g%h?D*T9^_?|%7(hC$j8(9>iPqepF_bj@n|Or`U6F?XXdEgY@VFw&r|e( z8wF^`*+C*B%#r~@8JCY&wKuV#ykF>!1Lfa5QDSe2>2)7<@ufeb?`EH z3VaJ}1AgDX7uDRspMkRlq7>6|f3e1*`&Af&T*q z2nSXiYI_P;cqn$avTZ8oN)pt!y2@9w6;^m^;Vi#a!bSNyUNcLZWaTTZ(#miAm_%EK zBekA2rcVo)|kyUpRRGL2<$p@T3ZO3 z;y_2kVUGgdgw(s6s1qVg_AV=%Q&^Dh4aU(n1lg8yq|2j|ba8(ihASuw2aCG(%kaWo zw*^^6vEx?>AX_6TmN2qvc~!#{)e9b(Qt)~leK U6w0WN#fU9xV|69mAqVFF1)sD~> [ - drop + { + [ "checker_size_inv" glGetUniformLocation 0.125 glUniform1f ] + [ "checker_color_1" glGetUniformLocation 1.0 0.5 0.0 1.0 glUniform4f ] + [ "checker_color_2" glGetUniformLocation 0.0 0.0 0.0 1.0 glUniform4f ] + } cleave GL_QUADS [ -1000.0 -30.0 1000.0 glVertex3f -1000.0 -30.0 -1000.0 glVertex3f From 2fe364a7bbb198e70b816ccd7f49945c9dedf9fd Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Fri, 14 Nov 2008 20:18:16 -0600 Subject: [PATCH 113/948] Specialized arrays work in progress --- basis/alien/arrays/arrays-docs.factor | 64 +-------- basis/alien/c-types/c-types-tests.factor | 2 - basis/alien/c-types/c-types.factor | 102 +++++---------- basis/alien/structs/structs.factor | 4 +- basis/cocoa/views/views.factor | 10 +- basis/compiler/tests/alien.factor | 9 +- basis/compiler/tests/codegen.factor | 2 +- basis/compiler/tests/spilling.factor | 2 +- .../tree/propagation/propagation-tests.factor | 4 +- basis/db/postgresql/lib/lib.factor | 9 +- basis/float-arrays/float-arrays-docs.factor | 62 --------- basis/float-arrays/float-arrays-tests.factor | 12 -- basis/float-arrays/float-arrays.factor | 123 ------------------ basis/float-arrays/summary.txt | 1 - basis/float-vectors/float-vectors-docs.factor | 37 ------ .../float-vectors/float-vectors-tests.factor | 14 -- basis/float-vectors/float-vectors.factor | 38 ------ basis/float-vectors/summary.txt | 1 - basis/{float-arrays => functors}/authors.txt | 0 basis/functors/functors-tests.factor | 47 +++++++ basis/functors/functors.factor | 98 ++++++++++++++ basis/functors/summary.txt | 1 + basis/functors/tags.txt | 1 + basis/io/mmap/functor/functor.factor | 22 ++++ basis/io/mmap/mmap.factor | 6 +- basis/io/unix/pipes/pipes.factor | 10 +- basis/io/windows/launcher/launcher.factor | 9 +- basis/io/windows/nt/monitors/monitors.factor | 2 +- basis/locals/locals-tests.factor | 1 - basis/locals/locals.factor | 37 +++--- basis/opengl/opengl.factor | 20 ++- basis/serialize/serialize-tests.factor | 8 +- basis/specialized-arrays/alien/alien.factor | 4 + basis/specialized-arrays/authors.txt | 1 + basis/specialized-arrays/bool/bool.factor | 4 + basis/specialized-arrays/char/char.factor | 4 + .../direct/alien/alien.factor | 4 + .../direct/bool/bool.factor | 4 + .../direct/char/char.factor | 4 + basis/specialized-arrays/direct/direct.factor | 3 + .../direct/double/double.factor | 4 + .../direct/float/float.factor | 4 + .../direct/functor/functor.factor | 35 +++++ .../specialized-arrays/direct/int/int.factor | 4 + .../direct/long/long.factor | 4 + .../direct/longlong/longlong.factor | 4 + .../direct/short/short.factor | 4 + .../direct/uchar/uchar.factor | 4 + .../direct/uint/uint.factor | 4 + .../direct/ulong/ulong.factor | 4 + .../direct/ulonglong/ulonglong.factor | 4 + .../direct/ushort/ushort.factor | 4 + basis/specialized-arrays/double/double.factor | 4 + basis/specialized-arrays/float/float.factor | 4 + .../specialized-arrays/functor/functor.factor | 61 +++++++++ basis/specialized-arrays/int/int.factor | 4 + basis/specialized-arrays/long/long.factor | 4 + .../longlong/longlong.factor | 4 + basis/specialized-arrays/short/short.factor | 4 + .../specialized-arrays-docs.factor | 37 ++++++ .../specialized-arrays-tests.factor | 11 ++ .../specialized-arrays.factor | 3 + basis/specialized-arrays/summary.txt | 1 + .../tags.txt | 0 basis/specialized-arrays/uchar/uchar.factor | 4 + basis/specialized-arrays/uint/uint.factor | 4 + basis/specialized-arrays/ulong/ulong.factor | 4 + .../ulonglong/ulonglong.factor | 4 + basis/specialized-arrays/ushort/ushort.factor | 4 + basis/specialized-vectors/alien/alien.factor | 4 + basis/specialized-vectors/authors.txt | 1 + basis/specialized-vectors/bool/bool.factor | 4 + basis/specialized-vectors/char/char.factor | 4 + .../specialized-vectors/double/double.factor | 4 + basis/specialized-vectors/float/float.factor | 4 + .../functor/functor.factor | 46 +++++++ basis/specialized-vectors/int/int.factor | 4 + basis/specialized-vectors/long/long.factor | 4 + .../longlong/longlong.factor | 4 + basis/specialized-vectors/short/short.factor | 4 + .../specialized-vectors-docs.factor | 35 +++++ .../specialized-vectors.factor | 3 + basis/specialized-vectors/summary.txt | 1 + .../tags.txt | 0 basis/specialized-vectors/uchar/uchar.factor | 4 + basis/specialized-vectors/uint/uint.factor | 4 + basis/specialized-vectors/ulong/ulong.factor | 4 + .../ulonglong/ulonglong.factor | 4 + .../specialized-vectors/ushort/ushort.factor | 4 + basis/ui/gadgets/buttons/buttons.factor | 5 +- basis/ui/render/render.factor | 9 +- basis/unix/utilities/utilities.factor | 5 +- basis/windows/com/wrapper/wrapper.factor | 5 +- basis/x11/clipboard/clipboard.factor | 7 +- basis/x11/glx/glx.factor | 4 +- basis/x11/xim/xim.factor | 6 +- core/syntax/syntax.factor | 4 +- core/words/words.factor | 2 + extra/benchmark/dawes/dawes.factor | 13 +- .../fixed-pipeline/fixed-pipeline.factor | 4 +- extra/bunny/model/model.factor | 7 +- extra/cairo/samples/samples.factor | 4 +- extra/cfdg/cfdg.factor | 4 +- extra/hello-world/deploy.factor | 17 +-- extra/jamshred/gl/gl.factor | 10 +- extra/math/blas/matrices/matrices.factor | 10 +- extra/math/blas/vectors/vectors.factor | 20 +-- extra/openal/openal.factor | 8 +- extra/opengl/shaders/shaders.factor | 5 +- extra/synth/buffers/buffers.factor | 4 +- 110 files changed, 757 insertions(+), 560 deletions(-) delete mode 100644 basis/float-arrays/float-arrays-docs.factor delete mode 100644 basis/float-arrays/float-arrays-tests.factor delete mode 100644 basis/float-arrays/float-arrays.factor delete mode 100644 basis/float-arrays/summary.txt delete mode 100644 basis/float-vectors/float-vectors-docs.factor delete mode 100644 basis/float-vectors/float-vectors-tests.factor delete mode 100644 basis/float-vectors/float-vectors.factor delete mode 100644 basis/float-vectors/summary.txt rename basis/{float-arrays => functors}/authors.txt (100%) mode change 100755 => 100644 create mode 100644 basis/functors/functors-tests.factor create mode 100644 basis/functors/functors.factor create mode 100644 basis/functors/summary.txt create mode 100644 basis/functors/tags.txt create mode 100644 basis/io/mmap/functor/functor.factor create mode 100644 basis/specialized-arrays/alien/alien.factor create mode 100644 basis/specialized-arrays/authors.txt create mode 100644 basis/specialized-arrays/bool/bool.factor create mode 100644 basis/specialized-arrays/char/char.factor create mode 100644 basis/specialized-arrays/direct/alien/alien.factor create mode 100644 basis/specialized-arrays/direct/bool/bool.factor create mode 100644 basis/specialized-arrays/direct/char/char.factor create mode 100644 basis/specialized-arrays/direct/direct.factor create mode 100644 basis/specialized-arrays/direct/double/double.factor create mode 100644 basis/specialized-arrays/direct/float/float.factor create mode 100644 basis/specialized-arrays/direct/functor/functor.factor create mode 100644 basis/specialized-arrays/direct/int/int.factor create mode 100644 basis/specialized-arrays/direct/long/long.factor create mode 100644 basis/specialized-arrays/direct/longlong/longlong.factor create mode 100644 basis/specialized-arrays/direct/short/short.factor create mode 100644 basis/specialized-arrays/direct/uchar/uchar.factor create mode 100644 basis/specialized-arrays/direct/uint/uint.factor create mode 100644 basis/specialized-arrays/direct/ulong/ulong.factor create mode 100644 basis/specialized-arrays/direct/ulonglong/ulonglong.factor create mode 100644 basis/specialized-arrays/direct/ushort/ushort.factor create mode 100644 basis/specialized-arrays/double/double.factor create mode 100644 basis/specialized-arrays/float/float.factor create mode 100644 basis/specialized-arrays/functor/functor.factor create mode 100644 basis/specialized-arrays/int/int.factor create mode 100644 basis/specialized-arrays/long/long.factor create mode 100644 basis/specialized-arrays/longlong/longlong.factor create mode 100644 basis/specialized-arrays/short/short.factor create mode 100644 basis/specialized-arrays/specialized-arrays-docs.factor create mode 100644 basis/specialized-arrays/specialized-arrays-tests.factor create mode 100644 basis/specialized-arrays/specialized-arrays.factor create mode 100644 basis/specialized-arrays/summary.txt rename basis/{float-arrays => specialized-arrays}/tags.txt (100%) create mode 100644 basis/specialized-arrays/uchar/uchar.factor create mode 100644 basis/specialized-arrays/uint/uint.factor create mode 100644 basis/specialized-arrays/ulong/ulong.factor create mode 100644 basis/specialized-arrays/ulonglong/ulonglong.factor create mode 100644 basis/specialized-arrays/ushort/ushort.factor create mode 100644 basis/specialized-vectors/alien/alien.factor create mode 100644 basis/specialized-vectors/authors.txt create mode 100644 basis/specialized-vectors/bool/bool.factor create mode 100644 basis/specialized-vectors/char/char.factor create mode 100644 basis/specialized-vectors/double/double.factor create mode 100644 basis/specialized-vectors/float/float.factor create mode 100644 basis/specialized-vectors/functor/functor.factor create mode 100644 basis/specialized-vectors/int/int.factor create mode 100644 basis/specialized-vectors/long/long.factor create mode 100644 basis/specialized-vectors/longlong/longlong.factor create mode 100644 basis/specialized-vectors/short/short.factor create mode 100644 basis/specialized-vectors/specialized-vectors-docs.factor create mode 100644 basis/specialized-vectors/specialized-vectors.factor create mode 100644 basis/specialized-vectors/summary.txt rename basis/{float-vectors => specialized-vectors}/tags.txt (100%) create mode 100644 basis/specialized-vectors/uchar/uchar.factor create mode 100644 basis/specialized-vectors/uint/uint.factor create mode 100644 basis/specialized-vectors/ulong/ulong.factor create mode 100644 basis/specialized-vectors/ulonglong/ulonglong.factor create mode 100644 basis/specialized-vectors/ushort/ushort.factor diff --git a/basis/alien/arrays/arrays-docs.factor b/basis/alien/arrays/arrays-docs.factor index 09a09cdc6f..c5efe1e030 100644 --- a/basis/alien/arrays/arrays-docs.factor +++ b/basis/alien/arrays/arrays-docs.factor @@ -1,69 +1,7 @@ IN: alien.arrays USING: help.syntax help.markup byte-arrays alien.c-types ; -ARTICLE: "c-arrays-factor" "Converting C arrays to and from Factor arrays" -"Each primitive C type has a pair of words, " { $snippet ">" { $emphasis "type" } "-array" } " and " { $snippet { $emphasis "type" } "-array>" } ", for converting an array of Factor objects to and from a " { $link byte-array } " of C values. This set of words consists of:" -{ $subsection >c-bool-array } -{ $subsection >c-char-array } -{ $subsection >c-double-array } -{ $subsection >c-float-array } -{ $subsection >c-int-array } -{ $subsection >c-long-array } -{ $subsection >c-longlong-array } -{ $subsection >c-short-array } -{ $subsection >c-uchar-array } -{ $subsection >c-uint-array } -{ $subsection >c-ulong-array } -{ $subsection >c-ulonglong-array } -{ $subsection >c-ushort-array } -{ $subsection >c-void*-array } -{ $subsection c-bool-array> } -{ $subsection c-char-array> } -{ $subsection c-double-array> } -{ $subsection c-float-array> } -{ $subsection c-int-array> } -{ $subsection c-long-array> } -{ $subsection c-longlong-array> } -{ $subsection c-short-array> } -{ $subsection c-uchar-array> } -{ $subsection c-uint-array> } -{ $subsection c-ulong-array> } -{ $subsection c-ulonglong-array> } -{ $subsection c-ushort-array> } -{ $subsection c-void*-array> } ; - -ARTICLE: "c-arrays-get/set" "Reading and writing elements in C arrays" -"Each C type has a pair of words, " { $snippet { $emphasis "type" } "-nth" } " and " { $snippet "set-" { $emphasis "type" } "-nth" } ", for reading and writing values of this type stored in an array. This set of words includes but is not limited to:" -{ $subsection char-nth } -{ $subsection set-char-nth } -{ $subsection uchar-nth } -{ $subsection set-uchar-nth } -{ $subsection short-nth } -{ $subsection set-short-nth } -{ $subsection ushort-nth } -{ $subsection set-ushort-nth } -{ $subsection int-nth } -{ $subsection set-int-nth } -{ $subsection uint-nth } -{ $subsection set-uint-nth } -{ $subsection long-nth } -{ $subsection set-long-nth } -{ $subsection ulong-nth } -{ $subsection set-ulong-nth } -{ $subsection longlong-nth } -{ $subsection set-longlong-nth } -{ $subsection ulonglong-nth } -{ $subsection set-ulonglong-nth } -{ $subsection float-nth } -{ $subsection set-float-nth } -{ $subsection double-nth } -{ $subsection set-double-nth } -{ $subsection void*-nth } -{ $subsection set-void*-nth } ; - ARTICLE: "c-arrays" "C arrays" "C arrays are allocated in the same manner as other C data; see " { $link "c-byte-arrays" } " and " { $link "malloc" } "." $nl -"C type specifiers for array types are documented in " { $link "c-types-specs" } "." -{ $subsection "c-arrays-factor" } -{ $subsection "c-arrays-get/set" } ; +"C type specifiers for array types are documented in " { $link "c-types-specs" } "." ; diff --git a/basis/alien/c-types/c-types-tests.factor b/basis/alien/c-types/c-types-tests.factor index edda9e7fdb..13ea115089 100644 --- a/basis/alien/c-types/c-types-tests.factor +++ b/basis/alien/c-types/c-types-tests.factor @@ -54,5 +54,3 @@ TYPEDEF: uchar* MyLPBYTE [ 0 B{ 1 2 3 4 } ] must-fail - -[ t ] [ { t f t } >c-bool-array { 1 0 1 } >c-int-array = ] unit-test diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor index a93c87611d..a81296f24d 100644 --- a/basis/alien/c-types/c-types.factor +++ b/basis/alien/c-types/c-types.factor @@ -19,7 +19,7 @@ reg-class size align stack-align? ; : new-c-type ( class -- type ) new - int-regs >>reg-class ; + int-regs >>reg-class ; inline : ( -- type ) \ c-type new-c-type ; @@ -172,12 +172,12 @@ M: byte-array byte-length length ; : c-getter ( name -- quot ) c-type-getter [ - [ "Cannot read struct fields with type" throw ] + [ "Cannot read struct fields with this type" throw ] ] unless* ; : c-setter ( name -- quot ) c-type-setter [ - [ "Cannot write struct fields with type" throw ] + [ "Cannot write struct fields with this type" throw ] ] unless* ; : ( n type -- array ) @@ -201,28 +201,13 @@ M: byte-array byte-length length ; : byte-array>memory ( byte-array base -- ) swap dup length memcpy ; -: (define-nth) ( word type quot -- ) +: array-accessor ( type quot -- def ) [ \ swap , [ heap-size , [ * >fixnum ] % ] [ % ] bi* - ] [ ] make define-inline ; - -: nth-word ( name vocab -- word ) - >r "-nth" append r> create ; - -: define-nth ( name vocab -- ) - dupd nth-word swap dup c-getter (define-nth) ; - -: set-nth-word ( name vocab -- word ) - >r "set-" swap "-nth" 3append r> create ; - -: define-set-nth ( name vocab -- ) - dupd set-nth-word swap dup c-setter (define-nth) ; + ] [ ] make ; : typedef ( old new -- ) c-types get set-at ; -: define-c-type ( type name vocab -- ) - >r tuck typedef r> [ define-nth ] 2keep define-set-nth ; - TUPLE: long-long-type < c-type ; : ( -- type ) @@ -240,62 +225,34 @@ M: long-long-type box-parameter ( n type -- ) M: long-long-type box-return ( type -- ) f swap box-parameter ; -: define-deref ( name vocab -- ) - >r dup CHAR: * prefix r> create - swap c-getter 0 prefix define-inline ; +: define-deref ( name -- ) + [ CHAR: * prefix "alien.c-types" create ] + [ c-getter 0 prefix ] bi + define-inline ; -: define-out ( name vocab -- ) - over [ tuck 0 ] over c-setter append swap - >r >r constructor-word r> r> prefix define-inline ; +: define-out ( name -- ) + [ "alien.c-types" constructor-word ] + [ [ [ ] curry ] [ c-setter ] bi append ] bi + define-inline ; : c-bool> ( int -- ? ) zero? not ; -: >c-array ( seq type word -- byte-array ) - [ [ dup length ] dip ] dip - [ [ execute ] 2curry each-index ] 2keep drop ; inline - -: >c-array-quot ( type vocab -- quot ) - dupd set-nth-word [ >c-array ] 2curry ; - -: to-array-word ( name vocab -- word ) - >r ">c-" swap "-array" 3append r> create ; - -: define-to-array ( type vocab -- ) - [ to-array-word ] 2keep >c-array-quot - (( array -- byte-array )) define-declared ; - -: c-array>quot ( type vocab -- quot ) - [ - \ swap , - nth-word 1quotation , - [ curry map ] % - ] [ ] make ; - -: from-array-word ( name vocab -- word ) - >r "c-" swap "-array>" 3append r> create ; - -: define-from-array ( type vocab -- ) - [ from-array-word ] 2keep c-array>quot - (( c-ptr n -- array )) define-declared ; - : define-primitive-type ( type name -- ) - "alien.c-types" - { - [ define-c-type ] - [ define-deref ] - [ define-to-array ] - [ define-from-array ] - [ define-out ] - } 2cleave ; + [ typedef ] + [ define-deref ] + [ define-out ] + tri ; : expand-constants ( c-type -- c-type' ) dup array? [ - unclip >r [ - dup word? [ - def>> { } swap with-datastack first - ] when - ] map r> prefix + unclip [ + [ + dup word? [ + def>> { } swap with-datastack first + ] when + ] map + ] dip prefix ] when ; : malloc-file-contents ( path -- alien len ) @@ -304,6 +261,17 @@ M: long-long-type box-return ( type -- ) : if-void ( type true false -- ) pick "void" = [ drop nip call ] [ nip call ] if ; inline +: primitive-types + { + "char" "uchar" + "short" "ushort" + "int" "uint" + "long" "ulong" + "longlong" "ulonglong" + "float" "double" + "void*" "bool" + } ; + [ [ alien-cell ] >>getter diff --git a/basis/alien/structs/structs.factor b/basis/alien/structs/structs.factor index ce30a2ee25..181ff98e62 100644 --- a/basis/alien/structs/structs.factor +++ b/basis/alien/structs/structs.factor @@ -34,10 +34,10 @@ M: struct-type stack-size : c-struct? ( type -- ? ) (c-type) struct-type? ; -: (define-struct) ( name vocab size align fields -- ) +: (define-struct) ( name size align fields -- ) >r [ align ] keep r> struct-type boa - -rot define-c-type ; + swap typedef ; : define-struct-early ( name vocab fields -- fields ) -rot [ rot first2 ] 2curry map ; diff --git a/basis/cocoa/views/views.factor b/basis/cocoa/views/views.factor index d03688b2be..3e7bd26965 100644 --- a/basis/cocoa/views/views.factor +++ b/basis/cocoa/views/views.factor @@ -1,8 +1,8 @@ -! Copyright (C) 2006, 2007 Slava Pestov +! Copyright (C) 2006, 2008 Slava Pestov ! See http://factorcode.org/license.txt for BSD license. -USING: alien.c-types arrays kernel math namespaces make cocoa -cocoa.messages cocoa.classes cocoa.types sequences -continuations ; +USING: specialized-arrays.int arrays kernel math namespaces make +cocoa cocoa.messages cocoa.classes cocoa.types sequences +continuations accessors ; IN: cocoa.views : NSOpenGLPFAAllRenderers 1 ; @@ -69,7 +69,7 @@ PRIVATE> NSOpenGLPFASamples , 8 , ] when 0 , - ] { } make >c-int-array + ] int-array{ } make underlying>> -> initWithAttributes: -> autorelease ; diff --git a/basis/compiler/tests/alien.factor b/basis/compiler/tests/alien.factor index d7e82402d5..114d3cdda2 100644 --- a/basis/compiler/tests/alien.factor +++ b/basis/compiler/tests/alien.factor @@ -3,7 +3,8 @@ USING: alien alien.c-types alien.syntax compiler kernel namespaces namespaces tools.test sequences stack-checker stack-checker.errors words arrays parser quotations continuations effects namespaces.private io io.streams.string -memory system threads tools.test math accessors combinators ; +memory system threads tools.test math accessors combinators +specialized-arrays.float ; FUNCTION: void ffi_test_0 ; [ ] [ ffi_test_0 ] unit-test @@ -188,7 +189,11 @@ FUNCTION: int ffi_test_12 int a int b rect c int d int e int f ; FUNCTION: float ffi_test_23 ( float[3] x, float[3] y ) ; -[ 32.0 ] [ { 1.0 2.0 3.0 } >c-float-array { 4.0 5.0 6.0 } >c-float-array ffi_test_23 ] unit-test +[ 32.0 ] [ + { 1.0 2.0 3.0 } >float-array underlying>> + { 4.0 5.0 6.0 } >float-array underlying>> + ffi_test_23 +] unit-test ! Test odd-size structs C-STRUCT: test-struct-1 { { "char" 1 } "x" } ; diff --git a/basis/compiler/tests/codegen.factor b/basis/compiler/tests/codegen.factor index a56ee55c82..2375e3da35 100644 --- a/basis/compiler/tests/codegen.factor +++ b/basis/compiler/tests/codegen.factor @@ -3,7 +3,7 @@ kernel.private math hashtables.private math.private namespaces sequences sequences.private tools.test namespaces.private slots.private sequences.private byte-arrays alien alien.accessors layouts words definitions compiler.units io -combinators vectors float-arrays ; +combinators vectors ; IN: compiler.tests ! Originally, this file did black box testing of templating diff --git a/basis/compiler/tests/spilling.factor b/basis/compiler/tests/spilling.factor index 156fdfff02..ee8c2f056a 100644 --- a/basis/compiler/tests/spilling.factor +++ b/basis/compiler/tests/spilling.factor @@ -1,5 +1,5 @@ USING: math.private kernel combinators accessors arrays -generalizations float-arrays tools.test ; +generalizations tools.test ; IN: compiler.tests : float-spill-bug ( a -- b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b b ) diff --git a/basis/compiler/tree/propagation/propagation-tests.factor b/basis/compiler/tree/propagation/propagation-tests.factor index 760ff167aa..865852e99f 100644 --- a/basis/compiler/tree/propagation/propagation-tests.factor +++ b/basis/compiler/tree/propagation/propagation-tests.factor @@ -8,7 +8,7 @@ math.functions math.private strings layouts compiler.tree.propagation.info compiler.tree.def-use compiler.tree.debugger compiler.tree.checker slots.private words hashtables classes assocs locals -float-arrays system sorting ; +specialized-arrays.double system sorting ; IN: compiler.tree.propagation.tests \ propagate must-infer @@ -588,7 +588,7 @@ MIXIN: empty-mixin [ { fixnum integer } declare bitand ] final-classes ] unit-test -[ V{ float-array } ] [ [| | F{ } ] final-classes ] unit-test +[ V{ double-array } ] [ [| | double-array{ } ] final-classes ] unit-test [ V{ t } ] [ [ netbsd unix? ] final-literals ] unit-test diff --git a/basis/db/postgresql/lib/lib.factor b/basis/db/postgresql/lib/lib.factor index 63284b28a3..0a12f4374a 100644 --- a/basis/db/postgresql/lib/lib.factor +++ b/basis/db/postgresql/lib/lib.factor @@ -5,7 +5,8 @@ quotations sequences db.postgresql.ffi alien alien.c-types db.types tools.walker ascii splitting math.parser combinators libc shuffle calendar.format byte-arrays destructors prettyprint accessors strings serialize io.encodings.binary io.encodings.utf8 -alien.strings io.streams.byte-array summary present urls ; +alien.strings io.streams.byte-array summary present urls +specialized-arrays.uint specialized-arrays.alien ; IN: db.postgresql.lib : postgresql-result-error-message ( res -- str/f ) @@ -64,7 +65,7 @@ M: postgresql-result-null summary ( obj -- str ) } case ; : param-types ( statement -- seq ) - in-params>> [ type>> type>oid ] map >c-uint-array ; + in-params>> [ type>> type>oid ] uint-array{ } map-as underlying>> ; : malloc-byte-array/length ( byte-array -- alien length ) [ malloc-byte-array &free ] [ length ] bi ; @@ -90,11 +91,11 @@ M: postgresql-result-null summary ( obj -- str ) ] 2map flip [ f f ] [ - first2 [ >c-void*-array ] [ >c-uint-array ] bi* + first2 [ >void*-array underlying>> ] [ >uint-array underlying>> ] bi* ] if-empty ; : param-formats ( statement -- seq ) - in-params>> [ type>> type>param-format ] map >c-uint-array ; + in-params>> [ type>> type>param-format ] uint-array{ } map-as underlying>> ; : do-postgresql-bound-statement ( statement -- res ) [ diff --git a/basis/float-arrays/float-arrays-docs.factor b/basis/float-arrays/float-arrays-docs.factor deleted file mode 100644 index 6c775dbd78..0000000000 --- a/basis/float-arrays/float-arrays-docs.factor +++ /dev/null @@ -1,62 +0,0 @@ -USING: arrays bit-arrays vectors strings sbufs -kernel help.markup help.syntax math ; -IN: float-arrays - -ARTICLE: "float-arrays" "Float arrays" -"Float arrays are fixed-size mutable sequences (" { $link "sequence-protocol" } ") whose elements are instances of " { $link float } ". Elements are unboxed, hence the memory usage is lower than an equivalent " { $link array } " of floats." -$nl -"Float array words are in the " { $vocab-link "float-arrays" } " vocabulary." -$nl -"Float arrays play a special role in the C library interface; they can be used to pass binary data back and forth between Factor and C. See " { $link "c-byte-arrays" } "." -$nl -"Float arrays form a class of objects." -{ $subsection float-array } -{ $subsection float-array? } -"There are several ways to construct float arrays." -{ $subsection >float-array } -{ $subsection } -"Creating a float array from several elements on the stack:" -{ $subsection 1float-array } -{ $subsection 2float-array } -{ $subsection 3float-array } -{ $subsection 4float-array } -"Float array literal syntax:" -{ $subsection POSTPONE: F{ } ; - -ABOUT: "float-arrays" - -HELP: F{ -{ $syntax "F{ elements... }" } -{ $values { "elements" "a list of real numbers" } } -{ $description "Marks the beginning of a literal float array. Literal float arrays are terminated by " { $link POSTPONE: } } "." } -{ $examples { $code "F{ 1.0 2.0 3.0 }" } } ; - -HELP: float-array -{ $description "The class of float arrays." } ; - -HELP: ( n -- float-array ) -{ $values { "n" "a non-negative integer" } { "float-array" "a new float array" } } -{ $description "Creates a new float array holding " { $snippet "n" } " floats with all elements initially set to " { $snippet "0.0" } "." } ; - -HELP: >float-array -{ $values { "seq" "a sequence" } { "float-array" float-array } } -{ $description "Outputs a freshly-allocated float array whose elements have the same floating-point values as a given sequence." } -{ $errors "Throws an error if the sequence contains elements other than real numbers." } ; - -HELP: 1float-array -{ $values { "x" object } { "array" float-array } } -{ $description "Create a new float array with one element." } ; - -{ 1array 2array 3array 4array } related-words - -HELP: 2float-array -{ $values { "x" object } { "y" object } { "array" float-array } } -{ $description "Create a new float array with two elements, with " { $snippet "x" } " appearing first." } ; - -HELP: 3float-array -{ $values { "x" object } { "y" object } { "z" object } { "array" float-array } } -{ $description "Create a new float array with three elements, with " { $snippet "x" } " appearing first." } ; - -HELP: 4float-array -{ $values { "w" object } { "x" object } { "y" object } { "z" object } { "array" float-array } } -{ $description "Create a new float array with four elements, with " { $snippet "w" } " appearing first." } ; diff --git a/basis/float-arrays/float-arrays-tests.factor b/basis/float-arrays/float-arrays-tests.factor deleted file mode 100644 index 64070b99b7..0000000000 --- a/basis/float-arrays/float-arrays-tests.factor +++ /dev/null @@ -1,12 +0,0 @@ -IN: float-arrays.tests -USING: float-arrays tools.test sequences.private ; - -[ F{ 0.0 0.0 0.0 } ] [ 3 ] unit-test - -[ F{ 1 2 3 0 0 0 } ] [ 6 F{ 1 2 3 } resize ] unit-test - -[ F{ 1 2 } ] [ 2 F{ 1 2 3 4 5 6 7 8 9 } resize ] unit-test - -[ -10 F{ } resize ] must-fail - -[ F{ 1.3 } ] [ 1.3 1float-array ] unit-test diff --git a/basis/float-arrays/float-arrays.factor b/basis/float-arrays/float-arrays.factor deleted file mode 100644 index ab3eef62a5..0000000000 --- a/basis/float-arrays/float-arrays.factor +++ /dev/null @@ -1,123 +0,0 @@ -! Copyright (C) 2007, 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: kernel kernel.private alien.accessors sequences -sequences.private math math.private byte-arrays accessors -alien.c-types parser prettyprint.backend ; -IN: float-arrays - -TUPLE: float-array -{ length array-capacity read-only } -{ underlying byte-array read-only } ; - -: ( n -- float-array ) - dup "double" float-array boa ; inline - -M: float-array clone - [ length>> ] [ underlying>> clone ] bi float-array boa ; - -M: float-array length length>> ; - -M: float-array nth-unsafe - underlying>> double-nth ; - -M: float-array set-nth-unsafe - [ >float ] 2dip underlying>> set-double-nth ; - -: >float-array ( seq -- float-array ) - T{ float-array } clone-like ; inline - -M: float-array like - drop dup float-array? [ >float-array ] unless ; - -M: float-array new-sequence - drop ; - -M: float-array equal? - over float-array? [ sequence= ] [ 2drop f ] if ; - -M: float-array resize - [ drop ] [ - [ "double" heap-size * ] [ underlying>> ] bi* - resize-byte-array - ] 2bi - float-array boa ; - -M: float-array byte-length length "double" heap-size * ; - -INSTANCE: float-array sequence - -: 1float-array ( x -- array ) - 1 [ set-first ] keep ; inline - -: 2float-array ( x y -- array ) - T{ float-array } 2sequence ; inline - -: 3float-array ( x y z -- array ) - T{ float-array } 3sequence ; inline - -: 4float-array ( w x y z -- array ) - T{ float-array } 4sequence ; inline - -: F{ \ } [ >float-array ] parse-literal ; parsing - -M: float-array pprint-delims drop \ F{ \ } ; -M: float-array >pprint-sequence ; -M: float-array pprint* pprint-object ; - -! Rice -USING: hints math.vectors arrays ; - -HINTS: vneg { float-array } { array } ; -HINTS: v*n { float-array float } { array object } ; -HINTS: n*v { float float-array } { array object } ; -HINTS: v/n { float-array float } { array object } ; -HINTS: n/v { float float-array } { object array } ; -HINTS: v+ { float-array float-array } { array array } ; -HINTS: v- { float-array float-array } { array array } ; -HINTS: v* { float-array float-array } { array array } ; -HINTS: v/ { float-array float-array } { array array } ; -HINTS: vmax { float-array float-array } { array array } ; -HINTS: vmin { float-array float-array } { array array } ; -HINTS: v. { float-array float-array } { array array } ; -HINTS: norm-sq { float-array } { array } ; -HINTS: norm { float-array } { array } ; -HINTS: normalize { float-array } { array } ; - -! More rice. Experimental, currently causes a slowdown in raytracer -! for some odd reason. - -USING: words classes.algebra compiler.tree.propagation.info ; - -{ v+ v- v* v/ vmax vmin } [ - [ - [ class>> float-array class<= ] both? - float-array object ? - ] "outputs" set-word-prop -] each - -{ n*v n/v } [ - [ - nip class>> float-array class<= float-array object ? - ] "outputs" set-word-prop -] each - -{ v*n v/n } [ - [ - drop class>> float-array class<= float-array object ? - ] "outputs" set-word-prop -] each - -{ vneg normalize } [ - [ - class>> float-array class<= float-array object ? - ] "outputs" set-word-prop -] each - -\ norm-sq [ - class>> float-array class<= float object ? -] "outputs" set-word-prop - -\ v. [ - [ class>> float-array class<= ] both? - float object ? -] "outputs" set-word-prop diff --git a/basis/float-arrays/summary.txt b/basis/float-arrays/summary.txt deleted file mode 100644 index 0eac3b0b1a..0000000000 --- a/basis/float-arrays/summary.txt +++ /dev/null @@ -1 +0,0 @@ -Efficient fixed-length floating point number arrays diff --git a/basis/float-vectors/float-vectors-docs.factor b/basis/float-vectors/float-vectors-docs.factor deleted file mode 100644 index 714c8512c1..0000000000 --- a/basis/float-vectors/float-vectors-docs.factor +++ /dev/null @@ -1,37 +0,0 @@ -USING: arrays float-arrays help.markup help.syntax kernel -combinators ; -IN: float-vectors - -ARTICLE: "float-vectors" "Float vectors" -"A float vector is a resizable mutable sequence of unsigned floats. Float vector words are found in the " { $vocab-link "float-vectors" } " vocabulary." -$nl -"Float vectors form a class:" -{ $subsection float-vector } -{ $subsection float-vector? } -"Creating float vectors:" -{ $subsection >float-vector } -{ $subsection } -"Literal syntax:" -{ $subsection POSTPONE: FV{ } -"If you don't care about initial capacity, a more elegant way to create a new float vector is to write:" -{ $code "FV{ } clone" } ; - -ABOUT: "float-vectors" - -HELP: float-vector -{ $description "The class of resizable float vectors. See " { $link "float-vectors" } " for information." } ; - -HELP: -{ $values { "n" "a positive integer specifying initial capacity" } { "float-vector" float-vector } } -{ $description "Creates a new float vector that can hold " { $snippet "n" } " floats before resizing." } ; - -HELP: >float-vector -{ $values { "seq" "a sequence" } { "float-vector" float-vector } } -{ $description "Outputs a freshly-allocated float vector with the same elements as a given sequence." } -{ $errors "Throws an error if the sequence contains elements other than real numbers." } ; - -HELP: FV{ -{ $syntax "FV{ elements... }" } -{ $values { "elements" "a list of real numbers" } } -{ $description "Marks the beginning of a literal float vector. Literal float vectors are terminated by " { $link POSTPONE: } } "." } -{ $examples { $code "FV{ 1.0 2.0 3.0 }" } } ; diff --git a/basis/float-vectors/float-vectors-tests.factor b/basis/float-vectors/float-vectors-tests.factor deleted file mode 100644 index 1483b269e0..0000000000 --- a/basis/float-vectors/float-vectors-tests.factor +++ /dev/null @@ -1,14 +0,0 @@ -USING: tools.test float-vectors vectors sequences kernel math ; -IN: float-vectors.tests - -[ 0 ] [ 123 length ] unit-test - -: do-it - 12345 [ >float over push ] each ; - -[ t ] [ - 3 do-it - 3 do-it sequence= -] unit-test - -[ t ] [ FV{ } float-vector? ] unit-test diff --git a/basis/float-vectors/float-vectors.factor b/basis/float-vectors/float-vectors.factor deleted file mode 100644 index 8e93582f04..0000000000 --- a/basis/float-vectors/float-vectors.factor +++ /dev/null @@ -1,38 +0,0 @@ -! Copyright (C) 2008 Slava Pestov. -! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel kernel.private math sequences -sequences.private growable float-arrays prettyprint.backend -parser accessors ; -IN: float-vectors - -TUPLE: float-vector -{ underlying float-array initial: F{ } } -{ length array-capacity } ; - -: ( n -- float-vector ) - 0 float-vector boa ; inline - -: >float-vector ( seq -- float-vector ) - T{ float-vector f F{ } 0 } clone-like ; - -M: float-vector like - drop dup float-vector? [ - dup float-array? - [ dup length float-vector boa ] [ >float-vector ] if - ] unless ; - -M: float-vector new-sequence - drop [ ] [ >fixnum ] bi float-vector boa ; - -M: float-vector equal? - over float-vector? [ sequence= ] [ 2drop f ] if ; - -M: float-array new-resizable drop ; - -INSTANCE: float-vector growable - -: FV{ \ } [ >float-vector ] parse-literal ; parsing - -M: float-vector >pprint-sequence ; -M: float-vector pprint-delims drop \ FV{ \ } ; -M: float-vector pprint* pprint-object ; diff --git a/basis/float-vectors/summary.txt b/basis/float-vectors/summary.txt deleted file mode 100644 index c476f41a6e..0000000000 --- a/basis/float-vectors/summary.txt +++ /dev/null @@ -1 +0,0 @@ -Growable float arrays diff --git a/basis/float-arrays/authors.txt b/basis/functors/authors.txt old mode 100755 new mode 100644 similarity index 100% rename from basis/float-arrays/authors.txt rename to basis/functors/authors.txt diff --git a/basis/functors/functors-tests.factor b/basis/functors/functors-tests.factor new file mode 100644 index 0000000000..39923afee7 --- /dev/null +++ b/basis/functors/functors-tests.factor @@ -0,0 +1,47 @@ +IN: functors.tests +USING: functors tools.test math words kernel ; + +<< + +FUNCTOR: define-box ( T -- ) + +B DEFINES ${T}-box + DEFINES <${B}> + +WHERE + +TUPLE: B { value T } ; + +C: B + +;FUNCTOR + +\ float define-box + +>> + +{ 1 0 } [ define-box ] must-infer-as + +[ T{ float-box f 5.0 } ] [ 5.0 ] unit-test + +: twice ( word -- ) + [ execute ] [ execute ] bi ; inline +<< + +FUNCTOR: wrapper-test ( W -- ) + +WW DEFINES ${W}${W} + +WHERE + +: WW W twice ; inline + +;FUNCTOR + +\ sq wrapper-test + +>> + +\ sqsq must-infer + +[ 16 ] [ 2 sqsq ] unit-test diff --git a/basis/functors/functors.factor b/basis/functors/functors.factor new file mode 100644 index 0000000000..16f6f073f5 --- /dev/null +++ b/basis/functors/functors.factor @@ -0,0 +1,98 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: parser kernel locals.private quotations classes.tuple +classes.tuple.parser make lexer combinators generic words +interpolate namespaces sequences io.streams.string fry +classes.mixin ; +IN: functors + +: scan-param ( -- obj ) + scan-object dup special? [ literalize ] unless ; + +: define* ( word def -- ) over set-word define ; + +: `TUPLE: + scan-param parsed + scan { + { ";" [ tuple parsed f parsed ] } + { "<" [ scan-param [ parse-tuple-slots ] { } make parsed ] } + [ + [ tuple parsed ] dip + [ parse-slot-name [ parse-tuple-slots ] when ] { } + make parsed + ] + } case + \ define-tuple-class parsed ; parsing + +: `M: + scan-param parsed + scan-param parsed + \ create-method parsed + parse-definition parsed + \ define* parsed ; parsing + +: `C: + scan-param parsed + scan-param parsed + [ [ boa ] curry define* ] over push-all ; parsing + +: `: + scan-param parsed + parse-definition parsed + \ define* parsed ; parsing + +: `INSTANCE: + scan-param parsed + scan-param parsed + \ add-mixin-instance parsed ; parsing + +: `inline \ inline parsed ; parsing + +: `parsing \ parsing parsed ; parsing + +: (INTERPOLATE) ( accum quot -- accum ) + [ scan interpolate-locals ] dip + '[ _ with-string-writer @ ] parsed ; + +: IS [ search ] (INTERPOLATE) ; parsing + +: DEFINES [ in get create ] (INTERPOLATE) ; parsing + +DEFER: ;FUNCTOR delimiter + +: functor-words ( -- assoc ) + H{ + { "TUPLE:" POSTPONE: `TUPLE: } + { "M:" POSTPONE: `M: } + { "C:" POSTPONE: `C: } + { ":" POSTPONE: `: } + { "INSTANCE:" POSTPONE: `INSTANCE: } + { "inline" POSTPONE: `inline } + { "parsing" POSTPONE: `parsing } + } ; + +: push-functor-words ( -- ) + functor-words use get push ; + +: pop-functor-words ( -- ) + functor-words use get delq ; + +: parse-functor-body ( -- form ) + t in-lambda? [ + V{ } clone + push-functor-words + "WHERE" parse-bindings* \ ;FUNCTOR (parse-lambda) + parsed-lambda + pop-functor-words + >quotation + ] with-variable ; + +: (FUNCTOR:) ( -- word def ) + CREATE + parse-locals + parse-functor-body swap pop-locals + lambda-rewrite first ; + +: FUNCTOR: (FUNCTOR:) define ; parsing + +: APPLY: scan-word scan-word execute swap '[ _ execute ] each ; parsing diff --git a/basis/functors/summary.txt b/basis/functors/summary.txt new file mode 100644 index 0000000000..d95b366bc1 --- /dev/null +++ b/basis/functors/summary.txt @@ -0,0 +1 @@ +First-class syntax diff --git a/basis/functors/tags.txt b/basis/functors/tags.txt new file mode 100644 index 0000000000..f4274299b1 --- /dev/null +++ b/basis/functors/tags.txt @@ -0,0 +1 @@ +extensions diff --git a/basis/io/mmap/functor/functor.factor b/basis/io/mmap/functor/functor.factor new file mode 100644 index 0000000000..b60a1c0bf2 --- /dev/null +++ b/basis/io/mmap/functor/functor.factor @@ -0,0 +1,22 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: functors accessors alien.c-types math kernel words ; +IN: io.mmap.functor + +SLOT: address +SLOT: length + +: mapped-file>direct ( mapped-file type -- alien length ) + [ [ address>> ] [ length>> ] bi ] dip + heap-size [ 1- + ] keep /i ; + +FUNCTOR: mapped-array-functor ( T -- ) + +C DEFINES + IS + +WHERE + +: C mapped-file>direct execute ; inline + +;FUNCTOR diff --git a/basis/io/mmap/mmap.factor b/basis/io/mmap/mmap.factor index 01e7054ef1..aea6d80636 100644 --- a/basis/io/mmap/mmap.factor +++ b/basis/io/mmap/mmap.factor @@ -2,7 +2,9 @@ ! See http://factorcode.org/license.txt for BSD license. USING: continuations destructors io.backend kernel quotations sequences system alien alien.accessors accessors -sequences.private system vocabs.loader combinators ; +sequences.private system vocabs.loader combinators +specialized-arrays.direct functors alien.c-types +io.mmap.functor ; IN: io.mmap TUPLE: mapped-file address handle length disposed ; @@ -30,6 +32,8 @@ M: mapped-file dispose* ( mmap -- ) close-mapped-file ; : with-mapped-file ( path length quot -- ) >r r> with-disposal ; inline +APPLY: mapped-array-functor primitive-types + { { [ os unix? ] [ "io.unix.mmap" require ] } { [ os winnt? ] [ "io.windows.mmap" require ] } diff --git a/basis/io/unix/pipes/pipes.factor b/basis/io/unix/pipes/pipes.factor index 53c336c555..5a1f2849d4 100644 --- a/basis/io/unix/pipes/pipes.factor +++ b/basis/io/unix/pipes/pipes.factor @@ -1,11 +1,11 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: system alien.c-types kernel unix math sequences -qualified io.unix.backend io.ports ; +USING: system kernel unix math sequences qualified +io.unix.backend io.ports specialized-arrays.int ; IN: io.unix.pipes QUALIFIED: io.pipes M: unix io.pipes:(pipe) ( -- pair ) - 2 "int" - dup pipe io-error - 2 c-int-array> first2 [ init-fd ] bi@ io.pipes:pipe boa ; + 2 + dup underlying>> pipe io-error + first2 [ init-fd ] bi@ io.pipes:pipe boa ; diff --git a/basis/io/windows/launcher/launcher.factor b/basis/io/windows/launcher/launcher.factor index d1ad309dd5..fc8e4a7bc0 100644 --- a/basis/io/windows/launcher/launcher.factor +++ b/basis/io/windows/launcher/launcher.factor @@ -6,7 +6,8 @@ windows.types math windows.kernel32 namespaces make io.launcher kernel sequences windows.errors splitting system threads init strings combinators io.backend accessors concurrency.flags io.files assocs -io.files.private windows destructors ; +io.files.private windows destructors specialized-arrays.ushort +specialized-arrays.alien ; IN: io.windows.launcher TUPLE: CreateProcess-args @@ -103,7 +104,7 @@ TUPLE: CreateProcess-args over get-environment [ swap % "=" % % "\0" % ] assoc-each "\0" % - ] "" make >c-ushort-array + ] ushort-array{ } make underlying>> >>lpEnvironment ] when ; @@ -157,8 +158,8 @@ M: windows kill-process* ( handle -- ) M: windows wait-for-processes ( -- ? ) processes get keys dup - [ handle>> PROCESS_INFORMATION-hProcess ] map - dup length swap >c-void*-array 0 0 + [ handle>> PROCESS_INFORMATION-hProcess ] void*-array{ } map-as + [ length ] [ underlying>> ] bi 0 0 WaitForMultipleObjects dup HEX: ffffffff = [ win32-error ] when dup WAIT_TIMEOUT = [ 2drop t ] [ swap nth process-exited f ] if ; diff --git a/basis/io/windows/nt/monitors/monitors.factor b/basis/io/windows/nt/monitors/monitors.factor index 2680b40089..3db726e06a 100644 --- a/basis/io/windows/nt/monitors/monitors.factor +++ b/basis/io/windows/nt/monitors/monitors.factor @@ -50,7 +50,7 @@ TUPLE: win32-monitor < monitor port ; } case 1array ; : memory>u16-string ( alien len -- string ) - [ memory>byte-array ] keep 2/ c-ushort-array> >string ; + memory>byte-array utf16n decode ; : parse-notify-record ( buffer -- path changed ) [ diff --git a/basis/locals/locals-tests.factor b/basis/locals/locals-tests.factor index 003ef459e3..4bb4b9e052 100644 --- a/basis/locals/locals-tests.factor +++ b/basis/locals/locals-tests.factor @@ -346,7 +346,6 @@ M:: sequence method-with-locals ( a -- y ) a reverse ; { 3 1 } [| from to seq | T{ slice f from to seq } ] must-infer-as - :: literal-identity-test ( -- a b ) { } V{ } ; diff --git a/basis/locals/locals.factor b/basis/locals/locals.factor index e74ecf3dc9..e06f714b56 100644 --- a/basis/locals/locals.factor +++ b/basis/locals/locals.factor @@ -274,29 +274,26 @@ SYMBOL: in-lambda? "|" parse-tokens make-locals dup push-locals \ ] (parse-lambda) ; -: parse-binding ( -- pair/f ) - scan dup "|" = [ +: parse-binding ( end -- pair/f ) + scan tuck = [ drop f ] [ - scan { - { "[" [ \ ] parse-until >quotation ] } - { "[|" [ parse-lambda ] } - } case 2array + scan-object 2array ] if ; -: (parse-bindings) ( -- ) - parse-binding [ +: (parse-bindings) ( end -- ) + dup parse-binding dup [ first2 >r make-local r> 2array , (parse-bindings) - ] when* ; + ] [ 2drop ] if ; -: parse-bindings ( -- bindings vars ) +: parse-bindings ( end -- bindings vars ) [ [ (parse-bindings) ] H{ } make-assoc dup push-locals ] { } make swap ; -: parse-bindings* ( -- words assoc ) +: parse-bindings* ( end -- words assoc ) [ [ namespace push-locals @@ -305,13 +302,13 @@ SYMBOL: in-lambda? ] { } make-assoc ] { } make swap ; -: (parse-wbindings) ( -- ) - parse-binding [ +: (parse-wbindings) ( end -- ) + dup parse-binding dup [ first2 >r make-local-word r> 2array , (parse-wbindings) - ] when* ; + ] [ 2drop ] if ; -: parse-wbindings ( -- bindings vars ) +: parse-wbindings ( end -- bindings vars ) [ [ (parse-wbindings) ] H{ } make-assoc dup push-locals @@ -334,12 +331,12 @@ M: wlet local-rewrite* let-rewrite ; : parse-locals ( -- vars assoc ) - ")" parse-effect + scan "(" assert= ")" parse-effect word [ over "declared-effect" set-word-prop ] when* in>> [ dup pair? [ first ] when ] map make-locals dup push-locals ; : parse-locals-definition ( word -- word quot ) - scan "(" assert= parse-locals \ ; (parse-lambda) + parse-locals \ ; (parse-lambda) 2dup "lambda" set-word-prop lambda-rewrite first ; @@ -357,15 +354,15 @@ PRIVATE> : [| parse-lambda parsed-lambda ; parsing : [let - scan "|" assert= parse-bindings + scan "|" assert= "|" parse-bindings \ ] (parse-lambda) parsed-lambda ; parsing : [let* - scan "|" assert= parse-bindings* + scan "|" assert= "|" parse-bindings* \ ] (parse-lambda) parsed-lambda ; parsing : [wlet - scan "|" assert= parse-wbindings + scan "|" assert= "|" parse-wbindings \ ] (parse-lambda) parsed-lambda ; parsing : :: (::) define ; parsing diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index 64326f340e..300e4f0a71 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -6,7 +6,8 @@ USING: alien alien.c-types continuations kernel libc math macros namespaces math.vectors math.constants math.functions math.parser opengl.gl opengl.glu combinators arrays sequences splitting words byte-arrays assocs colors accessors -generalizations locals memoize ; +generalizations locals specialized-arrays.float +specialized-arrays.uint ; IN: opengl : color>raw ( object -- r g b a ) @@ -52,7 +53,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) glMatrixMode glPopMatrix ; inline : gl-material ( face pname params -- ) - >c-float-array glMaterialfv ; + >float-array underlying>> glMaterialfv ; : gl-vertex-pointer ( seq -- ) [ 2 GL_FLOAT 0 ] dip glVertexPointer ; inline @@ -64,7 +65,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) [ 2 GL_FLOAT 0 ] dip glTexCoordPointer ; inline : line-vertices ( a b -- ) - append >c-float-array gl-vertex-pointer ; + append >float-array underlying>> gl-vertex-pointer ; : gl-line ( a b -- ) line-vertices GL_LINES 0 2 glDrawArrays ; @@ -75,7 +76,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) [ first 1- 1 ] [ [ first 1- ] [ second ] bi ] [ second 0 swap ] - } cleave 8 narray >c-float-array ; + } cleave 8 float-array{ } nsequence underlying>> ; : rect-vertices ( dim -- ) (rect-vertices) gl-vertex-pointer ; @@ -92,7 +93,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) [ first 0 ] [ first2 ] [ second 0 swap ] - } cleave 8 narray >c-float-array ; + } cleave 8 float-array{ } nsequence underlying>> ; : fill-rect-vertices ( dim -- ) (fill-rect-vertices) gl-vertex-pointer ; @@ -119,7 +120,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) circle-steps unit-circle adjust-points scale-points ; : circle-vertices ( loc dim steps -- vertices ) - circle-points concat >c-float-array ; + circle-points concat >float-array underlying>> ; : (gen-gl-object) ( quot -- id ) >r 1 0 r> keep *uint ; inline @@ -160,7 +161,7 @@ MACRO: all-enabled-client-state ( seq quot -- ) glActiveTexture swap glBindTexture gl-error ; : (set-draw-buffers) ( buffers -- ) - dup length swap >c-uint-array glDrawBuffers ; + [ length ] [ >uint-array underlying>> ] bi glDrawBuffers ; MACRO: set-draw-buffers ( buffers -- ) words>values [ (set-draw-buffers) ] curry ; @@ -203,11 +204,8 @@ TUPLE: sprite loc dim dim2 dlist texture ; : gl-translate ( point -- ) first2 0.0 glTranslated ; -MEMO: (rect-texture-coords) ( -- seq ) - { 0 0 1 0 1 1 0 1 } >c-float-array ; - : rect-texture-coords ( -- ) - (rect-texture-coords) gl-texture-coord-pointer ; + float-array{ 0 0 1 0 1 1 0 1 } gl-texture-coord-pointer ; : draw-sprite ( sprite -- ) GL_TEXTURE_COORD_ARRAY [ diff --git a/basis/serialize/serialize-tests.factor b/basis/serialize/serialize-tests.factor index 3a75ad65b6..c02fbe2b0b 100644 --- a/basis/serialize/serialize-tests.factor +++ b/basis/serialize/serialize-tests.factor @@ -2,9 +2,9 @@ ! See http://factorcode.org/license.txt for BSD license. ! USING: tools.test kernel serialize io io.streams.byte-array math -alien arrays byte-arrays bit-arrays float-arrays sequences math -prettyprint parser classes math.constants io.encodings.binary -random assocs ; +alien arrays byte-arrays bit-arrays specialized-arrays.double +sequences math prettyprint parser classes math.constants +io.encodings.binary random assocs ; IN: serialize.tests : test-serialize-cell @@ -48,7 +48,7 @@ C: serialize-test T{ serialize-test f "a" 2 } B{ 50 13 55 64 1 } ?{ t f t f f t f } - F{ 1.0 3.0 4.0 1.0 2.35 0.33 } + double-array{ 1.0 3.0 4.0 1.0 2.35 0.33 } << 1 [ 2 ] curry parsed >> { { "a" "bc" } { "de" "fg" } } H{ { "a" "bc" } { "de" "fg" } } diff --git a/basis/specialized-arrays/alien/alien.factor b/basis/specialized-arrays/alien/alien.factor new file mode 100644 index 0000000000..465d1665f9 --- /dev/null +++ b/basis/specialized-arrays/alien/alien.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.alien + +<< "void*" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/authors.txt b/basis/specialized-arrays/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/basis/specialized-arrays/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/basis/specialized-arrays/bool/bool.factor b/basis/specialized-arrays/bool/bool.factor new file mode 100644 index 0000000000..759ee91abc --- /dev/null +++ b/basis/specialized-arrays/bool/bool.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.bool + +<< "bool" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/char/char.factor b/basis/specialized-arrays/char/char.factor new file mode 100644 index 0000000000..cdf78eeef8 --- /dev/null +++ b/basis/specialized-arrays/char/char.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.char + +<< "char" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/alien/alien.factor b/basis/specialized-arrays/direct/alien/alien.factor new file mode 100644 index 0000000000..b1dee2e1d1 --- /dev/null +++ b/basis/specialized-arrays/direct/alien/alien.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.alien + +<< "void*" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/bool/bool.factor b/basis/specialized-arrays/direct/bool/bool.factor new file mode 100644 index 0000000000..139723d39a --- /dev/null +++ b/basis/specialized-arrays/direct/bool/bool.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.bool + +<< "bool" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/char/char.factor b/basis/specialized-arrays/direct/char/char.factor new file mode 100644 index 0000000000..cf4e3617ed --- /dev/null +++ b/basis/specialized-arrays/direct/char/char.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.char + +<< "char" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/direct.factor b/basis/specialized-arrays/direct/direct.factor new file mode 100644 index 0000000000..7c15c66415 --- /dev/null +++ b/basis/specialized-arrays/direct/direct.factor @@ -0,0 +1,3 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +IN: specialized-arrays.direct diff --git a/basis/specialized-arrays/direct/double/double.factor b/basis/specialized-arrays/direct/double/double.factor new file mode 100644 index 0000000000..423ceba688 --- /dev/null +++ b/basis/specialized-arrays/direct/double/double.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.double + +<< "double" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/float/float.factor b/basis/specialized-arrays/direct/float/float.factor new file mode 100644 index 0000000000..91a117ada5 --- /dev/null +++ b/basis/specialized-arrays/direct/float/float.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.float + +<< "float" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/functor/functor.factor b/basis/specialized-arrays/direct/functor/functor.factor new file mode 100644 index 0000000000..dd5164b8b4 --- /dev/null +++ b/basis/specialized-arrays/direct/functor/functor.factor @@ -0,0 +1,35 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: functors sequences sequences.private kernel words classes +math alien alien.c-types byte-arrays accessors +specialized-arrays ; +IN: specialized-arrays.direct.functor + +FUNCTOR: define-direct-array ( T -- ) + +A' IS ${T}-array +>A' IS >${T}-array + IS <${A'}> + +A DEFINES direct-${T}-array + DEFINES <${A}> + +NTH [ T dup c-getter array-accessor ] +SET-NTH [ T dup c-setter array-accessor ] + +WHERE + +TUPLE: A +{ underlying alien read-only } +{ length fixnum read-only } ; + +: A boa ; inline +M: A length length>> ; +M: A nth-unsafe underlying>> NTH call ; +M: A set-nth-unsafe underlying>> SET-NTH call ; +M: A like drop dup A instance? [ >A' execute ] unless ; +M: A new-sequence drop execute ; + +INSTANCE: A sequence + +;FUNCTOR diff --git a/basis/specialized-arrays/direct/int/int.factor b/basis/specialized-arrays/direct/int/int.factor new file mode 100644 index 0000000000..33410a7ad8 --- /dev/null +++ b/basis/specialized-arrays/direct/int/int.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.int + +<< "int" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/long/long.factor b/basis/specialized-arrays/direct/long/long.factor new file mode 100644 index 0000000000..ee2ed7188a --- /dev/null +++ b/basis/specialized-arrays/direct/long/long.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.long + +<< "long" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/longlong/longlong.factor b/basis/specialized-arrays/direct/longlong/longlong.factor new file mode 100644 index 0000000000..12306ff884 --- /dev/null +++ b/basis/specialized-arrays/direct/longlong/longlong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.longlong + +<< "longlong" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/short/short.factor b/basis/specialized-arrays/direct/short/short.factor new file mode 100644 index 0000000000..375696ccda --- /dev/null +++ b/basis/specialized-arrays/direct/short/short.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.short + +<< "short" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/uchar/uchar.factor b/basis/specialized-arrays/direct/uchar/uchar.factor new file mode 100644 index 0000000000..d0a8f0ddd1 --- /dev/null +++ b/basis/specialized-arrays/direct/uchar/uchar.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.uchar + +<< "uchar" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/uint/uint.factor b/basis/specialized-arrays/direct/uint/uint.factor new file mode 100644 index 0000000000..18b3b630bb --- /dev/null +++ b/basis/specialized-arrays/direct/uint/uint.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.uint + +<< "uint" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/ulong/ulong.factor b/basis/specialized-arrays/direct/ulong/ulong.factor new file mode 100644 index 0000000000..89e6f29e74 --- /dev/null +++ b/basis/specialized-arrays/direct/ulong/ulong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.ulong + +<< "ulong" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/ulonglong/ulonglong.factor b/basis/specialized-arrays/direct/ulonglong/ulonglong.factor new file mode 100644 index 0000000000..8cb6af20e5 --- /dev/null +++ b/basis/specialized-arrays/direct/ulonglong/ulonglong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.ulonglong + +<< "ulonglong" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/direct/ushort/ushort.factor b/basis/specialized-arrays/direct/ushort/ushort.factor new file mode 100644 index 0000000000..09f66b989d --- /dev/null +++ b/basis/specialized-arrays/direct/ushort/ushort.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.direct.functor +IN: specialized-arrays.direct.ushort + +<< "ushort" define-direct-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/double/double.factor b/basis/specialized-arrays/double/double.factor new file mode 100644 index 0000000000..b7fc3a8143 --- /dev/null +++ b/basis/specialized-arrays/double/double.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.double + +<< "double" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/float/float.factor b/basis/specialized-arrays/float/float.factor new file mode 100644 index 0000000000..5d9da66739 --- /dev/null +++ b/basis/specialized-arrays/float/float.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.float + +<< "float" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/functor/functor.factor b/basis/specialized-arrays/functor/functor.factor new file mode 100644 index 0000000000..8536e6f81a --- /dev/null +++ b/basis/specialized-arrays/functor/functor.factor @@ -0,0 +1,61 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: functors sequences sequences.private +prettyprint.backend kernel words classes math parser +alien.c-types byte-arrays accessors ; +IN: specialized-arrays.functor + +FUNCTOR: define-array ( T -- ) + +A DEFINES ${T}-array + DEFINES <${A}> +>A DEFINES >${A} +A{ DEFINES ${A}{ + +NTH [ T dup c-getter array-accessor ] +SET-NTH [ T dup c-setter array-accessor ] + +WHERE + +TUPLE: A +{ length array-capacity read-only } +{ underlying byte-array read-only } ; + +: dup T A boa ; inline + +M: A clone [ length>> ] [ underlying>> clone ] bi A boa ; + +M: A length length>> ; + +M: A nth-unsafe underlying>> NTH call ; + +M: A set-nth-unsafe underlying>> SET-NTH call ; + +: >A A new clone-like ; inline + +M: A like drop dup A instance? [ >A execute ] unless ; + +M: A new-sequence drop execute ; + +M: A equal? over A instance? [ sequence= ] [ 2drop f ] if ; + +M: A resize + [ drop ] [ + [ T heap-size * ] [ underlying>> ] bi* + resize-byte-array + ] 2bi + A boa ; + +M: A byte-length underlying>> length ; + +M: A pprint-delims drop A{ \ } ; + +M: A >pprint-sequence ; + +M: A pprint* pprint-object ; + +: A{ \ } [ >A execute ] parse-literal ; parsing + +INSTANCE: A sequence + +;FUNCTOR diff --git a/basis/specialized-arrays/int/int.factor b/basis/specialized-arrays/int/int.factor new file mode 100644 index 0000000000..37f4b59c80 --- /dev/null +++ b/basis/specialized-arrays/int/int.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.int + +<< "int" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/long/long.factor b/basis/specialized-arrays/long/long.factor new file mode 100644 index 0000000000..2cba6424eb --- /dev/null +++ b/basis/specialized-arrays/long/long.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.long + +<< "long" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/longlong/longlong.factor b/basis/specialized-arrays/longlong/longlong.factor new file mode 100644 index 0000000000..195dd78f7b --- /dev/null +++ b/basis/specialized-arrays/longlong/longlong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.longlong + +<< "longlong" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/short/short.factor b/basis/specialized-arrays/short/short.factor new file mode 100644 index 0000000000..3891462159 --- /dev/null +++ b/basis/specialized-arrays/short/short.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.short + +<< "short" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/specialized-arrays-docs.factor b/basis/specialized-arrays/specialized-arrays-docs.factor new file mode 100644 index 0000000000..54cb5d1cf5 --- /dev/null +++ b/basis/specialized-arrays/specialized-arrays-docs.factor @@ -0,0 +1,37 @@ +USING: help.markup help.syntax byte-arrays ; +IN: specialized-arrays + +ARTICLE: "specialized-arrays" "Specialized arrays" +"The " { $vocab-link "specialized-arrays" } " vocabulary implements fixed-length sequence types for storing machine values in a space-efficient manner without boxing." +$nl +"For each primitive C type " { $snippet "T" } ", a set of words are defined:" +{ $table + { { $snippet "T-array" } { "The class of arrays with elements of type " { $snippet "T" } } } + { { $snippet "" } { "Constructor for arrays with elements of type " { $snippet "T" } "; stack effect " { $snippet "( len -- array )" } } } + { { $snippet ">T-array" } { "Converts a sequence into a specialized array of type " { $snippet "T" } "; stack effect " { $snippet "( seq -- array )" } } } + { { $snippet "T-array{" } { "Literal syntax, consists of a series of values terminated by " { $snippet "}" } } } +} +"Each specialized array has a " { $slot "underlying" } " slot holding a " { $link byte-array } " with the raw data. This data can be passed to C functions." +$nl +"The primitive C types for which specialized arrays exist:" +{ $list + { $snippet "char" } + { $snippet "uchar" } + { $snippet "short" } + { $snippet "ushort" } + { $snippet "int" } + { $snippet "uint" } + { $snippet "long" } + { $snippet "ulong" } + { $snippet "longlong" } + { $snippet "ulonglong" } + { $snippet "float" } + { $snippet "double" } + { $snippet "void*" } + { $snippet "bool" } +} +"Specialized arrays are generated with a functor in the " { $vocab-link "specialized-arrays.functor" } " vocabulary." +$nl +"The " { $vocab-link "specialized-vectors" } " vocabulary provides resizable versions of the above." ; + +ABOUT: "specialized-arrays" diff --git a/basis/specialized-arrays/specialized-arrays-tests.factor b/basis/specialized-arrays/specialized-arrays-tests.factor new file mode 100644 index 0000000000..5810085d47 --- /dev/null +++ b/basis/specialized-arrays/specialized-arrays-tests.factor @@ -0,0 +1,11 @@ +IN: specialized-arrays.tests +USING: tools.test specialized-arrays sequences +specialized-arrays.int speicalized-arrays.bool ; + +[ t ] [ { 1 2 3 } >int-array int-array? ] unit-test + +[ t ] [ int-array{ 1 2 3 } int-array? ] unit-test + +[ 2 ] [ int-array{ 1 2 3 } second ] unit-test + +[ t ] [ { t f t } >bool-array underlying>> { 1 0 1 } >int-array underlying>> = ] unit-test diff --git a/basis/specialized-arrays/specialized-arrays.factor b/basis/specialized-arrays/specialized-arrays.factor new file mode 100644 index 0000000000..631d28ddd9 --- /dev/null +++ b/basis/specialized-arrays/specialized-arrays.factor @@ -0,0 +1,3 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +IN: specialized-arrays diff --git a/basis/specialized-arrays/summary.txt b/basis/specialized-arrays/summary.txt new file mode 100644 index 0000000000..6191766134 --- /dev/null +++ b/basis/specialized-arrays/summary.txt @@ -0,0 +1 @@ +Arrays of unboxed primitive C types diff --git a/basis/float-arrays/tags.txt b/basis/specialized-arrays/tags.txt similarity index 100% rename from basis/float-arrays/tags.txt rename to basis/specialized-arrays/tags.txt diff --git a/basis/specialized-arrays/uchar/uchar.factor b/basis/specialized-arrays/uchar/uchar.factor new file mode 100644 index 0000000000..c6ed4f3ab6 --- /dev/null +++ b/basis/specialized-arrays/uchar/uchar.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.uchar + +<< "uchar" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/uint/uint.factor b/basis/specialized-arrays/uint/uint.factor new file mode 100644 index 0000000000..1534a3d158 --- /dev/null +++ b/basis/specialized-arrays/uint/uint.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.uint + +<< "uint" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/ulong/ulong.factor b/basis/specialized-arrays/ulong/ulong.factor new file mode 100644 index 0000000000..27dc1295b3 --- /dev/null +++ b/basis/specialized-arrays/ulong/ulong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.ulong + +<< "ulong" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/ulonglong/ulonglong.factor b/basis/specialized-arrays/ulonglong/ulonglong.factor new file mode 100644 index 0000000000..cbb2b3cf9d --- /dev/null +++ b/basis/specialized-arrays/ulonglong/ulonglong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.ulonglong + +<< "ulonglong" define-array >> \ No newline at end of file diff --git a/basis/specialized-arrays/ushort/ushort.factor b/basis/specialized-arrays/ushort/ushort.factor new file mode 100644 index 0000000000..e0989aa9d4 --- /dev/null +++ b/basis/specialized-arrays/ushort/ushort.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-arrays.ushort + +<< "ushort" define-array >> \ No newline at end of file diff --git a/basis/specialized-vectors/alien/alien.factor b/basis/specialized-vectors/alien/alien.factor new file mode 100644 index 0000000000..e86f9f670f --- /dev/null +++ b/basis/specialized-vectors/alien/alien.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.alien + +<< "void*" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/authors.txt b/basis/specialized-vectors/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/basis/specialized-vectors/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/basis/specialized-vectors/bool/bool.factor b/basis/specialized-vectors/bool/bool.factor new file mode 100644 index 0000000000..3270c1d987 --- /dev/null +++ b/basis/specialized-vectors/bool/bool.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.bool + +<< "bool" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/char/char.factor b/basis/specialized-vectors/char/char.factor new file mode 100644 index 0000000000..2f0e2f0f3f --- /dev/null +++ b/basis/specialized-vectors/char/char.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.char + +<< "char" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/double/double.factor b/basis/specialized-vectors/double/double.factor new file mode 100644 index 0000000000..b2ca65b4be --- /dev/null +++ b/basis/specialized-vectors/double/double.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.double + +<< "double" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/float/float.factor b/basis/specialized-vectors/float/float.factor new file mode 100644 index 0000000000..aab6b7c048 --- /dev/null +++ b/basis/specialized-vectors/float/float.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.float + +<< "float" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/functor/functor.factor b/basis/specialized-vectors/functor/functor.factor new file mode 100644 index 0000000000..cf82f0dc30 --- /dev/null +++ b/basis/specialized-vectors/functor/functor.factor @@ -0,0 +1,46 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: functors sequences sequences.private growable +prettyprint.backend kernel words classes math parser ; +IN: specialized-vectors.functor + +FUNCTOR: define-vector ( T -- ) + +A IS ${T}-array + IS + +V DEFINES ${T}-vector + DEFINES <${V}> +>V DEFINES >${V} +V{ DEFINES ${V}{ + +WHERE + +TUPLE: V { underlying A } { length array-capacity } ; + +: execute 0 V boa ; inline + +M: V like + drop dup V instance? [ + dup A instance? [ dup length V boa ] [ >V execute ] if + ] unless ; + +M: V new-sequence drop [ execute ] [ >fixnum ] bi V boa ; + +M: A new-resizable drop execute ; + +M: V equal? over V instance? [ sequence= ] [ 2drop f ] if ; + +: >V V new clone-like ; inline + +M: V pprint-delims drop V{ \ } ; + +M: V >pprint-sequence ; + +M: V pprint* pprint-object ; + +: V{ [ >V execute ] parse-literal ; parsing + +INSTANCE: V growable + +;FUNCTOR diff --git a/basis/specialized-vectors/int/int.factor b/basis/specialized-vectors/int/int.factor new file mode 100644 index 0000000000..b02ec25073 --- /dev/null +++ b/basis/specialized-vectors/int/int.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.int + +<< "int" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/long/long.factor b/basis/specialized-vectors/long/long.factor new file mode 100644 index 0000000000..0f80bc3890 --- /dev/null +++ b/basis/specialized-vectors/long/long.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.long + +<< "long" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/longlong/longlong.factor b/basis/specialized-vectors/longlong/longlong.factor new file mode 100644 index 0000000000..78c86eb375 --- /dev/null +++ b/basis/specialized-vectors/longlong/longlong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.longlong + +<< "longlong" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/short/short.factor b/basis/specialized-vectors/short/short.factor new file mode 100644 index 0000000000..b6d150b91b --- /dev/null +++ b/basis/specialized-vectors/short/short.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.short + +<< "short" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/specialized-vectors-docs.factor b/basis/specialized-vectors/specialized-vectors-docs.factor new file mode 100644 index 0000000000..5c0a15cb75 --- /dev/null +++ b/basis/specialized-vectors/specialized-vectors-docs.factor @@ -0,0 +1,35 @@ +USING: help.markup help.syntax byte-vectors ; +IN: specialized-vectors + +ARTICLE: "specialized-vectors" "Specialized vectors" +"The " { $vocab-link "specialized-vectors" } " vocabulary implements resizable sequence types for storing machine values in a space-efficient manner without boxing." +$nl +"For each primitive C type " { $snippet "T" } ", a set of words are defined:" +{ $table + { { $snippet "T-vector" } { "The class of vectors with elements of type " { $snippet "T" } } } + { { $snippet "" } { "Constructor for vectors with elements of type " { $snippet "T" } "; stack effect " { $snippet "( len -- vector )" } } } + { { $snippet ">T-vector" } { "Converts a sequence into a specialized vector of type " { $snippet "T" } "; stack effect " { $snippet "( seq -- vector )" } } } + { { $snippet "T-vector{" } { "Literal syntax, consists of a series of values terminated by " { $snippet "}" } } } +} +"The primitive C types for which specialized vectors exist:" +{ $list + { $snippet "char" } + { $snippet "uchar" } + { $snippet "short" } + { $snippet "ushort" } + { $snippet "int" } + { $snippet "uint" } + { $snippet "long" } + { $snippet "ulong" } + { $snippet "longlong" } + { $snippet "ulonglong" } + { $snippet "float" } + { $snippet "double" } + { $snippet "void*" } + { $snippet "bool" } +} +"Specialized vectors are generated with a functor in the " { $vocab-link "specialized-vectors.functor" } " vocabulary." +$nl +"The " { $vocab-link "specialized-arrays" } " vocabulary provides fixed-length versions of the above." ; + +ABOUT: "specialized-vectors" diff --git a/basis/specialized-vectors/specialized-vectors.factor b/basis/specialized-vectors/specialized-vectors.factor new file mode 100644 index 0000000000..5df602c78d --- /dev/null +++ b/basis/specialized-vectors/specialized-vectors.factor @@ -0,0 +1,3 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +IN: specialized-vectors diff --git a/basis/specialized-vectors/summary.txt b/basis/specialized-vectors/summary.txt new file mode 100644 index 0000000000..9df7115d02 --- /dev/null +++ b/basis/specialized-vectors/summary.txt @@ -0,0 +1 @@ +Vectors of unboxed primitive C types diff --git a/basis/float-vectors/tags.txt b/basis/specialized-vectors/tags.txt similarity index 100% rename from basis/float-vectors/tags.txt rename to basis/specialized-vectors/tags.txt diff --git a/basis/specialized-vectors/uchar/uchar.factor b/basis/specialized-vectors/uchar/uchar.factor new file mode 100644 index 0000000000..245d4b3e45 --- /dev/null +++ b/basis/specialized-vectors/uchar/uchar.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.uchar + +<< "uchar" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/uint/uint.factor b/basis/specialized-vectors/uint/uint.factor new file mode 100644 index 0000000000..cb00880aff --- /dev/null +++ b/basis/specialized-vectors/uint/uint.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.uint + +<< "uint" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/ulong/ulong.factor b/basis/specialized-vectors/ulong/ulong.factor new file mode 100644 index 0000000000..0c0e0d3cda --- /dev/null +++ b/basis/specialized-vectors/ulong/ulong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.ulong + +<< "ulong" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/ulonglong/ulonglong.factor b/basis/specialized-vectors/ulonglong/ulonglong.factor new file mode 100644 index 0000000000..f3cd2cd9dd --- /dev/null +++ b/basis/specialized-vectors/ulonglong/ulonglong.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.ulonglong + +<< "ulonglong" define-vector >> \ No newline at end of file diff --git a/basis/specialized-vectors/ushort/ushort.factor b/basis/specialized-vectors/ushort/ushort.factor new file mode 100644 index 0000000000..78386ffa94 --- /dev/null +++ b/basis/specialized-vectors/ushort/ushort.factor @@ -0,0 +1,4 @@ +USE: specialized-arrays.functor +IN: specialized-vector.ushort + +<< "ushort" define-vector >> \ No newline at end of file diff --git a/basis/ui/gadgets/buttons/buttons.factor b/basis/ui/gadgets/buttons/buttons.factor index 11fb69fc7d..c2fe483d35 100644 --- a/basis/ui/gadgets/buttons/buttons.factor +++ b/basis/ui/gadgets/buttons/buttons.factor @@ -5,7 +5,8 @@ strings quotations assocs combinators classes colors classes.tuple opengl opengl.gl math.vectors ui.commands ui.gadgets ui.gadgets.borders ui.gadgets.labels ui.gadgets.theme ui.gadgets.tracks ui.gadgets.packs ui.gadgets.worlds ui.gestures -ui.render math.geometry.rect locals alien.c-types ; +ui.render math.geometry.rect locals alien.c-types +specialized-arrays.float ; IN: ui.gadgets.buttons @@ -118,7 +119,7 @@ TUPLE: checkmark-paint < caching-pen color last-vertices ; } cleave 4array ; : checkmark-vertices ( dim -- vertices ) - checkmark-points concat >c-float-array ; + checkmark-points concat >float-array underlying>> ; PRIVATE> diff --git a/basis/ui/render/render.factor b/basis/ui/render/render.factor index 71304aca0b..9529e34c70 100644 --- a/basis/ui/render/render.factor +++ b/basis/ui/render/render.factor @@ -3,7 +3,7 @@ USING: accessors alien alien.c-types arrays hashtables io kernel math namespaces opengl opengl.gl opengl.glu sequences strings io.styles vectors combinators math.vectors ui.gadgets colors -math.order math.geometry.rect locals ; +math.order math.geometry.rect locals specialized-arrays.float ; IN: ui.render SYMBOL: clip @@ -140,10 +140,11 @@ TUPLE: gradient < caching-pen colors last-vertices last-colors ; direction dim v* dim over v- swap colors length dup 1- v/n [ v*n ] with map [ dup rot v+ 2array ] with map - concat concat >c-float-array ; + concat concat >float-array underlying>> ; : gradient-colors ( colors -- seq ) - [ color>raw 4array dup 2array ] map concat concat >c-float-array ; + [ color>raw 4array dup 2array ] map concat concat + >float-array underlying>> ; M: gradient recompute-pen ( gadget gradient -- ) tuck @@ -171,7 +172,7 @@ M: gradient draw-interior TUPLE: polygon color vertex-array count ; : ( color points -- polygon ) - [ concat >c-float-array ] [ length ] bi polygon boa ; + [ concat >float-array underlying>> ] [ length ] bi polygon boa ; : draw-polygon ( polygon mode -- ) swap diff --git a/basis/unix/utilities/utilities.factor b/basis/unix/utilities/utilities.factor index 1f3a6bf78a..67acd3737a 100644 --- a/basis/unix/utilities/utilities.factor +++ b/basis/unix/utilities/utilities.factor @@ -1,7 +1,8 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.strings -combinators.short-circuit fry kernel layouts sequences ; +combinators.short-circuit fry kernel layouts sequences +specialized-arrays.alien ; IN: unix.utilities : more? ( alien -- ? ) @@ -16,4 +17,4 @@ IN: unix.utilities [ ] produce nip ; : strings>alien ( strings encoding -- alien ) - '[ _ malloc-string ] map f suffix >c-void*-array ; + '[ _ malloc-string ] void*-array{ } map f suffix underlying>> ; diff --git a/basis/windows/com/wrapper/wrapper.factor b/basis/windows/com/wrapper/wrapper.factor index d376cccae2..5cb830bc66 100644 --- a/basis/windows/com/wrapper/wrapper.factor +++ b/basis/windows/com/wrapper/wrapper.factor @@ -92,9 +92,6 @@ unless [ [ (( -- alien )) define-declared ] pick slip ] with-compilation-unit ; -: byte-array>malloc ( byte-array -- alien ) - [ byte-length malloc ] [ over byte-array>memory ] bi ; - : (callback-word) ( function-name interface-name counter -- word ) [ "::" rot 3append "-callback-" ] dip number>string 3append "windows.com.wrapper.callbacks" create ; @@ -132,7 +129,7 @@ unless 1 0 rot set-ulong-nth ; : (callbacks>vtbl) ( callbacks -- vtbl ) - [ execute ] map >c-void*-array byte-array>malloc ; + [ execute ] void*-array{ } map-as underlying>> malloc-byte-array ; : (callbacks>vtbls) ( callbacks -- vtbls ) [ (callbacks>vtbl) ] map ; diff --git a/basis/x11/clipboard/clipboard.factor b/basis/x11/clipboard/clipboard.factor index 1007b47a5b..2a0a889bb9 100644 --- a/basis/x11/clipboard/clipboard.factor +++ b/basis/x11/clipboard/clipboard.factor @@ -2,7 +2,8 @@ ! See http://factorcode.org/license.txt for BSD license. USING: alien alien.c-types alien.strings alien.syntax arrays kernel math namespaces sequences io.encodings.string -io.encodings.utf8 io.encodings.ascii x11.xlib x11.constants ; +io.encodings.utf8 io.encodings.ascii x11.xlib x11.constants +specialized-arrays.int ; IN: x11.clipboard ! This code was based on by McCLIM's Backends/CLX/port.lisp @@ -50,7 +51,7 @@ TUPLE: x-clipboard atom contents ; "TARGETS" x-atom 32 PropModeReplace { "UTF8_STRING" "STRING" "TARGETS" "TIMESTAMP" - } [ x-atom ] map >c-int-array + } [ x-atom ] int-array{ } map-as underlying>> 4 XChangeProperty drop ; : set-timestamp-prop ( evt -- ) @@ -58,7 +59,7 @@ TUPLE: x-clipboard atom contents ; [ XSelectionRequestEvent-requestor ] keep [ XSelectionRequestEvent-property ] keep >r "TIMESTAMP" x-atom 32 PropModeReplace r> - XSelectionRequestEvent-time 1array >c-int-array + XSelectionRequestEvent-time 1 XChangeProperty drop ; : send-notify ( evt prop -- ) diff --git a/basis/x11/glx/glx.factor b/basis/x11/glx/glx.factor index eefb93772a..99bae97b14 100644 --- a/basis/x11/glx/glx.factor +++ b/basis/x11/glx/glx.factor @@ -3,7 +3,7 @@ ! ! based on glx.h from xfree86, and some of glxtokens.h USING: alien alien.c-types alien.syntax alien.syntax.private x11.xlib -namespaces make kernel sequences parser words ; +namespaces make kernel sequences parser words specialized-arrays.int ; IN: x11.glx LIBRARY: glx @@ -93,7 +93,7 @@ FUNCTION: void* glXGetProcAddressARB ( char* procname ) ; GLX_DOUBLEBUFFER , GLX_DEPTH_SIZE , 16 , 0 , - ] { } make >c-int-array + ] int-array{ } make underlying>> glXChooseVisual [ "Could not get a double-buffered GLX RGBA visual" throw ] unless* ; diff --git a/basis/x11/xim/xim.factor b/basis/x11/xim/xim.factor index 35e1906b2b..c91ff83493 100644 --- a/basis/x11/xim/xim.factor +++ b/basis/x11/xim/xim.factor @@ -38,17 +38,17 @@ SYMBOL: keybuf SYMBOL: keysym : prepare-lookup ( -- ) - buf-size "uint" keybuf set + buf-size keybuf set 0 keysym set ; : finish-lookup ( len -- string keysym ) - keybuf get swap c-uint-array> >string + keybuf get swap 2 * head utf16n decode keysym get *KeySym ; : lookup-string ( event xic -- string keysym ) [ prepare-lookup - swap keybuf get buf-size keysym get 0 + swap keybuf get underlying>> buf-size keysym get 0 XwcLookupString finish-lookup ] with-scope ; diff --git a/core/syntax/syntax.factor b/core/syntax/syntax.factor index 105bdc325f..b27bab9b25 100644 --- a/core/syntax/syntax.factor +++ b/core/syntax/syntax.factor @@ -23,7 +23,7 @@ IN: bootstrap.syntax "syntax" lookup t "delimiter" set-word-prop ; : define-syntax ( name quot -- ) - >r "syntax" lookup dup r> define t "parsing" set-word-prop ; + >r "syntax" lookup dup r> define make-parsing ; [ { "]" "}" ";" ">>" } [ define-delimiter ] each @@ -93,7 +93,7 @@ IN: bootstrap.syntax "foldable" [ word make-foldable ] define-syntax "flushable" [ word make-flushable ] define-syntax "delimiter" [ word t "delimiter" set-word-prop ] define-syntax - "parsing" [ word t "parsing" set-word-prop ] define-syntax + "parsing" [ word make-parsing ] define-syntax "SYMBOL:" [ CREATE-WORD define-symbol diff --git a/core/words/words.factor b/core/words/words.factor index 66c60dc06e..f8cbaf0a22 100644 --- a/core/words/words.factor +++ b/core/words/words.factor @@ -243,6 +243,8 @@ ERROR: bad-create name vocab ; PREDICATE: parsing-word < word "parsing" word-prop ; +: make-parsing ( word -- ) t "parsing" set-word-prop ; + : delimiter? ( obj -- ? ) dup word? [ "delimiter" word-prop ] [ drop f ] if ; diff --git a/extra/benchmark/dawes/dawes.factor b/extra/benchmark/dawes/dawes.factor index 7cff06d1bc..9ece8465ab 100644 --- a/extra/benchmark/dawes/dawes.factor +++ b/extra/benchmark/dawes/dawes.factor @@ -1,19 +1,14 @@ -USING: sequences alien.c-types math hints kernel byte-arrays ; +USING: sequences hints kernel math specialized-arrays.int ; IN: benchmark.dawes ! Phil Dawes's performance problem -: int-length ( byte-array -- n ) length "int" heap-size /i ; inline +: count-ones ( byte-array -- n ) [ 1 = ] sigma ; -: count-ones ( byte-array -- n ) - 0 swap [ int-length ] keep [ - int-nth 1 = [ 1 + ] when - ] curry each-integer ; - -HINTS: count-ones byte-array ; +HINTS: count-ones int-array ; : make-byte-array ( -- byte-array ) - 120000 [ 255 bitand ] map >c-int-array ; + 120000 [ 255 bitand ] int-array{ } map-as ; : dawes-benchmark ( -- ) make-byte-array 200 swap [ count-ones ] curry replicate drop ; diff --git a/extra/bunny/fixed-pipeline/fixed-pipeline.factor b/extra/bunny/fixed-pipeline/fixed-pipeline.factor index 0bad9cc943..fd420d0b7d 100644 --- a/extra/bunny/fixed-pipeline/fixed-pipeline.factor +++ b/extra/bunny/fixed-pipeline/fixed-pipeline.factor @@ -1,5 +1,5 @@ USING: alien.c-types continuations destructors kernel -opengl opengl.gl bunny.model ; +opengl opengl.gl bunny.model specialized-arrays.float ; IN: bunny.fixed-pipeline TUPLE: bunny-fixed-pipeline ; @@ -13,7 +13,7 @@ M: bunny-fixed-pipeline draw-bunny GL_LIGHTING glEnable GL_LIGHT0 glEnable GL_COLOR_MATERIAL glEnable - GL_LIGHT0 GL_POSITION { 1.0 -1.0 1.0 1.0 } >c-float-array glLightfv + GL_LIGHT0 GL_POSITION float-array{ 1.0 -1.0 1.0 1.0 } underlying>> glLightfv GL_FRONT_AND_BACK GL_SHININESS 100.0 glMaterialf GL_FRONT_AND_BACK GL_SPECULAR glColorMaterial GL_FRONT_AND_BACK GL_AMBIENT_AND_DIFFUSE glColorMaterial diff --git a/extra/bunny/model/model.factor b/extra/bunny/model/model.factor index 1bbaf796ad..c9d109cb71 100755 --- a/extra/bunny/model/model.factor +++ b/extra/bunny/model/model.factor @@ -2,7 +2,8 @@ USING: accessors alien.c-types arrays combinators destructors http.client io io.encodings.ascii io.files kernel math math.matrices math.parser math.vectors opengl opengl.capabilities opengl.gl opengl.demo-support sequences -sequences.lib splitting vectors words ; +sequences.lib splitting vectors words +specialized-arrays.double specialized-arrays.uint ; IN: bunny.model : numbers ( str -- seq ) @@ -65,11 +66,11 @@ TUPLE: bunny-buffers array element-array nv ni ; { [ [ first concat ] [ second concat ] bi - append >c-float-array + append >double-array underlying>> GL_ARRAY_BUFFER swap GL_STATIC_DRAW ] [ - third concat >c-uint-array + third concat >uint-array underlying>> GL_ELEMENT_ARRAY_BUFFER swap GL_STATIC_DRAW ] [ first length 3 * ] diff --git a/extra/cairo/samples/samples.factor b/extra/cairo/samples/samples.factor index 0f21142f2a..bdd02c9e13 100644 --- a/extra/cairo/samples/samples.factor +++ b/extra/cairo/samples/samples.factor @@ -5,7 +5,7 @@ ! http://cairographics.org/samples/ USING: cairo cairo.ffi locals math.constants math io.backend kernel alien.c-types libc namespaces -cairo.gadgets ui.gadgets accessors ; +cairo.gadgets ui.gadgets accessors specialized-arrays.double ; IN: cairo.samples @@ -69,7 +69,7 @@ M:: clip-image-gadget render-cairo* ( gadget -- ) TUPLE: dash-gadget < cairo-gadget ; M:: dash-gadget render-cairo* ( gadget -- ) - [let | dashes [ { 50 10 10 10 } >c-double-array ] + [let | dashes [ double-array{ 50 10 10 10 } underlying>> ] ndash [ 4 ] | cr dashes ndash -50 cairo_set_dash cr 10 cairo_set_line_width diff --git a/extra/cfdg/cfdg.factor b/extra/cfdg/cfdg.factor index 102de8fd22..8110251fb7 100644 --- a/extra/cfdg/cfdg.factor +++ b/extra/cfdg/cfdg.factor @@ -6,7 +6,7 @@ USING: kernel alien.c-types combinators namespaces make arrays vars colors self self.slots random-weighted colors.hsv cfdg.gl accessors ui.gadgets.handler ui.gestures assocs ui.gadgets macros - qualified ; + qualified speicalized-arrays.double ; QUALIFIED: syntax IN: cfdg @@ -75,7 +75,7 @@ VAR: threshold 2 * sin , 2 * cos neg , 0 , 0 , 0 , 0 , 1 , 0 , 0 , 0 , 0 , 1 , ] - { } make >c-double-array glMultMatrixd ; + double-array{ } make underlying>> glMultMatrixd ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! diff --git a/extra/hello-world/deploy.factor b/extra/hello-world/deploy.factor index 219fe0ca05..a7d6620fff 100755 --- a/extra/hello-world/deploy.factor +++ b/extra/hello-world/deploy.factor @@ -1,14 +1,15 @@ USING: tools.deploy.config ; H{ - { deploy-c-types? f } - { deploy-name "Hello world (console)" } - { deploy-threads? f } + { deploy-unicode? f } + { deploy-reflection 1 } { deploy-word-props? f } - { deploy-reflection 2 } - { deploy-io 2 } { deploy-math? f } - { deploy-ui? f } - { deploy-compiler? f } - { "stop-after-last-window?" t } + { deploy-name "Hello world (console)" } { deploy-word-defs? f } + { "stop-after-last-window?" t } + { deploy-compiler? t } + { deploy-ui? f } + { deploy-threads? f } + { deploy-io 2 } + { deploy-c-types? f } } diff --git a/extra/jamshred/gl/gl.factor b/extra/jamshred/gl/gl.factor index 7bd6eb7fbc..b78e7de88e 100644 --- a/extra/jamshred/gl/gl.factor +++ b/extra/jamshred/gl/gl.factor @@ -3,7 +3,7 @@ USING: accessors alien.c-types jamshred.game jamshred.oint jamshred.player jamshred.tunnel kernel math math.constants math.functions math.vectors opengl opengl.gl opengl.glu -opengl.demo-support sequences float-arrays ; +opengl.demo-support sequences specialized-arrays.float ; IN: jamshred.gl : min-vertices 6 ; inline @@ -84,10 +84,10 @@ IN: jamshred.gl GL_FOG_DENSITY 0.09 glFogf GL_FRONT GL_AMBIENT_AND_DIFFUSE glColorMaterial GL_COLOR_MATERIAL glEnable - GL_LIGHT0 GL_POSITION F{ 0.0 0.0 0.0 1.0 } >c-float-array glLightfv - GL_LIGHT0 GL_AMBIENT F{ 0.2 0.2 0.2 1.0 } >c-float-array glLightfv - GL_LIGHT0 GL_DIFFUSE F{ 1.0 1.0 1.0 1.0 } >c-float-array glLightfv - GL_LIGHT0 GL_SPECULAR F{ 1.0 1.0 1.0 1.0 } >c-float-array glLightfv ; + GL_LIGHT0 GL_POSITION float-array{ 0.0 0.0 0.0 1.0 } underlying>> glLightfv + GL_LIGHT0 GL_AMBIENT float-array{ 0.2 0.2 0.2 1.0 } underlying>> glLightfv + GL_LIGHT0 GL_DIFFUSE float-array{ 1.0 1.0 1.0 1.0 } underlying>> glLightfv + GL_LIGHT0 GL_SPECULAR float-array{ 1.0 1.0 1.0 1.0 } underlying>> glLightfv ; : player-view ( player -- ) [ location>> ] diff --git a/extra/math/blas/matrices/matrices.factor b/extra/math/blas/matrices/matrices.factor index 4f50543e73..0899e2d079 100755 --- a/extra/math/blas/matrices/matrices.factor +++ b/extra/math/blas/matrices/matrices.factor @@ -3,7 +3,7 @@ combinators.lib combinators.short-circuit fry kernel locals macros math math.blas.cblas math.blas.vectors math.blas.vectors.private math.complex math.functions math.order multi-methods qualified sequences sequences.merged sequences.private generalizations -shuffle symbols ; +shuffle symbols speicalized-arrays.float specialized-arrays.double ; QUALIFIED: syntax IN: math.blas.matrices @@ -143,14 +143,14 @@ METHOD: (blas-vector-like) { object object object double-complex-blas-matrix } PRIVATE> : >float-blas-matrix ( arrays -- matrix ) - [ >c-float-array ] (>matrix) ; + [ >float-array underlying>> ] (>matrix) ; : >double-blas-matrix ( arrays -- matrix ) - [ >c-double-array ] (>matrix) ; + [ >double-array underlying>> ] (>matrix) ; : >float-complex-blas-matrix ( arrays -- matrix ) - [ (flatten-complex-sequence) >c-float-array ] (>matrix) + [ (flatten-complex-sequence) >float-array underlying>> ] (>matrix) ; : >double-complex-blas-matrix ( arrays -- matrix ) - [ (flatten-complex-sequence) >c-double-array ] (>matrix) + [ (flatten-complex-sequence) >double-array underlying>> ] (>matrix) ; GENERIC: n*M.V+n*V! ( alpha A x beta y -- y=alpha*A.x+b*y ) diff --git a/extra/math/blas/vectors/vectors.factor b/extra/math/blas/vectors/vectors.factor index a135f08f28..f29ef30ab7 100755 --- a/extra/math/blas/vectors/vectors.factor +++ b/extra/math/blas/vectors/vectors.factor @@ -1,7 +1,9 @@ USING: accessors alien alien.c-types arrays byte-arrays combinators combinators.short-circuit fry kernel macros math math.blas.cblas math.complex math.functions math.order multi-methods qualified -sequences sequences.private generalizations ; +sequences sequences.private generalizations +specialized-arrays.float specialized-arrays.double +specialized-arrays.direct.float specialized-arrays.direct.double ; QUALIFIED: syntax IN: math.blas.vectors @@ -90,14 +92,14 @@ MACRO: (do-copy) ( copy make-vector -- ) [ [ real-part ] [ imaginary-part ] bi 2array ] map concat ; : (>c-complex) ( complex -- alien ) - [ real-part ] [ imaginary-part ] bi 2array >c-float-array ; + [ real-part ] [ imaginary-part ] bi float-array{ } 2sequence underlying>> ; : (>z-complex) ( complex -- alien ) - [ real-part ] [ imaginary-part ] bi 2array >c-double-array ; + [ real-part ] [ imaginary-part ] bi double-array{ } 2sequence underlying>> ; : (c-complex>) ( alien -- complex ) - 2 c-float-array> first2 rect> ; + 2 first2 rect> ; : (z-complex>) ( alien -- complex ) - 2 c-double-array> first2 rect> ; + 2 first2 rect> ; : (prepare-nth) ( n v -- n*inc v-data ) [ inc>> ] [ data>> ] bi [ * ] dip ; @@ -170,14 +172,14 @@ syntax:M: blas-vector-base equal? } 2&& ; : >float-blas-vector ( seq -- v ) - [ >c-float-array ] [ length ] bi 1 ; + [ >float-array underlying>> ] [ length ] bi 1 ; : >double-blas-vector ( seq -- v ) - [ >c-double-array ] [ length ] bi 1 ; + [ >double-array underlying>> ] [ length ] bi 1 ; : >float-complex-blas-vector ( seq -- v ) - [ (flatten-complex-sequence) >c-float-array ] [ length ] bi + [ (flatten-complex-sequence) >float-array underlying>> ] [ length ] bi 1 ; : >double-complex-blas-vector ( seq -- v ) - [ (flatten-complex-sequence) >c-double-array ] [ length ] bi + [ (flatten-complex-sequence) >double-array underlying>> ] [ length ] bi 1 ; syntax:M: float-blas-vector clone diff --git a/extra/openal/openal.factor b/extra/openal/openal.factor index 2a8959b4a0..40593d1e8d 100644 --- a/extra/openal/openal.factor +++ b/extra/openal/openal.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel arrays alien system combinators alien.syntax namespaces alien.c-types sequences vocabs.loader shuffle combinators.lib - openal.backend ; + openal.backend specialized-arrays.uint ; IN: openal << "alut" { @@ -248,10 +248,10 @@ SYMBOL: init : ( n -- byte-array ) "ALuint" ; : gen-sources ( size -- seq ) - dup 2dup alGenSources swap c-uint-array> ; + dup 2dup underlying>> alGenSources swap ; : gen-buffers ( size -- seq ) - dup 2dup alGenBuffers swap c-uint-array> ; + dup 2dup underlying>> alGenBuffers swap ; : gen-buffer ( -- buffer ) 1 gen-buffers first ; @@ -267,7 +267,7 @@ os macosx? "openal.macosx" "openal.other" ? require [ alBufferData ] 4keep alutUnloadWAV ; : queue-buffers ( source buffers -- ) - [ length ] [ >c-uint-array ] bi alSourceQueueBuffers ; + [ length ] [ >uint-array underlying>> ] bi alSourceQueueBuffers ; : queue-buffer ( source buffer -- ) 1array queue-buffers ; diff --git a/extra/opengl/shaders/shaders.factor b/extra/opengl/shaders/shaders.factor index d52e55417f..93ca6b32cc 100755 --- a/extra/opengl/shaders/shaders.factor +++ b/extra/opengl/shaders/shaders.factor @@ -91,10 +91,9 @@ PREDICATE: fragment-shader < gl-shader (fragment-shader?) ; : gl-program-shaders ( program -- shaders ) dup gl-program-shaders-length - dup "GLuint" + dup 0 swap - [ glGetAttachedShaders ] { 3 1 } multikeep - c-uint-array> ; + [ underlying>> glGetAttachedShaders ] { 3 1 } multikeep ; : delete-gl-program-only ( program -- ) glDeleteProgram ; inline diff --git a/extra/synth/buffers/buffers.factor b/extra/synth/buffers/buffers.factor index faff19d8fd..b0128ca52a 100644 --- a/extra/synth/buffers/buffers.factor +++ b/extra/synth/buffers/buffers.factor @@ -38,10 +38,10 @@ M: 8bit-stereo-buffer buffer-format drop AL_FORMAT_STEREO8 ; M: 16bit-stereo-buffer buffer-format drop AL_FORMAT_STEREO16 ; : 8bit-buffer-data ( seq -- data size ) - [ 128 * >integer 128 + ] map [ >c-uchar-array ] [ length ] bi ; + [ 128 * >integer 128 + ] uchar-array{ } map-as [ underlying>> ] [ length ] bi ; : 16bit-buffer-data ( seq -- data size ) - [ 32768 * >integer ] map [ >c-short-array ] [ length 2 * ] bi ; + [ 32768 * >integer ] short-array{ } map-as [ underlying>> ] [ byte-length ] bi ; : stereo-data ( stereo-buffer -- left right ) [ left-data>> ] [ right-data>> ] bi@ ; From 7898a9252d7ade2dda2248273c101f512911afd0 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Sat, 15 Nov 2008 15:43:21 -0500 Subject: [PATCH 114/948] Cleanup PE solutions and formatting --- extra/project-euler/203/203-tests.factor | 4 +- extra/project-euler/203/203.factor | 67 +++++++++++++++++++++--- extra/project-euler/215/215.factor | 2 +- extra/project-euler/project-euler.factor | 2 +- 4 files changed, 65 insertions(+), 10 deletions(-) diff --git a/extra/project-euler/203/203-tests.factor b/extra/project-euler/203/203-tests.factor index 6c49c2f958..4922f9a8cc 100644 --- a/extra/project-euler/203/203-tests.factor +++ b/extra/project-euler/203/203-tests.factor @@ -1,5 +1,5 @@ -USING: project-euler.203 tools.test ; +USING: project-euler.203 project-euler.203.private tools.test ; IN: project-euler.203.tests [ 105 ] [ 8 solve ] unit-test -[ 34029210557338 ] [ 51 solve ] unit-test +[ 34029210557338 ] [ euler203 ] unit-test diff --git a/extra/project-euler/203/203.factor b/extra/project-euler/203/203.factor index 9a2916649e..f2b5a2e212 100644 --- a/extra/project-euler/203/203.factor +++ b/extra/project-euler/203/203.factor @@ -1,9 +1,64 @@ +! Copyright (c) 2008 Eric Mertens. +! See http://factorcode.org/license.txt for BSD license. USING: fry kernel math math.primes.factors sequences sets ; IN: project-euler.203 -: iterate ( n initial quot -- results ) swapd '[ @ dup ] replicate nip ; inline -: (generate) ( seq -- seq ) [ 0 prefix ] [ 0 suffix ] bi [ + ] 2map ; -: generate ( n -- seq ) 1- { 1 } [ (generate) ] iterate concat prune ; -: squarefree ( n -- ? ) factors duplicates empty? ; -: solve ( n -- n ) generate [ squarefree ] filter sum ; -: euler203 ( -- n ) 51 solve ; +! http://projecteuler.net/index.php?section=problems&id=203 + +! DESCRIPTION +! ----------- + +! The binomial coefficients nCk can be arranged in triangular form, Pascal's +! triangle, like this: + +! 1 +! 1 1 +! 1 2 1 +! 1 3 3 1 +! 1 4 6 4 1 +! 1 5 10 10 5 1 +! 1 6 15 20 15 6 1 +! 1 7 21 35 35 21 7 1 +! ......... + +! It can be seen that the first eight rows of Pascal's triangle contain twelve +! distinct numbers: 1, 2, 3, 4, 5, 6, 7, 10, 15, 20, 21 and 35. + +! A positive integer n is called squarefree if no square of a prime divides n. +! Of the twelve distinct numbers in the first eight rows of Pascal's triangle, +! all except 4 and 20 are squarefree. The sum of the distinct squarefree numbers +! in the first eight rows is 105. + +! Find the sum of the distinct squarefree numbers in the first 51 rows of +! Pascal's triangle. + + +! SOLUTION +! -------- + + + +: euler203 ( -- n ) + 51 solve ; + +! [ euler203 ] 100 ave-time +! 12 ms ave run time - 1.6 SD (100 trials) + +MAIN: euler203 diff --git a/extra/project-euler/215/215.factor b/extra/project-euler/215/215.factor index fc09b37515..82d6a31c66 100644 --- a/extra/project-euler/215/215.factor +++ b/extra/project-euler/215/215.factor @@ -9,7 +9,7 @@ IN: project-euler.215 ! ----------- ! Consider the problem of building a wall out of 2x1 and 3x1 bricks -! (horizontalvertical dimensions) such that, for extra strength, the gaps +! (horizontal x vertical dimensions) such that, for extra strength, the gaps ! between horizontally-adjacent bricks never line up in consecutive layers, ! i.e. never form a "running crack". diff --git a/extra/project-euler/project-euler.factor b/extra/project-euler/project-euler.factor index 9549505bf6..60d35f27ad 100644 --- a/extra/project-euler/project-euler.factor +++ b/extra/project-euler/project-euler.factor @@ -20,7 +20,7 @@ USING: definitions io io.files kernel math math.parser project-euler.097 project-euler.100 project-euler.116 project-euler.117 project-euler.134 project-euler.148 project-euler.150 project-euler.151 project-euler.164 project-euler.169 project-euler.173 project-euler.175 - project-euler.186 project-euler.190 project-euler.215 ; + project-euler.186 project-euler.190 project-euler.203 project-euler.215 ; IN: project-euler Date: Sat, 15 Nov 2008 17:26:00 -0500 Subject: [PATCH 115/948] Solution to Project Euler problem 99 --- extra/project-euler/099/099-tests.factor | 5 + extra/project-euler/099/099.factor | 52 ++ extra/project-euler/099/base_exp.txt | 1000 ++++++++++++++++++++++ 3 files changed, 1057 insertions(+) create mode 100644 extra/project-euler/099/099-tests.factor create mode 100644 extra/project-euler/099/099.factor create mode 100644 extra/project-euler/099/base_exp.txt diff --git a/extra/project-euler/099/099-tests.factor b/extra/project-euler/099/099-tests.factor new file mode 100644 index 0000000000..d3d46d98b4 --- /dev/null +++ b/extra/project-euler/099/099-tests.factor @@ -0,0 +1,5 @@ +USING: project-euler.099 project-euler.099.private tools.test ; +IN: project-euler.099.tests + +[ 2 ] [ { { 2 11 } { 3 7 } } solve ] unit-test +[ 709 ] [ euler099 ] unit-test diff --git a/extra/project-euler/099/099.factor b/extra/project-euler/099/099.factor new file mode 100644 index 0000000000..ebc830cf00 --- /dev/null +++ b/extra/project-euler/099/099.factor @@ -0,0 +1,52 @@ +! Copyright (c) 2008 Aaron Schaefer. +! See http://factorcode.org/license.txt for BSD license. +USING: io.encodings.ascii io.files kernel math math.functions math.parser + math.vectors sequences splitting ; +IN: project-euler.099 + +! http://projecteuler.net/index.php?section=problems&id=99 + +! DESCRIPTION +! ----------- + +! Comparing two numbers written in index form like 2^11 and 3^7 is not difficult, +! as any calculator would confirm that 2^11 = 2048 < 3^7 = 2187. + +! However, confirming that 632382^518061 519432^525806 would be much more +! difficult, as both numbers contain over three million digits. + +! Using base_exp.txt (right click and 'Save Link/Target As...'), a 22K text +! file containing one thousand lines with a base/exponent pair on each line, +! determine which line number has the greatest numerical value. + +! NOTE: The first two lines in the file represent the numbers in the example +! given above. + + +! SOLUTION +! -------- + +! Use logarithms to make the calculations necessary more manageable. + +number ] map ] map ; + +: simplify ( seq -- seq ) + #! exponent * log(base) + flip first2 swap [ log ] map v* ; + +: solve ( seq -- index ) + simplify [ supremum ] keep index 1+ ; + +PRIVATE> + +: euler099 ( -- answer ) + source-099 solve ; + +! [ euler099 ] 100 ave-time +! 16 ms ave run timen - 1.67 SD (100 trials) + +MAIN: euler099 diff --git a/extra/project-euler/099/base_exp.txt b/extra/project-euler/099/base_exp.txt new file mode 100644 index 0000000000..92201db6f5 --- /dev/null +++ b/extra/project-euler/099/base_exp.txt @@ -0,0 +1,1000 @@ +519432,525806 +632382,518061 +78864,613712 +466580,530130 +780495,510032 +525895,525320 +15991,714883 +960290,502358 +760018,511029 +166800,575487 +210884,564478 +555151,523163 +681146,515199 +563395,522587 +738250,512126 +923525,503780 +595148,520429 +177108,572629 +750923,511482 +440902,532446 +881418,505504 +422489,534197 +979858,501616 +685893,514935 +747477,511661 +167214,575367 +234140,559696 +940238,503122 +728969,512609 +232083,560102 +900971,504694 +688801,514772 +189664,569402 +891022,505104 +445689,531996 +119570,591871 +821453,508118 +371084,539600 +911745,504251 +623655,518600 +144361,582486 +352442,541775 +420726,534367 +295298,549387 +6530,787777 +468397,529976 +672336,515696 +431861,533289 +84228,610150 +805376,508857 +444409,532117 +33833,663511 +381850,538396 +402931,536157 +92901,604930 +304825,548004 +731917,512452 +753734,511344 +51894,637373 +151578,580103 +295075,549421 +303590,548183 +333594,544123 +683952,515042 +60090,628880 +951420,502692 +28335,674991 +714940,513349 +343858,542826 +549279,523586 +804571,508887 +260653,554881 +291399,549966 +402342,536213 +408889,535550 +40328,652524 +375856,539061 +768907,510590 +165993,575715 +976327,501755 +898500,504795 +360404,540830 +478714,529095 +694144,514472 +488726,528258 +841380,507226 +328012,544839 +22389,690868 +604053,519852 +329514,544641 +772965,510390 +492798,527927 +30125,670983 +895603,504906 +450785,531539 +840237,507276 +380711,538522 +63577,625673 +76801,615157 +502694,527123 +597706,520257 +310484,547206 +944468,502959 +121283,591152 +451131,531507 +566499,522367 +425373,533918 +40240,652665 +39130,654392 +714926,513355 +469219,529903 +806929,508783 +287970,550487 +92189,605332 +103841,599094 +671839,515725 +452048,531421 +987837,501323 +935192,503321 +88585,607450 +613883,519216 +144551,582413 +647359,517155 +213902,563816 +184120,570789 +258126,555322 +502546,527130 +407655,535678 +401528,536306 +477490,529193 +841085,507237 +732831,512408 +833000,507595 +904694,504542 +581435,521348 +455545,531110 +873558,505829 +94916,603796 +720176,513068 +545034,523891 +246348,557409 +556452,523079 +832015,507634 +173663,573564 +502634,527125 +250732,556611 +569786,522139 +216919,563178 +521815,525623 +92304,605270 +164446,576167 +753413,511364 +11410,740712 +448845,531712 +925072,503725 +564888,522477 +7062,780812 +641155,517535 +738878,512100 +636204,517828 +372540,539436 +443162,532237 +571192,522042 +655350,516680 +299741,548735 +581914,521307 +965471,502156 +513441,526277 +808682,508700 +237589,559034 +543300,524025 +804712,508889 +247511,557192 +543486,524008 +504383,526992 +326529,545039 +792493,509458 +86033,609017 +126554,589005 +579379,521481 +948026,502823 +404777,535969 +265767,554022 +266876,553840 +46631,643714 +492397,527958 +856106,506581 +795757,509305 +748946,511584 +294694,549480 +409781,535463 +775887,510253 +543747,523991 +210592,564536 +517119,525990 +520253,525751 +247926,557124 +592141,520626 +346580,542492 +544969,523902 +506501,526817 +244520,557738 +144745,582349 +69274,620858 +292620,549784 +926027,503687 +736320,512225 +515528,526113 +407549,535688 +848089,506927 +24141,685711 +9224,757964 +980684,501586 +175259,573121 +489160,528216 +878970,505604 +969546,502002 +525207,525365 +690461,514675 +156510,578551 +659778,516426 +468739,529945 +765252,510770 +76703,615230 +165151,575959 +29779,671736 +928865,503569 +577538,521605 +927555,503618 +185377,570477 +974756,501809 +800130,509093 +217016,563153 +365709,540216 +774508,510320 +588716,520851 +631673,518104 +954076,502590 +777828,510161 +990659,501222 +597799,520254 +786905,509727 +512547,526348 +756449,511212 +869787,505988 +653747,516779 +84623,609900 +839698,507295 +30159,670909 +797275,509234 +678136,515373 +897144,504851 +989554,501263 +413292,535106 +55297,633667 +788650,509637 +486748,528417 +150724,580377 +56434,632490 +77207,614869 +588631,520859 +611619,519367 +100006,601055 +528924,525093 +190225,569257 +851155,506789 +682593,515114 +613043,519275 +514673,526183 +877634,505655 +878905,505602 +1926,914951 +613245,519259 +152481,579816 +841774,507203 +71060,619442 +865335,506175 +90244,606469 +302156,548388 +399059,536557 +478465,529113 +558601,522925 +69132,620966 +267663,553700 +988276,501310 +378354,538787 +529909,525014 +161733,576968 +758541,511109 +823425,508024 +149821,580667 +269258,553438 +481152,528891 +120871,591322 +972322,501901 +981350,501567 +676129,515483 +950860,502717 +119000,592114 +392252,537272 +191618,568919 +946699,502874 +289555,550247 +799322,509139 +703886,513942 +194812,568143 +261823,554685 +203052,566221 +217330,563093 +734748,512313 +391759,537328 +807052,508777 +564467,522510 +59186,629748 +113447,594545 +518063,525916 +905944,504492 +613922,519213 +439093,532607 +445946,531981 +230530,560399 +297887,549007 +459029,530797 +403692,536075 +855118,506616 +963127,502245 +841711,507208 +407411,535699 +924729,503735 +914823,504132 +333725,544101 +176345,572832 +912507,504225 +411273,535308 +259774,555036 +632853,518038 +119723,591801 +163902,576321 +22691,689944 +402427,536212 +175769,572988 +837260,507402 +603432,519893 +313679,546767 +538165,524394 +549026,523608 +61083,627945 +898345,504798 +992556,501153 +369999,539727 +32847,665404 +891292,505088 +152715,579732 +824104,507997 +234057,559711 +730507,512532 +960529,502340 +388395,537687 +958170,502437 +57105,631806 +186025,570311 +993043,501133 +576770,521664 +215319,563513 +927342,503628 +521353,525666 +39563,653705 +752516,511408 +110755,595770 +309749,547305 +374379,539224 +919184,503952 +990652,501226 +647780,517135 +187177,570017 +168938,574877 +649558,517023 +278126,552016 +162039,576868 +658512,516499 +498115,527486 +896583,504868 +561170,522740 +747772,511647 +775093,510294 +652081,516882 +724905,512824 +499707,527365 +47388,642755 +646668,517204 +571700,522007 +180430,571747 +710015,513617 +435522,532941 +98137,602041 +759176,511070 +486124,528467 +526942,525236 +878921,505604 +408313,535602 +926980,503640 +882353,505459 +566887,522345 +3326,853312 +911981,504248 +416309,534800 +392991,537199 +622829,518651 +148647,581055 +496483,527624 +666314,516044 +48562,641293 +672618,515684 +443676,532187 +274065,552661 +265386,554079 +347668,542358 +31816,667448 +181575,571446 +961289,502320 +365689,540214 +987950,501317 +932299,503440 +27388,677243 +746701,511701 +492258,527969 +147823,581323 +57918,630985 +838849,507333 +678038,515375 +27852,676130 +850241,506828 +818403,508253 +131717,587014 +850216,506834 +904848,504529 +189758,569380 +392845,537217 +470876,529761 +925353,503711 +285431,550877 +454098,531234 +823910,508003 +318493,546112 +766067,510730 +261277,554775 +421530,534289 +694130,514478 +120439,591498 +213308,563949 +854063,506662 +365255,540263 +165437,575872 +662240,516281 +289970,550181 +847977,506933 +546083,523816 +413252,535113 +975829,501767 +361540,540701 +235522,559435 +224643,561577 +736350,512229 +328303,544808 +35022,661330 +307838,547578 +474366,529458 +873755,505819 +73978,617220 +827387,507845 +670830,515791 +326511,545034 +309909,547285 +400970,536363 +884827,505352 +718307,513175 +28462,674699 +599384,520150 +253565,556111 +284009,551093 +343403,542876 +446557,531921 +992372,501160 +961601,502308 +696629,514342 +919537,503945 +894709,504944 +892201,505051 +358160,541097 +448503,531745 +832156,507636 +920045,503924 +926137,503675 +416754,534757 +254422,555966 +92498,605151 +826833,507873 +660716,516371 +689335,514746 +160045,577467 +814642,508425 +969939,501993 +242856,558047 +76302,615517 +472083,529653 +587101,520964 +99066,601543 +498005,527503 +709800,513624 +708000,513716 +20171,698134 +285020,550936 +266564,553891 +981563,501557 +846502,506991 +334,1190800 +209268,564829 +9844,752610 +996519,501007 +410059,535426 +432931,533188 +848012,506929 +966803,502110 +983434,501486 +160700,577267 +504374,526989 +832061,507640 +392825,537214 +443842,532165 +440352,532492 +745125,511776 +13718,726392 +661753,516312 +70500,619875 +436952,532814 +424724,533973 +21954,692224 +262490,554567 +716622,513264 +907584,504425 +60086,628882 +837123,507412 +971345,501940 +947162,502855 +139920,584021 +68330,621624 +666452,516038 +731446,512481 +953350,502619 +183157,571042 +845400,507045 +651548,516910 +20399,697344 +861779,506331 +629771,518229 +801706,509026 +189207,569512 +737501,512168 +719272,513115 +479285,529045 +136046,585401 +896746,504860 +891735,505067 +684771,514999 +865309,506184 +379066,538702 +503117,527090 +621780,518717 +209518,564775 +677135,515423 +987500,501340 +197049,567613 +329315,544673 +236756,559196 +357092,541226 +520440,525733 +213471,563911 +956852,502490 +702223,514032 +404943,535955 +178880,572152 +689477,514734 +691351,514630 +866669,506128 +370561,539656 +739805,512051 +71060,619441 +624861,518534 +261660,554714 +366137,540160 +166054,575698 +601878,519990 +153445,579501 +279899,551729 +379166,538691 +423209,534125 +675310,515526 +145641,582050 +691353,514627 +917468,504026 +284778,550976 +81040,612235 +161699,576978 +616394,519057 +767490,510661 +156896,578431 +427408,533714 +254849,555884 +737217,512182 +897133,504851 +203815,566051 +270822,553189 +135854,585475 +778805,510111 +784373,509847 +305426,547921 +733418,512375 +732087,512448 +540668,524215 +702898,513996 +628057,518328 +640280,517587 +422405,534204 +10604,746569 +746038,511733 +839808,507293 +457417,530938 +479030,529064 +341758,543090 +620223,518824 +251661,556451 +561790,522696 +497733,527521 +724201,512863 +489217,528217 +415623,534867 +624610,518548 +847541,506953 +432295,533249 +400391,536421 +961158,502319 +139173,584284 +421225,534315 +579083,521501 +74274,617000 +701142,514087 +374465,539219 +217814,562985 +358972,540995 +88629,607424 +288597,550389 +285819,550812 +538400,524385 +809930,508645 +738326,512126 +955461,502535 +163829,576343 +826475,507891 +376488,538987 +102234,599905 +114650,594002 +52815,636341 +434037,533082 +804744,508880 +98385,601905 +856620,506559 +220057,562517 +844734,507078 +150677,580387 +558697,522917 +621751,518719 +207067,565321 +135297,585677 +932968,503404 +604456,519822 +579728,521462 +244138,557813 +706487,513800 +711627,513523 +853833,506674 +497220,527562 +59428,629511 +564845,522486 +623621,518603 +242689,558077 +125091,589591 +363819,540432 +686453,514901 +656813,516594 +489901,528155 +386380,537905 +542819,524052 +243987,557841 +693412,514514 +488484,528271 +896331,504881 +336730,543721 +728298,512647 +604215,519840 +153729,579413 +595687,520398 +540360,524240 +245779,557511 +924873,503730 +509628,526577 +528523,525122 +3509,847707 +522756,525555 +895447,504922 +44840,646067 +45860,644715 +463487,530404 +398164,536654 +894483,504959 +619415,518874 +966306,502129 +990922,501212 +835756,507474 +548881,523618 +453578,531282 +474993,529410 +80085,612879 +737091,512193 +50789,638638 +979768,501620 +792018,509483 +665001,516122 +86552,608694 +462772,530469 +589233,520821 +891694,505072 +592605,520594 +209645,564741 +42531,649269 +554376,523226 +803814,508929 +334157,544042 +175836,572970 +868379,506051 +658166,516520 +278203,551995 +966198,502126 +627162,518387 +296774,549165 +311803,547027 +843797,507118 +702304,514032 +563875,522553 +33103,664910 +191932,568841 +543514,524006 +506835,526794 +868368,506052 +847025,506971 +678623,515342 +876139,505726 +571997,521984 +598632,520198 +213590,563892 +625404,518497 +726508,512738 +689426,514738 +332495,544264 +411366,535302 +242546,558110 +315209,546555 +797544,509219 +93889,604371 +858879,506454 +124906,589666 +449072,531693 +235960,559345 +642403,517454 +720567,513047 +705534,513858 +603692,519870 +488137,528302 +157370,578285 +63515,625730 +666326,516041 +619226,518883 +443613,532186 +597717,520257 +96225,603069 +86940,608450 +40725,651929 +460976,530625 +268875,553508 +270671,553214 +363254,540500 +384248,538137 +762889,510892 +377941,538833 +278878,551890 +176615,572755 +860008,506412 +944392,502967 +608395,519571 +225283,561450 +45095,645728 +333798,544090 +625733,518476 +995584,501037 +506135,526853 +238050,558952 +557943,522972 +530978,524938 +634244,517949 +177168,572616 +85200,609541 +953043,502630 +523661,525484 +999295,500902 +840803,507246 +961490,502312 +471747,529685 +380705,538523 +911180,504275 +334149,544046 +478992,529065 +325789,545133 +335884,543826 +426976,533760 +749007,511582 +667067,516000 +607586,519623 +674054,515599 +188534,569675 +565185,522464 +172090,573988 +87592,608052 +907432,504424 +8912,760841 +928318,503590 +757917,511138 +718693,513153 +315141,546566 +728326,512645 +353492,541647 +638429,517695 +628892,518280 +877286,505672 +620895,518778 +385878,537959 +423311,534113 +633501,517997 +884833,505360 +883402,505416 +999665,500894 +708395,513697 +548142,523667 +756491,511205 +987352,501340 +766520,510705 +591775,520647 +833758,507563 +843890,507108 +925551,503698 +74816,616598 +646942,517187 +354923,541481 +256291,555638 +634470,517942 +930904,503494 +134221,586071 +282663,551304 +986070,501394 +123636,590176 +123678,590164 +481717,528841 +423076,534137 +866246,506145 +93313,604697 +783632,509880 +317066,546304 +502977,527103 +141272,583545 +71708,618938 +617748,518975 +581190,521362 +193824,568382 +682368,515131 +352956,541712 +351375,541905 +505362,526909 +905165,504518 +128645,588188 +267143,553787 +158409,577965 +482776,528754 +628896,518282 +485233,528547 +563606,522574 +111001,595655 +115920,593445 +365510,540237 +959724,502374 +938763,503184 +930044,503520 +970959,501956 +913658,504176 +68117,621790 +989729,501253 +567697,522288 +820427,508163 +54236,634794 +291557,549938 +124961,589646 +403177,536130 +405421,535899 +410233,535417 +815111,508403 +213176,563974 +83099,610879 +998588,500934 +513640,526263 +129817,587733 +1820,921851 +287584,550539 +299160,548820 +860621,506386 +529258,525059 +586297,521017 +953406,502616 +441234,532410 +986217,501386 +781938,509957 +461247,530595 +735424,512277 +146623,581722 +839838,507288 +510667,526494 +935085,503327 +737523,512167 +303455,548204 +992779,501145 +60240,628739 +939095,503174 +794368,509370 +501825,527189 +459028,530798 +884641,505363 +512287,526364 +835165,507499 +307723,547590 +160587,577304 +735043,512300 +493289,527887 +110717,595785 +306480,547772 +318593,546089 +179810,571911 +200531,566799 +314999,546580 +197020,567622 +301465,548487 +237808,559000 +131944,586923 +882527,505449 +468117,530003 +711319,513541 +156240,578628 +965452,502162 +992756,501148 +437959,532715 +739938,512046 +614249,519196 +391496,537356 +62746,626418 +688215,514806 +75501,616091 +883573,505412 +558824,522910 +759371,511061 +173913,573489 +891351,505089 +727464,512693 +164833,576051 +812317,508529 +540320,524243 +698061,514257 +69149,620952 +471673,529694 +159092,577753 +428134,533653 +89997,606608 +711061,513557 +779403,510081 +203327,566155 +798176,509187 +667688,515963 +636120,517833 +137410,584913 +217615,563034 +556887,523038 +667229,515991 +672276,515708 +325361,545187 +172115,573985 +13846,725685 \ No newline at end of file From 72fea0752652a7a0ea4d716ced7d6266e0748b10 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Sat, 15 Nov 2008 17:33:51 -0500 Subject: [PATCH 116/948] Forgot to update project-euler.factor --- extra/project-euler/project-euler.factor | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/extra/project-euler/project-euler.factor b/extra/project-euler/project-euler.factor index 60d35f27ad..027e8fe50f 100644 --- a/extra/project-euler/project-euler.factor +++ b/extra/project-euler/project-euler.factor @@ -17,10 +17,11 @@ USING: definitions io io.files kernel math math.parser project-euler.052 project-euler.053 project-euler.055 project-euler.056 project-euler.059 project-euler.067 project-euler.071 project-euler.073 project-euler.075 project-euler.076 project-euler.079 project-euler.092 - project-euler.097 project-euler.100 project-euler.116 project-euler.117 - project-euler.134 project-euler.148 project-euler.150 project-euler.151 - project-euler.164 project-euler.169 project-euler.173 project-euler.175 - project-euler.186 project-euler.190 project-euler.203 project-euler.215 ; + project-euler.097 project-euler.099 project-euler.100 project-euler.116 + project-euler.117 project-euler.134 project-euler.148 project-euler.150 + project-euler.151 project-euler.164 project-euler.169 project-euler.173 + project-euler.175 project-euler.186 project-euler.190 project-euler.203 + project-euler.215 ; IN: project-euler Date: Sun, 16 Nov 2008 17:34:53 -0500 Subject: [PATCH 117/948] Missing in extra/webapps/user-admin/new-user.xml --- extra/webapps/user-admin/new-user.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/webapps/user-admin/new-user.xml b/extra/webapps/user-admin/new-user.xml index d3cf681165..313c8e2702 100644 --- a/extra/webapps/user-admin/new-user.xml +++ b/extra/webapps/user-admin/new-user.xml @@ -37,7 +37,7 @@ Capabilities: -

  • +

  • From c7f5d53144fbe560f611a240fb609df65a5f14c0 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Sun, 16 Nov 2008 21:24:56 -0500 Subject: [PATCH 118/948] Cleanup math.functions and remove >r r> usages --- basis/math/functions/functions.factor | 28 +++++++++++++-------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/basis/math/functions/functions.factor b/basis/math/functions/functions.factor index 43efc35c27..4fa83a9904 100644 --- a/basis/math/functions/functions.factor +++ b/basis/math/functions/functions.factor @@ -15,7 +15,7 @@ IN: math.functions PRIVATE> : rect> ( x y -- z ) - over real? over real? and [ + 2dup [ real? ] both? [ (rect>) ] [ "Complex number must have real components" throw @@ -27,10 +27,10 @@ M: real sqrt >float dup 0.0 < [ neg fsqrt 0.0 swap rect> ] [ fsqrt ] if ; : each-bit ( n quot: ( ? -- ) -- ) - over 0 = pick -1 = or [ + over [ 0 = ] [ -1 = ] bi or [ 2drop ] [ - 2dup >r >r >r odd? r> call r> 2/ r> each-bit + 2dup { [ odd? ] [ call ] [ 2/ ] [ each-bit ] } spread ] if ; inline recursive : map-bits ( n quot: ( ? -- obj ) -- seq ) @@ -69,8 +69,7 @@ PRIVATE> >rect [ >float ] bi@ ; inline : >polar ( z -- abs arg ) - >float-rect [ [ sq ] bi@ + fsqrt ] [ swap fatan2 ] 2bi ; - inline + >float-rect [ [ sq ] bi@ + fsqrt ] [ swap fatan2 ] 2bi ; inline : cis ( arg -- z ) dup fcos swap fsin rect> ; inline @@ -79,11 +78,10 @@ PRIVATE> r >r >float-rect swap r> swap fpow r> rot * fexp /f ; - inline + [ >float-rect swap ] [ swap fpow ] [ rot * fexp /f ] tri* ; inline : ^theta ( w abs arg -- theta ) - >r >r >float-rect r> flog * swap r> * + ; inline + [ >float-rect ] [ flog * swap ] [ * + ] tri* ; inline : ^complex ( x y -- z ) swap >polar [ ^mag ] [ ^theta ] 3bi polar> ; inline @@ -106,18 +104,18 @@ PRIVATE> : (^mod) ( n x y -- z ) 1 swap [ - [ dupd * pick mod ] when >r sq over mod r> + [ dupd * pick mod ] when [ sq over mod ] dip ] each-bit 2nip ; inline : (gcd) ( b a x y -- a d ) over zero? [ 2nip ] [ - swap [ /mod >r over * swapd - r> ] keep (gcd) + swap [ /mod [ over * swapd - ] dip ] keep (gcd) ] if ; : gcd ( x y -- a d ) - 0 -rot 1 -rot (gcd) dup 0 < [ neg ] when ; foldable + [ 0 1 ] 2dip (gcd) dup 0 < [ neg ] when ; foldable : lcm ( a b -- c ) [ * ] 2keep gcd nip /i ; foldable @@ -131,7 +129,7 @@ PRIVATE> : ^mod ( x y n -- z ) over 0 < [ - [ >r neg r> ^mod ] keep mod-inv + [ [ neg ] dip ^mod ] keep mod-inv ] [ -rot (^mod) ] if ; foldable @@ -141,14 +139,14 @@ GENERIC: absq ( x -- y ) foldable M: real absq sq ; : ~abs ( x y epsilon -- ? ) - >r - abs r> < ; + [ - abs ] dip < ; : ~rel ( x y epsilon -- ? ) - >r [ - abs ] 2keep [ abs ] bi@ + r> * < ; + [ [ - abs ] 2keep [ abs ] bi@ + ] dip * < ; : ~ ( x y epsilon -- ? ) { - { [ pick fp-nan? pick fp-nan? or ] [ 3drop f ] } + { [ pick pick [ fp-nan? ] either? ] [ 3drop f ] } { [ dup zero? ] [ drop number= ] } { [ dup 0 < ] [ ~rel ] } [ ~abs ] From 553bc1fb7a7055bd2d9ce650e89299c8f7f96b55 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 07:17:05 -0600 Subject: [PATCH 119/948] Fix +

    diff --git a/basis/furnace/auth/features/recover-password/recover-1.xml b/basis/furnace/auth/features/recover-password/recover-1.xml index a8b67513a4..6dc882538e 100644 --- a/basis/furnace/auth/features/recover-password/recover-1.xml +++ b/basis/furnace/auth/features/recover-password/recover-1.xml @@ -32,7 +32,7 @@ - + diff --git a/basis/furnace/auth/features/recover-password/recover-3.xml b/basis/furnace/auth/features/recover-password/recover-3.xml index 2df400ffe2..ec68e27947 100644 --- a/basis/furnace/auth/features/recover-password/recover-3.xml +++ b/basis/furnace/auth/features/recover-password/recover-3.xml @@ -31,7 +31,7 @@

    - +

    diff --git a/basis/furnace/auth/features/registration/register.xml b/basis/furnace/auth/features/registration/register.xml index 45c090905e..1e2fec6dd0 100644 --- a/basis/furnace/auth/features/registration/register.xml +++ b/basis/furnace/auth/features/registration/register.xml @@ -62,7 +62,7 @@

    - +

    diff --git a/basis/furnace/auth/login/login.xml b/basis/furnace/auth/login/login.xml index 917c182fb3..9a37174e95 100644 --- a/basis/furnace/auth/login/login.xml +++ b/basis/furnace/auth/login/login.xml @@ -35,7 +35,7 @@

    - +

    diff --git a/extra/webapps/help/search.xml b/extra/webapps/help/search.xml index e5fa5d3901..bcaed59ea4 100644 --- a/extra/webapps/help/search.xml +++ b/extra/webapps/help/search.xml @@ -30,7 +30,7 @@ - + diff --git a/extra/webapps/pastebin/new-paste.xml b/extra/webapps/pastebin/new-paste.xml index 96339b6cf8..9866c8819a 100644 --- a/extra/webapps/pastebin/new-paste.xml +++ b/extra/webapps/pastebin/new-paste.xml @@ -18,6 +18,6 @@ -

    +

    diff --git a/extra/webapps/pastebin/paste.xml b/extra/webapps/pastebin/paste.xml index 8fe672049f..a48d2ea42d 100644 --- a/extra/webapps/pastebin/paste.xml +++ b/extra/webapps/pastebin/paste.xml @@ -52,7 +52,7 @@ -

    +

    diff --git a/extra/webapps/wee-url/shorten.xml b/extra/webapps/wee-url/shorten.xml index 53f611a8d8..3dda556aa2 100644 --- a/extra/webapps/wee-url/shorten.xml +++ b/extra/webapps/wee-url/shorten.xml @@ -4,7 +4,7 @@

    Shorten URL:

    - +
    diff --git a/extra/webapps/wiki/edit.xml b/extra/webapps/wiki/edit.xml index 9cb2e92f93..f8c593cf2f 100644 --- a/extra/webapps/wiki/edit.xml +++ b/extra/webapps/wiki/edit.xml @@ -16,7 +16,7 @@

    - +

    diff --git a/extra/webapps/wiki/revisions.xml b/extra/webapps/wiki/revisions.xml index 1d9c01fd65..759cc77449 100644 --- a/extra/webapps/wiki/revisions.xml +++ b/extra/webapps/wiki/revisions.xml @@ -32,7 +32,7 @@ - + From c0b56c4d3ba4ef7f4fc70584a1ba923a89960e17 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 08:47:08 -0600 Subject: [PATCH 120/948] 'see' now shows declarations on methods --- basis/prettyprint/prettyprint-tests.factor | 10 ++++++++++ basis/prettyprint/prettyprint.factor | 3 +++ 2 files changed, 13 insertions(+) diff --git a/basis/prettyprint/prettyprint-tests.factor b/basis/prettyprint/prettyprint-tests.factor index 6a4ac71eb8..8eaaab3c1d 100644 --- a/basis/prettyprint/prettyprint-tests.factor +++ b/basis/prettyprint/prettyprint-tests.factor @@ -355,3 +355,13 @@ INTERSECTION: intersection-see-test sequence number ; [ ] [ \ curry see ] unit-test [ "POSTPONE: [" ] [ \ [ unparse ] unit-test + +TUPLE: started-out-hustlin' ; + +GENERIC: ended-up-ballin' + +M: started-out-hustlin' ended-up-ballin' ; inline + +[ "USING: prettyprint.tests ;\nM: started-out-hustlin' ended-up-ballin' ; inline\n" ] [ + [ { started-out-hustlin' ended-up-ballin' } see ] with-string-writer +] unit-test diff --git a/basis/prettyprint/prettyprint.factor b/basis/prettyprint/prettyprint.factor index b0293a8759..3befdaff2b 100644 --- a/basis/prettyprint/prettyprint.factor +++ b/basis/prettyprint/prettyprint.factor @@ -253,6 +253,9 @@ M: object see block> ] with-use nl ; +M: method-spec see + first2 method see ; + GENERIC: see-class* ( word -- ) M: union-class see-class* From 543ef13a7d30ad86ed398de5a6ec8b20af38109f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 09:01:01 -0600 Subject: [PATCH 121/948] Shorter help filenames --- basis/help/html/html.factor | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index 4100a34d72..d2d0725a1e 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -10,17 +10,15 @@ IN: help.html : escape-char ( ch -- ) dup H{ - { CHAR: " "__quote__" } + { CHAR: " "__quo__" } { CHAR: * "__star__" } { CHAR: : "__colon__" } { CHAR: < "__lt__" } { CHAR: > "__gt__" } - { CHAR: ? "__question__" } - { CHAR: \\ "__backslash__" } + { CHAR: ? "__que__" } + { CHAR: \\ "__back__" } { CHAR: | "__pipe__" } - { CHAR: _ "__underscore__" } { CHAR: / "__slash__" } - { CHAR: \\ "__backslash__" } { CHAR: , "__comma__" } { CHAR: @ "__at__" } } at [ % ] [ , ] ?if ; From 672f9e400e4845f1cda10efc3cc985c13e38dee4 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 11:16:32 -0600 Subject: [PATCH 122/948] Better error message --- basis/stack-checker/errors/errors.factor | 6 ++++++ basis/stack-checker/known-words/known-words.factor | 2 +- basis/stack-checker/stack-checker-tests.factor | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/basis/stack-checker/errors/errors.factor b/basis/stack-checker/errors/errors.factor index 9fb2b59f6c..31ae0a6789 100644 --- a/basis/stack-checker/errors/errors.factor +++ b/basis/stack-checker/errors/errors.factor @@ -108,3 +108,9 @@ M: inconsistent-recursive-call-error error. "The recursive word " write word>> pprint " calls itself with a different set of quotation parameters than were input" print ; + +TUPLE: unknown-primitive-error ; + +M: unknown-primitive-error error. + drop + "Cannot determine stack effect statically" print ; diff --git a/basis/stack-checker/known-words/known-words.factor b/basis/stack-checker/known-words/known-words.factor index 4aea0f2d28..f1034f2ca6 100644 --- a/basis/stack-checker/known-words/known-words.factor +++ b/basis/stack-checker/known-words/known-words.factor @@ -162,7 +162,7 @@ M: object infer-call* { \ load-locals [ infer-load-locals ] } { \ get-local [ infer-get-local ] } { \ drop-locals [ infer-drop-locals ] } - { \ do-primitive [ \ do-primitive cannot-infer-effect ] } + { \ do-primitive [ unknown-primitive-error inference-error ] } { \ alien-invoke [ infer-alien-invoke ] } { \ alien-indirect [ infer-alien-indirect ] } { \ alien-callback [ infer-alien-callback ] } diff --git a/basis/stack-checker/stack-checker-tests.factor b/basis/stack-checker/stack-checker-tests.factor index 9bf8ed62f0..defcde53f0 100644 --- a/basis/stack-checker/stack-checker-tests.factor +++ b/basis/stack-checker/stack-checker-tests.factor @@ -580,3 +580,5 @@ DEFER: eee' dup "A" throw [ bogus-error ] [ drop ] if ; inline recursive [ bogus-error ] must-infer + +[ [ clear ] infer. ] [ inference-error? ] must-fail-with From a166db313aaf090048914b85c2fd38bf387672df Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 12:23:12 -0600 Subject: [PATCH 123/948] Inferring set-datastack is just a warning not an error --- basis/stack-checker/known-words/known-words.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/stack-checker/known-words/known-words.factor b/basis/stack-checker/known-words/known-words.factor index f1034f2ca6..fdc4b4b35c 100644 --- a/basis/stack-checker/known-words/known-words.factor +++ b/basis/stack-checker/known-words/known-words.factor @@ -162,7 +162,7 @@ M: object infer-call* { \ load-locals [ infer-load-locals ] } { \ get-local [ infer-get-local ] } { \ drop-locals [ infer-drop-locals ] } - { \ do-primitive [ unknown-primitive-error inference-error ] } + { \ do-primitive [ unknown-primitive-error inference-warning ] } { \ alien-invoke [ infer-alien-invoke ] } { \ alien-indirect [ infer-alien-indirect ] } { \ alien-callback [ infer-alien-callback ] } From 14246fde379df2117238498b2094920c417af33b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 12:23:44 -0600 Subject: [PATCH 124/948] Better FFI unit tests expose a new problem --- basis/compiler/tests/alien.factor | 14 +++++++++++--- vm/ffi_test.c | 12 +++++++++++- vm/ffi_test.h | 3 ++- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/basis/compiler/tests/alien.factor b/basis/compiler/tests/alien.factor index d7e82402d5..3ca6fc87f3 100644 --- a/basis/compiler/tests/alien.factor +++ b/basis/compiler/tests/alien.factor @@ -146,13 +146,21 @@ FUNCTION: void ffi_test_20 double x1, double x2, double x3, ! Make sure XT doesn't get clobbered in stack frame -: ffi_test_31 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ptr -- result y ) - "void" +: ffi_test_31 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a -- result y ) + "int" f "ffi_test_31" { "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" "int" } alien-invoke gc 3 ; -[ 3 ] [ 42 [ ] each ffi_test_31 ] unit-test +[ 861 3 ] [ 42 [ ] each ffi_test_31 ] unit-test + +: ffi_test_31_point_5 ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a -- result ) + "float" + f "ffi_test_31_point_5" + { "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" "float" } + alien-invoke ; + +[ 861.0 ] [ 42 [ >float ] each ffi_test_31_point_5 ] unit-test FUNCTION: longlong ffi_test_21 long x long y ; diff --git a/vm/ffi_test.c b/vm/ffi_test.c index 081ae42ebf..7ae4491d80 100755 --- a/vm/ffi_test.c +++ b/vm/ffi_test.c @@ -224,7 +224,17 @@ struct test_struct_7 ffi_test_30(void) return s; } -void ffi_test_31(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20, int x21, int x22, int x23, int x24, int x25, int x26, int x27, int x28, int x29, int x30, int x31, int x32, int x33, int x34, int x35, int x36, int x37, int x38, int x39, int x40, int x41) { } +int ffi_test_31(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20, int x21, int x22, int x23, int x24, int x25, int x26, int x27, int x28, int x29, int x30, int x31, int x32, int x33, int x34, int x35, int x36, int x37, int x38, int x39, int x40, int x41) +{ + printf("ffi_test_31(%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)\n",x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41); + return x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21 + x22 + x23 + x24 + x25 + x26 + x27 + x28 + x29 + x30 + x31 + x32 + x33 + x34 + x35 + x36 + x37 + x38 + x39 + x40 + x41; +} + +float ffi_test_31_point_5(float x0, float x1, float x2, float x3, float x4, float x5, float x6, float x7, float x8, float x9, float x10, float x11, float x12, float x13, float x14, float x15, float x16, float x17, float x18, float x19, float x20, float x21, float x22, float x23, float x24, float x25, float x26, float x27, float x28, float x29, float x30, float x31, float x32, float x33, float x34, float x35, float x36, float x37, float x38, float x39, float x40, float x41) +{ + printf("ffi_test_31_point_5(%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f)\n",x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30,x31,x32,x33,x34,x35,x36,x37,x38,x39,x40,x41); + return x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13 + x14 + x15 + x16 + x17 + x18 + x19 + x20 + x21 + x22 + x23 + x24 + x25 + x26 + x27 + x28 + x29 + x30 + x31 + x32 + x33 + x34 + x35 + x36 + x37 + x38 + x39 + x40 + x41; +} double ffi_test_32(struct test_struct_8 x, int y) { diff --git a/vm/ffi_test.h b/vm/ffi_test.h index f9195a4285..7c51261157 100755 --- a/vm/ffi_test.h +++ b/vm/ffi_test.h @@ -48,7 +48,8 @@ struct test_struct_6 { char x, y, z, a, b, c; }; DLLEXPORT struct test_struct_6 ffi_test_29(void); struct test_struct_7 { char x, y, z, a, b, c, d; }; DLLEXPORT struct test_struct_7 ffi_test_30(void); -DLLEXPORT void ffi_test_31(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20, int x21, int x22, int x23, int x24, int x25, int x26, int x27, int x28, int x29, int x30, int x31, int x32, int x33, int x34, int x35, int x36, int x37, int x38, int x39, int x40, int x41); +DLLEXPORT int ffi_test_31(int x0, int x1, int x2, int x3, int x4, int x5, int x6, int x7, int x8, int x9, int x10, int x11, int x12, int x13, int x14, int x15, int x16, int x17, int x18, int x19, int x20, int x21, int x22, int x23, int x24, int x25, int x26, int x27, int x28, int x29, int x30, int x31, int x32, int x33, int x34, int x35, int x36, int x37, int x38, int x39, int x40, int x41); +DLLEXPORT float ffi_test_31_point_5(float x0, float x1, float x2, float x3, float x4, float x5, float x6, float x7, float x8, float x9, float x10, float x11, float x12, float x13, float x14, float x15, float x16, float x17, float x18, float x19, float x20, float x21, float x22, float x23, float x24, float x25, float x26, float x27, float x28, float x29, float x30, float x31, float x32, float x33, float x34, float x35, float x36, float x37, float x38, float x39, float x40, float x41); struct test_struct_8 { double x; double y; }; DLLEXPORT double ffi_test_32(struct test_struct_8 x, int y); struct test_struct_9 { float x; float y; }; From 20f5541d35c6a064d328b9da568298b02aa49ccf Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 13:34:37 -0600 Subject: [PATCH 125/948] Refactoring FFI for Win64 --- basis/alien/c-types/c-types.factor | 2 +- basis/alien/structs/structs.factor | 28 ++++++++++++---------- basis/compiler/codegen/codegen.factor | 4 ++-- basis/cpu/architecture/architecture.factor | 17 +++---------- basis/cpu/ppc/linux/linux.factor | 2 +- basis/cpu/ppc/macosx/macosx.factor | 2 +- basis/cpu/x86/64/winnt/winnt.factor | 5 ++-- basis/cpu/x86/x86.factor | 2 +- 8 files changed, 27 insertions(+), 35 deletions(-) diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor index a93c87611d..b4e4d05f2e 100644 --- a/basis/alien/c-types/c-types.factor +++ b/basis/alien/c-types/c-types.factor @@ -164,7 +164,7 @@ GENERIC: stack-size ( type -- size ) foldable M: string stack-size c-type stack-size ; -M: c-type stack-size size>> ; +M: c-type stack-size size>> cell align ; GENERIC: byte-length ( seq -- n ) flushable diff --git a/basis/alien/structs/structs.factor b/basis/alien/structs/structs.factor index ce30a2ee25..adb25aa977 100644 --- a/basis/alien/structs/structs.factor +++ b/basis/alien/structs/structs.factor @@ -1,14 +1,10 @@ ! Copyright (C) 2004, 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: accessors arrays generic hashtables kernel kernel.private -math namespaces parser sequences strings words libc +math namespaces parser sequences strings words libc fry alien.c-types alien.structs.fields cpu.architecture ; IN: alien.structs -: if-value-structs? ( ctype true false -- ) - value-structs? - [ drop call ] [ >r 2drop "void*" r> call ] if ; inline - TUPLE: struct-type size align fields ; M: struct-type heap-size size>> ; @@ -17,20 +13,26 @@ M: struct-type c-type-align align>> ; M: struct-type c-type-stack-align? drop f ; -M: struct-type unbox-parameter - [ %unbox-struct ] [ unbox-parameter ] if-value-structs? ; +: if-value-struct ( ctype true false -- ) + [ dup value-struct? ] 2dip '[ drop "void*" @ ] if ; inline -M: struct-type unbox-return - f swap %unbox-struct ; +M: struct-type unbox-parameter + [ %unbox-large-struct ] [ unbox-parameter ] if-value-struct ; M: struct-type box-parameter - [ %box-struct ] [ box-parameter ] if-value-structs? ; + [ %box-large-struct ] [ box-parameter ] if-value-struct ; + +: if-small-struct ( c-type true false -- ? ) + [ dup struct-small-enough? ] 2dip '[ f swap @ ] if ; inline + +M: struct-type unbox-return + [ %unbox-small-struct ] [ %unbox-large-struct ] if-small-struct ; M: struct-type box-return - f swap %box-struct ; + [ %box-small-struct ] [ %box-large-struct ] if-small-struct ; M: struct-type stack-size - [ heap-size ] [ stack-size ] if-value-structs? ; + [ heap-size ] [ stack-size ] if-value-struct ; : c-struct? ( type -- ? ) (c-type) struct-type? ; @@ -40,7 +42,7 @@ M: struct-type stack-size -rot define-c-type ; : define-struct-early ( name vocab fields -- fields ) - -rot [ rot first2 ] 2curry map ; + [ first2 ] with with map ; : compute-struct-align ( types -- n ) [ c-type-align ] map supremum ; diff --git a/basis/compiler/codegen/codegen.factor b/basis/compiler/codegen/codegen.factor index 0d45b28126..9f6e8e9c9b 100644 --- a/basis/compiler/codegen/codegen.factor +++ b/basis/compiler/codegen/codegen.factor @@ -235,7 +235,7 @@ M: float-regs reg-class-variable drop float-regs ; GENERIC: inc-reg-class ( register-class -- ) : ?dummy-stack-params ( reg-class -- ) - dummy-stack-params? [ reg-size stack-params +@ ] [ drop ] if ; + dummy-stack-params? [ reg-size cell align stack-params +@ ] [ drop ] if ; : ?dummy-int-params ( reg-class -- ) dummy-int-params? [ reg-size cell /i 1 max int-regs +@ ] [ drop ] if ; @@ -264,7 +264,7 @@ M: object reg-class-full? : spill-param ( reg-class -- n reg-class ) stack-params get - >r reg-size stack-params +@ r> + >r reg-size cell align stack-params +@ r> stack-params ; : fastcall-param ( reg-class -- n reg-class ) diff --git a/basis/cpu/architecture/architecture.factor b/basis/cpu/architecture/architecture.factor index 96dd577c10..d26e7f6ff7 100644 --- a/basis/cpu/architecture/architecture.factor +++ b/basis/cpu/architecture/architecture.factor @@ -141,10 +141,10 @@ HOOK: %loop-entry cpu ( -- ) HOOK: small-enough? cpu ( n -- ? ) ! Is this structure small enough to be returned in registers? -HOOK: struct-small-enough? cpu ( heap-size -- ? ) +HOOK: struct-small-enough? cpu ( c-type -- ? ) -! Do we pass value structs by value or hidden reference? -HOOK: value-structs? cpu ( -- ? ) +! Do we pass this struct by value or hidden reference? +HOOK: value-struct? cpu ( c-type -- ? ) ! If t, all parameters are shadowed by dummy stack parameters HOOK: dummy-stack-params? cpu ( -- ? ) @@ -207,14 +207,3 @@ M: object %callback-return drop %return ; M: stack-params param-reg drop ; M: stack-params param-regs drop f ; - -: if-small-struct ( n size true false -- ? ) - [ 2dup [ not ] [ struct-small-enough? ] bi* and ] 2dip - [ '[ nip @ ] ] dip if ; - inline - -: %unbox-struct ( n c-type -- ) - [ %unbox-small-struct ] [ %unbox-large-struct ] if-small-struct ; - -: %box-struct ( n c-type -- ) - [ %box-small-struct ] [ %box-large-struct ] if-small-struct ; diff --git a/basis/cpu/ppc/linux/linux.factor b/basis/cpu/ppc/linux/linux.factor index 090495aa11..5cfa1391c4 100644 --- a/basis/cpu/ppc/linux/linux.factor +++ b/basis/cpu/ppc/linux/linux.factor @@ -15,7 +15,7 @@ M: linux lr-save 1 cells ; M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 } ; -M: ppc value-structs? f ; +M: ppc value-struct? drop f ; M: ppc dummy-stack-params? f ; diff --git a/basis/cpu/ppc/macosx/macosx.factor b/basis/cpu/ppc/macosx/macosx.factor index 877fb37d31..c742cf2ddc 100644 --- a/basis/cpu/ppc/macosx/macosx.factor +++ b/basis/cpu/ppc/macosx/macosx.factor @@ -16,7 +16,7 @@ M: macosx lr-save 2 cells ; M: float-regs param-regs drop { 1 2 3 4 5 6 7 8 9 10 11 12 13 } ; -M: ppc value-structs? t ; +M: ppc value-struct? drop t ; M: ppc dummy-stack-params? t ; diff --git a/basis/cpu/x86/64/winnt/winnt.factor b/basis/cpu/x86/64/winnt/winnt.factor index 0124c40877..92560ef5e9 100644 --- a/basis/cpu/x86/64/winnt/winnt.factor +++ b/basis/cpu/x86/64/winnt/winnt.factor @@ -10,8 +10,9 @@ M: float-regs param-regs drop { XMM0 XMM1 XMM2 XMM3 } ; M: x86.64 reserved-area-size 4 cells ; -M: x86.64 struct-small-enough? ( size -- ? ) - heap-size cell <= ; +M: x86.64 struct-small-enough? heap-size { 1 2 4 8 } member? ; + +M: x86.64 value-struct? heap-size { 1 2 4 8 } member? ; M: x86.64 dummy-stack-params? f ; diff --git a/basis/cpu/x86/x86.factor b/basis/cpu/x86/x86.factor index dfe3d3e55e..58d95ffcde 100644 --- a/basis/cpu/x86/x86.factor +++ b/basis/cpu/x86/x86.factor @@ -507,7 +507,7 @@ M: x86 %prepare-alien-invoke temp-reg-1 2 cells [+] ds-reg MOV temp-reg-1 3 cells [+] rs-reg MOV ; -M: x86 value-structs? t ; +M: x86 value-struct? drop t ; M: x86 small-enough? ( n -- ? ) HEX: -80000000 HEX: 7fffffff between? ; From 5d8b3c3fb13f4404f0eb16a868aa729c6edf50b1 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 17:20:56 -0500 Subject: [PATCH 126/948] Cleanup math.intervals and eliminate >r r> usage --- basis/math/intervals/intervals.factor | 34 +++++++++++++-------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/basis/math/intervals/intervals.factor b/basis/math/intervals/intervals.factor index 54ee0ac894..4182d25524 100644 --- a/basis/math/intervals/intervals.factor +++ b/basis/math/intervals/intervals.factor @@ -12,10 +12,10 @@ SYMBOL: full-interval TUPLE: interval { from read-only } { to read-only } ; : ( from to -- int ) - over first over first { + 2dup [ first ] bi@ { { [ 2dup > ] [ 2drop 2drop empty-interval ] } { [ 2dup = ] [ - 2drop over second over second and + 2drop 2dup [ second ] both? [ interval boa ] [ 2drop empty-interval ] if ] } [ 2drop interval boa ] @@ -26,16 +26,16 @@ TUPLE: interval { from read-only } { to read-only } ; : closed-point ( n -- endpoint ) t 2array ; : [a,b] ( a b -- interval ) - >r closed-point r> closed-point ; foldable + [ closed-point ] dip closed-point ; foldable : (a,b) ( a b -- interval ) - >r open-point r> open-point ; foldable + [ open-point ] dip open-point ; foldable : [a,b) ( a b -- interval ) - >r closed-point r> open-point ; foldable + [ closed-point ] dip open-point ; foldable : (a,b] ( a b -- interval ) - >r open-point r> closed-point ; foldable + [ open-point ] dip closed-point ; foldable : [a,a] ( a -- interval ) closed-point dup ; foldable @@ -51,11 +51,11 @@ TUPLE: interval { from read-only } { to read-only } ; : [-inf,inf] ( -- interval ) full-interval ; inline : compare-endpoints ( p1 p2 quot -- ? ) - >r over first over first r> call [ + [ 2dup [ first ] bi@ ] dip call [ 2drop t ] [ - over first over first = [ - swap second swap second not or + 2dup [ first ] bi@ = [ + [ second ] bi@ not or ] [ 2drop f ] if @@ -86,7 +86,7 @@ TUPLE: interval { from read-only } { to read-only } ; ] if ; : (interval-op) ( p1 p2 quot -- p3 ) - [ [ first ] [ first ] [ ] tri* call ] + [ [ first ] [ first ] [ call ] tri* ] [ drop [ second ] both? ] 3bi 2array ; inline @@ -177,7 +177,7 @@ TUPLE: interval { from read-only } { to read-only } ; drop f ] [ interval>points - 2dup [ second ] bi@ and + 2dup [ second ] both? [ [ first ] bi@ = ] [ 2drop f ] if ] if ; @@ -193,9 +193,9 @@ TUPLE: interval { from read-only } { to read-only } ; dup [ interval>points [ first ] bi@ [a,b] ] when ; : interval-integer-op ( i1 i2 quot -- i3 ) - >r 2dup - [ interval>points [ first integer? ] both? ] both? - r> [ 2drop [-inf,inf] ] if ; inline + [ + 2dup [ interval>points [ first integer? ] both? ] both? + ] dip [ 2drop [-inf,inf] ] if ; inline : interval-shift ( i1 i2 -- i3 ) #! Inaccurate; could be tighter @@ -302,7 +302,7 @@ SYMBOL: incomparable 2tri and and ; : (interval<) ( i1 i2 -- i1 i2 ? ) - over from>> over from>> endpoint< ; + 2dup [ from>> ] bi@ endpoint< ; : interval< ( i1 i2 -- ? ) { @@ -314,10 +314,10 @@ SYMBOL: incomparable } cond 2nip ; : left-endpoint-<= ( i1 i2 -- ? ) - >r from>> r> to>> = ; + [ from>> ] dip to>> = ; : right-endpoint-<= ( i1 i2 -- ? ) - >r to>> r> from>> = ; + [ to>> ] dip from>> = ; : interval<= ( i1 i2 -- ? ) { From d328589b87c05cfb40a8c1e9363b6d9a0fee5837 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 17:59:15 -0500 Subject: [PATCH 127/948] Cleanup partial-dispatch by removing >r r> usage --- basis/math/partial-dispatch/partial-dispatch.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/basis/math/partial-dispatch/partial-dispatch.factor b/basis/math/partial-dispatch/partial-dispatch.factor index fd0e910b37..6874b79d2e 100644 --- a/basis/math/partial-dispatch/partial-dispatch.factor +++ b/basis/math/partial-dispatch/partial-dispatch.factor @@ -126,7 +126,7 @@ SYMBOL: fast-math-ops : math-method* ( word left right -- quot ) 3dup math-op - [ >r 3drop r> 1quotation ] [ drop math-method ] if ; + [ [ 3drop ] dip 1quotation ] [ drop math-method ] if ; : math-both-known? ( word left right -- ? ) 3dup math-op @@ -157,13 +157,13 @@ SYMBOL: fast-math-ops ] bi@ append ; : each-derived-op ( word quot -- ) - >r derived-ops r> each ; inline + [ derived-ops ] dip each ; inline : each-fast-derived-op ( word quot -- ) - >r fast-derived-ops r> each ; inline + [ fast-derived-ops ] dip each ; inline : each-integer-derived-op ( word quot -- ) - >r integer-derived-ops r> each ; inline + [ integer-derived-ops ] dip each ; inline [ [ From fa88f8825b6656cf66ae7c74516e8d9ea881ede1 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 18:13:42 -0500 Subject: [PATCH 128/948] Replace >r r> usage with dip in math.ratios --- basis/math/ratios/ratios.factor | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/basis/math/ratios/ratios.factor b/basis/math/ratios/ratios.factor index d9dea22b7b..81294d29f7 100644 --- a/basis/math/ratios/ratios.factor +++ b/basis/math/ratios/ratios.factor @@ -12,10 +12,10 @@ IN: math.ratios dup 1 number= [ drop ] [ ] if ; inline : scale ( a/b c/d -- a*d b*c ) - 2>fraction >r * swap r> * swap ; inline + 2>fraction [ * swap ] dip * swap ; inline : ratio+d ( a/b c/d -- b*d ) - denominator swap denominator * ; inline + [ denominator ] bi@ * ; inline PRIVATE> @@ -24,7 +24,7 @@ M: integer / "Division by zero" throw ] [ dup 0 < [ [ neg ] bi@ ] when - 2dup gcd nip tuck /i >r /i r> fraction> + 2dup gcd nip tuck /i [ /i ] dip fraction> ] if ; M: ratio hashcode* @@ -52,7 +52,7 @@ M: ratio >= scale >= ; M: ratio + 2dup scale + -rot ratio+d / ; M: ratio - 2dup scale - -rot ratio+d / ; -M: ratio * 2>fraction * >r * r> / ; +M: ratio * 2>fraction * [ * ] dip / ; M: ratio / scale / ; M: ratio /i scale /i ; M: ratio /f scale /f ; From d2a67c78b2b385b3286d376c50a6f02fbfbb3b3b Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 18:14:29 -0500 Subject: [PATCH 129/948] Replace >r r> usage with dip in math.ranges --- basis/math/ranges/ranges.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/math/ranges/ranges.factor b/basis/math/ranges/ranges.factor index 5acdc43ca3..41fd28e441 100644 --- a/basis/math/ranges/ranges.factor +++ b/basis/math/ranges/ranges.factor @@ -8,7 +8,7 @@ TUPLE: range { step read-only } ; : ( a b step -- range ) - >r over - r> + [ over - ] dip [ / 1+ 0 max >integer ] keep range boa ; inline From 9c27e9d61bd086cfa44e9ad9451c72c4aa82af81 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 18:17:14 -0500 Subject: [PATCH 130/948] Replace >r r> usage with dip in math.vectors --- basis/math/vectors/vectors.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/math/vectors/vectors.factor b/basis/math/vectors/vectors.factor index 5316720b2f..01a421b4e7 100644 --- a/basis/math/vectors/vectors.factor +++ b/basis/math/vectors/vectors.factor @@ -25,7 +25,7 @@ IN: math.vectors : normalize ( u -- v ) dup norm v/n ; : set-axis ( u v axis -- w ) - [ >r zero? 2over ? r> swap nth ] map-index 2nip ; + [ [ zero? 2over ? ] dip swap nth ] map-index 2nip ; HINTS: vneg { array } ; HINTS: norm-sq { array } ; From 000d84a8719d689199aec3a343349838935fcc49 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 18:20:34 -0500 Subject: [PATCH 131/948] Replace pick pick with 2over in math.functions --- basis/math/functions/functions.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/math/functions/functions.factor b/basis/math/functions/functions.factor index 4fa83a9904..c582c560a9 100644 --- a/basis/math/functions/functions.factor +++ b/basis/math/functions/functions.factor @@ -146,7 +146,7 @@ M: real absq sq ; : ~ ( x y epsilon -- ? ) { - { [ pick pick [ fp-nan? ] either? ] [ 3drop f ] } + { [ 2over [ fp-nan? ] either? ] [ 3drop f ] } { [ dup zero? ] [ drop number= ] } { [ dup 0 < ] [ ~rel ] } [ ~abs ] From 7815560f30c19699d44e251acf18b4f69d937651 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 17:28:44 -0600 Subject: [PATCH 132/948] Fix index paths --- basis/help/html/html.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index d2d0725a1e..82e83e60e0 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -115,10 +115,10 @@ M: result link-href href>> ; [ [ title>> ] compare ] sort ; : article-apropos ( string -- results ) - "articles.idx" temp-file offline-apropos ; + "docs/articles.idx" temp-file offline-apropos ; : word-apropos ( string -- results ) - "words.idx" temp-file offline-apropos ; + "docs/words.idx" temp-file offline-apropos ; : vocab-apropos ( string -- results ) - "vocabs.idx" temp-file offline-apropos ; + "docs/vocabs.idx" temp-file offline-apropos ; From b50d4c9b36621be6e96eff3d935d48454e49c39f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 17:30:47 -0600 Subject: [PATCH 133/948] Fix help search again --- basis/help/html/html.factor | 6 +++--- extra/webapps/help/help.factor | 8 +++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/basis/help/html/html.factor b/basis/help/html/html.factor index 82e83e60e0..6b90ba6937 100644 --- a/basis/help/html/html.factor +++ b/basis/help/html/html.factor @@ -115,10 +115,10 @@ M: result link-href href>> ; [ [ title>> ] compare ] sort ; : article-apropos ( string -- results ) - "docs/articles.idx" temp-file offline-apropos ; + "articles.idx" offline-apropos ; : word-apropos ( string -- results ) - "docs/words.idx" temp-file offline-apropos ; + "words.idx" offline-apropos ; : vocab-apropos ( string -- results ) - "docs/vocabs.idx" temp-file offline-apropos ; + "vocabs.idx" offline-apropos ; diff --git a/extra/webapps/help/help.factor b/extra/webapps/help/help.factor index c209fe222e..3072f5d024 100644 --- a/extra/webapps/help/help.factor +++ b/extra/webapps/help/help.factor @@ -18,9 +18,11 @@ TUPLE: help-webapp < dispatcher ; help-dir set-current-directory - "search" value article-apropos "articles" set-value - "search" value word-apropos "words" set-value - "search" value vocab-apropos "vocabs" set-value + help-dir [ + "search" value article-apropos "articles" set-value + "search" value word-apropos "words" set-value + "search" value vocab-apropos "vocabs" set-value + ] with-directory { help-webapp "search" } ] >>submit ; From 4d0b5cf7e74c793b1a1b75ff3ea052b24c3b9348 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 17:35:39 -0600 Subject: [PATCH 134/948] Clean up --- extra/webapps/help/help.factor | 2 -- 1 file changed, 2 deletions(-) diff --git a/extra/webapps/help/help.factor b/extra/webapps/help/help.factor index 3072f5d024..6f2c4f0042 100644 --- a/extra/webapps/help/help.factor +++ b/extra/webapps/help/help.factor @@ -16,8 +16,6 @@ TUPLE: help-webapp < dispatcher ; { "search" [ 1 v-min-length 50 v-max-length v-one-line ] } } validate-params - help-dir set-current-directory - help-dir [ "search" value article-apropos "articles" set-value "search" value word-apropos "words" set-value From f8e86894a46d3879c233e9d1161626111ac402b8 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 18:41:21 -0500 Subject: [PATCH 135/948] Minor Project Euler cleanup --- extra/project-euler/047/047.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/project-euler/047/047.factor b/extra/project-euler/047/047.factor index 30c01d8f61..9caaa8776f 100644 --- a/extra/project-euler/047/047.factor +++ b/extra/project-euler/047/047.factor @@ -32,7 +32,7 @@ IN: project-euler.047 Date: Mon, 17 Nov 2008 17:48:06 -0600 Subject: [PATCH 136/948] Fix typo --- basis/compiler/compiler-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/compiler/compiler-docs.factor b/basis/compiler/compiler-docs.factor index 6cb860d33f..512d26f4bf 100644 --- a/basis/compiler/compiler-docs.factor +++ b/basis/compiler/compiler-docs.factor @@ -6,7 +6,7 @@ HELP: enable-compiler { $description "Enables the optimizing compiler." } ; HELP: disable-compiler -{ $description "Enables the optimizing compiler." } ; +{ $description "Disable the optimizing compiler." } ; ARTICLE: "compiler-usage" "Calling the optimizing compiler" "Normally, new word definitions are recompiled automatically. This can be changed:" From 6161d99637b3badf687552d9d2ac81a9fca5cad0 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 18:48:19 -0500 Subject: [PATCH 137/948] Replace nested >r r> with spread in math.statistics --- extra/math/statistics/statistics.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extra/math/statistics/statistics.factor b/extra/math/statistics/statistics.factor index 267a95c100..7568af5294 100644 --- a/extra/math/statistics/statistics.factor +++ b/extra/math/statistics/statistics.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2008 Doug Coleman, Michael Judge. ! See http://factorcode.org/license.txt for BSD license. -USING: arrays kernel math math.analysis math.functions sequences sequences.lib - sorting ; +USING: arrays combinators kernel math math.analysis math.functions sequences + sequences.lib sorting ; IN: math.statistics : mean ( seq -- n ) @@ -63,7 +63,7 @@ IN: math.statistics r sq ; : least-squares ( {{x,y}...} -- alpha beta ) - [r] >r >r >r >r 2dup r> r> r> r> + [r] { [ 2dup ] [ ] [ ] [ ] [ ] } spread ! stack is mean(x) mean(y) mean(x) mean(y) {x} {y} sx sy [ (r) ] 2keep ! stack is mean(x) mean(y) r sx sy swap / * ! stack is mean(x) mean(y) beta From eea93234d05abd58a8512d05985541f436ff4652 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Nov 2008 18:41:53 -0600 Subject: [PATCH 138/948] Fix some types for Win64 --- basis/windows/kernel32/kernel32.factor | 10 +++++----- basis/windows/types/types.factor | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/basis/windows/kernel32/kernel32.factor b/basis/windows/kernel32/kernel32.factor index 462377e85c..96301dbbe4 100644 --- a/basis/windows/kernel32/kernel32.factor +++ b/basis/windows/kernel32/kernel32.factor @@ -199,11 +199,11 @@ TYPEDEF: FILE_NOTIFY_INFORMATION* PFILE_NOTIFY_INFORMATION : THREAD_PRIORITY_TIME_CRITICAL 15 ; inline C-STRUCT: OVERLAPPED - { "int" "internal" } - { "int" "internal-high" } - { "int" "offset" } - { "int" "offset-high" } - { "void*" "event" } ; + { "UINT_PTR" "internal" } + { "UINT_PTR" "internal-high" } + { "DWORD" "offset" } + { "DWORD" "offset-high" } + { "HANDLE" "event" } ; C-STRUCT: SYSTEMTIME { "WORD" "wYear" } diff --git a/basis/windows/types/types.factor b/basis/windows/types/types.factor index 0ac8409016..6b1a57a098 100644 --- a/basis/windows/types/types.factor +++ b/basis/windows/types/types.factor @@ -40,10 +40,11 @@ TYPEDEF: void* LPVOID TYPEDEF: void* LPCVOID TYPEDEF: float FLOAT -TYPEDEF: short HALF_PTR -TYPEDEF: ushort UHALF_PTR -TYPEDEF: int INT_PTR -TYPEDEF: uint UINT_PTR + +TYPEDEF: intptr_t HALF_PTR +TYPEDEF: intptr_t UHALF_PTR +TYPEDEF: intptr_t INT_PTR +TYPEDEF: intptr_t UINT_PTR TYPEDEF: int LONG_PTR TYPEDEF: ulong ULONG_PTR From ccd13ce975fe4461de7ffe903b8fd4b8cd1408b5 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Nov 2008 18:42:10 -0600 Subject: [PATCH 139/948] Define intptr_t type --- basis/alien/c-types/c-types.factor | 2 +- basis/cpu/x86/64/winnt/winnt.factor | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/basis/alien/c-types/c-types.factor b/basis/alien/c-types/c-types.factor index b4e4d05f2e..543af8dee8 100644 --- a/basis/alien/c-types/c-types.factor +++ b/basis/alien/c-types/c-types.factor @@ -436,6 +436,6 @@ M: long-long-type box-return ( type -- ) "double" define-primitive-type "long" "ptrdiff_t" typedef - + "long" "intptr_t" typedef "ulong" "size_t" typedef ] with-compilation-unit diff --git a/basis/cpu/x86/64/winnt/winnt.factor b/basis/cpu/x86/64/winnt/winnt.factor index 92560ef5e9..9108c0e8f7 100644 --- a/basis/cpu/x86/64/winnt/winnt.factor +++ b/basis/cpu/x86/64/winnt/winnt.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel layouts system math alien.c-types +USING: kernel layouts system math alien.c-types sequences compiler.cfg.registers cpu.architecture cpu.x86.assembler cpu.x86 ; IN: cpu.x86.64.winnt @@ -22,6 +22,7 @@ M: x86.64 dummy-fp-params? t ; << "longlong" "ptrdiff_t" typedef +"longlong" "intptr_t" typedef "int" "long" typedef "uint" "ulong" typedef >> From efb2e49c50c318f598508d6e62da53ebcf056a21 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Nov 2008 18:42:21 -0600 Subject: [PATCH 140/948] Fix freetype for Win64 --- basis/freetype/freetype.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/freetype/freetype.factor b/basis/freetype/freetype.factor index 8572a8bd91..683169e394 100644 --- a/basis/freetype/freetype.factor +++ b/basis/freetype/freetype.factor @@ -64,7 +64,7 @@ C-STRUCT: glyph { "FT_Pos" "advance-x" } { "FT_Pos" "advance-y" } - { "long" "format" } + { "intptr_t" "format" } { "int" "bitmap-rows" } { "int" "bitmap-width" } From d0139671802d194732d31d3ef60f202e9e33af88 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Nov 2008 18:42:44 -0600 Subject: [PATCH 141/948] Make io.servers.connection work if SSL is not available --- basis/io/servers/connection/connection.factor | 30 ++++++++++++------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/basis/io/servers/connection/connection.factor b/basis/io/servers/connection/connection.factor index 674ed8803c..942bdb041d 100644 --- a/basis/io/servers/connection/connection.factor +++ b/basis/io/servers/connection/connection.factor @@ -114,19 +114,29 @@ M: threaded-server handle-client* handler>> call ; ] when* ] unless ; +: (start-server) ( threaded-server -- ) + init-server + dup threaded-server [ + dup name>> [ + [ listen-on [ start-accept-loop ] parallel-each ] + [ ready>> raise-flag ] + bi + ] with-logging + ] with-variable ; + PRIVATE> : start-server ( threaded-server -- ) - init-server - dup secure-config>> [ - dup threaded-server [ - dup name>> [ - [ listen-on [ start-accept-loop ] parallel-each ] - [ ready>> raise-flag ] - bi - ] with-logging - ] with-variable - ] with-secure-context ; + #! Only create a secure-context if we want to listen on + #! a secure port, otherwise start-server won't work at + #! all if SSL is not available. + dup secure>> [ + dup secure-config>> [ + (start-server) + ] with-secure-context + ] [ + (start-server) + ] if ; : wait-for-server ( threaded-server -- ) ready>> wait-for-flag ; From 1c33e993daa0093db9efcff32a577e9d2f0c4251 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Nov 2008 18:43:10 -0600 Subject: [PATCH 142/948] Tweak launcher test: it failed without cygwin --- .../windows/nt/launcher/launcher-tests.factor | 314 +++++++++--------- 1 file changed, 157 insertions(+), 157 deletions(-) diff --git a/basis/io/windows/nt/launcher/launcher-tests.factor b/basis/io/windows/nt/launcher/launcher-tests.factor index 949b0a7961..cbae2f5eca 100644 --- a/basis/io/windows/nt/launcher/launcher-tests.factor +++ b/basis/io/windows/nt/launcher/launcher-tests.factor @@ -1,157 +1,157 @@ -USING: io.launcher tools.test calendar accessors environment -namespaces kernel system arrays io io.files io.encodings.ascii -sequences parser assocs hashtables math continuations eval ; -IN: io.windows.launcher.nt.tests - -[ ] [ - - "notepad" >>command - 1/2 seconds >>timeout - "notepad" set -] unit-test - -[ f ] [ "notepad" get process-running? ] unit-test - -[ f ] [ "notepad" get process-started? ] unit-test - -[ ] [ "notepad" [ run-detached ] change ] unit-test - -[ "notepad" get wait-for-process ] must-fail - -[ t ] [ "notepad" get killed>> ] unit-test - -[ f ] [ "notepad" get process-running? ] unit-test - -[ ] [ - - vm "-quiet" "-run=hello-world" 3array >>command - "out.txt" temp-file >>stdout - try-process -] unit-test - -[ "Hello world" ] [ - "out.txt" temp-file ascii file-lines first -] unit-test - -[ ] [ - - vm "-run=listener" 2array >>command - +closed+ >>stdin - try-process -] unit-test - -[ ] [ - "resource:basis/io/windows/nt/launcher/test" [ - - vm "-script" "stderr.factor" 3array >>command - "out.txt" temp-file >>stdout - "err.txt" temp-file >>stderr - try-process - ] with-directory -] unit-test - -[ "output" ] [ - "out.txt" temp-file ascii file-lines first -] unit-test - -[ "error" ] [ - "err.txt" temp-file ascii file-lines first -] unit-test - -[ ] [ - "resource:basis/io/windows/nt/launcher/test" [ - - vm "-script" "stderr.factor" 3array >>command - "out.txt" temp-file >>stdout - +stdout+ >>stderr - try-process - ] with-directory -] unit-test - -[ "outputerror" ] [ - "out.txt" temp-file ascii file-lines first -] unit-test - -[ "output" ] [ - "resource:basis/io/windows/nt/launcher/test" [ - - vm "-script" "stderr.factor" 3array >>command - "err2.txt" temp-file >>stderr - ascii lines first - ] with-directory -] unit-test - -[ "error" ] [ - "err2.txt" temp-file ascii file-lines first -] unit-test - -[ t ] [ - "resource:basis/io/windows/nt/launcher/test" [ - - vm "-script" "env.factor" 3array >>command - ascii contents - ] with-directory eval - - os-envs = -] unit-test - -[ t ] [ - "resource:basis/io/windows/nt/launcher/test" [ - - vm "-script" "env.factor" 3array >>command - +replace-environment+ >>environment-mode - os-envs >>environment - ascii contents - ] with-directory eval - - os-envs = -] unit-test - -[ "B" ] [ - "resource:basis/io/windows/nt/launcher/test" [ - - vm "-script" "env.factor" 3array >>command - { { "A" "B" } } >>environment - ascii contents - ] with-directory eval - - "A" swap at -] unit-test - -[ f ] [ - "resource:basis/io/windows/nt/launcher/test" [ - - vm "-script" "env.factor" 3array >>command - { { "HOME" "XXX" } } >>environment - +prepend-environment+ >>environment-mode - ascii contents - ] with-directory eval - - "HOME" swap at "XXX" = -] unit-test - -2 [ - [ ] [ - - "cmd.exe /c dir" >>command - "dir.txt" temp-file >>stdout - try-process - ] unit-test - - [ ] [ "dir.txt" temp-file delete-file ] unit-test -] times - -[ "append-test" temp-file delete-file ] ignore-errors - -[ "Hello appender\r\nHello appender\r\n" ] [ - 2 [ - "resource:basis/io/windows/nt/launcher/test" [ - - vm "-script" "append.factor" 3array >>command - "append-test" temp-file >>stdout - try-process - ] with-directory - ] times - - "append-test" temp-file ascii file-contents -] unit-test +USING: io.launcher tools.test calendar accessors environment +namespaces kernel system arrays io io.files io.encodings.ascii +sequences parser assocs hashtables math continuations eval ; +IN: io.windows.launcher.nt.tests + +[ ] [ + + "notepad" >>command + 1/2 seconds >>timeout + "notepad" set +] unit-test + +[ f ] [ "notepad" get process-running? ] unit-test + +[ f ] [ "notepad" get process-started? ] unit-test + +[ ] [ "notepad" [ run-detached ] change ] unit-test + +[ "notepad" get wait-for-process ] must-fail + +[ t ] [ "notepad" get killed>> ] unit-test + +[ f ] [ "notepad" get process-running? ] unit-test + +[ ] [ + + vm "-quiet" "-run=hello-world" 3array >>command + "out.txt" temp-file >>stdout + try-process +] unit-test + +[ "Hello world" ] [ + "out.txt" temp-file ascii file-lines first +] unit-test + +[ ] [ + + vm "-run=listener" 2array >>command + +closed+ >>stdin + try-process +] unit-test + +[ ] [ + "resource:basis/io/windows/nt/launcher/test" [ + + vm "-script" "stderr.factor" 3array >>command + "out.txt" temp-file >>stdout + "err.txt" temp-file >>stderr + try-process + ] with-directory +] unit-test + +[ "output" ] [ + "out.txt" temp-file ascii file-lines first +] unit-test + +[ "error" ] [ + "err.txt" temp-file ascii file-lines first +] unit-test + +[ ] [ + "resource:basis/io/windows/nt/launcher/test" [ + + vm "-script" "stderr.factor" 3array >>command + "out.txt" temp-file >>stdout + +stdout+ >>stderr + try-process + ] with-directory +] unit-test + +[ "outputerror" ] [ + "out.txt" temp-file ascii file-lines first +] unit-test + +[ "output" ] [ + "resource:basis/io/windows/nt/launcher/test" [ + + vm "-script" "stderr.factor" 3array >>command + "err2.txt" temp-file >>stderr + ascii lines first + ] with-directory +] unit-test + +[ "error" ] [ + "err2.txt" temp-file ascii file-lines first +] unit-test + +[ t ] [ + "resource:basis/io/windows/nt/launcher/test" [ + + vm "-script" "env.factor" 3array >>command + ascii contents + ] with-directory eval + + os-envs = +] unit-test + +[ t ] [ + "resource:basis/io/windows/nt/launcher/test" [ + + vm "-script" "env.factor" 3array >>command + +replace-environment+ >>environment-mode + os-envs >>environment + ascii contents + ] with-directory eval + + os-envs = +] unit-test + +[ "B" ] [ + "resource:basis/io/windows/nt/launcher/test" [ + + vm "-script" "env.factor" 3array >>command + { { "A" "B" } } >>environment + ascii contents + ] with-directory eval + + "A" swap at +] unit-test + +[ f ] [ + "resource:basis/io/windows/nt/launcher/test" [ + + vm "-script" "env.factor" 3array >>command + { { "USERPROFILE" "XXX" } } >>environment + +prepend-environment+ >>environment-mode + ascii contents + ] with-directory eval + + "USERPROFILE" swap at "XXX" = +] unit-test + +2 [ + [ ] [ + + "cmd.exe /c dir" >>command + "dir.txt" temp-file >>stdout + try-process + ] unit-test + + [ ] [ "dir.txt" temp-file delete-file ] unit-test +] times + +[ "append-test" temp-file delete-file ] ignore-errors + +[ "Hello appender\r\nHello appender\r\n" ] [ + 2 [ + "resource:basis/io/windows/nt/launcher/test" [ + + vm "-script" "append.factor" 3array >>command + "append-test" temp-file >>stdout + try-process + ] with-directory + ] times + + "append-test" temp-file ascii file-contents +] unit-test From b8487ffcb0c1bbb8bdb134017a17fd457a66e152 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Nov 2008 18:43:33 -0600 Subject: [PATCH 143/948] Download Windows DLLs from builder, so that we don't need wget to build Factor --- extra/mason/child/child.factor | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/extra/mason/child/child.factor b/extra/mason/child/child.factor index 2bc6b191c4..0c9669ed5a 100644 --- a/extra/mason/child/child.factor +++ b/extra/mason/child/child.factor @@ -2,14 +2,26 @@ ! See http://factorcode.org/license.txt for BSD license. USING: kernel namespaces make debugger sequences io.files io.launcher arrays accessors calendar continuations -combinators.short-circuit mason.common mason.report mason.platform ; +combinators.short-circuit mason.common mason.report +mason.platform mason.config http.client ; IN: mason.child : make-cmd ( -- args ) - [ gnu-make , "clean" , platform , ] { } make ; + gnu-make platform 2array ; + +: download-dlls ( -- ) + target-os get "winnt" = [ + "http://factorcode.org/dlls/" + target-cpu get "x86.64" = [ "64/" append ] when + [ "freetype6.dll" append ] + [ "zlib1.dll" append ] bi + [ download ] bi@ + ] when ; : make-vm ( -- ) "factor" [ + download-dlls + make-cmd >>command "../compile-log" >>stdout From 93c8f5a2f4ad2448018c7ce715495ab678661525 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Nov 2008 18:43:59 -0600 Subject: [PATCH 144/948] Use our MD5 library instead of OpenSSL so that we can run builder without OpenSSL being installed --- basis/bootstrap/image/download/download.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/bootstrap/image/download/download.factor b/basis/bootstrap/image/download/download.factor index 71aa2e8adc..f9b7b56779 100644 --- a/basis/bootstrap/image/download/download.factor +++ b/basis/bootstrap/image/download/download.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: http.client checksums checksums.openssl splitting assocs +USING: http.client checksums checksums.md5 splitting assocs kernel io.files bootstrap.image sequences io urls ; IN: bootstrap.image.download @@ -13,7 +13,7 @@ IN: bootstrap.image.download : need-new-image? ( image -- ? ) dup exists? [ - [ openssl-md5 checksum-file hex-string ] + [ md5 checksum-file hex-string ] [ download-checksums at ] bi = not ] [ drop t ] if ; From ddd28c7d12fff8bf6ed4fa757e63c9eb24f9247c Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 17 Nov 2008 18:44:06 -0600 Subject: [PATCH 145/948] Fix Win64 type issue --- vm/math.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/math.c b/vm/math.c index 388a472f2e..c6b91bc8f7 100644 --- a/vm/math.c +++ b/vm/math.c @@ -109,7 +109,7 @@ void primitive_fixnum_shift(void) } else if(y < WORD_SIZE - TAG_BITS) { - F_FIXNUM mask = -(1L << (WORD_SIZE - 1 - TAG_BITS - y)); + F_FIXNUM mask = -((F_FIXNUM)1 << (WORD_SIZE - 1 - TAG_BITS - y)); if((x > 0 && (x & mask) == 0) || (x & mask) == mask) { dpush(tag_fixnum(x << y)); From a7551efd0231f9e0bd466429897972fb320a7e75 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 21:12:10 -0500 Subject: [PATCH 146/948] Add documentation for math.quaternions --- .../math/quaternions/quaternions-docs.factor | 46 +++++++++++++++++++ extra/math/quaternions/quaternions.factor | 35 +++++--------- 2 files changed, 58 insertions(+), 23 deletions(-) create mode 100644 extra/math/quaternions/quaternions-docs.factor diff --git a/extra/math/quaternions/quaternions-docs.factor b/extra/math/quaternions/quaternions-docs.factor new file mode 100644 index 0000000000..bb34ec8da2 --- /dev/null +++ b/extra/math/quaternions/quaternions-docs.factor @@ -0,0 +1,46 @@ +USING: help.markup help.syntax math math.vectors vectors ; +IN: math.quaternions + +HELP: q* +{ $values { "u" "a quaternion" } { "v" "a quaternion" } { "u*v" "a quaternion" } } +{ $description "Multiply quaternions." } +{ $examples { $example "USING: math.quaternions prettyprint ;" "{ C{ 0 1 } 0 } { 0 1 } q* ." "{ 0 C{ 0 1 } }" } } ; + +HELP: qconjugate +{ $values { "u" "a quaternion" } { "u'" "a quaternion" } } +{ $description "Quaternion conjugate." } ; + +HELP: qrecip +{ $values { "u" "a quaternion" } { "1/u" "a quaternion" } } +{ $description "Quaternion inverse." } ; + +HELP: q/ +{ $values { "u" "a quaternion" } { "v" "a quaternion" } { "u/v" "a quaternion" } } +{ $description "Divide quaternions." } +{ $examples { $example "USING: math.quaternions prettyprint ;" "{ 0 C{ 0 1 } } { 0 1 } q/ ." "{ C{ 0 1 } 0 }" } } ; + +HELP: q*n +{ $values { "q" "a quaternion" } { "n" number } { "q" "a quaternion" } } +{ $description "Multiplies each element of " { $snippet "q" } " by " { $snippet "n" } "." } +{ $notes "You will get the wrong result if you try to multiply a quaternion by a complex number on the right using " { $link v*n } ". Use this word instead." + $nl "Note that " { $link v*n } " with a quaternion and a real is okay." } ; + +HELP: c>q +{ $values { "c" number } { "q" "a quaternion" } } +{ $description "Turn a complex number into a quaternion." } +{ $examples { $example "USING: math.quaternions prettyprint ;" "C{ 0 1 } c>q ." "{ C{ 0 1 } 0 }" } } ; + +HELP: v>q +{ $values { "v" vector } { "q" "a quaternion" } } +{ $description "Turn a 3-vector into a quaternion with real part 0." } +{ $examples { $example "USING: math.quaternions prettyprint ;" "{ 1 0 0 } v>q ." "{ C{ 0 1 } 0 }" } } ; + +HELP: q>v +{ $values { "q" "a quaternion" } { "v" vector } } +{ $description "Get the vector part of a quaternion, discarding the real part." } +{ $examples { $example "USING: math.quaternions prettyprint ;" "{ C{ 0 1 } 0 } q>v ." "{ 1 0 0 }" } } ; + +HELP: euler +{ $values { "phi" number } { "theta" number } { "psi" number } { "q" "a quaternion" } } +{ $description "Convert a rotation given by Euler angles (phi, theta, and psi) to a quaternion." } ; + diff --git a/extra/math/quaternions/quaternions.factor b/extra/math/quaternions/quaternions.factor index ffc0fcc9f7..bb0d025dc6 100755 --- a/extra/math/quaternions/quaternions.factor +++ b/extra/math/quaternions/quaternions.factor @@ -1,15 +1,13 @@ ! Copyright (C) 2005, 2007 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. - -! Everybody's favorite non-commutative skew field, the -! quaternions! - -! Quaternions are represented as pairs of complex numbers, -! using the identity: (a+bi)+(c+di)j = a+bi+cj+dk. -USING: arrays kernel math math.vectors math.functions -arrays sequences ; +USING: arrays kernel math math.functions math.vectors sequences ; IN: math.quaternions +! Everybody's favorite non-commutative skew field, the quaternions! + +! Quaternions are represented as pairs of complex numbers, using the +! identity: (a+bi)+(c+di)j = a+bi+cj+dk. + : q* ( u v -- u*v ) - #! Multiply quaternions. [ q*a ] [ q*b ] 2bi 2array ; : qconjugate ( u -- u' ) - #! Quaternion conjugate. first2 [ conjugate ] [ neg ] bi* 2array ; : qrecip ( u -- 1/u ) - #! Quaternion inverse. qconjugate dup norm-sq v/n ; : q/ ( u v -- u/v ) - #! Divide quaternions. qrecip q* ; : q*n ( q n -- q ) - #! Note: you will get the wrong result if you try to - #! multiply a quaternion by a complex number on the right - #! using v*n. Use this word instead. Note that v*n with a - #! quaternion and a real is okay. conjugate v*n ; : c>q ( c -- q ) - #! Turn a complex number into a quaternion. 0 2array ; : v>q ( v -- q ) - #! Turn a 3-vector into a quaternion with real part 0. first3 rect> [ 0 swap rect> ] dip 2array ; : q>v ( q -- v ) - #! Get the vector part of a quaternion, discarding the real - #! part. first2 [ imaginary-part ] dip >rect 3array ; ! Zero @@ -67,11 +53,14 @@ PRIVATE> : qj { 0 1 } ; : qk { 0 C{ 0 1 } } ; -! Euler angles -- see -! http://www.mathworks.com/access/helpdesk/help/toolbox/aeroblks/euleranglestoquaternions.html +! Euler angles + +q swap sin ] dip n*v v- ; + [ -0.5 * [ cos c>q ] [ sin ] bi ] dip n*v v- ; + +PRIVATE> : euler ( phi theta psi -- q ) [ qi (euler) ] [ qj (euler) ] [ qk (euler) ] tri* q* q* ; From a9a28a3231e08a5eff92e0ad033d1d70a02c3b48 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 20:28:52 -0600 Subject: [PATCH 147/948] Trying to blindly fix Win64 unit tests --- basis/html/templates/fhtml/fhtml-tests.factor | 6 ++++-- core/io/io-tests.factor | 7 ++++++- core/io/test/separator-test.txt | 1 - extra/benchmark/regex-dna/regex-dna-tests.factor | 6 +++--- extra/contributors/contributors.factor | 2 +- extra/mason/child/child-tests.factor | 6 +++--- 6 files changed, 17 insertions(+), 11 deletions(-) delete mode 100644 core/io/test/separator-test.txt diff --git a/basis/html/templates/fhtml/fhtml-tests.factor b/basis/html/templates/fhtml/fhtml-tests.factor index b863087a92..d314a60124 100644 --- a/basis/html/templates/fhtml/fhtml-tests.factor +++ b/basis/html/templates/fhtml/fhtml-tests.factor @@ -1,6 +1,6 @@ USING: io io.files io.streams.string io.encodings.utf8 html.templates html.templates.fhtml kernel -tools.test sequences parser ; +tools.test sequences parser splitting prettyprint ; IN: html.templates.fhtml.tests : test-template ( path -- ? ) @@ -8,8 +8,10 @@ IN: html.templates.fhtml.tests prepend [ ".fhtml" append [ call-template ] with-string-writer + lines ] keep - ".html" append utf8 file-contents = ; + ".html" append utf8 file-lines + [ . . ] [ = ] 2bi ; [ t ] [ "example" test-template ] unit-test [ t ] [ "bug" test-template ] unit-test diff --git a/core/io/io-tests.factor b/core/io/io-tests.factor index c38a7c9ebc..18cde1a35c 100644 --- a/core/io/io-tests.factor +++ b/core/io/io-tests.factor @@ -25,6 +25,11 @@ IN: io.tests ! Make sure we use correct to_c_string form when writing [ ] [ "\0" write ] unit-test +[ ] [ + "It seems Jobs has lost his grasp on reality again.\n" + "separator-test.txt" temp-file latin1 set-file-contents +] unit-test + [ { { "It seems " CHAR: J } @@ -33,7 +38,7 @@ IN: io.tests } ] [ [ - "resource:core/io/test/separator-test.txt" + "separator-test.txt" temp-file latin1 [ "J" read-until 2array , "i" read-until 2array , diff --git a/core/io/test/separator-test.txt b/core/io/test/separator-test.txt deleted file mode 100644 index c3568f6ea0..0000000000 --- a/core/io/test/separator-test.txt +++ /dev/null @@ -1 +0,0 @@ -It seems Jobs has lost his grasp on reality again. diff --git a/extra/benchmark/regex-dna/regex-dna-tests.factor b/extra/benchmark/regex-dna/regex-dna-tests.factor index f1d4b7f627..79765849b5 100644 --- a/extra/benchmark/regex-dna/regex-dna-tests.factor +++ b/extra/benchmark/regex-dna/regex-dna-tests.factor @@ -1,10 +1,10 @@ USING: benchmark.regex-dna io io.files io.encodings.ascii -io.streams.string kernel tools.test ; +io.streams.string kernel tools.test splitting ; IN: benchmark.regex-dna.tests [ t ] [ "resource:extra/benchmark/regex-dna/regex-dna-test-in.txt" - [ regex-dna ] with-string-writer + [ regex-dna ] with-string-writer string-lines "resource:extra/benchmark/regex-dna/regex-dna-test-out.txt" - ascii file-contents = + ascii file-lines = ] unit-test diff --git a/extra/contributors/contributors.factor b/extra/contributors/contributors.factor index 9f2d5a55fa..f6fcac5297 100755 --- a/extra/contributors/contributors.factor +++ b/extra/contributors/contributors.factor @@ -7,7 +7,7 @@ IN: contributors : changelog ( -- authors ) image parent-directory [ - "git-log --pretty=format:%an" ascii lines + "git log --pretty=format:%an" ascii lines ] with-directory ; : patch-counts ( authors -- assoc ) diff --git a/extra/mason/child/child-tests.factor b/extra/mason/child/child-tests.factor index 7913d05b26..104360e1fa 100644 --- a/extra/mason/child/child-tests.factor +++ b/extra/mason/child/child-tests.factor @@ -1,7 +1,7 @@ IN: mason.child.tests USING: mason.child mason.config tools.test namespaces ; -[ { "make" "clean" "winnt-x86-32" } ] [ +[ { "make" "winnt-x86-32" } ] [ [ "winnt" target-os set "x86.32" target-cpu set @@ -9,7 +9,7 @@ USING: mason.child mason.config tools.test namespaces ; ] with-scope ] unit-test -[ { "make" "clean" "macosx-x86-32" } ] [ +[ { "make" "macosx-x86-32" } ] [ [ "macosx" target-os set "x86.32" target-cpu set @@ -17,7 +17,7 @@ USING: mason.child mason.config tools.test namespaces ; ] with-scope ] unit-test -[ { "gmake" "clean" "netbsd-ppc" } ] [ +[ { "gmake" "netbsd-ppc" } ] [ [ "netbsd" target-os set "ppc" target-cpu set From 116ad2f04b4905952d2747d1841dc408a28f1eac Mon Sep 17 00:00:00 2001 From: "U-SLAVA-DFB8FF805\\Slava" Date: Mon, 17 Nov 2008 20:40:53 -0600 Subject: [PATCH 148/948] Fix compile errors in hardware-info.windows --- extra/hardware-info/windows/windows.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/hardware-info/windows/windows.factor b/extra/hardware-info/windows/windows.factor index 3162496974..3aa6824ff6 100755 --- a/extra/hardware-info/windows/windows.factor +++ b/extra/hardware-info/windows/windows.factor @@ -18,7 +18,7 @@ IN: hardware-info.windows : processor-architecture ( -- n ) system-info SYSTEM_INFO-dwOemId HEX: ffff0000 bitand ; -: os-version +: os-version ( -- os-version ) "OSVERSIONINFO" "OSVERSIONINFO" heap-size over set-OSVERSIONINFO-dwOSVersionInfoSize [ GetVersionEx ] keep swap zero? [ win32-error ] when ; @@ -67,4 +67,4 @@ IN: hardware-info.windows { { [ os wince? ] [ "hardware-info.windows.ce" ] } { [ os winnt? ] [ "hardware-info.windows.nt" ] } -} cond [ require ] when* >> +} cond require >> From b0821229a1debae326f568c108e90541bda7eb23 Mon Sep 17 00:00:00 2001 From: "Jose A. Ortega Ruiz" Date: Tue, 18 Nov 2008 03:47:13 +0100 Subject: [PATCH 149/948] Emacs factor mode: indentation improvements. --- misc/factor.el | 107 +++++++++++++++++++++++++++++++------------------ 1 file changed, 67 insertions(+), 40 deletions(-) diff --git a/misc/factor.el b/misc/factor.el index 393ed26ae0..6204bdbef6 100644 --- a/misc/factor.el +++ b/misc/factor.el @@ -317,10 +317,9 @@ value from the existing code in the buffer." ;;; Factor mode indentation: -(defvar factor-indent-width factor-default-indent-width - "Indentation width in factor buffers. A local variable.") - -(make-variable-buffer-local 'factor-indent-width) +(make-variable-buffer-local + (defvar factor-indent-width factor-default-indent-width + "Indentation width in factor buffers. A local variable.")) (defconst factor--regexp-word-start (let ((sws '("" ":" "TUPLE" "MACRO" "MACRO:" "M"))) @@ -340,45 +339,67 @@ value from the existing code in the buffer." (setq iw (current-indentation)))))) iw)) -(defun factor--brackets-depth () - "Returns number of brackets, not closed on previous lines." - (syntax-ppss-depth - (save-excursion - (syntax-ppss (line-beginning-position))))) +(defsubst factor--ppss-brackets-depth () + (nth 0 (syntax-ppss))) + +(defsubst factor--ppss-brackets-start () + (nth 1 (syntax-ppss))) + +(defsubst factor--line-indent (pos) + (save-excursion (goto-char pos) (current-indentation))) + +(defconst factor--regex-closing-paren "[])}]") +(defsubst factor--at-closing-paren-p () + (looking-at factor--regex-closing-paren)) + +(defsubst factor--at-first-char-p () + (= (- (point) (line-beginning-position)) (current-indentation))) + +(defconst factor--regex-single-liner + (format "^%s" (regexp-opt '("USE:" "IN:" "PRIVATE>" " (factor--ppss-brackets-depth) 0)) + (let ((op (factor--ppss-brackets-start))) + (when (> (line-number-at-pos) (line-number-at-pos op)) + (if (factor--at-closing-paren-p) + (factor--line-indent op) + (+ (factor--line-indent op) factor-indent-width))))))) + +(defun factor--indent-definition () + (save-excursion + (beginning-of-line) + (when (looking-at "\\([^ ]\\|^\\)+:") 0))) + +(defun factor--indent-continuation () + (save-excursion + (forward-line -1) + (beginning-of-line) + (if (bobp) 0 + (if (looking-at "^[ \t]*$") + (factor--indent-continuation) + (if (factor--at-end-of-def) + (- (current-indentation) factor-indent-width) + (if (factor--indent-definition) + (+ (current-indentation) factor-indent-width) + (current-indentation))))))) (defun factor--calculate-indentation () "Calculate Factor indentation for line at point." - (let ((not-indented t) - (cur-indent 0)) - (save-excursion - (beginning-of-line) - (if (bobp) - (setq cur-indent 0) - (save-excursion - (while not-indented - ;; Check that we are inside open brackets - (save-excursion - (let ((cur-depth (factor--brackets-depth))) - (forward-line -1) - (setq cur-indent (+ (current-indentation) - (* factor-indent-width - (- cur-depth (factor--brackets-depth))))) - (setq not-indented nil))) - (forward-line -1) - ;; Check that we are after the end of previous word - (if (looking-at ".*;[ \t]*$") - (progn - (setq cur-indent (- (current-indentation) factor-indent-width)) - (setq not-indented nil)) - ;; Check that we are after the start of word - (if (looking-at factor--regexp-word-start) - (progn - (message "inword") - (setq cur-indent (+ (current-indentation) factor-indent-width)) - (setq not-indented nil)) - (if (bobp) - (setq not-indented nil)))))))) - cur-indent)) + (or (and (bobp) 0) + (factor--indent-definition) + (factor--indent-in-brackets) + (factor--indent-continuation) + 0)) (defun factor-indent-line () "Indent current line as Factor code" @@ -420,11 +441,15 @@ value from the existing code in the buffer." ;;; Factor listener mode +;;;###autoload (define-derived-mode factor-listener-mode comint-mode "Factor Listener") (define-key factor-listener-mode-map [f8] 'factor-refresh-all) +;;;###autoload (defun run-factor () + "Start a factor listener inside emacs, or switch to it if it +already exists." (interactive) (switch-to-buffer (make-comint-in-buffer "factor" nil (expand-file-name factor-binary) nil @@ -433,6 +458,8 @@ value from the existing code in the buffer." (factor-listener-mode)) (defun factor-refresh-all () + "Reload source files and documentation for all loaded +vocabularies which have been modified on disk." (interactive) (comint-send-string "*factor*" "refresh-all\n")) From 5697b75394ca218ed6041b3a4411d19dfddb9d46 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 20:48:02 -0600 Subject: [PATCH 150/948] Fix user-admin/new-user template --- extra/webapps/user-admin/new-user.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/webapps/user-admin/new-user.xml b/extra/webapps/user-admin/new-user.xml index 313c8e2702..0820dbcb64 100644 --- a/extra/webapps/user-admin/new-user.xml +++ b/extra/webapps/user-admin/new-user.xml @@ -37,7 +37,7 @@ Capabilities: -

  • +
    From d6dd9ea2a31bda9e6d6613945883e2f88cdcef5d Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 21:21:57 -0600 Subject: [PATCH 151/948] Add workaround for Windows bttray.exe issue --- vm/os-windows-nt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/vm/os-windows-nt.c b/vm/os-windows-nt.c index 54afd1c147..e22ea1446b 100755 --- a/vm/os-windows-nt.c +++ b/vm/os-windows-nt.c @@ -29,7 +29,13 @@ long exception_handler(PEXCEPTION_POINTERS pe) signal_number = ERROR_DIVIDE_BY_ZERO; c->EIP = (CELL)divide_by_zero_signal_handler_impl; } - else + /* If the Widcomm bluetooth stack is installed, the BTTray.exe process + injects code into running programs. For some reason this results in + random SEH exceptions with this (undocumented) exception code being + raised. The workaround seems to be ignoring this altogether, since that + is what happens if SEH is not enabled. Don't really have any idea what + this exception means. */ + else if(e->ExceptionCode != 0x40010006) { signal_number = 11; c->EIP = (CELL)misc_signal_handler_impl; From 930f3d0edc786e42c23ff352722f0d452b33e7a7 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Mon, 17 Nov 2008 21:26:16 -0600 Subject: [PATCH 152/948] locals: Allow 'local-reader' in literals --- basis/locals/locals.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/basis/locals/locals.factor b/basis/locals/locals.factor index e74ecf3dc9..7de9d10436 100644 --- a/basis/locals/locals.factor +++ b/basis/locals/locals.factor @@ -229,6 +229,8 @@ M: tuple rewrite-element M: local rewrite-element , ; +M: local-reader rewrite-element , ; + M: word rewrite-element literalize , ; M: object rewrite-element , ; From 5c51d9fd2cef229c4a729e4e54e8328688187981 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 21:42:59 -0600 Subject: [PATCH 153/948] Get regexp words to infer --- basis/regexp/parser/parser.factor | 2 +- basis/regexp/regexp-tests.factor | 3 +++ basis/regexp/traversal/traversal.factor | 3 ++- basis/regexp/utils/utils-tests.factor | 4 ++++ basis/regexp/utils/utils.factor | 4 +--- 5 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 basis/regexp/utils/utils-tests.factor diff --git a/basis/regexp/parser/parser.factor b/basis/regexp/parser/parser.factor index d04016b93a..b7716d8580 100644 --- a/basis/regexp/parser/parser.factor +++ b/basis/regexp/parser/parser.factor @@ -137,7 +137,7 @@ ERROR: bad-special-group string ; DEFER: (parse-regexp) : nested-parse-regexp ( token ? -- ) [ push-stack (parse-regexp) pop-stack ] dip - [ ] when pop-stack boa push-stack ; + [ ] when pop-stack new swap >>term push-stack ; ! non-capturing groups : (parse-special-group) ( -- ) diff --git a/basis/regexp/regexp-tests.factor b/basis/regexp/regexp-tests.factor index 2339628801..2a6c0dc16f 100644 --- a/basis/regexp/regexp-tests.factor +++ b/basis/regexp/regexp-tests.factor @@ -2,6 +2,9 @@ USING: regexp tools.test kernel sequences regexp.parser regexp.traversal eval ; IN: regexp-tests +\ must-infer +\ matches? must-infer + [ f ] [ "b" "a*" matches? ] unit-test [ t ] [ "" "a*" matches? ] unit-test [ t ] [ "a" "a*" matches? ] unit-test diff --git a/basis/regexp/traversal/traversal.factor b/basis/regexp/traversal/traversal.factor index 91c7ce16dc..c9e8a54348 100644 --- a/basis/regexp/traversal/traversal.factor +++ b/basis/regexp/traversal/traversal.factor @@ -107,7 +107,8 @@ M: capture-group-off flag-action ( dfa-traverser flag -- ) : increment-state ( dfa-traverser state -- dfa-traverser ) [ dup traverse-forward>> - [ 1+ ] [ 1- ] ? change-current-index + [ [ 1+ ] change-current-index ] + [ [ 1- ] change-current-index ] if dup current-state>> >>last-state ] dip first >>current-state ; diff --git a/basis/regexp/utils/utils-tests.factor b/basis/regexp/utils/utils-tests.factor new file mode 100644 index 0000000000..d048ad4be1 --- /dev/null +++ b/basis/regexp/utils/utils-tests.factor @@ -0,0 +1,4 @@ +USING: regexp.utils tools.test ; +IN: regexp.utils.tests + +[ [ ] [ ] while-changes ] must-infer diff --git a/basis/regexp/utils/utils.factor b/basis/regexp/utils/utils.factor index fb058ecf92..5116dd2b7e 100644 --- a/basis/regexp/utils/utils.factor +++ b/basis/regexp/utils/utils.factor @@ -5,9 +5,7 @@ namespaces regexp.backend sequences unicode.categories math.ranges fry combinators.short-circuit vectors ; IN: regexp.utils -: (while-changes) ( obj quot pred pred-ret -- obj ) - ! quot: ( obj -- obj' ) - ! pred: ( obj -- <=> ) +: (while-changes) ( obj quot: ( obj -- obj' ) pred: ( obj -- <=> ) pred-ret -- obj ) [ [ dup slip ] dip pick over call ] dip dupd = [ 3drop ] [ (while-changes) ] if ; inline recursive From b3e63a2b1a67458670a0e1aed0c583216dac0d23 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 21:45:23 -0600 Subject: [PATCH 154/948] Fix gradient in slides --- extra/galois-talk/authors.txt | 1 + extra/galois-talk/summary.txt | 1 + extra/galois-talk/tags.txt | 1 + extra/google-tech-talk/authors.txt | 1 + extra/google-tech-talk/summary.txt | 1 + extra/google-tech-talk/tags.txt | 1 + extra/slides/slides.factor | 12 +++++------- extra/vpri-talk/authors.txt | 1 + extra/vpri-talk/summary.txt | 1 + extra/vpri-talk/tags.txt | 1 + 10 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 extra/galois-talk/authors.txt create mode 100644 extra/galois-talk/summary.txt create mode 100644 extra/galois-talk/tags.txt create mode 100644 extra/google-tech-talk/authors.txt create mode 100644 extra/google-tech-talk/summary.txt create mode 100644 extra/google-tech-talk/tags.txt create mode 100644 extra/vpri-talk/authors.txt create mode 100644 extra/vpri-talk/summary.txt create mode 100644 extra/vpri-talk/tags.txt diff --git a/extra/galois-talk/authors.txt b/extra/galois-talk/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/galois-talk/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/galois-talk/summary.txt b/extra/galois-talk/summary.txt new file mode 100644 index 0000000000..00f30acf8d --- /dev/null +++ b/extra/galois-talk/summary.txt @@ -0,0 +1 @@ +Slides from a talk at Galois by Slava Pestov, October 2008 diff --git a/extra/galois-talk/tags.txt b/extra/galois-talk/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/galois-talk/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/google-tech-talk/authors.txt b/extra/google-tech-talk/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/google-tech-talk/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/google-tech-talk/summary.txt b/extra/google-tech-talk/summary.txt new file mode 100644 index 0000000000..1747a569c9 --- /dev/null +++ b/extra/google-tech-talk/summary.txt @@ -0,0 +1 @@ +Slides from Google Tech Talk by Slava Pestov, October 2008 diff --git a/extra/google-tech-talk/tags.txt b/extra/google-tech-talk/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/google-tech-talk/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/slides/slides.factor b/extra/slides/slides.factor index 2940bcbfcb..dc8bdd4576 100755 --- a/extra/slides/slides.factor +++ b/extra/slides/slides.factor @@ -48,19 +48,17 @@ IN: slides : $divider ( -- ) [ - T{ gradient f - { - T{ rgba f 0.25 0.25 0.25 1.0 } - T{ rgba f 1.0 1.0 1.0 0.0 } - } - } >>interior + { + T{ rgba f 0.25 0.25 0.25 1.0 } + T{ rgba f 1.0 1.0 1.0 0.0 } + } >>interior { 800 10 } >>dim { 1 0 } >>orientation gadget. ] ($block) ; : page-theme ( gadget -- ) - T{ gradient f { T{ rgba f 0.8 0.8 1.0 1.0 } T{ rgba f 0.8 1.0 1.0 1.0 } } } + { T{ rgba f 0.8 0.8 1.0 1.0 } T{ rgba f 0.8 1.0 1.0 1.0 } } >>interior drop ; : ( list -- gadget ) diff --git a/extra/vpri-talk/authors.txt b/extra/vpri-talk/authors.txt new file mode 100644 index 0000000000..1901f27a24 --- /dev/null +++ b/extra/vpri-talk/authors.txt @@ -0,0 +1 @@ +Slava Pestov diff --git a/extra/vpri-talk/summary.txt b/extra/vpri-talk/summary.txt new file mode 100644 index 0000000000..1ebcc4b114 --- /dev/null +++ b/extra/vpri-talk/summary.txt @@ -0,0 +1 @@ +Slides from a talk at VPRI by Slava Pestov, October 2008 diff --git a/extra/vpri-talk/tags.txt b/extra/vpri-talk/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/vpri-talk/tags.txt @@ -0,0 +1 @@ +demos From e17f51948005ff8b20f63efe74f7d0d3fe48cb5b Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Mon, 17 Nov 2008 22:51:57 -0500 Subject: [PATCH 155/948] Minor documentation fixes --- basis/math/vectors/vectors-docs.factor | 2 +- extra/math/derivatives/derivatives-docs.factor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/math/vectors/vectors-docs.factor b/basis/math/vectors/vectors-docs.factor index 140eddb2f6..7ee948be65 100644 --- a/basis/math/vectors/vectors-docs.factor +++ b/basis/math/vectors/vectors-docs.factor @@ -34,7 +34,7 @@ HELP: n*v { $description "Multiplies each element of " { $snippet "u" } " by " { $snippet "n" } "." } ; HELP: v*n -{ $values { "n" "a number" } { "u" "a sequence of numbers" } { "v" "a sequence of numbers" } } +{ $values { "u" "a sequence of numbers" } { "n" "a number" } { "v" "a sequence of numbers" } } { $description "Multiplies each element of " { $snippet "u" } " by " { $snippet "n" } "." } ; HELP: n/v diff --git a/extra/math/derivatives/derivatives-docs.factor b/extra/math/derivatives/derivatives-docs.factor index bbb793fe92..1630b2f9de 100644 --- a/extra/math/derivatives/derivatives-docs.factor +++ b/extra/math/derivatives/derivatives-docs.factor @@ -90,7 +90,6 @@ HELP: derivative-func " [ cos ]" " bi - abs" "] map minmax" - } } } ; @@ -100,4 +99,5 @@ ARTICLE: "derivatives" "The Derivative Toolkit" { $subsection derivative } { $subsection derivative-func } { $subsection (derivative) } ; + ABOUT: "derivatives" From 1fa0fb6258bc39e8e5d145f2b6c0a9d2a9984381 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 21:53:38 -0600 Subject: [PATCH 156/948] Add unit test for Ed's fix --- basis/locals/locals-tests.factor | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/basis/locals/locals-tests.factor b/basis/locals/locals-tests.factor index 003ef459e3..ca6697be1c 100644 --- a/basis/locals/locals-tests.factor +++ b/basis/locals/locals-tests.factor @@ -346,7 +346,6 @@ M:: sequence method-with-locals ( a -- y ) a reverse ; { 3 1 } [| from to seq | T{ slice f from to seq } ] must-infer-as - :: literal-identity-test ( -- a b ) { } V{ } ; @@ -356,6 +355,10 @@ M:: sequence method-with-locals ( a -- y ) a reverse ; swapd [ eq? ] [ eq? ] 2bi* ] unit-test +:: mutable-local-in-literal-test ( a! -- b ) a 1 + a! { a } ; + +[ { 4 } ] [ 3 mutable-local-in-literal-test ] unit-test + :: compare-case ( obj1 obj2 lt-quot eq-quot gt-quot -- ) obj1 obj2 <=> { { +lt+ [ lt-quot call ] } From 4df50bc6411f1bd11dadccad4430d721f2dd2ac5 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Nov 2008 21:56:59 -0600 Subject: [PATCH 157/948] Fix benchmark.regex-dna --- extra/benchmark/regex-dna/regex-dna-tests.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/benchmark/regex-dna/regex-dna-tests.factor b/extra/benchmark/regex-dna/regex-dna-tests.factor index 79765849b5..9f64d438c7 100644 --- a/extra/benchmark/regex-dna/regex-dna-tests.factor +++ b/extra/benchmark/regex-dna/regex-dna-tests.factor @@ -4,7 +4,7 @@ IN: benchmark.regex-dna.tests [ t ] [ "resource:extra/benchmark/regex-dna/regex-dna-test-in.txt" - [ regex-dna ] with-string-writer string-lines + [ regex-dna ] with-string-writer lines "resource:extra/benchmark/regex-dna/regex-dna-test-out.txt" ascii file-lines = ] unit-test From 91df21a8cfc0bd50a02e63038dd1388e17d67dd3 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Mon, 17 Nov 2008 21:57:46 -0600 Subject: [PATCH 158/948] boids: Fix indendation --- extra/boids/boids.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/boids/boids.factor b/extra/boids/boids.factor index 193582524c..9956df9982 100644 --- a/extra/boids/boids.factor +++ b/extra/boids/boids.factor @@ -83,7 +83,7 @@ VAR: separation-radius : relative-position ( self other -- v ) swap [ pos>> ] bi@ v- ; : relative-angle ( self other -- angle ) -over vel>> -rot relative-position angle-between ; + over vel>> -rot relative-position angle-between ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! From 79b80baae826f1f4fbeffe88ca371a656132351e Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 18 Nov 2008 01:10:00 -0600 Subject: [PATCH 159/948] remove storing the user in ftp server --- extra/ftp/server/server.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/ftp/server/server.factor b/extra/ftp/server/server.factor index f8ab04ed00..c5c854ba92 100644 --- a/extra/ftp/server/server.factor +++ b/extra/ftp/server/server.factor @@ -75,7 +75,7 @@ C: ftp-list : handle-USER ( ftp-command -- ) [ - tokenized>> second client get (>>user) + drop 331 "Please specify the password." server-response ] [ 2drop "bad USER" ftp-error From bb3fee58e390a81cb734ff2bd8bbd3cb247b2302 Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 18 Nov 2008 01:38:29 -0600 Subject: [PATCH 160/948] update.latest: Use 'http' protocol for git commands (git daemon on factorcode.org is flakey lately) --- extra/update/latest/latest.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/update/latest/latest.factor b/extra/update/latest/latest.factor index 7cc2fac853..9546379223 100644 --- a/extra/update/latest/latest.factor +++ b/extra/update/latest/latest.factor @@ -9,7 +9,7 @@ IN: update.latest : git-pull-master ( -- ) image parent-directory [ - { "git" "pull" "git://factorcode.org/git/factor.git" "master" } + { "git" "pull" "http://factorcode.org/git/factor.git" "master" } run-command ] with-directory ; From a79107695ebd0ef0420d2a04463527089ee8dbca Mon Sep 17 00:00:00 2001 From: Eduardo Cavazos Date: Tue, 18 Nov 2008 08:57:20 -0600 Subject: [PATCH 161/948] boids: more indentation fixes --- extra/boids/boids.factor | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/extra/boids/boids.factor b/extra/boids/boids.factor index 9956df9982..3d4cd392ca 100644 --- a/extra/boids/boids.factor +++ b/extra/boids/boids.factor @@ -189,13 +189,12 @@ boids> [ within-alignment-neighborhood? ] with filter ; : above? ( n a b -- ? ) nip > ; : wrap ( n a b -- n ) -{ { [ 3dup below? ] - [ 2nip ] } - { [ 3dup above? ] - [ drop nip ] } - { [ t ] - [ 2drop ] } } -cond ; + { + { [ 3dup below? ] [ 2nip ] } + { [ 3dup above? ] [ drop nip ] } + { [ t ] [ 2drop ] } + } + cond ; ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! From fd95e641257a63e2931d2c7b15ab213888d873a9 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Tue, 18 Nov 2008 10:13:57 -0500 Subject: [PATCH 162/948] Cleanup polynomials and add documentation --- .../math/polynomials/polynomials-docs.factor | 94 +++++++++++++++++++ .../math/polynomials/polynomials-tests.factor | 3 +- extra/math/polynomials/polynomials.factor | 46 ++++----- 3 files changed, 115 insertions(+), 28 deletions(-) create mode 100644 extra/math/polynomials/polynomials-docs.factor diff --git a/extra/math/polynomials/polynomials-docs.factor b/extra/math/polynomials/polynomials-docs.factor new file mode 100644 index 0000000000..08b7ca7c4d --- /dev/null +++ b/extra/math/polynomials/polynomials-docs.factor @@ -0,0 +1,94 @@ +USING: help.markup help.syntax math sequences ; +IN: math.polynomials + +ARTICLE: "polynomials" "Polynomials" +"A polynomial is a vector with the highest powers on the right:" +{ $code "{ 1 1 0 1 } -> 1 + x + x^3" "{ } -> 0" } +"Numerous words are defined to help with polynomial arithmetic:" +{ $subsection p= } +{ $subsection p+ } +{ $subsection p- } +{ $subsection p* } +{ $subsection p-sq } +{ $subsection powers } +{ $subsection n*p } +{ $subsection p/mod } +{ $subsection pgcd } +{ $subsection polyval } +{ $subsection pdiff } +{ $subsection pextend-conv } +{ $subsection ptrim } +{ $subsection 2ptrim } ; + +ABOUT: "polynomials" + +HELP: powers +{ $values { "n" integer } { "x" number } { "seq" sequence } } +{ $description "Output a sequence having " { $snippet "n" } " elements in the format: " { $snippet "{ 1 x x^2 x^3 ... }" } "." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "4 2 powers ." "{ 1 2 4 8 }" } } ; + +HELP: p= +{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "?" "a boolean" } } +{ $description "Tests if two polynomials are equal." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 } { 0 1 0 } p= ." "t" } } ; + +HELP: ptrim +{ $values { "p" "a polynomial" } { "p" "a polynomial" } } +{ $description "Trims excess zeros from a polynomial." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 0 0 } ptrim ." "{ 0 1 }" } } ; + +HELP: 2ptrim +{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } } +{ $description "Trims excess zeros from two polynomials." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 0 0 } { 1 0 0 } 2ptrim swap . ." "{ 0 1 }\n{ 1 }" } } ; + +HELP: p+ +{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } } +{ $description "Adds " { $snippet "p" } " and " { $snippet "q" } " component-wise." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } p+ ." "{ 1 1 1 }" } } ; + +HELP: p- +{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } } +{ $description "Subtracts " { $snippet "q" } " from " { $snippet "p" } " component-wise." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 } { 0 1 } p- ." "{ 1 0 1 }" } } ; + +HELP: n*p +{ $values { "n" number } { "p" "a polynomial" } { "n*p" "a polynomial" } } +{ $description "Multiplies each element of " { $snippet "p" } " by " { $snippet "n" } "." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "4 { 3 0 1 } n*p ." "{ 12 0 4 }" } } ; + +HELP: pextend-conv +{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } } +{ $description "Convulution, extending to " { $snippet "p_m + q_n - 1" } "." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv swap . ." "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ; + +HELP: p* +{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } } +{ $description "Multiplies two polynomials." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 2 3 0 0 0 } { 1 2 0 0 } p* ." "{ 1 4 7 6 0 0 0 0 0 }" } } ; + +HELP: p-sq +{ $values { "p" "a polynomial" } { "p^2" "a polynomial" } } +{ $description "Squares a polynomial." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 2 0 } p-sq ." "{ 1 4 4 0 0 }" } } ; + +HELP: p/mod +{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "z" "a polynomial" } { "w" "a polynomial" } } +{ $description "Computes to quotient " { $snippet "z" } " and remainder " { $snippet "w" } " of dividing " { $snippet "p" } " by " { $snippet "q" } "." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 1 } { 3 1 } p/mod swap . ." "V{ 7 -2 1 }\nV{ -20 0 0 }" } } ; + +HELP: pgcd +{ $values { "p" "a polynomial" } { "q" "a polynomial" } { "a" "a polynomial" } { "d" "a polynomial" } } +{ $description "Computes the greatest common divisor " { $snippet "d" } " of " { $snippet "p" } " and " { $snippet "q" } ", and another value " { $snippet "a" } " satisfying:" { $code "a*q = d mod p" } } +{ $notes "GCD in the case of polynomials is a monic polynomial of the highest possible degree that divides into both " { $snippet "p" } " and " { $snippet "q" } "." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 1} { 1 1 } pgcd swap . ." "{ 0 0 }\n{ 1 1 }" } } ; + +HELP: pdiff +{ $values { "p" "a polynomial" } { "p'" "a polynomial" } } +{ $description "Finds the derivative of " { $snippet "p" } "." } ; + +HELP: polyval +{ $values { "p" "a polynomial" } { "x" number } { "p[x]" number } } +{ $description "Evaluate " { $snippet "p" } " with the input " { $snippet "x" } "." } +{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } 2 polyval ." "5" } } ; + diff --git a/extra/math/polynomials/polynomials-tests.factor b/extra/math/polynomials/polynomials-tests.factor index cccf24fbff..cd88d19d13 100644 --- a/extra/math/polynomials/polynomials-tests.factor +++ b/extra/math/polynomials/polynomials-tests.factor @@ -1,7 +1,6 @@ -IN: math.polynomials.tests USING: kernel math math.polynomials tools.test ; +IN: math.polynomials.tests -! Tests [ { 0 1 } ] [ { 0 1 0 0 } ptrim ] unit-test [ { 1 } ] [ { 1 0 0 } ptrim ] unit-test [ { 0 } ] [ { 0 } ptrim ] unit-test diff --git a/extra/math/polynomials/polynomials.factor b/extra/math/polynomials/polynomials.factor index 47226114d0..13090b6486 100644 --- a/extra/math/polynomials/polynomials.factor +++ b/extra/math/polynomials/polynomials.factor @@ -4,46 +4,38 @@ USING: arrays kernel make math math.order math.vectors sequences shuffle splitting vectors ; IN: math.polynomials -! Polynomials are vectors with the highest powers on the right: -! { 1 1 0 1 } -> 1 + x + x^3 -! { } -> 0 - -: powers ( n x -- seq ) - #! Output sequence has n elements, { 1 x x^2 x^3 ... } - 1 [ * ] accumulate nip ; - -: p= ( p p -- ? ) pextend = ; +: powers ( n x -- seq ) + 1 [ * ] accumulate nip ; + +: p= ( p q -- ? ) pextend = ; : ptrim ( p -- p ) dup length 1 = [ [ zero? ] trim-right ] unless ; -: 2ptrim ( p p -- p p ) [ ptrim ] bi@ ; -: p+ ( p p -- p ) pextend v+ ; -: p- ( p p -- p ) pextend v- ; +: 2ptrim ( p q -- p q ) [ ptrim ] bi@ ; +: p+ ( p q -- r ) pextend v+ ; +: p- ( p q -- r ) pextend v- ; : n*p ( n p -- n*p ) n*v ; -! convolution -: pextend-conv ( p p -- p p ) - #! extend to: p_m + p_n - 1 +: pextend-conv ( p q -- p q ) 2dup [ length ] bi@ + 1- 2pad-right [ >vector ] bi@ ; -: p* ( p p -- p ) - #! Multiply two polynomials. +: p* ( p q -- r ) 2unempty pextend-conv dup length [ over length pick pick [ * ] 2map sum ] map 2nip reverse ; -: p-sq ( p -- p-sq ) +: p-sq ( p -- p^2 ) dup p* ; PRIVATE> -: p/mod ( a b -- / mod ) +: p/mod ( p q -- z w ) p/mod-setup [ [ (p/mod) ] times ] V{ } make reverse nip swap 2ptrim pextend ; + tuck p/mod [ pick p* swap [ swapd p- ] dip ] dip (pgcd) ] if ; -: pgcd ( p p -- p q ) +PRIVATE> + +: pgcd ( p q -- a d ) swap V{ 0 } clone V{ 1 } clone 2swap (pgcd) [ >array ] bi@ ; : pdiff ( p -- p' ) - #! Polynomial derivative. dup length v* { 0 } ?head drop ; : polyval ( p x -- p[x] ) - #! Evaluate a polynomial. [ dup length ] dip powers v. ; From f59071189c478a2d211f3bbf083fd45ab8b5cbe1 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Tue, 18 Nov 2008 10:19:29 -0500 Subject: [PATCH 163/948] Moved math.polynomials to extra --- {extra => basis}/math/polynomials/authors.txt | 0 {extra => basis}/math/polynomials/polynomials-docs.factor | 0 {extra => basis}/math/polynomials/polynomials-tests.factor | 0 {extra => basis}/math/polynomials/polynomials.factor | 0 {extra => basis}/math/polynomials/summary.txt | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {extra => basis}/math/polynomials/authors.txt (100%) rename {extra => basis}/math/polynomials/polynomials-docs.factor (100%) rename {extra => basis}/math/polynomials/polynomials-tests.factor (100%) rename {extra => basis}/math/polynomials/polynomials.factor (100%) rename {extra => basis}/math/polynomials/summary.txt (100%) diff --git a/extra/math/polynomials/authors.txt b/basis/math/polynomials/authors.txt similarity index 100% rename from extra/math/polynomials/authors.txt rename to basis/math/polynomials/authors.txt diff --git a/extra/math/polynomials/polynomials-docs.factor b/basis/math/polynomials/polynomials-docs.factor similarity index 100% rename from extra/math/polynomials/polynomials-docs.factor rename to basis/math/polynomials/polynomials-docs.factor diff --git a/extra/math/polynomials/polynomials-tests.factor b/basis/math/polynomials/polynomials-tests.factor similarity index 100% rename from extra/math/polynomials/polynomials-tests.factor rename to basis/math/polynomials/polynomials-tests.factor diff --git a/extra/math/polynomials/polynomials.factor b/basis/math/polynomials/polynomials.factor similarity index 100% rename from extra/math/polynomials/polynomials.factor rename to basis/math/polynomials/polynomials.factor diff --git a/extra/math/polynomials/summary.txt b/basis/math/polynomials/summary.txt similarity index 100% rename from extra/math/polynomials/summary.txt rename to basis/math/polynomials/summary.txt From 5869a1aab48fa5cb6afef8000658aba963587f63 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Tue, 18 Nov 2008 10:20:44 -0500 Subject: [PATCH 164/948] Move math.combinatorics to basis --- {extra => basis}/math/combinatorics/authors.txt | 0 {extra => basis}/math/combinatorics/combinatorics-docs.factor | 0 {extra => basis}/math/combinatorics/combinatorics-tests.factor | 0 {extra => basis}/math/combinatorics/combinatorics.factor | 0 {extra => basis}/math/combinatorics/summary.txt | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {extra => basis}/math/combinatorics/authors.txt (100%) rename {extra => basis}/math/combinatorics/combinatorics-docs.factor (100%) rename {extra => basis}/math/combinatorics/combinatorics-tests.factor (100%) rename {extra => basis}/math/combinatorics/combinatorics.factor (100%) rename {extra => basis}/math/combinatorics/summary.txt (100%) diff --git a/extra/math/combinatorics/authors.txt b/basis/math/combinatorics/authors.txt similarity index 100% rename from extra/math/combinatorics/authors.txt rename to basis/math/combinatorics/authors.txt diff --git a/extra/math/combinatorics/combinatorics-docs.factor b/basis/math/combinatorics/combinatorics-docs.factor similarity index 100% rename from extra/math/combinatorics/combinatorics-docs.factor rename to basis/math/combinatorics/combinatorics-docs.factor diff --git a/extra/math/combinatorics/combinatorics-tests.factor b/basis/math/combinatorics/combinatorics-tests.factor similarity index 100% rename from extra/math/combinatorics/combinatorics-tests.factor rename to basis/math/combinatorics/combinatorics-tests.factor diff --git a/extra/math/combinatorics/combinatorics.factor b/basis/math/combinatorics/combinatorics.factor similarity index 100% rename from extra/math/combinatorics/combinatorics.factor rename to basis/math/combinatorics/combinatorics.factor diff --git a/extra/math/combinatorics/summary.txt b/basis/math/combinatorics/summary.txt similarity index 100% rename from extra/math/combinatorics/summary.txt rename to basis/math/combinatorics/summary.txt From 1ffc6051cdad982b99bfbdda312beb5251a5732b Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Tue, 18 Nov 2008 10:22:16 -0500 Subject: [PATCH 165/948] Move math.blas to basis --- {extra => basis}/math/blas/cblas/authors.txt | 0 {extra => basis}/math/blas/cblas/cblas.factor | 0 {extra => basis}/math/blas/cblas/summary.txt | 0 {extra => basis}/math/blas/cblas/tags.txt | 0 {extra => basis}/math/blas/matrices/authors.txt | 0 {extra => basis}/math/blas/matrices/matrices-docs.factor | 0 {extra => basis}/math/blas/matrices/matrices-tests.factor | 0 {extra => basis}/math/blas/matrices/matrices.factor | 0 {extra => basis}/math/blas/matrices/summary.txt | 0 {extra => basis}/math/blas/matrices/tags.txt | 0 {extra => basis}/math/blas/syntax/authors.txt | 0 {extra => basis}/math/blas/syntax/summary.txt | 0 {extra => basis}/math/blas/syntax/syntax-docs.factor | 0 {extra => basis}/math/blas/syntax/syntax.factor | 0 {extra => basis}/math/blas/syntax/tags.txt | 0 {extra => basis}/math/blas/vectors/authors.txt | 0 {extra => basis}/math/blas/vectors/summary.txt | 0 {extra => basis}/math/blas/vectors/tags.txt | 0 {extra => basis}/math/blas/vectors/vectors-docs.factor | 0 {extra => basis}/math/blas/vectors/vectors-tests.factor | 0 {extra => basis}/math/blas/vectors/vectors.factor | 0 21 files changed, 0 insertions(+), 0 deletions(-) rename {extra => basis}/math/blas/cblas/authors.txt (100%) rename {extra => basis}/math/blas/cblas/cblas.factor (100%) rename {extra => basis}/math/blas/cblas/summary.txt (100%) rename {extra => basis}/math/blas/cblas/tags.txt (100%) rename {extra => basis}/math/blas/matrices/authors.txt (100%) rename {extra => basis}/math/blas/matrices/matrices-docs.factor (100%) rename {extra => basis}/math/blas/matrices/matrices-tests.factor (100%) rename {extra => basis}/math/blas/matrices/matrices.factor (100%) rename {extra => basis}/math/blas/matrices/summary.txt (100%) rename {extra => basis}/math/blas/matrices/tags.txt (100%) rename {extra => basis}/math/blas/syntax/authors.txt (100%) rename {extra => basis}/math/blas/syntax/summary.txt (100%) rename {extra => basis}/math/blas/syntax/syntax-docs.factor (100%) rename {extra => basis}/math/blas/syntax/syntax.factor (100%) rename {extra => basis}/math/blas/syntax/tags.txt (100%) rename {extra => basis}/math/blas/vectors/authors.txt (100%) rename {extra => basis}/math/blas/vectors/summary.txt (100%) rename {extra => basis}/math/blas/vectors/tags.txt (100%) rename {extra => basis}/math/blas/vectors/vectors-docs.factor (100%) rename {extra => basis}/math/blas/vectors/vectors-tests.factor (100%) rename {extra => basis}/math/blas/vectors/vectors.factor (100%) diff --git a/extra/math/blas/cblas/authors.txt b/basis/math/blas/cblas/authors.txt similarity index 100% rename from extra/math/blas/cblas/authors.txt rename to basis/math/blas/cblas/authors.txt diff --git a/extra/math/blas/cblas/cblas.factor b/basis/math/blas/cblas/cblas.factor similarity index 100% rename from extra/math/blas/cblas/cblas.factor rename to basis/math/blas/cblas/cblas.factor diff --git a/extra/math/blas/cblas/summary.txt b/basis/math/blas/cblas/summary.txt similarity index 100% rename from extra/math/blas/cblas/summary.txt rename to basis/math/blas/cblas/summary.txt diff --git a/extra/math/blas/cblas/tags.txt b/basis/math/blas/cblas/tags.txt similarity index 100% rename from extra/math/blas/cblas/tags.txt rename to basis/math/blas/cblas/tags.txt diff --git a/extra/math/blas/matrices/authors.txt b/basis/math/blas/matrices/authors.txt similarity index 100% rename from extra/math/blas/matrices/authors.txt rename to basis/math/blas/matrices/authors.txt diff --git a/extra/math/blas/matrices/matrices-docs.factor b/basis/math/blas/matrices/matrices-docs.factor similarity index 100% rename from extra/math/blas/matrices/matrices-docs.factor rename to basis/math/blas/matrices/matrices-docs.factor diff --git a/extra/math/blas/matrices/matrices-tests.factor b/basis/math/blas/matrices/matrices-tests.factor similarity index 100% rename from extra/math/blas/matrices/matrices-tests.factor rename to basis/math/blas/matrices/matrices-tests.factor diff --git a/extra/math/blas/matrices/matrices.factor b/basis/math/blas/matrices/matrices.factor similarity index 100% rename from extra/math/blas/matrices/matrices.factor rename to basis/math/blas/matrices/matrices.factor diff --git a/extra/math/blas/matrices/summary.txt b/basis/math/blas/matrices/summary.txt similarity index 100% rename from extra/math/blas/matrices/summary.txt rename to basis/math/blas/matrices/summary.txt diff --git a/extra/math/blas/matrices/tags.txt b/basis/math/blas/matrices/tags.txt similarity index 100% rename from extra/math/blas/matrices/tags.txt rename to basis/math/blas/matrices/tags.txt diff --git a/extra/math/blas/syntax/authors.txt b/basis/math/blas/syntax/authors.txt similarity index 100% rename from extra/math/blas/syntax/authors.txt rename to basis/math/blas/syntax/authors.txt diff --git a/extra/math/blas/syntax/summary.txt b/basis/math/blas/syntax/summary.txt similarity index 100% rename from extra/math/blas/syntax/summary.txt rename to basis/math/blas/syntax/summary.txt diff --git a/extra/math/blas/syntax/syntax-docs.factor b/basis/math/blas/syntax/syntax-docs.factor similarity index 100% rename from extra/math/blas/syntax/syntax-docs.factor rename to basis/math/blas/syntax/syntax-docs.factor diff --git a/extra/math/blas/syntax/syntax.factor b/basis/math/blas/syntax/syntax.factor similarity index 100% rename from extra/math/blas/syntax/syntax.factor rename to basis/math/blas/syntax/syntax.factor diff --git a/extra/math/blas/syntax/tags.txt b/basis/math/blas/syntax/tags.txt similarity index 100% rename from extra/math/blas/syntax/tags.txt rename to basis/math/blas/syntax/tags.txt diff --git a/extra/math/blas/vectors/authors.txt b/basis/math/blas/vectors/authors.txt similarity index 100% rename from extra/math/blas/vectors/authors.txt rename to basis/math/blas/vectors/authors.txt diff --git a/extra/math/blas/vectors/summary.txt b/basis/math/blas/vectors/summary.txt similarity index 100% rename from extra/math/blas/vectors/summary.txt rename to basis/math/blas/vectors/summary.txt diff --git a/extra/math/blas/vectors/tags.txt b/basis/math/blas/vectors/tags.txt similarity index 100% rename from extra/math/blas/vectors/tags.txt rename to basis/math/blas/vectors/tags.txt diff --git a/extra/math/blas/vectors/vectors-docs.factor b/basis/math/blas/vectors/vectors-docs.factor similarity index 100% rename from extra/math/blas/vectors/vectors-docs.factor rename to basis/math/blas/vectors/vectors-docs.factor diff --git a/extra/math/blas/vectors/vectors-tests.factor b/basis/math/blas/vectors/vectors-tests.factor similarity index 100% rename from extra/math/blas/vectors/vectors-tests.factor rename to basis/math/blas/vectors/vectors-tests.factor diff --git a/extra/math/blas/vectors/vectors.factor b/basis/math/blas/vectors/vectors.factor similarity index 100% rename from extra/math/blas/vectors/vectors.factor rename to basis/math/blas/vectors/vectors.factor From c3f05eaaa141440c3f0cd77b787ced32108df924 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Tue, 18 Nov 2008 10:22:48 -0500 Subject: [PATCH 166/948] Move math.quaternions to extra --- {extra => basis}/math/quaternions/authors.txt | 0 {extra => basis}/math/quaternions/quaternions-docs.factor | 0 {extra => basis}/math/quaternions/quaternions-tests.factor | 0 {extra => basis}/math/quaternions/quaternions.factor | 0 {extra => basis}/math/quaternions/summary.txt | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {extra => basis}/math/quaternions/authors.txt (100%) rename {extra => basis}/math/quaternions/quaternions-docs.factor (100%) rename {extra => basis}/math/quaternions/quaternions-tests.factor (100%) rename {extra => basis}/math/quaternions/quaternions.factor (100%) rename {extra => basis}/math/quaternions/summary.txt (100%) diff --git a/extra/math/quaternions/authors.txt b/basis/math/quaternions/authors.txt similarity index 100% rename from extra/math/quaternions/authors.txt rename to basis/math/quaternions/authors.txt diff --git a/extra/math/quaternions/quaternions-docs.factor b/basis/math/quaternions/quaternions-docs.factor similarity index 100% rename from extra/math/quaternions/quaternions-docs.factor rename to basis/math/quaternions/quaternions-docs.factor diff --git a/extra/math/quaternions/quaternions-tests.factor b/basis/math/quaternions/quaternions-tests.factor similarity index 100% rename from extra/math/quaternions/quaternions-tests.factor rename to basis/math/quaternions/quaternions-tests.factor diff --git a/extra/math/quaternions/quaternions.factor b/basis/math/quaternions/quaternions.factor similarity index 100% rename from extra/math/quaternions/quaternions.factor rename to basis/math/quaternions/quaternions.factor diff --git a/extra/math/quaternions/summary.txt b/basis/math/quaternions/summary.txt similarity index 100% rename from extra/math/quaternions/summary.txt rename to basis/math/quaternions/summary.txt From 47d268d8947f27011dc3b52e4a153a17191f7d55 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Tue, 18 Nov 2008 10:30:11 -0500 Subject: [PATCH 167/948] Remove documentation duplication in math.statistics --- extra/math/statistics/statistics-docs.factor | 11 ++++++----- extra/math/statistics/statistics.factor | 10 +--------- 2 files changed, 7 insertions(+), 14 deletions(-) diff --git a/extra/math/statistics/statistics-docs.factor b/extra/math/statistics/statistics-docs.factor index 695834b554..7a7eb70dd2 100644 --- a/extra/math/statistics/statistics-docs.factor +++ b/extra/math/statistics/statistics-docs.factor @@ -3,13 +3,14 @@ IN: math.statistics HELP: geometric-mean { $values { "seq" "a sequence of numbers" } { "n" "a non-negative real number"} } -{ $description "Computes the geometric mean of all elements in " { $snippet "seq" } ". The geometric mean measures the central tendency of a data set that minimizes the effects of extreme values." } +{ $description "Computes the geometric mean of all elements in " { $snippet "seq" } ". The geometric mean measures the central tendency of a data set that minimizes the effects of extreme values." } { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } geometric-mean ." "1.81712059283214" } } { $errors "Throws a " { $link signal-error. } " (square-root of 0) if the sequence is empty." } ; HELP: harmonic-mean { $values { "seq" "a sequence of numbers" } { "n" "a non-negative real number"} } -{ $description "Computes the harmonic mean of the elements in " { $snippet "seq" } ". The harmonic mean is appropriate when the average of rates is desired." } +{ $description "Computes the harmonic mean of the elements in " { $snippet "seq" } ". The harmonic mean is appropriate when the average of rates is desired." } +{ $notes "Positive reals only." } { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } harmonic-mean ." "6/11" } } { $errors "Throws a " { $link signal-error. } " (divide by zero) if the sequence is empty." } ; @@ -36,21 +37,21 @@ HELP: range HELP: std { $values { "seq" "a sequence of numbers" } { "x" "a non-negative real number"} } -{ $description "Computes the standard deviation of " { $snippet "seq" } " by squaring the variance of the sequence. It measures how widely spread the values in a sequence are about the mean." } +{ $description "Computes the standard deviation of " { $snippet "seq" } ", which is the square root of the variance. It measures how widely spread the values in a sequence are about the mean." } { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 } std ." "1.0" } { $example "USING: math.statistics prettyprint ;" "{ 1 2 3 4 } std ." "1.290994448735806" } } ; HELP: ste { $values { "seq" "a sequence of numbers" } { "x" "a non-negative real number"} } - { $description "Computes the standard error of the mean for " { $snippet "seq" } ". It's defined as the standard deviation divided by the square root of the length of the sequence, and measures uncertainty associated with the estimate of the mean." } + { $description "Computes the standard error of the mean for " { $snippet "seq" } ". It's defined as the standard deviation divided by the square root of the length of the sequence, and measures uncertainty associated with the estimate of the mean." } { $examples { $example "USING: math.statistics prettyprint ;" "{ -2 2 } ste ." "2.0" } { $example "USING: math.statistics prettyprint ;" "{ -2 2 2 } ste ." "1.333333333333333" } } ; HELP: var { $values { "seq" "a sequence of numbers" } { "x" "a non-negative real number"} } -{ $description "Computes the variance of " { $snippet "seq" } ". It's a measurement of the spread of values in a sequence. The larger the variance, the larger the distance of values from the mean." } +{ $description "Computes the variance of " { $snippet "seq" } ". It's a measurement of the spread of values in a sequence. The larger the variance, the larger the distance of values from the mean." } { $notes "If the number of elements in " { $snippet "seq" } " is 1 or less, it outputs 0." } { $examples { $example "USING: math.statistics prettyprint ;" "{ 1 } var ." "0" } diff --git a/extra/math/statistics/statistics.factor b/extra/math/statistics/statistics.factor index 7568af5294..d2494ee32a 100644 --- a/extra/math/statistics/statistics.factor +++ b/extra/math/statistics/statistics.factor @@ -5,20 +5,15 @@ USING: arrays combinators kernel math math.analysis math.functions sequences IN: math.statistics : mean ( seq -- n ) - #! arithmetic mean, sum divided by length [ sum ] [ length ] bi / ; : geometric-mean ( seq -- n ) - #! geometric mean, nth root of product [ length ] [ product ] bi nth-root ; : harmonic-mean ( seq -- n ) - #! harmonic mean, reciprocal of sum of reciprocals. - #! positive reals only [ recip ] sigma recip ; : median ( seq -- n ) - #! middle number if odd, avg of two middle numbers if even natural-sort dup length even? [ [ midpoint@ dup 1- 2array ] keep nths mean ] [ @@ -26,11 +21,10 @@ IN: math.statistics ] if ; : range ( seq -- n ) - #! max - min minmax swap - ; : var ( seq -- x ) - #! variance, normalize by N-1 + #! normalize by N-1 dup length 1 <= [ drop 0 ] [ @@ -39,11 +33,9 @@ IN: math.statistics ] if ; : std ( seq -- x ) - #! standard deviation, sqrt of variance var sqrt ; : ste ( seq -- x ) - #! standard error, standard deviation / sqrt ( length of sequence ) [ std ] [ length ] bi sqrt / ; : ((r)) ( mean(x) mean(y) {x} {y} -- (r) ) From 197bb708934f6ab2b4c4f3960d9e284e73832bf4 Mon Sep 17 00:00:00 2001 From: Aaron Schaefer Date: Tue, 18 Nov 2008 10:31:07 -0500 Subject: [PATCH 168/948] Move math.statistics to extra --- {extra => basis}/math/statistics/authors.txt | 0 {extra => basis}/math/statistics/statistics-docs.factor | 0 {extra => basis}/math/statistics/statistics-tests.factor | 0 {extra => basis}/math/statistics/statistics.factor | 0 {extra => basis}/math/statistics/summary.txt | 0 5 files changed, 0 insertions(+), 0 deletions(-) rename {extra => basis}/math/statistics/authors.txt (100%) rename {extra => basis}/math/statistics/statistics-docs.factor (100%) rename {extra => basis}/math/statistics/statistics-tests.factor (100%) rename {extra => basis}/math/statistics/statistics.factor (100%) rename {extra => basis}/math/statistics/summary.txt (100%) diff --git a/extra/math/statistics/authors.txt b/basis/math/statistics/authors.txt similarity index 100% rename from extra/math/statistics/authors.txt rename to basis/math/statistics/authors.txt diff --git a/extra/math/statistics/statistics-docs.factor b/basis/math/statistics/statistics-docs.factor similarity index 100% rename from extra/math/statistics/statistics-docs.factor rename to basis/math/statistics/statistics-docs.factor diff --git a/extra/math/statistics/statistics-tests.factor b/basis/math/statistics/statistics-tests.factor similarity index 100% rename from extra/math/statistics/statistics-tests.factor rename to basis/math/statistics/statistics-tests.factor diff --git a/extra/math/statistics/statistics.factor b/basis/math/statistics/statistics.factor similarity index 100% rename from extra/math/statistics/statistics.factor rename to basis/math/statistics/statistics.factor diff --git a/extra/math/statistics/summary.txt b/basis/math/statistics/summary.txt similarity index 100% rename from extra/math/statistics/summary.txt rename to basis/math/statistics/summary.txt From f44d8f4cf51b7073fd3eb99de4f21291ef079f5c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 11:45:55 -0600 Subject: [PATCH 169/948] Fix combinators so that directory. can infer on Unix --- basis/unix/groups/groups.factor | 6 ++++-- basis/unix/users/users.factor | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/basis/unix/groups/groups.factor b/basis/unix/groups/groups.factor index b8edf7fa36..177949aec9 100644 --- a/basis/unix/groups/groups.factor +++ b/basis/unix/groups/groups.factor @@ -76,9 +76,11 @@ M: integer user-groups ( id -- seq ) : all-groups ( -- seq ) [ getgrent dup ] [ group-struct>group ] [ drop ] produce ; +: ( -- assoc ) + all-groups [ [ id>> ] keep ] H{ } map>assoc ; + : with-group-cache ( quot -- ) - all-groups [ [ id>> ] keep ] H{ } map>assoc - group-cache rot with-variable ; inline + [ group-cache ] dip with-variable ; inline : real-group-id ( -- id ) getgid ; inline diff --git a/basis/unix/users/users.factor b/basis/unix/users/users.factor index f76fbd5388..8487d5adf2 100644 --- a/basis/unix/users/users.factor +++ b/basis/unix/users/users.factor @@ -41,9 +41,11 @@ PRIVATE> SYMBOL: user-cache +: ( -- assoc ) + all-users [ [ uid>> ] keep ] H{ } map>assoc ; + : with-user-cache ( quot -- ) - all-users [ [ uid>> ] keep ] H{ } map>assoc - user-cache rot with-variable ; inline + [ user-cache ] dip with-variable ; inline GENERIC: user-passwd ( obj -- passwd ) From bec8cc423939ef5184700def9959e41c7c6a1e83 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 11:46:51 -0600 Subject: [PATCH 170/948] Add unit test to assert that directory. can infeR --- basis/io/files/listing/listing-tests.factor | 2 ++ 1 file changed, 2 insertions(+) diff --git a/basis/io/files/listing/listing-tests.factor b/basis/io/files/listing/listing-tests.factor index a2347c8db9..8c2dc28559 100644 --- a/basis/io/files/listing/listing-tests.factor +++ b/basis/io/files/listing/listing-tests.factor @@ -3,4 +3,6 @@ USING: tools.test io.files.listing strings kernel ; IN: io.files.listing.tests +\ directory. must-infer + [ ] [ "" directory. ] unit-test From b609ca7d01a07425dcb84b6669f93f7ac5529886 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 11:48:06 -0600 Subject: [PATCH 171/948] Tweak gl-rect to generate the correct output on Windows with Intel graphics --- basis/opengl/opengl.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index aec7960857..21fe663c44 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -72,9 +72,9 @@ MACRO: all-enabled-client-state ( seq quot -- ) : (rect-vertices) ( dim -- vertices ) { [ drop 0.5 0.5 ] - [ first 0.5 - 0.5 ] - [ [ first 0.5 - ] [ second 0.5 - ] bi ] - [ second 0.5 - 0.5 swap ] + [ first 0.3 - 0.5 ] + [ [ first 0.3 - ] [ second 0.3 - ] bi ] + [ second 0.3 - 0.5 swap ] } cleave 8 narray >c-float-array ; : rect-vertices ( dim -- ) From f8a6e3b0d8148a605d8bd2b48eb0369fbb5434d7 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 11:50:02 -0600 Subject: [PATCH 172/948] Don't use the obscure CLEAR key --- basis/ui/tools/listener/listener.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/ui/tools/listener/listener.factor b/basis/ui/tools/listener/listener.factor index 68bf765295..d842bf8a68 100644 --- a/basis/ui/tools/listener/listener.factor +++ b/basis/ui/tools/listener/listener.factor @@ -181,8 +181,8 @@ M: stack-display tool-scroller listener-gadget "toolbar" f { { f restart-listener } - { T{ key-down f f "CLEAR" } clear-output } - { T{ key-down f { C+ } "CLEAR" } clear-stack } + { T{ key-down f { A+ } "c" } clear-output } + { T{ key-down f { A+ } "C" } clear-stack } { T{ key-down f { C+ } "d" } com-end } { T{ key-down f f "F1" } listener-help } } define-command-map From 0a124677675d849f384752a5118e23dff4aa3350 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 18 Nov 2008 13:31:43 -0600 Subject: [PATCH 173/948] fix compile errors in ftp.server --- extra/ftp/server/server.factor | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/extra/ftp/server/server.factor b/extra/ftp/server/server.factor index c5c854ba92..9095dedf35 100644 --- a/extra/ftp/server/server.factor +++ b/extra/ftp/server/server.factor @@ -7,10 +7,11 @@ namespaces make sequences ftp io.unix.launcher.parser unicode.case splitting assocs classes io.servers.connection destructors calendar io.timeouts io.streams.duplex threads continuations math concurrency.promises byte-arrays -io.backend sequences.lib tools.hexdump io.files.listing ; +io.backend sequences.lib tools.hexdump io.files.listing +io.streams.string ; IN: ftp.server -TUPLE: ftp-client url mode state command-promise ; +TUPLE: ftp-client url mode state command-promise user password ; : ( url -- ftp-client ) ftp-client new @@ -75,7 +76,7 @@ C: ftp-list : handle-USER ( ftp-command -- ) [ - drop + tokenized>> second client get (>>user) 331 "Please specify the password." server-response ] [ 2drop "bad USER" ftp-error @@ -140,16 +141,16 @@ ERROR: type-error type ; 150 "Here comes the directory listing." server-response ; : finish-directory ( -- ) - 226 "Opening " server-response ; + 226 "Directory send OK." server-response ; GENERIC: service-command ( stream obj -- ) M: ftp-list service-command ( stream obj -- ) drop - start-directory - [ + start-directory [ utf8 encode-output - directory. [ ftp-send ] each + [ current-directory get directory. ] with-string-writer string-lines + harvest [ ftp-send ] each ] with-output-stream finish-directory ; From 054dce145ccc6e06285e0dd6c9ca0a3b15baf56d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 18 Nov 2008 14:00:27 -0600 Subject: [PATCH 174/948] fix polynomial help lint --- extra/math/polynomials/polynomials-docs.factor | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/extra/math/polynomials/polynomials-docs.factor b/extra/math/polynomials/polynomials-docs.factor index 08b7ca7c4d..f97ae308e1 100644 --- a/extra/math/polynomials/polynomials-docs.factor +++ b/extra/math/polynomials/polynomials-docs.factor @@ -40,7 +40,7 @@ HELP: ptrim HELP: 2ptrim { $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } } { $description "Trims excess zeros from two polynomials." } -{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 0 1 0 0 } { 1 0 0 } 2ptrim swap . ." "{ 0 1 }\n{ 1 }" } } ; +{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 0 1 0 0 } { 1 0 0 } 2ptrim swap . ." "{ 0 1 }\n{ 1 }" } } ; HELP: p+ { $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } } @@ -60,7 +60,7 @@ HELP: n*p HELP: pextend-conv { $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } } { $description "Convulution, extending to " { $snippet "p_m + q_n - 1" } "." } -{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv swap . ." "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ; +{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv swap . ." "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ; HELP: p* { $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } } @@ -75,13 +75,18 @@ HELP: p-sq HELP: p/mod { $values { "p" "a polynomial" } { "q" "a polynomial" } { "z" "a polynomial" } { "w" "a polynomial" } } { $description "Computes to quotient " { $snippet "z" } " and remainder " { $snippet "w" } " of dividing " { $snippet "p" } " by " { $snippet "q" } "." } -{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 1 } { 3 1 } p/mod swap . ." "V{ 7 -2 1 }\nV{ -20 0 0 }" } } ; +{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 1 1 1 } { 3 1 } p/mod swap . ." "V{ 7 -2 1 }\nV{ -20 0 0 }" } } ; HELP: pgcd { $values { "p" "a polynomial" } { "q" "a polynomial" } { "a" "a polynomial" } { "d" "a polynomial" } } { $description "Computes the greatest common divisor " { $snippet "d" } " of " { $snippet "p" } " and " { $snippet "q" } ", and another value " { $snippet "a" } " satisfying:" { $code "a*q = d mod p" } } { $notes "GCD in the case of polynomials is a monic polynomial of the highest possible degree that divides into both " { $snippet "p" } " and " { $snippet "q" } "." } -{ $examples { $example "USING: math.polynomials prettyprint ;" "{ 1 1 1 1} { 1 1 } pgcd swap . ." "{ 0 0 }\n{ 1 1 }" } } ; +{ $examples + { $example "USING: kernel math.polynomials prettyprint ;" + "{ 1 1 1 1 } { 1 1 } pgcd [ . ] bi@" + "{ 0 0 }\n{ 1 1 }" + } +} ; HELP: pdiff { $values { "p" "a polynomial" } { "p'" "a polynomial" } } From 46e7978371b97f000bd1e866b032228b1cc186d9 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 18 Nov 2008 14:00:43 -0600 Subject: [PATCH 175/948] fix typo --- basis/furnace/furnace-docs.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/furnace/furnace-docs.factor b/basis/furnace/furnace-docs.factor index b86d4c3295..911433d100 100644 --- a/basis/furnace/furnace-docs.factor +++ b/basis/furnace/furnace-docs.factor @@ -97,7 +97,7 @@ HELP: with-exit-continuation { $notes "Furnace actions and authentication realms wrap their execution in this combinator, allowing form validation failures and login requests, respectively, to immediately return an HTTP response to the client without running any more responder code." } ; ARTICLE: "furnace.extension-points" "Furnace extension points" -"Furnace features such as session management, conversation scope and asides need to modify URLs in links and redirects, and insert hidden form fields, to implement state on top of the setateless HTTP protocol. In order to decouple the server-side state management code from the HTML templating code, a series of hooks are used." +"Furnace features such as session management, conversation scope and asides need to modify URLs in links and redirects, and insert hidden form fields, to implement state on top of the stateless HTTP protocol. In order to decouple the server-side state management code from the HTML templating code, a series of hooks are used." $nl "Responders can implement methods on the following generic words:" { $subsection modify-query } From cba8f2a8605eec3a0f743f442870929602957433 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 18 Nov 2008 14:09:50 -0600 Subject: [PATCH 176/948] swap . . -> [ . ] bi@ --- extra/math/polynomials/polynomials-docs.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/extra/math/polynomials/polynomials-docs.factor b/extra/math/polynomials/polynomials-docs.factor index f97ae308e1..edffa5377d 100644 --- a/extra/math/polynomials/polynomials-docs.factor +++ b/extra/math/polynomials/polynomials-docs.factor @@ -40,7 +40,7 @@ HELP: ptrim HELP: 2ptrim { $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } } { $description "Trims excess zeros from two polynomials." } -{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 0 1 0 0 } { 1 0 0 } 2ptrim swap . ." "{ 0 1 }\n{ 1 }" } } ; +{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 0 1 0 0 } { 1 0 0 } 2ptrim [ . ] bi@" "{ 0 1 }\n{ 1 }" } } ; HELP: p+ { $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } } @@ -60,7 +60,7 @@ HELP: n*p HELP: pextend-conv { $values { "p" "a polynomial" } { "q" "a polynomial" } { "p" "a polynomial" } { "q" "a polynomial" } } { $description "Convulution, extending to " { $snippet "p_m + q_n - 1" } "." } -{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv swap . ." "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ; +{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 0 1 } { 0 1 } pextend-conv [ . ] bi@" "V{ 1 0 1 0 }\nV{ 0 1 0 0 }" } } ; HELP: p* { $values { "p" "a polynomial" } { "q" "a polynomial" } { "r" "a polynomial" } } @@ -75,7 +75,7 @@ HELP: p-sq HELP: p/mod { $values { "p" "a polynomial" } { "q" "a polynomial" } { "z" "a polynomial" } { "w" "a polynomial" } } { $description "Computes to quotient " { $snippet "z" } " and remainder " { $snippet "w" } " of dividing " { $snippet "p" } " by " { $snippet "q" } "." } -{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 1 1 1 } { 3 1 } p/mod swap . ." "V{ 7 -2 1 }\nV{ -20 0 0 }" } } ; +{ $examples { $example "USING: kernel math.polynomials prettyprint ;" "{ 1 1 1 1 } { 3 1 } p/mod [ . ] bi@" "V{ 7 -2 1 }\nV{ -20 0 0 }" } } ; HELP: pgcd { $values { "p" "a polynomial" } { "q" "a polynomial" } { "a" "a polynomial" } { "d" "a polynomial" } } From aee589190b1e8911eda3565d0086ff721bd388e2 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 14:10:21 -0600 Subject: [PATCH 177/948] Add signed-le> and signed-be> wordS --- basis/math/bitwise/bitwise.factor | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/basis/math/bitwise/bitwise.factor b/basis/math/bitwise/bitwise.factor index ad1907fcb0..afd83d4458 100644 --- a/basis/math/bitwise/bitwise.factor +++ b/basis/math/bitwise/bitwise.factor @@ -2,7 +2,7 @@ ! See http://factorcode.org/license.txt for BSD license. USING: arrays kernel math math.functions sequences sequences.private words namespaces macros hints -combinators fry ; +combinators fry io.binary ; IN: math.bitwise ! utilities @@ -93,3 +93,11 @@ PRIVATE> : bit-count ( x -- n ) dup 0 < [ bitnot ] when (bit-count) ; inline + +! Signed byte array to integer conversion +: signed-le> ( bytes -- x ) + [ le> ] [ length 8 * 1- on-bits ] bi + 2dup > [ bitnot bitor ] [ drop ] if ; + +: signed-be> ( bytes -- x ) + signed-le> ; From f32908f502ebb82a1d807e6bb5ba19a65f87348f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 14:10:31 -0600 Subject: [PATCH 178/948] Fix load-bitmap to work with negative height --- extra/graphics/bitmap/bitmap.factor | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/extra/graphics/bitmap/bitmap.factor b/extra/graphics/bitmap/bitmap.factor index 4d83300934..4c35e3d7d0 100755 --- a/extra/graphics/bitmap/bitmap.factor +++ b/extra/graphics/bitmap/bitmap.factor @@ -1,11 +1,11 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien arrays byte-arrays combinators summary -io.backend graphics.viewer io io.binary io.files kernel libc -math math.functions namespaces opengl opengl.gl prettyprint -sequences strings ui ui.gadgets.panes io.encodings.binary -accessors grouping ; +USING: alien arrays byte-arrays combinators summary io.backend +graphics.viewer io io.binary io.files kernel libc math +math.functions math.bitwise namespaces opengl opengl.gl +prettyprint sequences strings ui ui.gadgets.panes +io.encodings.binary accessors grouping ; IN: graphics.bitmap ! Currently can only handle 24bit bitmaps. @@ -56,8 +56,8 @@ M: bitmap-magic summary : parse-bitmap-header ( bitmap -- ) 4 read le> >>header-length - 4 read le> >>width - 4 read le> >>height + 4 read signed-le> >>width + 4 read signed-le> >>height 2 read le> >>planes 2 read le> >>bit-count 4 read le> >>compression From d0e53db5fc9415250170748d01e81fea8c48fb1c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 14:15:38 -0600 Subject: [PATCH 179/948] Rendering tweaks --- basis/opengl/opengl.factor | 3 ++- basis/ui/gadgets/buttons/buttons.factor | 4 ++-- basis/ui/gadgets/editors/editors.factor | 2 +- basis/ui/gadgets/grid-lines/grid-lines.factor | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/basis/opengl/opengl.factor b/basis/opengl/opengl.factor index 21fe663c44..ecb4c4a08c 100644 --- a/basis/opengl/opengl.factor +++ b/basis/opengl/opengl.factor @@ -64,7 +64,8 @@ MACRO: all-enabled-client-state ( seq quot -- ) [ 2 GL_FLOAT 0 ] dip glTexCoordPointer ; inline : line-vertices ( a b -- ) - append >c-float-array gl-vertex-pointer ; + [ first2 [ 0.5 + ] bi@ ] bi@ 4 narray + >c-float-array gl-vertex-pointer ; : gl-line ( a b -- ) line-vertices GL_LINES 0 2 glDrawArrays ; diff --git a/basis/ui/gadgets/buttons/buttons.factor b/basis/ui/gadgets/buttons/buttons.factor index 11fb69fc7d..c975e64b12 100644 --- a/basis/ui/gadgets/buttons/buttons.factor +++ b/basis/ui/gadgets/buttons/buttons.factor @@ -111,8 +111,8 @@ TUPLE: checkmark-paint < caching-pen color last-vertices ; : checkmark-points ( dim -- points ) { - [ { 0 0 } v* { 0 1 } v+ ] - [ { 1 1 } v* { 0 1 } v+ ] + [ { 0 0 } v* ] + [ { 1 1 } v* ] [ { 0 1 } v* ] [ { 1 0 } v* ] } cleave 4array ; diff --git a/basis/ui/gadgets/editors/editors.factor b/basis/ui/gadgets/editors/editors.factor index 74647a6afb..2cf6d24154 100644 --- a/basis/ui/gadgets/editors/editors.factor +++ b/basis/ui/gadgets/editors/editors.factor @@ -112,7 +112,7 @@ M: editor ungraft* line-height * ; : caret-loc ( editor -- loc ) - [ editor-caret* ] keep 2dup loc>x 1+ + [ editor-caret* ] keep 2dup loc>x rot first rot line>y 2array ; : caret-dim ( editor -- dim ) diff --git a/basis/ui/gadgets/grid-lines/grid-lines.factor b/basis/ui/gadgets/grid-lines/grid-lines.factor index d7844e3fa3..adfdd16f69 100644 --- a/basis/ui/gadgets/grid-lines/grid-lines.factor +++ b/basis/ui/gadgets/grid-lines/grid-lines.factor @@ -27,7 +27,7 @@ M: grid-lines draw-boundary dup grid set dup rect-dim half-gap v- grid-dim set compute-grid - [ { 1 0 } draw-grid-lines ] + [ { -0.5 -0.5 } gl-translate { 1 0 } draw-grid-lines ] [ { 0.5 -0.5 } gl-translate { 0 1 } draw-grid-lines From 9fb6224e301a7bb2851169057da13e991457d730 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 18 Nov 2008 14:15:48 -0600 Subject: [PATCH 180/948] Add UI render test tool --- extra/ui/render/test/reference.bmp | Bin 0 -> 73554 bytes extra/ui/render/test/reference.bmp.2 | Bin 0 -> 89322 bytes extra/ui/render/test/test.factor | 70 +++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100644 extra/ui/render/test/reference.bmp create mode 100644 extra/ui/render/test/reference.bmp.2 create mode 100644 extra/ui/render/test/test.factor diff --git a/extra/ui/render/test/reference.bmp b/extra/ui/render/test/reference.bmp new file mode 100644 index 0000000000000000000000000000000000000000..0740fcc8173f0a6fc4fcfa76802b5146e5a7c59b GIT binary patch literal 73554 zcmeIwu?Ye}7=+RPx-bw-t-u1zO{~HGGvjlWD?&cr!Y&*a&CI($o|kRD=eF*3-S@h$ zb+?xW#gNHaszyq*OiTL2FeZaU0zo?xW#gNH zaszyq*OiTL2FeZaU0zo?xW#gNHaszyq*OiTL O2FeZaU0(OkvwZ-#zpe-X literal 0 HcmV?d00001 diff --git a/extra/ui/render/test/reference.bmp.2 b/extra/ui/render/test/reference.bmp.2 new file mode 100644 index 0000000000000000000000000000000000000000..630563a5c7d6bc7838e122b7207ff3ad83cf5102 GIT binary patch literal 89322 zcmeI5L6X}x5JlzkGP|50XYt-Q$TG_;vd&3nPUpQZp|HhJ`oa(xN@Am7_M0+Hh>!^2 z_kRsQQ!an|{`1c-C;Rz#Dt}Mq$5j5B%9qn0r?1oXpQ-)#-%gh@z5M^@d^*j4?Dctm z!rZi_e)-V(d^%Hx(cltL3o2y@4ZPWyY31)|1uV|SoOir={x*$!#3I^r^gk;Ad)t`k zl{;WB51A!<@9*!YT6ueWtG3lXqxboIUB88G*vrk{;sdUI)aT&-OIz9&eYh_T&q5SJAdv>W7S+^;ibREpL(1Eu-AvL7Duob=l{r_ zVGs5q{g=7#l07~5w{kUY`!UP9my^JfJ@o;6?Z;P3OU-wj_wsNEdwuw7v8VYC_F%8& z725XY754J*rZZ*T+n1wf@)CPab!478?8URkx|fGHohj_Wp8A1$KLub9_WHSvo>YO7 zJw1C^8^vD(_MGa-JoS=2^#R=Zb7vZ>=KPKU_Ta7$cd(a-wQ{Bwd(E|)gW<0af4a}t zSa|7QdVtq43cy|;zFHh)*1eq0kDqnP zo}T-yjpDBX>s~wu5hEzsQy;*cKX<0F<~zP?iJ%~+PuT0jS1XTczJt9O4kCJmJ=lxz z9ewgWXKOv`)yAGPCyA_kta~|~A3tl@gS~hc<{Sa+!Cp@1$IrTCPtP9KM)B8x?>XZ+ zh!{c1p85dp{JArYRdasF5J5pqpRm`5uT~y|y%_ID_X>OQ?CCzAbuXHTe*MEDC!Jw1C^8^vD(_MAN(KTcmId+GzY^XJYqR?Ybx z!#Hesj|BGm@YTv=RraRf&;LW)4p-U3czcTHZ&LvF;@Q)E{@uD~>^0Xt*z-mp?D??wYp_>a4_hBy#wGSP`ULU?%c}(-& zUX0bA1A8A32)hA$uoq^&CaJbUapb3zDv@$9kZggxU>ePFLC{u-#}wR75D_vc)j z)9a(ndXB}-U+M$6yXoSog=$`7?5_XGM0c;39J%rSXdcWu9*d#IThAV=@m=D~b>06@ z=mL8==_}b&AHd!K>)s_ZT6TP~NKVM<^zmj5dwuw7@lF z91-lrv#0xf*vrEq?8URUW!`SaNavIVfDF{?5Pjn&YwHeSo7VZ-<>@A{yE-tKhV-o0od!qS1XTc zzI&9VN8b;7{n+}fC)k6%&pblAj{>k4&mMbDA8(KTRM?AWk3Hw;l=zGf_I?faEKb)l zS>alL;=YfQcl^PUwE2)zwzz4$)d$y@uEm*q>;8X27u8&2 z!N1=d5}Dlw1$*)5J>BQm*xT#=9Pi!i!-HN>0QTb9+p_M#-U}ul^rNr`dxKi@@WX;V z*gL$*2c017!QPKA|Gskptvt2CUH??7?2c9yB>B0DJN5vFCI&_`r{by?FMv>^Ut? z*E0F(T7TmHz;;YEv^Dn33rn$_{8@czU%T@8ZTc-N)y{QG`{fFIhhVg1?=HrgQ>m}7 zH9PC_fj#4Fk0RqdgmDir3D}dpocJ>;2i>tZz<8o`$kOjlnRSos%rmA{&eM1Q0k)Uf A1ONa4 literal 0 HcmV?d00001 diff --git a/extra/ui/render/test/test.factor b/extra/ui/render/test/test.factor new file mode 100644 index 0000000000..01b5b65bcf --- /dev/null +++ b/extra/ui/render/test/test.factor @@ -0,0 +1,70 @@ +! Copyright (C) 2008 Slava Pestov. +! See http://factorcode.org/license.txt for BSD license. +USING: accessors colors arrays kernel sequences math byte-arrays +namespaces cap graphics.bitmap +ui.gadgets ui.gadgets.packs ui.gadgets.borders ui.gadgets.grids +ui.gadgets.grid-lines ui.gadgets.labels ui.gadgets.buttons +ui.render ui opengl opengl.gl ; +IN: ui.render.test + +SINGLETON: line-test + +M: line-test draw-interior + 2drop { 0 0 } { 0 10 } gl-line ; + +: ( -- gadget ) + + line-test >>interior + { 1 10 } >>dim ; + +TUPLE: ui-render-test < pack { first-time? initial: t } ; + +: message-window ( text -- ) +