Explorar o código

yet more result type

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8457 8c9fc860-2736-0410-a75d-ab315db34111
eth.metacore %!s(int64=6) %!d(string=hai) anos
pai
achega
2d88ad36ba

+ 1 - 1
source/PC.Mod

@@ -313,7 +313,7 @@ END CompileInterface;
 PROCEDURE CompileFile*(CONST name, opt: ARRAY OF CHAR; pc: LONGINT; log: Streams.Writer;
 	diagnostics : Diagnostics.Diagnostics; VAR error: BOOLEAN);
 VAR
-	atu: Texts.Text; format, res: LONGINT;
+	atu: Texts.Text; format: LONGINT; res: WORD;
 BEGIN
 	NEW(atu);
 	TextUtilities.LoadAuto(atu, name, format, res);

+ 1 - 1
source/PCAAMD64.Mod

@@ -1917,7 +1917,7 @@ END AssembleText;
 
 PROCEDURE AssembleFile* (CONST fileName: ARRAY OF CHAR; diagnostics: Diagnostics.Diagnostics; labels, listing: Streams.Writer);
 VAR
-	format, res: LONGINT;
+	format: LONGINT; res: WORD;
 	text: Texts.Text;
 	assembly: Assembly;
 	destFile: ARRAY Files.NameLength OF CHAR;

+ 1 - 1
source/PCOFPE.Mod

@@ -120,7 +120,7 @@ MODULE PCOFPE; (** AUTHOR "ejz"; PURPOSE "Parallel Compiler: PE object file plug
 		SectionReader = OBJECT (Streams.Reader)
 			VAR sect: Section; org, ofs: LONGINT;
 
-			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
 				len := sect.used - SELF.ofs;
 				IF len > 0 THEN

+ 1 - 1
source/PNGDecoder.Mod

@@ -40,7 +40,7 @@ TYPE
 			remain := firstChunk;
 		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 i, crc, tag: LONGINT; ch: CHAR;
 		BEGIN
 			IF ~eof THEN

+ 1 - 1
source/RAWPrinter.Mod

@@ -32,7 +32,7 @@ MODULE RAWPrinter; (** AUTHOR "dk"; PURPOSE "Printing Raw to Port 9100"; *)
 			buf : ARRAY 10000 OF CHAR;
 			conn : TCP.Connection;
 			fadr: IP.Adr;
-			connres, len : LONGINT;
+			connres: WORD; len : LONGINT;
 	BEGIN
 		 DNS.HostByName(printer, fadr, connres);
 		IF res = DNS.Ok THEN

+ 4 - 4
source/Repositories.Mod

@@ -615,7 +615,7 @@ TYPE
 		END InitializeLanguages;
 
 		PROCEDURE Find(CONST language : Localization.Language) : Translator;
-		VAR t : Translator; res, i : LONGINT;
+		VAR t : Translator; res: WORD; i : LONGINT;
 		BEGIN
 			t := NIL;
 			IF (languages # NIL) THEN
@@ -640,7 +640,7 @@ TYPE
 		END Find;
 
 		PROCEDURE GetDefaultTranslator() : Translator;
-		VAR t : Translator; i, res : LONGINT;
+		VAR t : Translator; i: LONGINT; res : WORD;
 		BEGIN
 			t := NIL;
 			IF (languages # NIL) THEN
@@ -2169,12 +2169,12 @@ BEGIN
 END DumpAll;
 
 PROCEDURE Call*(context : Commands.Context); (** moduleName.procedureName [params] ~ *)
-VAR c : Context; cmdString : POINTER TO ARRAY OF CHAR; res : WORD;
+VAR c : Context; cmdString : POINTER TO ARRAY OF CHAR; res : WORD; ignore: LONGINT;
 BEGIN
 	NEW(c,	NIL, NIL, context.out, context.error, context.caller);
 	IF (context.arg.Available() > 0) THEN
 		NEW(cmdString, context.arg.Available());
-		context.arg.Bytes(cmdString^, 0, LEN(cmdString), res);
+		context.arg.Bytes(cmdString^, 0, LEN(cmdString), ignore);
 		CallCommand(cmdString^, c, res);
 		context.out.String("res: "); context.out.Int(res, 0); context.out.Ln;
 		context.out.String("c.res: "); context.out.Int(c.result, 0); context.out.Ln;

+ 2 - 2
source/Serials.Mod

@@ -90,7 +90,7 @@ TYPE
 
 		(** Receive size characters into buf, starting at ofs and return the effective number of bytes read in len.
 			Wait until at least min bytes (possibly zero) are available. res is non-zero on error. *)
-		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 ch: CHAR;
 		BEGIN
 			len := 0;
@@ -362,7 +362,7 @@ END GetPortParameters;
 *)
 PROCEDURE SetTrace*(context: Commands.Context);
 VAR
-	portNumber, bps, data, parity, stop, res: LONGINT; params: SET;
+	portNumber, bps, data, parity, stop: LONGINT; res: WORD; params: SET;
 BEGIN
 	GetPortParameters(context.arg, portNumber, bps, data, parity, stop, params, res);
 	IF (portNumber > 0) & (res # 0) THEN

+ 2 - 2
source/SerialsVirtual.Mod

@@ -284,7 +284,7 @@ BEGIN
 	KernelLog.String(ModuleName); KernelLog.String(": ");
 END ShowModule;
 
-PROCEDURE GetSlowdownValues(bps : LONGINT; VAR eachNCharacters, waitForMs, res : LONGINT);
+PROCEDURE GetSlowdownValues(bps : LONGINT; VAR eachNCharacters, waitForMs: LONGINT; VAR res : WORD);
 BEGIN
 	res := Serials.Ok;
 	waitForMs := 1;
@@ -315,7 +315,7 @@ PROCEDURE SendFileIntern(portNbr : LONGINT; CONST filename : ARRAY OF CHAR; loop
 VAR
 	port : Serials.Port;
 	file : Files.File;
-	len, res : LONGINT;
+	len: LONGINT; res : WORD;
 	in : Files.Reader; out : Streams.Writer;
 	buffer : ARRAY BufferSize OF CHAR;
 BEGIN

+ 2 - 2
source/Shell.Mod

@@ -278,7 +278,7 @@ TYPE
 			RETURN ch;
 		END ReadCommand;
 
-		PROCEDURE Parse(VAR cmd: Command; VAR wait: BOOLEAN): LONGINT;
+		PROCEDURE Parse(VAR cmd: Command; VAR wait: BOOLEAN): WORD;
 		VAR sym: SET; pos: LONGINT; c, next: CHAR;
 
 			PROCEDURE Init;
@@ -343,7 +343,7 @@ TYPE
 				RETURN cmd
 			END Cmd;
 
-			PROCEDURE CmdLine(VAR command: Command): LONGINT;
+			PROCEDURE CmdLine(VAR command: Command): WORD;
 			VAR cmd, prev: Command; fn: Files.FileName; f: Files.File; fr: Files.Reader; fw: Files.Writer;
 				r: Streams.Reader; w: Streams.Writer; append, piped: BOOLEAN; s: ARRAY 64 OF CHAR;
 			BEGIN

+ 3 - 3
source/ShellSerial.Mod

@@ -45,7 +45,7 @@ PROCEDURE ModemReceive(context : Commands.Context; modemMode: LONGINT); (** [[fi
 VAR
 	fileName : Files.FileName;
 	length: LONGINT;
-	port : Serials.Port; portNbr, bps, data, parity, stop, res : LONGINT;
+	port : Serials.Port; portNbr, bps, data, parity, stop: LONGINT; res : WORD;
 	isOpen0 : BOOLEAN;
 	bps0, data0, parity0, stop0 : LONGINT;
 	w : Streams.Writer; r : Streams.Reader;
@@ -185,7 +185,7 @@ END Wait;
 (** Open a shell listening on the specified <portNbr> *)
 PROCEDURE Open*(context : Commands.Context); (** [portNbr BitsPerSecond DataBits Parity StopBits Prompt] ~ *)
 VAR
-	port : Serials.Port; portNbr, bps, data, parity, stop, res : LONGINT;
+	port : Serials.Port; portNbr, bps, data, parity, stop: LONGINT; res : WORD;
 	prompt: ARRAY 32 OF CHAR;
 	w : Streams.Writer; r : Streams.Reader;
 	params: SET;
@@ -226,7 +226,7 @@ END Open;
 PROCEDURE Cleanup;
 VAR
 	port : Serials.Port;
-	i, res : LONGINT;
+	i: LONGINT; res : WORD;
 	isOpen0, isTracePort : BOOLEAN;
 	bps0, data0, parity0, stop0 : LONGINT;
 BEGIN

+ 3 - 3
source/System.Mod

@@ -399,7 +399,7 @@ PROCEDURE RenameExtension*(context : Commands.Context);
 VAR
 	enumerator : Files.Enumerator;
 	oe, ne, temp: ARRAY 16 OF CHAR;
-	name, file, ext : Files.FileName; flags : SET; time, date, size, res : LONGINT;
+	name, file, ext : Files.FileName; flags : SET; time, date, size: LONGINT; res : WORD;
 BEGIN
 	context.arg.SkipWhitespace; context.arg.String(oe);
 	context.arg.SkipWhitespace; context.arg.String(ne);
@@ -468,7 +468,7 @@ VAR
 	command, parameters, paramString : Strings.String;
 	temp : Strings.String;
 	msg : ARRAY 128 OF CHAR;
-	cur, available, i, j, k, res : LONGINT;
+	cur, available, i, j, k: LONGINT; res: WORD;
 
 	PROCEDURE CreateContext(paramString : Strings.String) : Commands.Context;
 	VAR c : Commands.Context; arg : Streams.StringReader; dummy : ARRAY 1 OF CHAR;
@@ -604,7 +604,7 @@ PROCEDURE Repeat*(context : Commands.Context); (* nofTimes command [command para
 VAR
 	command, msg : ARRAY 128 OF CHAR;
 	parameterPosition : LONGINT;
-	nofTimes, res : LONGINT;
+	nofTimes: LONGINT; res : WORD;
 BEGIN
 	nofTimes := 0; command := "";
 	context.arg.SkipWhitespace;	context.arg.Int(nofTimes, FALSE);

+ 4 - 4
source/TLS.Mod

@@ -754,7 +754,7 @@ TYPE
 		END Send;
 
 		(** Receive secured data *)
-		PROCEDURE Receive*( VAR data: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len, res: LONGINT );
+		PROCEDURE Receive*( VAR data: ARRAY OF CHAR; ofs, size, min: LONGINT; VAR len: LONGINT; VAR res: WORD);
 		BEGIN
 			applicationDataPipe.Receive(data, ofs, size, min, len ,res);
 		END Receive;
@@ -1197,7 +1197,7 @@ TYPE
 
 		PROCEDURE ReceiveClientHello( VAR data: ARRAY OF CHAR; ofs, len: LONGINT ): LONGINT;
 			VAR
-				nofSuites, i, idLen, idPos, pos, cipherSuite, major, minor, res: LONGINT;
+				nofSuites, i, idLen, idPos, pos, cipherSuite, major, minor: LONGINT; res: WORD;
 		BEGIN
 			IF Trace THEN PrintDirection(FALSE); KernelLog.String("ClientHello");KernelLog.Ln END;
 			pos := ofs;
@@ -1326,7 +1326,7 @@ TYPE
 		END SendClientHello;
 
 		PROCEDURE ReceiveV2ClientHello( VAR data: ARRAY OF CHAR; ofs, len: LONGINT ): LONGINT;
-			VAR nofSuites, idLen, challengeLen, i, cipherSuite, res: LONGINT;
+			VAR nofSuites, idLen, challengeLen, i, cipherSuite: LONGINT; res: WORD;
 		BEGIN
 			IF Trace THEN PrintDirection(FALSE); KernelLog.String("SSLv2.0 ClientHello");KernelLog.Ln END;
 			nofSuites := ( 256 * ORD(data[ofs+3]) + ORD(data[ofs+4]) ) DIV 3;
@@ -1382,7 +1382,7 @@ TYPE
 
 		PROCEDURE ReceiveServerHello(VAR data: ARRAY OF CHAR; ofs, len: LONGINT): LONGINT;
 		VAR
-			pos, major, minor, i, idLen, idPos, cipherSuite, res: LONGINT;
+			pos, major, minor, i, idLen, idPos, cipherSuite: LONGINT; res: WORD;
 		BEGIN
 			IF Trace THEN PrintDirection(FALSE); KernelLog.String("ServerHello");KernelLog.Ln END;
 			pos := ofs;

+ 1 - 1
source/Tar.Mod

@@ -117,7 +117,7 @@ TYPE
 			SELF.input := input; SELF.max := size; SELF.archive := archive
 		END Init;
 
-		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
 			IF max = 0 THEN
 				res := -1;

+ 10 - 10
source/TextUtilities.Mod

@@ -199,7 +199,7 @@ TYPE
 			InitReader (Receive, Streams.DefaultReaderSize);
 		END Init;
 
-		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 ucs32, prevofs: LONGINT;
 		BEGIN
 			reader.text.AcquireRead;
@@ -777,7 +777,7 @@ TYPE
 		END GetUTF8Char;
 
 		PROCEDURE InsertPiece(charContent : XML.CDataSect);
-		VAR i, m, tpos, res : LONGINT; ch, last : Texts.Char32; tempUCS32 : ARRAY 1024 OF Texts.Char32;
+		VAR i, m, tpos: LONGINT; res : WORD; ch, last : Texts.Char32; tempUCS32 : ARRAY 1024 OF Texts.Char32;
 			oldpos, len : LONGINT;
 			r, sr : Streams.StringReader; token : ARRAY 256 OF CHAR;
 			tempInt: LONGINT;
@@ -830,11 +830,11 @@ TYPE
 				sr.SkipWhitespace; sr.Token(token);												(* AdHoc *)
 				sr.SkipWhitespace; sr.Token(token); COPY(token, attr.fontInfo.name); 				(* family *)
 				sr.SkipWhitespace; sr.Token(token); Strings.StrToInt(token, attr.fontInfo.size);		(* size *)
-				sr.SkipWhitespace; sr.Token(token); Strings.StrToInt(token, res); 					(* style *)
-				IF (res = 0) THEN attr.fontInfo.style := {};
-				ELSIF (res = 1) THEN attr.fontInfo.style := {0};
-				ELSIF (res = 2) THEN attr.fontInfo.style := {1};
-				ELSIF (res = 3) THEN attr.fontInfo.style := {0,1};
+				sr.SkipWhitespace; sr.Token(token); Strings.StrToInt(token, tempInt); 					(* style *)
+				IF (tempInt = 0) THEN attr.fontInfo.style := {};
+				ELSIF (tempInt = 1) THEN attr.fontInfo.style := {0};
+				ELSIF (tempInt = 2) THEN attr.fontInfo.style := {1};
+				ELSIF (tempInt = 3) THEN attr.fontInfo.style := {0,1};
 				ELSE attr.fontInfo.style := {};
 				END;
 				sr.SkipWhitespace; sr.Token(token); Strings.StrToInt(token, attr.voff);				(* voff *)
@@ -1537,7 +1537,7 @@ TYPE
 		END Open;
 
 		PROCEDURE WriteText*(text : Texts.Text; VAR res : WORD);
-		VAR r : Texts.TextReader; ch : Texts.Char32; i, j, k : LONGINT;
+		VAR r : Texts.TextReader; ch : Texts.Char32; i, j: LONGINT; k : WORD;
 			byte : ARRAY 2 OF CHAR;
 		BEGIN
 			res :=  -1;
@@ -1692,7 +1692,7 @@ BEGIN
 END CountWhitespace;
 
 (** Procedure to load File without explicit given Format - appropriate Format will be chosen automaticaly *)
-PROCEDURE LoadAuto*(text: Text; CONST fileName: ARRAY OF CHAR; VAR format, res: LONGINT);
+PROCEDURE LoadAuto*(text: Text; CONST fileName: ARRAY OF CHAR; VAR format: LONGINT; VAR res: WORD);
 VAR f : Files.File; re : Files.Reader; ri: Files.Rider; ch: CHAR; fstring: ARRAY 64 OF CHAR; i: LONGINT;
 BEGIN
 	(* KernelLog.String("Auto Format.... "); KernelLog.Ln; *)
@@ -2544,7 +2544,7 @@ END SetClipboard;
 PROCEDURE GetTextReader* (CONST filename: ARRAY OF CHAR): Streams.Reader;
 VAR
 	file: Files.File; fileReader: Files.Reader; offset: LONGINT;
-	text: Text; format, res: LONGINT; textReader: TextReader;
+	text: Text; format: LONGINT; res: WORD; textReader: TextReader;
 BEGIN
 	(* Optimisation: skip header of oberon files and return a file reader instead of default text reader*)
 	file := Files.Old (filename);

+ 1 - 1
source/Texts.Mod

@@ -1395,7 +1395,7 @@ VAR
 	str: Strings.String;
 	cStyle : CharacterStyle;
 	pStyle : ParagraphStyle;
-	tempReal: LONGREAL; tempInt, tempRes : LONGINT;
+	tempReal: LONGREAL; tempInt: LONGINT; tempRes : WORD;
 BEGIN
 	NEW(scanner, r);
 	NEW(parser, scanner);