From a8dcede569a4001855de971fdcd93f4099201e25 Mon Sep 17 00:00:00 2001 From: erg Date: Tue, 1 Sep 2009 13:16:37 -0500 Subject: [PATCH 1/6] fix file-systems on the bsds --- basis/io/files/info/unix/freebsd/freebsd.factor | 4 ++-- basis/io/files/info/unix/netbsd/netbsd.factor | 4 ++-- basis/io/files/info/unix/openbsd/openbsd.factor | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/basis/io/files/info/unix/freebsd/freebsd.factor b/basis/io/files/info/unix/freebsd/freebsd.factor index baae14a30f..cdf158bd2f 100644 --- a/basis/io/files/info/unix/freebsd/freebsd.factor +++ b/basis/io/files/info/unix/freebsd/freebsd.factor @@ -51,5 +51,5 @@ M: freebsd statvfs>file-system-info ( file-system-info statvfs -- file-system-in M: freebsd file-systems ( -- array ) f 0 0 getfsstat dup io-error \ statfs - [ dup length 0 getfsstat io-error ] - [ [ f_mntonname>> utf8 alien>string file-system-info ] map ] bi ; + [ dup byte-length 0 getfsstat io-error ] + [ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ; diff --git a/basis/io/files/info/unix/netbsd/netbsd.factor b/basis/io/files/info/unix/netbsd/netbsd.factor index 65c2d1d03c..10d9a7eb8b 100755 --- a/basis/io/files/info/unix/netbsd/netbsd.factor +++ b/basis/io/files/info/unix/netbsd/netbsd.factor @@ -48,5 +48,5 @@ M: netbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-inf M: netbsd file-systems ( -- array ) f 0 0 getvfsstat dup io-error \ statvfs - [ dup length 0 getvfsstat io-error ] - [ [ f_mntonname>> utf8 alien>string file-system-info ] map ] bi ; + [ dup byte-length 0 getvfsstat io-error ] + [ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ; diff --git a/basis/io/files/info/unix/openbsd/openbsd.factor b/basis/io/files/info/unix/openbsd/openbsd.factor index 3cf2863713..19763c7861 100755 --- a/basis/io/files/info/unix/openbsd/openbsd.factor +++ b/basis/io/files/info/unix/openbsd/openbsd.factor @@ -49,5 +49,5 @@ M: openbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-in M: openbsd file-systems ( -- seq ) f 0 0 getfsstat dup io-error \ statfs - [ dup length 0 getfsstat io-error ] - [ [ f_mntonname>> utf8 alien>string file-system-info ] map ] bi ; + [ dup byte-length 0 getfsstat io-error ] + [ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ; From 297cb5ef57aa246791162b19a11370d744662a12 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 1 Sep 2009 14:18:29 -0500 Subject: [PATCH 2/6] openbsd defined a struct with freebsd in the name. oops..... --- basis/io/files/info/unix/openbsd/openbsd.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/io/files/info/unix/openbsd/openbsd.factor b/basis/io/files/info/unix/openbsd/openbsd.factor index 3cf2863713..382ab3735c 100755 --- a/basis/io/files/info/unix/openbsd/openbsd.factor +++ b/basis/io/files/info/unix/openbsd/openbsd.factor @@ -8,11 +8,11 @@ arrays io.files.info.unix classes.struct struct-arrays io.encodings.utf8 ; IN: io.files.unix.openbsd -TUPLE: freebsd-file-system-info < unix-file-system-info +TUPLE: openbsd-file-system-info < unix-file-system-info io-size sync-writes sync-reads async-writes async-reads owner ; -M: openbsd new-file-system-info freebsd-file-system-info new ; +M: openbsd new-file-system-info openbsd-file-system-info new ; M: openbsd file-system-statfs \ statfs [ statfs io-error ] keep ; From cd9013642554bacb4ed9e382ab1d455f475e840d Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Tue, 1 Sep 2009 18:16:57 -0500 Subject: [PATCH 3/6] add using to windows.com.wrapper --- basis/windows/com/wrapper/wrapper.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/windows/com/wrapper/wrapper.factor b/basis/windows/com/wrapper/wrapper.factor index 2af416fb7e..25b11a6a1d 100755 --- a/basis/windows/com/wrapper/wrapper.factor +++ b/basis/windows/com/wrapper/wrapper.factor @@ -4,7 +4,7 @@ namespaces windows.ole32 libc vocabs assocs accessors arrays sequences quotations combinators math words compiler.units destructors fry math.parser generalizations sets specialized-arrays.alien specialized-arrays.direct.alien -windows.kernel32 ; +windows.kernel32 classes.struct ; IN: windows.com.wrapper TUPLE: com-wrapper < disposable callbacks vtbls ; From 64d2459dac6e81c85fb74c03d16ca4d72931f8e1 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Tue, 1 Sep 2009 21:14:26 -0500 Subject: [PATCH 4/6] require numeric literals to begin and end with a digit/decimal point so that stuff like "," and "1," don't parse as numbers --- core/math/parser/parser-tests.factor | 17 +++++++++++------ core/math/parser/parser.factor | 15 +++++++++++++-- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor index 2b440b24d4..1ee3f9d220 100644 --- a/core/math/parser/parser-tests.factor +++ b/core/math/parser/parser-tests.factor @@ -25,13 +25,18 @@ unit-test [ "e" string>number ] unit-test -[ 100000 ] -[ "100,000" string>number ] -unit-test +[ 100000 ] [ "100,000" string>number ] unit-test -[ 100000.0 ] -[ "100,000.0" string>number ] -unit-test +[ 100000.0 ] [ "100,000.0" string>number ] unit-test + +[ f ] [ "," string>number ] unit-test +[ f ] [ "-," string>number ] unit-test +[ f ] [ "1," string>number ] unit-test +[ f ] [ "-1," string>number ] unit-test +[ f ] [ ",2" string>number ] unit-test +[ f ] [ "-,2" string>number ] unit-test + +[ 2.0 ] [ "2." string>number ] unit-test [ "100.0" ] [ "1.0e2" string>number number>string ] diff --git a/core/math/parser/parser.factor b/core/math/parser/parser.factor index 21062baf4b..21fbf5f186 100644 --- a/core/math/parser/parser.factor +++ b/core/math/parser/parser.factor @@ -86,16 +86,27 @@ SYMBOL: negative? [ CHAR: , eq? not ] filter >byte-array 0 suffix (string>float) ; +: number-char? ( char -- ? ) + "0123456789." member? ; + +: numeric-looking? ( str -- ? ) + "-" ?head drop + dup empty? [ drop f ] [ + dup first number-char? [ + last number-char? + ] [ drop f ] if + ] if ; + PRIVATE> : base> ( str radix -- n/f ) - over empty? [ 2drop f ] [ + over numeric-looking? [ over [ "/." member? ] find nip { { CHAR: / [ string>ratio ] } { CHAR: . [ drop string>float ] } [ drop string>integer ] } case - ] if ; + ] [ 2drop f ] if ; : string>number ( str -- n/f ) 10 base> ; : bin> ( str -- n/f ) 2 base> ; From 0c2f6fd63c12fcd53f42dadbb4589dfd3ed96ca5 Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Tue, 1 Sep 2009 21:28:23 -0500 Subject: [PATCH 5/6] let's not forget about hex literals --- core/math/parser/parser-tests.factor | 2 ++ core/math/parser/parser.factor | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/math/parser/parser-tests.factor b/core/math/parser/parser-tests.factor index 1ee3f9d220..b8b65d1334 100644 --- a/core/math/parser/parser-tests.factor +++ b/core/math/parser/parser-tests.factor @@ -38,6 +38,8 @@ unit-test [ 2.0 ] [ "2." string>number ] unit-test +[ 255 ] [ "ff" hex> ] unit-test + [ "100.0" ] [ "1.0e2" string>number number>string ] unit-test diff --git a/core/math/parser/parser.factor b/core/math/parser/parser.factor index 21fbf5f186..9f07a7d953 100644 --- a/core/math/parser/parser.factor +++ b/core/math/parser/parser.factor @@ -87,7 +87,7 @@ SYMBOL: negative? >byte-array 0 suffix (string>float) ; : number-char? ( char -- ? ) - "0123456789." member? ; + "0123456789ABCDEFabcdef." member? ; : numeric-looking? ( str -- ? ) "-" ?head drop From e140dd3fbb94b7c2d5a4915148be1408d0b442c9 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 2 Sep 2009 04:30:29 -0500 Subject: [PATCH 6/6] tools.deploy.shaker: fix snafu --- basis/tools/deploy/shaker/strip-struct-arrays.factor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/basis/tools/deploy/shaker/strip-struct-arrays.factor b/basis/tools/deploy/shaker/strip-struct-arrays.factor index 55b6630082..b83adc401a 100644 --- a/basis/tools/deploy/shaker/strip-struct-arrays.factor +++ b/basis/tools/deploy/shaker/strip-struct-arrays.factor @@ -1,4 +1,4 @@ -USING: kernel stack-checker.transforms ; +USING: kernel stack-checker.transforms struct-arrays.private ; IN: struct-arrays : struct-element-constructor ( c-type -- word )