factor/extra/io/serial/serial.factor

23 lines
612 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 )
2008-08-15 00:54:57 -04:00
HOOK: open-serial os ( serial -- stream )
2008-08-15 00:44:39 -04:00
{
2008-08-15 00:54:57 -04:00
{ [ os unix? ] [ "io.serial.unix" ] }
2008-08-15 00:44:39 -04:00
} cond require