|
@@ -38,7 +38,7 @@ TYPE
|
|
|
END
|
|
|
END Send;
|
|
|
|
|
|
- PROCEDURE Receive*(VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len, res: LONGINT);
|
|
|
+ PROCEDURE Receive*(VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len: LONGINT; VAR res: WORD);
|
|
|
VAR
|
|
|
t, ti: LONGINT;
|
|
|
BEGIN
|
|
@@ -77,7 +77,7 @@ TYPE
|
|
|
|
|
|
|
|
|
(** Any stream input procedure or method. Identical to the definition in Streams.Mod, but I don't want to import that here*)
|
|
|
-TYPE Receiver* = PROCEDURE {DELEGATE} ( VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len, res: LONGINT );
|
|
|
+TYPE Receiver* = PROCEDURE {DELEGATE} ( VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len: LONGINT; VAR res: WORD );
|
|
|
(*makes a decoupled copy of a receiver*)
|
|
|
(*internally it's a pipe that automatically reads the input in a continuous loop*)
|
|
|
TYPE ReadDecoupler*= OBJECT
|
|
@@ -86,7 +86,8 @@ TYPE ReadDecoupler*= OBJECT
|
|
|
inputReceiver: Receiver;
|
|
|
numR: LONGINT;
|
|
|
smallbuf: ARRAY[128] OF CHAR;
|
|
|
- len,res: LONGINT;
|
|
|
+ len: LONGINT;
|
|
|
+ res: WORD;
|
|
|
|
|
|
PROCEDURE &InitReadDecoupler*(inputReceiver: Receiver);
|
|
|
BEGIN
|
|
@@ -94,7 +95,7 @@ TYPE ReadDecoupler*= OBJECT
|
|
|
SELF.inputReceiver:=inputReceiver;
|
|
|
END InitReadDecoupler;
|
|
|
|
|
|
- PROCEDURE Receive*(VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len, res: LONGINT);
|
|
|
+ PROCEDURE Receive*(VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len: LONGINT; VAR res: WORD);
|
|
|
BEGIN
|
|
|
pipe.Receive(buf,ofs,size,min,len,res);
|
|
|
END Receive;
|
|
@@ -103,16 +104,11 @@ BEGIN{ACTIVE}
|
|
|
|
|
|
LOOP
|
|
|
(*todo: check res, if inputReceiver throws anything but 'OK' exit the loop*)
|
|
|
- inputReceiver(smallbuf, 0, 128, 1, len,res); (*read at least 1 byte into the small buffer*)
|
|
|
- pipe.Send(smallbuf, 0, len, FALSE, res); (*feed the amount read (usually 1 entire line) into the pipe to cross threads*)
|
|
|
+ inputReceiver(smallbuf, 0, 128, 1, len, res); (*read at least 1 byte into the small buffer*)
|
|
|
+ pipe.Send(smallbuf, 0, len, FALSE, res); (*feed the amount read (usually 1 entire line) into the pipe to cross threads*)
|
|
|
END;
|
|
|
END ReadDecoupler;
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
END Pipes.
|
|
|
|
|
|
(*
|