Commit 33920fe3 authored by Herbert Valerio Riedel's avatar Herbert Valerio Riedel 🕺
Browse files

Don't assume existence of termios constants beyond `B38400`

This patch does not modify the `BaudRate` structure but rather causes
some functions taking a `BaudRate` to throw exceptions on systems which
don't provide `B57600` and/or `B115200`. I'm not totally happy with this
patch yet, but this unbreaks compilation on platforms which don't define
at least of these constants.

This fixes #51
parent cd061c04
......@@ -527,8 +527,16 @@ baud2Word B4800 = (#const B4800)
baud2Word B9600 = (#const B9600)
baud2Word B19200 = (#const B19200)
baud2Word B38400 = (#const B38400)
#ifdef B57600
baud2Word B57600 = (#const B57600)
#else
baud2Word B57600 = error "B57600 not available on this system"
#endif
#ifdef B115200
baud2Word B115200 = (#const B115200)
#else
baud2Word B115200 = error "B115200 not available on this system"
#endif
-- And convert a word back to a baud rate
-- We really need some cpp macros here.
......@@ -551,8 +559,12 @@ word2Baud x =
else if x == (#const B9600) then B9600
else if x == (#const B19200) then B19200
else if x == (#const B38400) then B38400
#ifdef B57600
else if x == (#const B57600) then B57600
#endif
#ifdef B115200
else if x == (#const B115200) then B115200
#endif
else error "unknown baud rate"
-- Clear termios i_flag
......
......@@ -4,6 +4,8 @@
* Don't assume non-POSIX `WCOREDUMP(x)` macro exists
* Don't assume existence of termios constants beyond `B38400`
## 2.7.1.0 *Dec 2014*
* Bundled with GHC 7.10.1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment