]> gitweb.factorcode.org Git - factor.git/blob - extra/serial/serial.factor
Fixing basis -> extra dependencies
[factor.git] / extra / serial / serial.factor
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
5 vocabs.loader ;
6 IN: serial
7
8 TUPLE: serial stream path baud 
9     termios iflag oflag cflag lflag ;
10
11 ERROR: invalid-baud baud ;
12 M: invalid-baud summary ( invalid-baud -- string )
13     "Baud rate "
14     swap baud>> number>string
15     " not supported" 3append ;
16
17 HOOK: lookup-baud os ( m -- n )
18 HOOK: open-serial os ( serial -- serial' )
19 M: serial dispose ( serial -- ) stream>> dispose ;
20
21 {
22     { [ os unix? ] [ "serial.unix" ] } 
23 } cond require