wean extra/ vocabs off <c-array>

db4
Joe Groff 2009-08-31 09:54:35 -05:00
parent 02d924f1a5
commit 72bb3e144f
2 changed files with 5 additions and 7 deletions

View File

@ -1,14 +1,15 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
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
: (uname) ( buf -- int )
"int" f "uname" { "char*" } alien-invoke ;
: uname ( -- seq )
65536 "char" <c-array> [ (uname) io-error ] keep
65536 <char-array> [ (uname) io-error ] keep
"\0" split harvest [ utf8 decode ] map
6 "" pad-tail ;

View File

@ -3,7 +3,7 @@
USING: alien alien.c-types classes.struct accessors kernel
math namespaces windows windows.kernel32 windows.advapi32 words
combinators vocabs.loader system-info.backend system
alien.strings windows.errors ;
alien.strings windows.errors specialized-arrays.ushort ;
IN: system-info.windows
: system-info ( -- SYSTEM_INFO )
@ -49,11 +49,8 @@ IN: system-info.windows
: sse3? ( -- ? )
PF_SSE3_INSTRUCTIONS_AVAILABLE feature-present? ;
: <u16-string-object> ( n -- obj )
"ushort" <c-array> ;
: 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
: windows-directory ( -- str )