[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

occam: out ! 0 :: "" semantics



-- In a "ByteStream.PROTOCOL.Tokenizer" I've written to marshal
-- bytes on the socket stream I/O, I came upon this problem of
-- what to do when a counted array has zero bytes "to send" off.
-- In SPoC it seems to do a synchronization and an OUTPUT/INPUT
-- pair of len zero in the case, and no memcpy.

-- Obviously we can't send zero bytes over a network, but inside
-- the SPoC runtime system it's ok to say "here is your zero bytes"
-- as long as both parts adher to the same protocol.
--
-- What does KRoC do?

PROTOCOL Envelope IS INT :: []BYTE:

PROC Producer (CHAN OF Envelope out)
  out ! 0 :: ""
:
PROC Consumer (CHAN OF Envelope in)
  INT len:
  [100]BYTE data:
  in ? len :: data
:

CHAN OF Envelope chan:
PAR
  Producer(chan)
  Consumer(chan)

-- 
Oyvind
(------------------------------------------------------------------(
)       Oyvind Teig )          oyvind.teig@xxxxxxxxxxxx ) Tel: +47 )
( Navia Maritime AS (          oyvind.teig@xxxxxxxxxxxx ( 73581268 (
)    div. Autronica )                                   ) Fax: +47 )
(    7005 Trondheim (           http://www.autronica.no ( 73581001 (
)            Norway )                                   )          )
(------------------------------------------------------------------(
) 4May2000:Part of world's largest company in maritime electronics )
( http://www.kongsberg.com/        http://www.kongsberg-gruppen.no (
(------------------------------------------------------------------(
)                    http://www.autronica.no/pub/tech/rd/index.htm )
(------------------------------------------------------------------(