From 0eadbd0b114dc45e829c9004dc117fcea6275491 Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Tue, 25 Mar 2008 11:37:02 +0000 Subject: [PATCH] Added support for occam's flush (sending 255) and moved some of the unreachable flush commands in the C++ support headers --- support/tock_support_cppcsp.h | 13 ++++++++++--- testcases/echo.occ | 1 + 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/support/tock_support_cppcsp.h b/support/tock_support_cppcsp.h index 361d786..a5cc48d 100644 --- a/support/tock_support_cppcsp.h +++ b/support/tock_support_cppcsp.h @@ -93,12 +93,12 @@ protected: in >> c; out << c; } - out.flush(); } catch (csp::PoisonException& e) { in.poison(); } + out.flush(); } public: inline StreamWriter(std::ostream& _out,const csp::Chanin& _in) @@ -225,14 +225,21 @@ protected: { tockSendableArrayOfBytes aob(1,&c); in >> aob; - out << c; + if (c == 255) + { + out.flush(); + } + else + { + out << c; + } } - out.flush(); } catch (csp::PoisonException& e) { in.poison(); } + out.flush(); } public: inline StreamWriterByteArray(std::ostream& _out,const csp::Chanin& _in) diff --git a/testcases/echo.occ b/testcases/echo.occ index 3b1a32d..2cb9576 100644 --- a/testcases/echo.occ +++ b/testcases/echo.occ @@ -5,4 +5,5 @@ PROC echo(CHAN BYTE in, out) in ? c out ! c out ! c + out ! 255 :