From c5e3bdf66842e54e3a791eb2f28d3d0eb6832956 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 13 Aug 2008 21:51:25 -0500 Subject: [PATCH] add constants for bsd serial --- extra/serial/unix/bsd/bsd.factor | 15 ++++++++++++++- extra/serial/unix/termios/bsd/bsd.factor | 2 +- extra/serial/unix/unix.factor | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/extra/serial/unix/bsd/bsd.factor b/extra/serial/unix/bsd/bsd.factor index 68aaa03a23..7dac47193a 100644 --- a/extra/serial/unix/bsd/bsd.factor +++ b/extra/serial/unix/bsd/bsd.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel sequences system serial ; +USING: alien.syntax kernel sequences system serial ; IN: serial.unix M: bsd lookup-baud ( m -- n ) @@ -9,3 +9,16 @@ M: bsd lookup-baud ( m -- n ) 7200 9600 14400 19200 28800 38400 57600 76800 115200 230400 460800 921600 } member? [ invalid-baud ] unless ; + +: TCSANOW 0 ; inline +: TCSADRAIN 1 ; inline +: TCSAFLUSH 2 ; inline +: TCSASOFT HEX: 10 ; inline + +: TCIFLUSH 1 ; inline +: TCOFLUSH 2 ; inline +: TCIOFLUSH 3 ; inline +: TCOOFF 1 ; inline +: TCOON 2 ; inline +: TCIOFF 3 ; inline +: TCION 4 ; inline diff --git a/extra/serial/unix/termios/bsd/bsd.factor b/extra/serial/unix/termios/bsd/bsd.factor index c8f1e8be54..5fbc571519 100644 --- a/extra/serial/unix/termios/bsd/bsd.factor +++ b/extra/serial/unix/termios/bsd/bsd.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: kernel sequences system ; +USING: alien.syntax kernel sequences system ; IN: serial.unix.termios : NCCS 20 ; inline diff --git a/extra/serial/unix/unix.factor b/extra/serial/unix/unix.factor index 6b48c758cc..7ed5bced37 100644 --- a/extra/serial/unix/unix.factor +++ b/extra/serial/unix/unix.factor @@ -5,10 +5,10 @@ io.streams.duplex io.unix.backend system kernel math math.bitfields vocabs.loader unix serial serial.unix.termios ; IN: serial.unix -{ +<< { { [ os linux? ] [ "serial.unix.linux" ] } { [ os bsd? ] [ "serial.unix.bsd" ] } -} cond require +} cond require >> FUNCTION: speed_t cfgetispeed ( termios* t ) ; FUNCTION: speed_t cfgetospeed ( termios* t ) ;