aboutsummaryrefslogtreecommitdiffhomepage
path: root/System
diff options
context:
space:
mode:
authorGravatar Herbert Valerio Riedel <hvr@gnu.org>2015-11-16 19:03:12 +0100
committerGravatar Herbert Valerio Riedel <hvr@gnu.org>2015-11-16 19:08:12 +0100
commit33920fe3e0477cef1beda59d0ea47f4344be8d26 (patch)
treec27188b7fbeaf532bc6ff94abead7274dbe8e88f /System
parentcd061c04b9239fcc68c43ed439331e1a41e5e22a (diff)
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
Diffstat (limited to 'System')
-rw-r--r--System/Posix/Terminal/Common.hsc12
1 files changed, 12 insertions, 0 deletions
diff --git a/System/Posix/Terminal/Common.hsc b/System/Posix/Terminal/Common.hsc
index 2f6327a..49418f5 100644
--- a/System/Posix/Terminal/Common.hsc
+++ b/System/Posix/Terminal/Common.hsc
@@ -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