Pārlūkot izejas kodu

use WORD instead of LONGINT for result type

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8452 8c9fc860-2736-0410-a75d-ab315db34111
eth.metacore 6 gadi atpakaļ
vecāks
revīzija
1cc2171176
4 mainītis faili ar 10 papildinājumiem un 14 dzēšanām
  1. 1 1
      source/Commands.Mod
  2. 7 11
      source/Pipes.Mod
  3. 1 1
      source/Strings.Mod
  4. 1 1
      source/Windows.WinTrace.Mod

+ 1 - 1
source/Commands.Mod

@@ -58,7 +58,7 @@ TYPE
 			tracedPos := pos0;
 		END Init;
 
-		PROCEDURE Receiver(VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len, res: LONGINT);
+		PROCEDURE Receiver(VAR buf: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len: LONGINT; VAR res: WORD);
 		VAR inReader: Streams.Reader;nextPos: LONGINT;
 		BEGIN
 			inReader := in;

+ 7 - 11
source/Pipes.Mod

@@ -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.
 
 (*

+ 1 - 1
source/Strings.Mod

@@ -666,7 +666,7 @@ BEGIN
 END IntToHexStr;
 
 (** converts a hex string to an integer. Leading whitespace is ignored. res=Ok indicates success, val=0 on failure. *)
-PROCEDURE HexStrToInt*(CONST string: ARRAY OF CHAR; VAR val, res: LONGINT);
+PROCEDURE HexStrToInt*(CONST string: ARRAY OF CHAR; VAR val: LONGINT; VAR res: WORD);
 VAR length, i : LONGINT; ch: CHAR; negative : BOOLEAN;
 BEGIN
 	length := LEN(string); val := 0; res := -1;

+ 1 - 1
source/Windows.WinTrace.Mod

@@ -32,7 +32,7 @@ END SendError;
 
 
 (* Receiver to be used with Stream.Reader *)
-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 b: Kernel32.BOOL; tlen: LONGINT;
 BEGIN
 	len := 0;