Merge commit 'origin/master' into emacs

db4
Jose A. Ortega Ruiz 2009-01-12 03:02:49 +01:00
commit e8ba9800b4
5 changed files with 17 additions and 26 deletions

View File

@ -267,8 +267,8 @@ $nl
{ $heading "Example: ls" } { $heading "Example: ls" }
"Here is an example implementing a simplified version of the Unix " { $snippet "ls" } " command in Factor:" "Here is an example implementing a simplified version of the Unix " { $snippet "ls" } " command in Factor:"
{ $code { $code
<" USING: command-line namespaces io io.files tools.files <" USING: command-line namespaces io io.files
sequences kernel ; io.pathnames tools.files sequences kernel ;
command-line get [ command-line get [
current-directory get directory. current-directory get directory.

View File

@ -1,4 +1,4 @@
! Copyright (C) 2005, 2008 Slava Pestov. ! Copyright (C) 2005, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays hashtables io kernel math namespaces USING: accessors arrays hashtables io kernel math namespaces
make opengl sequences strings splitting ui.gadgets make opengl sequences strings splitting ui.gadgets
@ -12,11 +12,7 @@ TUPLE: label < gadget text font color ;
text>> dup string? [ "\n" join ] unless ; inline text>> dup string? [ "\n" join ] unless ; inline
: set-label-string ( string label -- ) : set-label-string ( string label -- )
CHAR: \n pick memq? [ [ CHAR: \n over memq? [ string-lines ] when ] dip (>>text) ; inline
[ string-lines ] dip (>>text)
] [
(>>text)
] if ; inline
: label-theme ( gadget -- gadget ) : label-theme ( gadget -- gadget )
sans-serif-font >>font sans-serif-font >>font

View File

@ -4,8 +4,7 @@ USING: combinators.short-circuit unicode.categories kernel math
combinators splitting sequences math.parser io.files io assocs combinators splitting sequences math.parser io.files io assocs
arrays namespaces make math.ranges unicode.normalize.private values arrays namespaces make math.ranges unicode.normalize.private values
io.encodings.ascii unicode.syntax unicode.data compiler.units fry io.encodings.ascii unicode.syntax unicode.data compiler.units fry
alien.syntax sets accessors interval-maps memoize locals words alien.syntax sets accessors interval-maps memoize locals words ;
strings hints ;
IN: unicode.breaks IN: unicode.breaks
<PRIVATE <PRIVATE
@ -212,25 +211,21 @@ to: word-table
[ dupd walk-up wNumeric property-not= ] } [ dupd walk-up wNumeric property-not= ] }
{ check-number-before { check-number-before
[ dupd walk-down wNumeric property-not= ] } [ dupd walk-down wNumeric property-not= ] }
} case ; inline } case ;
:: word-break-next ( old-class new-char i str -- next-class ? ) :: word-break-next ( old-class new-char i str -- next-class ? )
new-char dup format/extended? new-char dup format/extended?
[ drop old-class dup { 1 2 3 } member? ] [ [ drop old-class dup { 1 2 3 } member? ] [
word-break-prop old-class over word-table-nth word-break-prop old-class over word-table-nth
i str word-break? i str word-break?
] if ; inline ] if ;
PRIVATE> PRIVATE>
: first-word ( str -- i ) : first-word ( str -- i )
[ unclip-slice word-break-prop over <enum> ] keep [ unclip-slice word-break-prop over <enum> ] keep
'[ swap _ word-break-next ] assoc-find 2drop '[ swap _ word-break-next ] assoc-find 2drop
nip swap length or 1+ ; inline nip swap length or 1+ ;
HINTS: first-word string ;
: >words ( str -- words ) : >words ( str -- words )
[ first-word ] >pieces ; [ first-word ] >pieces ;
HINTS: >words string ;

View File

@ -5,7 +5,7 @@ io.encodings.ascii kernel values splitting accessors math.parser
ascii io assocs strings math namespaces make sorting combinators ascii io assocs strings math namespaces make sorting combinators
math.order arrays unicode.normalize unicode.data locals math.order arrays unicode.normalize unicode.data locals
unicode.syntax macros sequences.deep words unicode.breaks unicode.syntax macros sequences.deep words unicode.breaks
quotations ; quotations combinators.short-circuit ;
IN: unicode.collation IN: unicode.collation
<PRIVATE <PRIVATE
@ -71,12 +71,12 @@ ducet insert-helpers
building get empty? [ 0 ] [ building get peek peek ] if ; building get empty? [ 0 ] [ building get peek peek ] if ;
: blocked? ( char -- ? ) : blocked? ( char -- ? )
combining-class [ combining-class dup { 0 f } member?
last combining-class = [ drop last non-starter? ]
] [ last combining-class ] if* ; [ last combining-class = ] if ;
: possible-bases ( -- slice-of-building ) : possible-bases ( -- slice-of-building )
building get dup [ first combining-class not ] find-last building get dup [ first non-starter? not ] find-last
drop [ 0 ] unless* tail-slice ; drop [ 0 ] unless* tail-slice ;
:: ?combine ( char slice i -- ? ) :: ?combine ( char slice i -- ? )

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov. ! Copyright (C) 2008, 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors specialized-arrays.double fry kernel locals make math USING: accessors specialized-arrays.double fry kernel locals math
math.constants math.functions math.vectors prettyprint math.constants math.functions math.vectors prettyprint combinators.smart
sequences hints arrays ; sequences hints arrays ;
IN: benchmark.nbody IN: benchmark.nbody
@ -53,7 +53,7 @@ TUPLE: nbody-system { bodies array read-only } ;
offset-momentum drop ; inline offset-momentum drop ; inline
: <nbody-system> ( -- system ) : <nbody-system> ( -- system )
[ <sun> , <jupiter> , <saturn> , <uranus> , <neptune> , ] { } make nbody-system boa [ <sun> <jupiter> <saturn> <uranus> <neptune> ] output>array nbody-system boa
dup bodies>> init-bodies ; inline dup bodies>> init-bodies ; inline
:: each-pair ( bodies pair-quot: ( other-body body -- ) each-quot: ( body -- ) -- ) :: each-pair ( bodies pair-quot: ( other-body body -- ) each-quot: ( body -- ) -- )