]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix ltrim/rtrim, get extra/ to load after number tower changes
authorSlava Pestov <slava@factorcode.org>
Sun, 21 Oct 2007 21:37:50 +0000 (17:37 -0400)
committerSlava Pestov <slava@factorcode.org>
Sun, 21 Oct 2007 21:37:50 +0000 (17:37 -0400)
24 files changed:
core/bootstrap/stage2.factor
core/io/files/files.factor
core/sequences/sequences-tests.factor
core/sequences/sequences.factor
extra/benchmark/raytracer/raytracer.factor
extra/benchmark/spectral-norm/spectral-norm.factor
extra/boids/ui/ui.factor
extra/calendar/calendar.factor
extra/color-picker/color-picker.factor
extra/colors/hsv/hsv.factor
extra/crypto/sha1/sha1.factor
extra/factory/commands/commands.factor
extra/io/windows/nt/backend/backend.factor
extra/io/windows/windows.factor
extra/irc/irc.factor
extra/math/fft/fft.factor
extra/math/polynomials/polynomials.factor
extra/pack/pack.factor
extra/parser-combinators/parser-combinators.factor
extra/pos/pos.factor
extra/tar/tar.factor
extra/tetris/game/game.factor
misc/integration/deploy-size-test.factor [new file with mode: 0644]
misc/integration/macosx-deploy.factor

index 121dd815e3d2b32ea8d43caca2acc6be8475de92..1a527813070a47cd914cf99f67910a0b5a2917f7 100755 (executable)
@@ -19,7 +19,7 @@ IN: bootstrap.stage2
 
     parse-command-line
 
-    H{ } clone changed-words set-global
+    all-words [ dup ] H{ } map>assoc changed-words set-global
 
     "-no-crossref" cli-args member? [
         "Cross-referencing..." print flush
@@ -41,9 +41,6 @@ IN: bootstrap.stage2
     ] if
 
     [
-        ! Compile everything if compiler is loaded
-        all-words [ changed-word ] each
-
         "exclude" "include"
         [ get-global " " split [ empty? not ] subset ] 2apply
         seq-diff
index 84d83bd05273cddbce8d7528c77b946434f6b585..da1c07852552227b2dbae6c59cae021d077f2b86 100644 (file)
@@ -29,9 +29,8 @@ M: object root-directory? ( path -- ? ) "/" = ;
     "/\\" member? ;
 
 : path+ ( str1 str2 -- str )
-    >r [ path-separator? ] rtrim r>
-    [ path-separator? ] ltrim
-    >r "/" r> 3append ;
+    >r [ path-separator? ] right-trim "/" r>
+    [ path-separator? ] left-trim 3append ;
 
 : stat ( path -- directory? permissions length modified )
     normalize-pathname (stat) ;
index 58250f1ee549cd72163aa62c109497009c472301..1509fa8c054dfa6ac833b8aac3302d76e1acdbac 100755 (executable)
@@ -236,9 +236,11 @@ unit-test
 
 [ -1./0. 0 delete-nth ] unit-test-fails
 [ "" ] [ "" [ blank? ] trim ] unit-test
-[ "" ] [ "" [ blank? ] ltrim ] unit-test
-[ "" ] [ "" [ blank? ] rtrim ] unit-test
+[ "" ] [ "" [ blank? ] left-trim ] unit-test
+[ "" ] [ "" [ blank? ] right-trim ] unit-test
+[ "" ] [ "  " [ blank? ] left-trim ] unit-test
+[ "" ] [ "  " [ blank? ] right-trim ] unit-test
 [ "asdf" ] [ " asdf " [ blank? ] trim ] unit-test
-[ "asdf " ] [ " asdf " [ blank? ] ltrim ] unit-test
-[ " asdf" ] [ " asdf " [ blank? ] rtrim ] unit-test
+[ "asdf " ] [ " asdf " [ blank? ] left-trim ] unit-test
+[ " asdf" ] [ " asdf " [ blank? ] right-trim ] unit-test
 
index 778f688c86e5247b77a7713c553fa7f148d05827..dedbbfc59d95e49f47458fe2d86b731daaad5c42 100755 (executable)
@@ -652,16 +652,16 @@ PRIVATE>
     dup slice? [ { } like ] when 0 over length rot <slice> ;
     inline
 
-: ltrim ( seq quot -- newseq )
-    over >r [ not ] compose find drop
-    r> swap [ tail ] when* ; inline
+: left-trim ( seq quot -- newseq )
+    over >r [ not ] compose find drop r> swap
+    [ tail ] [ dup length tail ] if* ; inline
 
-: rtrim ( seq quot -- newseq )
-    over >r [ not ] compose find-last drop
-    r> swap [ 1+ head ] when* ; inline
+: right-trim ( seq quot -- newseq )
+    over >r [ not ] compose find-last drop r> swap
+    [ 1+ head ] [ 0 head ] if* ; inline
 
 : trim ( seq quot -- newseq )
-    [ ltrim ] keep rtrim ; inline
+    [ left-trim ] keep right-trim ; inline
 
 : sum ( seq -- n ) 0 [ + ] reduce ;
 : product ( seq -- n ) 1 [ * ] reduce ;
index 8f447bcb699ce356f67258ca542e10d731da58cf..b277b08d796d3db7965f86ccfc01d5631d60614f 100644 (file)
@@ -2,7 +2,7 @@
 ! http://www.ffconsultancy.com/free/ray_tracer/languages.html
 
 USING: float-arrays compiler generic io io.files kernel math
-math.vectors math.parser namespaces sequences
+math.functions math.vectors math.parser namespaces sequences
 sequences.private words ;
 IN: benchmark.raytracer
 
index 196f06142e413f3ab25f21517ebd219e4f4c1d10..e67359e70cc623ed2cb1bdc4e398662fabaf7d93 100644 (file)
@@ -1,7 +1,7 @@
 ! Factor port of
 ! http://shootout.alioth.debian.org/gp4/benchmark.php?test=spectralnorm&lang=all
-USING: float-arrays kernel math math.vectors sequences
-sequences.private prettyprint words tools.time hints ;
+USING: float-arrays kernel math math.functions math.vectors
+sequences sequences.private prettyprint words tools.time hints ;
 IN: benchmark.spectral-norm
 
 : fast-truncate >fixnum >float ; inline
index 2bd86f49f67bb893923a95b618cdff45c0c31d92..15f33796fae38523e2b109aee6469b1b5a1577cf 100644 (file)
@@ -1,6 +1,7 @@
 
 USING: kernel namespaces
        math
+       math.functions
        math.vectors
        math.parser
        hashtables sequences threads
index 27857e0d9ffc81834ee703d6d28be0b74c81c14e..59414a11421c5dfe818cd884b08f9db3929875b4 100644 (file)
@@ -2,7 +2,7 @@
 ! See http://factorcode.org/license.txt for BSD license.
 
 USING: arrays hashtables io io.streams.string kernel math
-math.vectors math.parser
+math.vectors math.functions math.parser
 namespaces sequences strings tuples system ;
 IN: calendar
 
index 7082afc8224dee3219343a289496129dc359f876..62ea2e29ba8395e43c842e6ced68086998477f39 100644 (file)
@@ -1,8 +1,9 @@
 ! Copyright (C) 2006, 2007 Slava Pestov.
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel math math.parser models sequences ui ui.gadgets
-ui.gadgets.controls ui.gadgets.frames ui.gadgets.labels
-ui.gadgets.packs ui.gadgets.sliders ui.render ;
+USING: kernel math math.functions math.parser models sequences
+ui ui.gadgets ui.gadgets.controls ui.gadgets.frames
+ui.gadgets.labels ui.gadgets.packs ui.gadgets.sliders ui.render
+;
 IN: color-picker
 
 ! Simple example demonstrating the use of models.
index 102f45ce8acab19fe56a4187c60dfadad38422df..79919d2d02f002accb2796e3c68d3630ba1a3fbf 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2007 Eduardo Cavazos
 ! See http://factorcode.org/license.txt for BSD license.
 
-USING: kernel combinators arrays sequences math combinators.lib ;
+USING: kernel combinators arrays sequences math math.functions
+combinators.lib ;
 
 IN: colors.hsv
 
index 3497e33915deb77b14ec1145c6cb1fb4fd4a5ef3..dfc5b10f7a578cc28a90e1cd0e70205761e216c6 100644 (file)
@@ -127,7 +127,7 @@ SYMBOL: K
 : file>sha1 ( file -- sha1 ) <file-reader> stream>sha1 ;
 
 : string>sha1-interleave ( string -- )
-    [ zero? ] ltrim
+    [ zero? ] left-trim
     dup length odd? [ 1 tail ] when
     seq>2seq [ string>sha1 ] 2apply
     swap 2seq>seq ;
index 35fab82ea869202a528798b3ca2fb0e6595f3b23..282c738976ab9a4b543e4fcc46236387a466ad0e 100644 (file)
@@ -1,5 +1,5 @@
 
-USING: kernel combinators sequences math math.vectors mortar slot-accessors
+USING: kernel combinators sequences math math.functions math.vectors mortar slot-accessors
        x x.widgets.wm.root x.widgets.wm.frame combinators.lib ;
 
 IN: factory.commands
index a7f803fd7f30d0093a375047ed9d00b5792b2089..0cbdabfa1e49ccdc2409fe5c19cde7d7418689ed 100755 (executable)
@@ -32,7 +32,7 @@ M: windows-nt-io normalize-pathname ( string -- string )
                 dup first CHAR: \\ = [ CHAR: \\ , ] unless %
             ] "" make
         ] }
-    } cond [ "/\\." member? ] rtrim ;
+    } cond [ "/\\." member? ] right-trim ;
 
 SYMBOL: io-hash
 
index 423783526e9dad177c014c2e6aec45fcf637f366..f46af26568f0df2387832157d93562a35f1af6e0 100644 (file)
@@ -17,7 +17,7 @@ M: windows-io (socket-destructor) ( obj -- )
     destructor-obj closesocket drop ;
 
 M: windows-io root-directory? ( path -- ? )
-    [ path-separator? ] rtrim
+    [ path-separator? ] right-trim
     dup length 2 = [
         dup first Letter?
         swap second CHAR: : = and
index 0f2f2c371ab9ac5531074910ebb5a8f78fb20643..6f54768cabf5eb65f8261066789c7fd8cad723cf 100644 (file)
@@ -72,7 +72,7 @@ TUPLE: part-command channel text ;
 
 SYMBOL: irc-client
 : irc-stream> ( -- stream ) irc-client get irc-client-stream ;
-: trim-: ( seq -- seq ) [ CHAR: : = ] ltrim ;
+: trim-: ( seq -- seq ) [ CHAR: : = ] left-trim ;
 : parse-name ( string -- string )
     trim-: "!" split first ;
 : irc-split ( string -- seq )
index a21351fa74452b7628af8bfcc493fbb5fe612409..6b5215350c9b99df83b00f6b27fb5afc2476c24b 100644 (file)
@@ -9,7 +9,7 @@ IN: math.fft
 : odd ( seq -- seq ) 2 group 1 <column> ;
 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 ;
index 5a4cc2bc66b9bb4c099fe387ea2ab6790a760979..f805df824949703b12d7cfefc3d5c5778c56cb72 100644 (file)
@@ -22,7 +22,7 @@ PRIVATE>
 : p= ( p p -- ? ) pextend = ;
 
 : ptrim ( p -- p )
-    dup length 1 = [ [ zero? ] rtrim ] unless ;
+    dup length 1 = [ [ zero? ] right-trim ] unless ;
 
 : 2ptrim ( p p -- p p ) [ ptrim ] 2apply ;
 : p+ ( p p -- p ) pextend v+ ;
index 07b572f801dd30e3b412289f8df69c2082a41696..fd39f83a98ce2b09f5f7ba85d4e8b2d67d06b471 100644 (file)
@@ -88,7 +88,7 @@ M: string b, ( n string -- ) heap-size b, ;
     "\0" read-until [ drop f ] unless ;
 
 : read-c-string* ( n -- str/f )
-    read [ 0 = ] rtrim dup empty? [ drop f ] when ;
+    read [ 0 = ] right-trim dup empty? [ drop f ] when ;
 
 : (read-128-ber) ( n -- n )
     1 read first
index 97acf8398ba451193adf14fe03a5027bec5078a8..fa0733f321ec3d40ff024a9b025b0396db15fb25 100644 (file)
@@ -111,11 +111,11 @@ M: or-parser (parse) ( input parser1 -- list )
   #! input. This implements the choice parsing operator.
   [ or-parser-p1 ] keep or-parser-p2 >r dupd parse swap r> parse lappend ;
 
-: ltrim-slice ( string -- string )
+: left-trim-slice ( string -- string )
   #! Return a new string without any leading whitespace
   #! from the original string.
   dup empty? [
-    dup first blank? [ 1 tail-slice ltrim-slice ] when 
+    dup first blank? [ 1 tail-slice left-trim-slice ] when 
   ] unless ;
 
 TUPLE: sp-parser p1 ;
@@ -127,7 +127,7 @@ C: sp sp-parser ( p1 -- parser )
 M: sp-parser (parse) ( input parser -- list )
   #! Skip all leading whitespace from the input then call
   #! the parser on the remaining input.
-  >r ltrim-slice r> sp-parser-p1 parse ;
+  >r left-trim-slice r> sp-parser-p1 parse ;
 
 TUPLE: just-parser p1 ;
 
index 3071ebcf5f804b53aabdb538c4be7dcdabbf750b..24c5410e996ff95325d51555589bf207fe1534d4 100644 (file)
@@ -1,5 +1,5 @@
 
-USING: kernel math math.vectors sequences self ;
+USING: kernel math math.functions math.vectors sequences self ;
 
 IN: pos
 
index e41264680c9a8ee8d4b0a25f6607649dc5b536db..01a50566b4eb337495cc9287592f910320feb573 100644 (file)
@@ -164,7 +164,7 @@ TUPLE: unimplemented-typeflag header ;
 ! Long file name
 : typeflag-L ( header -- )
     <string-writer> [ read-data-blocks ] keep
-    >string [ CHAR: \0 = ] rtrim filename set
+    >string [ CHAR: \0 = ] right-trim filename set
     global [ "long filename: " write filename get . flush ] bind
     filename get tar-path+ make-directories ;
 
index 869a7c49c20aa115b683f6dd804f18e9fd9c6bba..74c2f5f1cbbeb4af43b660cff95bde39dd2ec9ca 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2006, 2007 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: kernel sequences math tetris.board tetris.piece
-tetris.tetromino lazy-lists combinators system ;
+USING: kernel sequences math math.functions tetris.board
+tetris.piece tetris.tetromino lazy-lists combinators system ;
 IN: tetris.game
 
 TUPLE: tetris pieces last-update update-interval rows score game-state paused? running? ;
diff --git a/misc/integration/deploy-size-test.factor b/misc/integration/deploy-size-test.factor
new file mode 100644 (file)
index 0000000..91cdaba
--- /dev/null
@@ -0,0 +1,28 @@
+USING: tools.deploy sequences io.files io.launcher io
+kernel concurrency prettyprint ;
+
+"." resource-path cd
+
+"deploy-log" make-directory
+
+{
+    "automata.ui"
+    "boids.ui"
+    "bunny"
+    "color-picker"
+    "gesture-logger"
+    "golden-section"
+    "hello-world"
+    "hello-ui"
+    "lsys.ui"
+    "maze"
+    "nehe"
+    "tetris"
+    "catalyst-talk"
+} [
+    dup
+    "deploy-log/" over append <file-writer>
+    [ deploy ] with-stream
+    dup file-length 1024 /f
+    2array
+] parallel-map .
index 29642a08eb30bbbd19684dc80841db6df1221068..f1e6e7fe066429c94f63684dfb41257cfe8a071e 100644 (file)
@@ -3,7 +3,7 @@ kernel concurrency ;
 
 "." resource-path cd
 
-"mkdir deploy-log" run-process
+"deploy-log" make-directory
 
 {
     "automata.ui"