factor/extra/io/serial/serial.factor

24 lines
661 B
Factor
Raw Normal View History

2008-08-15 00:44:39 -04:00
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types assocs combinators destructors
kernel math math.bitfields math.parser sequences summary system
vocabs.loader ;
IN: io.serial
TUPLE: serial stream path baud
termios iflag oflag cflag lflag ;
ERROR: invalid-baud baud ;
M: invalid-baud summary ( invalid-baud -- string )
"Baud rate "
swap baud>> number>string
" not supported" 3append ;
HOOK: lookup-baud os ( m -- n )
HOOK: open-serial os ( serial -- serial' )
M: serial dispose ( serial -- ) stream>> dispose ;
{
{ [ os unix? ] [ "serial.unix" ] }
} cond require