From a4e62dfdba8f84ddd543379345d6600d6bc2af31 Mon Sep 17 00:00:00 2001 From: sheeple Date: Mon, 13 Apr 2009 14:47:39 -0500 Subject: [PATCH 1/6] Fix for math.parser syntax change --- .../compiler/tree/propagation/recursive/recursive.factor | 4 ++-- basis/math/functions/functions.factor | 2 +- basis/math/intervals/intervals.factor | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/basis/compiler/tree/propagation/recursive/recursive.factor b/basis/compiler/tree/propagation/recursive/recursive.factor index 1bcd36f6b0..b8d1760a0b 100644 --- a/basis/compiler/tree/propagation/recursive/recursive.factor +++ b/basis/compiler/tree/propagation/recursive/recursive.factor @@ -28,8 +28,8 @@ IN: compiler.tree.propagation.recursive { { [ 2dup interval-subset? ] [ empty-interval ] } { [ over empty-interval eq? ] [ empty-interval ] } - { [ 2dup interval>= t eq? ] [ 1./0. [a,a] ] } - { [ 2dup interval<= t eq? ] [ -1./0. [a,a] ] } + { [ 2dup interval>= t eq? ] [ 1/0. [a,a] ] } + { [ 2dup interval<= t eq? ] [ -1/0. [a,a] ] } [ [-inf,inf] ] } cond interval-union nip ; diff --git a/basis/math/functions/functions.factor b/basis/math/functions/functions.factor index 1eac321e3b..a6beb87345 100644 --- a/basis/math/functions/functions.factor +++ b/basis/math/functions/functions.factor @@ -81,7 +81,7 @@ PRIVATE> 2dup [ real? ] both? [ drop 0 >= ] [ 2drop f ] if ; inline : 0^ ( x -- z ) - dup zero? [ drop 0./0. ] [ 0 < 1./0. 0 ? ] if ; inline + dup zero? [ drop 0/0. ] [ 0 < 1/0. 0 ? ] if ; inline : (^mod) ( n x y -- z ) make-bits 1 [ diff --git a/basis/math/intervals/intervals.factor b/basis/math/intervals/intervals.factor index 4fbc880971..02ea181f4e 100755 --- a/basis/math/intervals/intervals.factor +++ b/basis/math/intervals/intervals.factor @@ -40,13 +40,13 @@ TUPLE: interval { from read-only } { to read-only } ; : [a,a] ( a -- interval ) closed-point dup ; foldable -: [-inf,a] ( a -- interval ) -1./0. swap [a,b] ; inline +: [-inf,a] ( a -- interval ) -1/0. swap [a,b] ; inline -: [-inf,a) ( a -- interval ) -1./0. swap [a,b) ; inline +: [-inf,a) ( a -- interval ) -1/0. swap [a,b) ; inline -: [a,inf] ( a -- interval ) 1./0. [a,b] ; inline +: [a,inf] ( a -- interval ) 1/0. [a,b] ; inline -: (a,inf] ( a -- interval ) 1./0. (a,b] ; inline +: (a,inf] ( a -- interval ) 1/0. (a,b] ; inline : [-inf,inf] ( -- interval ) full-interval ; inline From b1c1b4aba73ffb6401db40ca0b204b917ef1a86b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 13 Apr 2009 15:11:32 -0500 Subject: [PATCH 2/6] Fix pango.layouts issue on 64-bit systems --- basis/pango/layouts/layouts.factor | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/basis/pango/layouts/layouts.factor b/basis/pango/layouts/layouts.factor index defcdec6f8..25aee74ca4 100644 --- a/basis/pango/layouts/layouts.factor +++ b/basis/pango/layouts/layouts.factor @@ -44,7 +44,7 @@ FUNCTION: PangoLayoutLine* pango_layout_get_line_readonly ( PangoLayout* layout, int line ) ; FUNCTION: void -pango_layout_line_index_to_x ( PangoLayoutLine* line, int index_, gboolean trailing, int* x_pos ) ; +pango_layout_line_index_to_x ( PangoLayoutLine* line, int index_, uint trailing, int* x_pos ) ; FUNCTION: gboolean pango_layout_line_x_to_index ( PangoLayoutLine* line, int x_pos, int* index_, int* trailing ) ; @@ -122,7 +122,7 @@ MEMO: missing-font-metrics ( font -- metrics ) : line-offset>x ( layout n -- x ) #! n is an index into the UTF8 encoding of the text [ drop first-line ] [ swap string>> >utf8-index ] 2bi - f 0 [ pango_layout_line_index_to_x ] keep + 0 0 [ pango_layout_line_index_to_x ] keep *int pango>float ; : x>line-offset ( layout x -- n ) @@ -205,4 +205,4 @@ SYMBOL: cached-layouts : cached-line ( font string -- line ) cached-layout layout>> first-line ; -[ cached-layouts set-global ] "pango.layouts" add-init-hook \ No newline at end of file +[ cached-layouts set-global ] "pango.layouts" add-init-hook From b6ee0dca3be2c6fda889232eefe766706e01ce35 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 13 Apr 2009 15:17:04 -0500 Subject: [PATCH 3/6] Fix compile warning --- build-support/factor.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-support/factor.sh b/build-support/factor.sh index ad64c541fe..2fec39f14a 100755 --- a/build-support/factor.sh +++ b/build-support/factor.sh @@ -199,7 +199,7 @@ find_architecture() { write_test_program() { echo "#include " > $C_WORD.c - echo "int main(){printf(\"%d\", 8*sizeof(void*)); return 0; }" >> $C_WORD.c + echo "int main(){printf(\"%ld\", 8*sizeof(void*)); return 0; }" >> $C_WORD.c } c_find_word_size() { From 30a44225cd0201d810b0bb5d497820345528ac89 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 14 Apr 2009 15:04:58 -0500 Subject: [PATCH 4/6] Fix code for floats syntax change --- basis/lcs/lcs.factor | 2 +- core/sequences/sequences-tests.factor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/lcs/lcs.factor b/basis/lcs/lcs.factor index 8c67590697..d32b199873 100644 --- a/basis/lcs/lcs.factor +++ b/basis/lcs/lcs.factor @@ -8,7 +8,7 @@ IN: lcs 0 1 ? + [ [ 1+ ] bi@ ] dip min min ; : lcs-step ( insert delete change same? -- next ) - 1 -1./0. ? + max max ; ! -1./0. is -inf (float) + 1 -1/0. ? + max max ; ! -1/0. is -inf (float) :: loop-step ( i j matrix old new step -- ) i j 1+ matrix nth nth ! insertion diff --git a/core/sequences/sequences-tests.factor b/core/sequences/sequences-tests.factor index da495f410f..85f9d56596 100644 --- a/core/sequences/sequences-tests.factor +++ b/core/sequences/sequences-tests.factor @@ -227,7 +227,7 @@ unit-test [ -3 10 nth ] must-fail [ 11 10 nth ] must-fail -[ -1./0. 0 delete-nth ] must-fail +[ -1/0. 0 delete-nth ] must-fail [ "" ] [ "" [ CHAR: \s = ] trim ] unit-test [ "" ] [ "" [ CHAR: \s = ] trim-head ] unit-test [ "" ] [ "" [ CHAR: \s = ] trim-tail ] unit-test From 1c68b389cc0a07164137b09fb6d72797b78d48e0 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 14 Apr 2009 15:05:10 -0500 Subject: [PATCH 5/6] Document special float values --- core/math/parser/parser-docs.factor | 2 +- core/syntax/syntax-docs.factor | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/core/math/parser/parser-docs.factor b/core/math/parser/parser-docs.factor index bcc75a842a..ba0df3e357 100644 --- a/core/math/parser/parser-docs.factor +++ b/core/math/parser/parser-docs.factor @@ -25,7 +25,7 @@ $nl ABOUT: "number-strings" HELP: digits>integer -{ $values { "seq" "a sequence of integers" } { "radix" "an integer between 2 and 36" } { "n" integer } } +{ $values { "seq" "a sequence of integers" } { "radix" "an integer between 2 and 36" } { "n/f" { $maybe integer } } } { $description "Converts a sequence of digits (with most significant digit first) into an integer." } { $notes "This is one of the factors of " { $link string>number } "." } ; diff --git a/core/syntax/syntax-docs.factor b/core/syntax/syntax-docs.factor index bb8791df97..33a0096ff9 100644 --- a/core/syntax/syntax-docs.factor +++ b/core/syntax/syntax-docs.factor @@ -66,6 +66,12 @@ ARTICLE: "syntax-floats" "Float syntax" "7.e13" "1.0e-5" } +"There are three special float values:" +{ $table +{ "Positive infinity" { $snippet "1/0." } } +{ "Negative infinity" { $snippet "-1/0." } } +{ "Not-a-number" { $snippet "0/0." } } +} "More information on floats can be found in " { $link "floats" } "." ; ARTICLE: "syntax-complex-numbers" "Complex number syntax" From da38a259630ec91599030754680b92393d7882b5 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 14 Apr 2009 17:09:16 -0500 Subject: [PATCH 6/6] More float syntax fixes --- extra/math/analysis/analysis.factor | 4 ++-- extra/webapps/site-watcher/site-watcher.factor | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/extra/math/analysis/analysis.factor b/extra/math/analysis/analysis.factor index fa01b0376d..a1fc0bd07b 100755 --- a/extra/math/analysis/analysis.factor +++ b/extra/math/analysis/analysis.factor @@ -42,7 +42,7 @@ PRIVATE> #! gamma(x) = integral 0..inf [ t^(x-1) exp(-t) ] dt #! gamma(n+1) = n! for n > 0 dup { [ 0.0 <= ] [ 1.0 mod zero? ] } 1&& [ - drop 1./0. + drop 1/0. ] [ [ abs gamma-lanczos6 ] keep dup 0 > [ drop ] [ gamma-neg ] if ] if ; @@ -51,7 +51,7 @@ PRIVATE> #! gammaln(x) is an alternative when gamma(x)'s range #! varies too widely dup 0 < [ - drop 1./0. + drop 1/0. ] [ [ abs gammaln-lanczos6 ] keep dup 0 > [ drop ] [ gamma-neg ] if ] if ; diff --git a/extra/webapps/site-watcher/site-watcher.factor b/extra/webapps/site-watcher/site-watcher.factor index edd8104a7e..b60f1b1b6a 100644 --- a/extra/webapps/site-watcher/site-watcher.factor +++ b/extra/webapps/site-watcher/site-watcher.factor @@ -1,15 +1,16 @@ ! Copyright (C) 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs db.sqlite furnace furnace.actions furnace.alloy -furnace.auth furnace.auth.features.deactivate-user +USING: accessors assocs db.sqlite furnace furnace.actions +furnace.alloy furnace.auth furnace.auth.features.deactivate-user furnace.auth.features.edit-profile furnace.auth.features.recover-password furnace.auth.features.registration furnace.auth.login furnace.boilerplate furnace.redirection html.forms http.server http.server.dispatchers kernel namespaces site-watcher site-watcher.db site-watcher.private urls validators io.sockets.secure.unix.debug -io.servers.connection db db.tuples sequences webapps.site-watcher.common -webapps.site-watcher.watching webapps.site-watcher.spidering ; +io.servers.connection io.files.temp db db.tuples sequences +webapps.site-watcher.common webapps.site-watcher.watching +webapps.site-watcher.spidering ; QUALIFIED: assocs IN: webapps.site-watcher