Merge branch 'master' of git://factorcode.org/git/factor
commit
e3b967fe67
|
@ -51,5 +51,5 @@ M: freebsd statvfs>file-system-info ( file-system-info statvfs -- file-system-in
|
||||||
M: freebsd file-systems ( -- array )
|
M: freebsd file-systems ( -- array )
|
||||||
f 0 0 getfsstat dup io-error
|
f 0 0 getfsstat dup io-error
|
||||||
\ statfs <struct-array>
|
\ statfs <struct-array>
|
||||||
[ dup length 0 getfsstat io-error ]
|
[ dup byte-length 0 getfsstat io-error ]
|
||||||
[ [ f_mntonname>> utf8 alien>string file-system-info ] map ] bi ;
|
[ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;
|
||||||
|
|
|
@ -48,5 +48,5 @@ M: netbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-inf
|
||||||
M: netbsd file-systems ( -- array )
|
M: netbsd file-systems ( -- array )
|
||||||
f 0 0 getvfsstat dup io-error
|
f 0 0 getvfsstat dup io-error
|
||||||
\ statvfs <struct-array>
|
\ statvfs <struct-array>
|
||||||
[ dup length 0 getvfsstat io-error ]
|
[ dup byte-length 0 getvfsstat io-error ]
|
||||||
[ [ f_mntonname>> utf8 alien>string file-system-info ] map ] bi ;
|
[ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;
|
||||||
|
|
|
@ -8,11 +8,11 @@ arrays io.files.info.unix classes.struct struct-arrays
|
||||||
io.encodings.utf8 ;
|
io.encodings.utf8 ;
|
||||||
IN: io.files.unix.openbsd
|
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
|
io-size sync-writes sync-reads async-writes async-reads
|
||||||
owner ;
|
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
|
M: openbsd file-system-statfs
|
||||||
\ statfs <struct> [ statfs io-error ] keep ;
|
\ statfs <struct> [ statfs io-error ] keep ;
|
||||||
|
@ -49,5 +49,5 @@ M: openbsd statvfs>file-system-info ( file-system-info statvfs -- file-system-in
|
||||||
M: openbsd file-systems ( -- seq )
|
M: openbsd file-systems ( -- seq )
|
||||||
f 0 0 getfsstat dup io-error
|
f 0 0 getfsstat dup io-error
|
||||||
\ statfs <struct-array>
|
\ statfs <struct-array>
|
||||||
[ dup length 0 getfsstat io-error ]
|
[ dup byte-length 0 getfsstat io-error ]
|
||||||
[ [ f_mntonname>> utf8 alien>string file-system-info ] map ] bi ;
|
[ [ f_mntonname>> utf8 alien>string file-system-info ] { } map-as ] bi ;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
USING: kernel stack-checker.transforms ;
|
USING: kernel stack-checker.transforms struct-arrays.private ;
|
||||||
IN: struct-arrays
|
IN: struct-arrays
|
||||||
|
|
||||||
: struct-element-constructor ( c-type -- word )
|
: struct-element-constructor ( c-type -- word )
|
||||||
|
|
|
@ -4,7 +4,7 @@ namespaces windows.ole32 libc vocabs assocs accessors arrays
|
||||||
sequences quotations combinators math words compiler.units
|
sequences quotations combinators math words compiler.units
|
||||||
destructors fry math.parser generalizations sets
|
destructors fry math.parser generalizations sets
|
||||||
specialized-arrays.alien specialized-arrays.direct.alien
|
specialized-arrays.alien specialized-arrays.direct.alien
|
||||||
windows.kernel32 ;
|
windows.kernel32 classes.struct ;
|
||||||
IN: windows.com.wrapper
|
IN: windows.com.wrapper
|
||||||
|
|
||||||
TUPLE: com-wrapper < disposable callbacks vtbls ;
|
TUPLE: com-wrapper < disposable callbacks vtbls ;
|
||||||
|
|
|
@ -25,13 +25,20 @@ unit-test
|
||||||
[ "e" string>number ]
|
[ "e" string>number ]
|
||||||
unit-test
|
unit-test
|
||||||
|
|
||||||
[ 100000 ]
|
[ 100000 ] [ "100,000" string>number ] unit-test
|
||||||
[ "100,000" string>number ]
|
|
||||||
unit-test
|
|
||||||
|
|
||||||
[ 100000.0 ]
|
[ 100000.0 ] [ "100,000.0" string>number ] unit-test
|
||||||
[ "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
|
||||||
|
|
||||||
|
[ 255 ] [ "ff" hex> ] unit-test
|
||||||
|
|
||||||
[ "100.0" ]
|
[ "100.0" ]
|
||||||
[ "1.0e2" string>number number>string ]
|
[ "1.0e2" string>number number>string ]
|
||||||
|
|
|
@ -86,16 +86,27 @@ SYMBOL: negative?
|
||||||
[ CHAR: , eq? not ] filter
|
[ CHAR: , eq? not ] filter
|
||||||
>byte-array 0 suffix (string>float) ;
|
>byte-array 0 suffix (string>float) ;
|
||||||
|
|
||||||
|
: number-char? ( char -- ? )
|
||||||
|
"0123456789ABCDEFabcdef." member? ;
|
||||||
|
|
||||||
|
: numeric-looking? ( str -- ? )
|
||||||
|
"-" ?head drop
|
||||||
|
dup empty? [ drop f ] [
|
||||||
|
dup first number-char? [
|
||||||
|
last number-char?
|
||||||
|
] [ drop f ] if
|
||||||
|
] if ;
|
||||||
|
|
||||||
PRIVATE>
|
PRIVATE>
|
||||||
|
|
||||||
: base> ( str radix -- n/f )
|
: base> ( str radix -- n/f )
|
||||||
over empty? [ 2drop f ] [
|
over numeric-looking? [
|
||||||
over [ "/." member? ] find nip {
|
over [ "/." member? ] find nip {
|
||||||
{ CHAR: / [ string>ratio ] }
|
{ CHAR: / [ string>ratio ] }
|
||||||
{ CHAR: . [ drop string>float ] }
|
{ CHAR: . [ drop string>float ] }
|
||||||
[ drop string>integer ]
|
[ drop string>integer ]
|
||||||
} case
|
} case
|
||||||
] if ;
|
] [ 2drop f ] if ;
|
||||||
|
|
||||||
: string>number ( str -- n/f ) 10 base> ;
|
: string>number ( str -- n/f ) 10 base> ;
|
||||||
: bin> ( str -- n/f ) 2 base> ;
|
: bin> ( str -- n/f ) 2 base> ;
|
||||||
|
|
Loading…
Reference in New Issue