wean extra/ vocabs off <c-array>
parent
02d924f1a5
commit
72bb3e144f
|
|
@ -1,14 +1,15 @@
|
||||||
! Copyright (C) 2008 Doug Coleman.
|
! Copyright (C) 2008 Doug Coleman.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: unix alien alien.c-types kernel math sequences strings
|
USING: unix alien alien.c-types kernel math sequences strings
|
||||||
io.backend.unix splitting io.encodings.utf8 io.encodings.string ;
|
io.backend.unix splitting io.encodings.utf8 io.encodings.string
|
||||||
|
specialized-arrays.char ;
|
||||||
IN: system-info.linux
|
IN: system-info.linux
|
||||||
|
|
||||||
: (uname) ( buf -- int )
|
: (uname) ( buf -- int )
|
||||||
"int" f "uname" { "char*" } alien-invoke ;
|
"int" f "uname" { "char*" } alien-invoke ;
|
||||||
|
|
||||||
: uname ( -- seq )
|
: uname ( -- seq )
|
||||||
65536 "char" <c-array> [ (uname) io-error ] keep
|
65536 <char-array> [ (uname) io-error ] keep
|
||||||
"\0" split harvest [ utf8 decode ] map
|
"\0" split harvest [ utf8 decode ] map
|
||||||
6 "" pad-tail ;
|
6 "" pad-tail ;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
USING: alien alien.c-types classes.struct accessors kernel
|
USING: alien alien.c-types classes.struct accessors kernel
|
||||||
math namespaces windows windows.kernel32 windows.advapi32 words
|
math namespaces windows windows.kernel32 windows.advapi32 words
|
||||||
combinators vocabs.loader system-info.backend system
|
combinators vocabs.loader system-info.backend system
|
||||||
alien.strings windows.errors ;
|
alien.strings windows.errors specialized-arrays.ushort ;
|
||||||
IN: system-info.windows
|
IN: system-info.windows
|
||||||
|
|
||||||
: system-info ( -- SYSTEM_INFO )
|
: system-info ( -- SYSTEM_INFO )
|
||||||
|
|
@ -49,11 +49,8 @@ IN: system-info.windows
|
||||||
: sse3? ( -- ? )
|
: sse3? ( -- ? )
|
||||||
PF_SSE3_INSTRUCTIONS_AVAILABLE feature-present? ;
|
PF_SSE3_INSTRUCTIONS_AVAILABLE feature-present? ;
|
||||||
|
|
||||||
: <u16-string-object> ( n -- obj )
|
|
||||||
"ushort" <c-array> ;
|
|
||||||
|
|
||||||
: get-directory ( word -- str )
|
: get-directory ( word -- str )
|
||||||
[ MAX_UNICODE_PATH [ <u16-string-object> ] keep dupd ] dip
|
[ MAX_UNICODE_PATH [ <ushort-array> ] keep dupd ] dip
|
||||||
execute win32-error=0/f alien>native-string ; inline
|
execute win32-error=0/f alien>native-string ; inline
|
||||||
|
|
||||||
: windows-directory ( -- str )
|
: windows-directory ( -- str )
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue