(* buffer.sig *) (* CML buffers with adjustable maximum lengths *) signature BUFFER = sig (* a buffer whose elmements come from type 'a *) type 'a buffer exception Size (* create a buffer with a given maximum length; raises Size if the length is not positive *) val make : int -> 'a buffer (* addEvt buf x returns an event that, when synchronized with, will cause x to be added to the end of buf, and will yield () *) val addEvt : 'a buffer -> 'a -> unit CML.event (* delEvt buf returns an event that, when synchronized with, with remove the first element from buf, and will yield this element *) val delEvt : 'a buffer -> 'a CML.event (* lenEvt buf returns an event that, when synchronized with, will yield the current length of buf *) val lenEvt : 'a buffer -> int CML.event (* newMaxLenEvt buf n returns an event, that when synchronized with, will attempt to set the maximum length of buf to n this attempt will succeed, resulting in the value true, if the current length of buf is no more than n this attempt will fail, resulting in the value false, if the current length of buf is strictly greater than n *) val newMaxLenEvt : 'a buffer -> int -> bool CML.event end;