move serial to io.serial

db4
Doug Coleman 2009-02-22 17:50:29 -06:00
parent 0ccb04e50f
commit 378c8f90ff
21 changed files with 21 additions and 26 deletions

View File

@ -3,22 +3,21 @@
USING: accessors alien.c-types assocs combinators destructors USING: accessors alien.c-types assocs combinators destructors
kernel math math.bitwise math.parser sequences summary system kernel math math.bitwise math.parser sequences summary system
vocabs.loader ; vocabs.loader ;
IN: serial IN: io.serial
TUPLE: serial stream path baud TUPLE: serial stream path baud
termios iflag oflag cflag lflag ; termios iflag oflag cflag lflag ;
ERROR: invalid-baud baud ; ERROR: invalid-baud baud ;
M: invalid-baud summary ( invalid-baud -- string ) M: invalid-baud summary ( invalid-baud -- string )
"Baud rate " baud>> number>string
swap baud>> number>string "Baud rate " " not supported" surround ;
" not supported" 3append ;
HOOK: lookup-baud os ( m -- n ) HOOK: lookup-baud os ( m -- n )
HOOK: open-serial os ( serial -- serial' ) HOOK: open-serial os ( serial -- serial' )
M: serial dispose ( serial -- ) stream>> dispose ; M: serial dispose ( serial -- ) stream>> dispose ;
{ {
{ [ os unix? ] [ "serial.unix" ] } { [ os unix? ] [ "io.serial.unix" ] }
{ [ os windows? ] [ "serial.windows" ] } { [ os windows? ] [ "io.serial.windows" ] }
} cond require } cond require

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel math.bitwise sequences system serial ; USING: alien.syntax kernel math.bitwise sequences system io.serial ;
IN: serial.unix IN: io.serial.unix
M: bsd lookup-baud ( m -- n ) M: bsd lookup-baud ( m -- n )
dup { dup {

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: assocs alien.syntax kernel serial system unix ; USING: assocs alien.syntax kernel io.serial system unix ;
IN: serial.unix IN: io.serial.unix
CONSTANT: TCSANOW 0 CONSTANT: TCSANOW 0
CONSTANT: TCSADRAIN 1 CONSTANT: TCSADRAIN 1

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel sequences system ; USING: alien.syntax kernel sequences system ;
IN: serial.unix.termios IN: io.serial.unix.termios
CONSTANT: NCCS 20 CONSTANT: NCCS 20

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.syntax kernel system unix ; USING: alien.syntax kernel system unix ;
IN: serial.unix.termios IN: io.serial.unix.termios
CONSTANT: NCCS 32 CONSTANT: NCCS 32

View File

@ -1,9 +1,9 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: combinators system vocabs.loader ; USING: combinators system vocabs.loader ;
IN: serial.unix.termios IN: io.serial.unix.termios
{ {
{ [ os linux? ] [ "serial.unix.termios.linux" ] } { [ os linux? ] [ "io.serial.unix.termios.linux" ] }
{ [ os bsd? ] [ "serial.unix.termios.bsd" ] } { [ os bsd? ] [ "io.serial.unix.termios.bsd" ] }
} cond require } cond require

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors kernel math.bitwise serial serial.unix ; USING: accessors kernel math.bitwise io.serial io.serial.unix ;
IN: serial.unix IN: io.serial.unix
: serial-obj ( -- obj ) : serial-obj ( -- obj )
serial new serial new

View File

@ -2,12 +2,12 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.syntax combinators io.ports USING: accessors alien.c-types alien.syntax combinators io.ports
io.streams.duplex system kernel math math.bitwise io.streams.duplex system kernel math math.bitwise
vocabs.loader unix serial serial.unix.termios io.backend.unix ; vocabs.loader unix io.serial io.serial.unix.termios io.backend.unix ;
IN: serial.unix IN: io.serial.unix
<< { << {
{ [ os linux? ] [ "serial.unix.linux" ] } { [ os linux? ] [ "io.serial.unix.linux" ] }
{ [ os bsd? ] [ "serial.unix.bsd" ] } { [ os bsd? ] [ "io.serial.unix.bsd" ] }
} cond require >> } cond require >>
FUNCTION: speed_t cfgetispeed ( termios* t ) ; FUNCTION: speed_t cfgetispeed ( termios* t ) ;

View File

@ -3,7 +3,7 @@
USING: io.files.windows io.streams.duplex kernel math USING: io.files.windows io.streams.duplex kernel math
math.bitwise windows.kernel32 accessors alien.c-types math.bitwise windows.kernel32 accessors alien.c-types
windows io.files.windows fry locals continuations ; windows io.files.windows fry locals continuations ;
IN: serial.windows IN: io.serial.windows
: <serial-stream> ( path encoding -- duplex ) : <serial-stream> ( path encoding -- duplex )
[ open-r/w dup ] dip <encoder-duplex> ; [ open-r/w dup ] dip <encoder-duplex> ;

View File

@ -1,4 +0,0 @@
! Copyright (C) 2009 Your name.
! See http://factorcode.org/license.txt for BSD license.
USING: tools.test serial.windows ;
IN: serial.windows.tests