1 ! Copyright (C) 2008 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien.c-types assocs combinators destructors
4 kernel math math.bitwise math.parser sequences summary system
8 TUPLE: serial stream path baud
9 termios iflag oflag cflag lflag ;
11 ERROR: invalid-baud baud ;
12 M: invalid-baud summary ( invalid-baud -- string )
14 swap baud>> number>string
15 " not supported" 3append ;
17 HOOK: lookup-baud os ( m -- n )
18 HOOK: open-serial os ( serial -- serial' )
19 M: serial dispose ( serial -- ) stream>> dispose ;
22 { [ os unix? ] [ "serial.unix" ] }
23 { [ os windows? ] [ "serial.windows" ] }