]> gitweb.factorcode.org Git - factor.git/blob - extra/io/serial/serial.factor
Merge branch 'master' into experimental
[factor.git] / extra / io / 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: io.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>> number>string
14     "Baud rate " " not supported" surround ;
15
16 HOOK: lookup-baud os ( m -- n )
17 HOOK: open-serial os ( serial -- stream )
18
19 {
20     { [ os unix? ] [ "io.serial.unix" ] } 
21 } cond require