|##########|
|#MAGIC   #|CKOLFLJM
|#PROJECT #|""
|#PATHS   #|"StdProject"
|#FLAGS   #|xx---x--x----xx-----------------
|#USERSW  #|--------------------------------
|#USERMASK#|--------------------------------
|#SWITCHES#|x----xxxxx-xx---
|##########|
DEFINITION MODULE OPipes;

FROM OStreams   IMPORT InStream,OutStream,EOF;
FROM OThreads   IMPORT Semaphore,Signal;

TYPE
  Pipe        = POINTER TO OBJECT OF InStream,OutStream; END;
  StaticPipe  = POINTER TO OBJECT OF Pipe,Signal AS full,
                                          Signal AS empty;
                  buffer : CLASSPTR TO ARRAY OF CHAR;
                  in,out : INTEGER;
                  eof    : BOOLEAN;
                  CONSTRUCTOR Create(size : INTEGER := 256);
                  DESTRUCTOR Delete;
                  METHOD PutEOF;
                  METHOD ReadChar():CHAR;
                  METHOD WriteChar(c : CHAR);
                  METHOD Destruct;
                END;

  BuffPtr     = HIDDEN;
  DynamicPipe = POINTER TO OBJECT OF Pipe,Signal AS empty;
                  inbuffer,
                  outbuffer : BuffPtr;
                  in,out    : INTEGER;
                  eof       : BOOLEAN;
                  CONSTRUCTOR Create;
                  DESTRUCTOR Delete;
                  METHOD PutEOF;
                  METHOD ReadChar():CHAR;
                  METHOD WriteChar(c : CHAR);
                  METHOD Destruct;
                END;

END OPipes.

