2
0
Эх сурвалжийг харах

use WORD instead of LONGINT for result type

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8458 8c9fc860-2736-0410-a75d-ab315db34111
eth.metacore 6 жил өмнө
parent
commit
529508e1a4

+ 1 - 1
source/UnicodeBidirectionality.Mod

@@ -2677,7 +2677,7 @@ VAR
 	file : Files.File;
 	decoder : Codecs.TextDecoder;
 	in : Streams.Reader;
-	decoderRes : LONGINT;
+	decoderRes : WORD;
 	text : Texts.Text;
 	error : BOOLEAN;
 	bidiFormatter : BidiFormatter;

+ 2 - 2
source/UnicodeProperties.Mod

@@ -191,7 +191,7 @@ TYPE
 		fullname : ARRAY 256 OF CHAR;
 		file : Files.File;
 		in: Streams.Reader;
-		decoderRes : LONGINT;
+		decoderRes : WORD;
 
 		(* loads a file into a local Text and creates an associated TextReader *)
 		PROCEDURE LoadTxtFile;
@@ -352,7 +352,7 @@ TYPE
 		VAR
 			thisChar, thisInt : Texts.Char32;
 			i,j : INTEGER;
-			dummyVal : LONGINT;
+			dummyVal : WORD;
 		BEGIN
 			text.AcquireRead;
 			textReader.SetPosition(startPos);

+ 2 - 2
source/Unzip.Mod

@@ -18,7 +18,7 @@ MODULE Unzip; (** AUTHOR "ejz"; PURPOSE "Aos unzip program"; *)
 		SizeReader = OBJECT
 			VAR input: Streams.Reader; max: 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
 				IF min > max THEN min := max END;
 				input.Bytes(buf, ofs, min, len);
@@ -338,7 +338,7 @@ MODULE Unzip; (** AUTHOR "ejz"; PURPOSE "Aos unzip program"; *)
 	(* Directory [ \d ] zip ~ *)
 	PROCEDURE Directory*(context : Commands.Context);
 	VAR
-		F: Files.File; zip: ZipFile; name: Files.FileName; res, i: LONGINT;
+		F: Files.File; zip: ZipFile; name: Files.FileName; res: WORD; i: LONGINT;
 		e: Entry; opt: ARRAY 32 OF CHAR; ch: CHAR; detail: BOOLEAN;
 	BEGIN
 		context.arg.SkipWhitespace();

+ 3 - 3
source/VirtualDisks.Mod

@@ -63,7 +63,7 @@ TYPE
 			HALT(301); (* abstract *)
 		END TransferOperation;
 
-		PROCEDURE GetSize*(VAR size, res: LONGINT);
+		PROCEDURE GetSize*(VAR size: LONGINT; VAR res: WORD);
 		BEGIN
 			size := SELF.size;	res := Disks.Ok;
 		END GetSize;
@@ -234,7 +234,7 @@ END GetOptions;
 PROCEDURE Install*(context : Commands.Context); (** [Options] diskname filename ~ *)
 VAR
 	diskname, filename : ARRAY 256 OF CHAR;
-	blocksize, c, h, s, res : LONGINT;
+	blocksize, c, h, s: LONGINT; res: WORD;
 	file : Files.File;
 	disk : FileDisk;
 
@@ -284,7 +284,7 @@ END Install;
 PROCEDURE InstallRamdisk*(context : Commands.Context); (** [Options] diskname size  ~ *)
 VAR
 	diskname  : ARRAY 256 OF CHAR;
-	size, blocksize, c, h, s, res : LONGINT;
+	size, blocksize, c, h, s: LONGINT; res: WORD;
 	memory : MemoryBlock;
 	disk : RamDisk;
 

+ 1 - 1
source/WMGraphics.Mod

@@ -809,7 +809,7 @@ END GetExtension;
 *)
 PROCEDURE LoadImage*(CONST name : ARRAY OF CHAR; shared : BOOLEAN): Image;
 VAR img : Image;
-	res, w, h, x : LONGINT;
+	res: WORD; w, h, x : LONGINT;
 	decoder : Codecs.ImageDecoder;
 	in : Streams.Reader;
 	ext : ARRAY 16 OF CHAR;

+ 3 - 3
source/WMProperties.Mod

@@ -131,7 +131,7 @@ TYPE
 		END IsLink;
 
 		PROCEDURE WriteLink*(w : Streams.Writer; context: ANY;  indent : LONGINT): BOOLEAN;
-		VAR name : String; id,res: LONGINT; repository: Repositories.Repository; objectName: String;
+		VAR name : String; id: LONGINT; res: WORD; repository: Repositories.Repository; objectName: String;
 		BEGIN
 			IF object # NIL THEN
 				Indent(w, indent);
@@ -1093,7 +1093,7 @@ TYPE
 		END FromXML;
 
 		PROCEDURE ToXML*(VAR element: XML.Element);
-		VAR chars: XML.ArrayChars;s: String; w: Streams.StringWriter; res,len: LONGINT;
+		VAR chars: XML.ArrayChars;s: String; w: Streams.StringWriter; res: WORD; len: LONGINT;
 		BEGIN
 			IF (GetName # NIL) & nonDefault THEN
 				ToXML^(element);
@@ -1998,7 +1998,7 @@ TYPE
 		END ToXML;
 
 		PROCEDURE WriteXML*(w : Streams.Writer; context: ANY;  indent : LONGINT);
-		VAR name : String; id,res: LONGINT; repository: Repositories.Repository; objectName: String;
+		VAR name : String; id: LONGINT; res: WORD; repository: Repositories.Repository; objectName: String;
 		BEGIN
 			name := GetName();
 			IF name = NIL THEN KernelLog.String("Nameless boolean property encountered. Ignored"); KernelLog.Ln; RETURN END;

+ 2 - 2
source/WhitespaceRemover.Mod

@@ -70,7 +70,7 @@ BEGIN
 END CheckWhitespace;
 
 (** Removed all end-of-line whitespace from file named 'filename' *)
-PROCEDURE RemoveFromFile*(VAR filename : Files.FileName; VAR nofRemoved, res : LONGINT);
+PROCEDURE RemoveFromFile*(VAR filename : Files.FileName; VAR nofRemoved: LONGINT; VAR res : WORD);
 VAR file : Files.File; text : Texts.Text; format : LONGINT;
 BEGIN
 	file := Files.Old(filename);
@@ -102,7 +102,7 @@ VAR
 	filename : Files.FileName;
 	fileflags : SET;
 	time, date, size : LONGINT;
-	nofRemovedTotal, res : LONGINT;
+	nofRemovedTotal: LONGINT; res : WORD;
 	nofFiles, nofErrors : LONGINT;
 
 	PROCEDURE RemoveFromThisFile(VAR filename : Files.FileName);

+ 1 - 1
source/Windows.TCP.Mod

@@ -165,7 +165,7 @@ TYPE
 		END Send;
 
 	(** Receive data on a TCP connection. The data parameter specifies the buffer. The ofs parameters specify the position in the buffer where data should be received (usually 0), and the size parameters specifies how many bytes of data can be received in the buffer. The min parameter specifies the minimum number of bytes to receive before Receive returns and must by <= size. The len parameter returns the number of bytes received, and the res parameter returns 0 if ok, or a non-zero error code otherwise (e.g. if the connection is closed by the communication partner, or by a call of the Close method). *)
-		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 );
 		VAR ret: LONGINT;
 		BEGIN
 			ASSERT ( (ofs >= 0) & (ofs + size <= LEN( data )) & (min <= size) );

+ 1 - 1
source/Windows.V24.Mod

@@ -162,7 +162,7 @@ TYPE
 		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 i, l, read, ret: LONGINT;
 		BEGIN
 			ASSERT ( LEN( buf ) >= ofs + size );

+ 1 - 1
source/Windows.WinDisks.Mod

@@ -116,7 +116,7 @@ TYPE
 			END;
 		END Transfer;
 
-		PROCEDURE GetSize*( VAR size, res: LONGINT );
+		PROCEDURE GetSize*( VAR size: LONGINT; VAR res: WORD );
 		BEGIN
 			size := SELF.size;  res := Disks.Ok;
 		END GetSize;

+ 4 - 4
source/Windows.WinFS.Mod

@@ -162,7 +162,7 @@ TYPE
 			Prefix( name, fname );  f :=  fs.Old0( fname ); IF f # NIL THEN  f.fs := SELF; END; RETURN f;
 		END Old0;
 
-		PROCEDURE Delete0*( name: ARRAY OF CHAR;  VAR key, res: LONGINT );
+		PROCEDURE Delete0*( name: ARRAY OF CHAR;  VAR key: LONGINT; VAR res: WORD);
 		VAR fname: FileName;
 		BEGIN
 			Prefix( name, fname );  fs.Delete0( fname, key, res );
@@ -192,7 +192,7 @@ TYPE
 			Prefix( name, fname );  fs.CreateDirectory0( fname, res );
 		END CreateDirectory0;
 
-		PROCEDURE RemoveDirectory0*( name: ARRAY OF CHAR;  force: BOOLEAN;  VAR key, res: LONGINT );
+		PROCEDURE RemoveDirectory0*( name: ARRAY OF CHAR;  force: BOOLEAN;  VAR key: LONGINT; VAR res: WORD );
 		VAR fname: FileName;
 		BEGIN
 			Prefix( name, fname );  fs.RemoveDirectory0( fname, force, key, res );
@@ -244,7 +244,7 @@ TYPE
 			RETURN NIL
 		END Old0;
 
-		PROCEDURE Delete0( name: ARRAY OF CHAR;  VAR key, res: LONGINT );
+		PROCEDURE Delete0( name: ARRAY OF CHAR;  VAR key: LONGINT; VAR res: WORD );
 		VAR fname: FileName;  F: File;  ret: Kernel32.BOOL;
 		BEGIN {EXCLUSIVE}
 			ConvertChar( name, Files.PathDelimiter, PathDelimiter );  key := 0;  res := 1;
@@ -397,7 +397,7 @@ TYPE
 			ELSE res := 1 END
 		END CreateDirectory0;
 
-		PROCEDURE RemoveDirectory0( name: ARRAY OF CHAR;  force: BOOLEAN;  VAR key, res: LONGINT );
+		PROCEDURE RemoveDirectory0( name: ARRAY OF CHAR;  force: BOOLEAN;  VAR key: LONGINT; VAR res: WORD );
 		VAR ret: Kernel32.BOOL;
 		BEGIN {EXCLUSIVE}
 			ConvertChar( name, Files.PathDelimiter, PathDelimiter );  key := 0;  res := 1;

+ 1 - 1
source/XMLGeneratorSchema.Mod

@@ -8,7 +8,7 @@ PROCEDURE OpenGeneratorSchema*(CONST xgsName: ARRAY OF CHAR): XML.ElementRegistr
 VAR xgsFile: Files.File; scanner: XMLScanner.Scanner; parser: XMLParser.Parser; doc: XML.Document;
 	root: XML.Element; name, moduleName, procedureName, generator, elementName: XML.String; contents: XMLObjects.Enumerator; content: ANY;
 	module: Modules.Module; generatorProc : XML.GeneratorProcedure;
-	res, i: LONGINT; msg: ARRAY 1024 OF CHAR; er: XML.ElementRegistry;
+	res: WORD; i: LONGINT; msg: ARRAY 1024 OF CHAR; er: XML.ElementRegistry;
 	reader: Files.Reader;
 BEGIN
 	xgsFile := Files.Old(xgsName);

+ 1 - 1
source/XMLParser.Mod

@@ -960,7 +960,7 @@ TYPE
 		END ParseAttributeValue;
 
 		PROCEDURE ParseCharRef(): XML.CharReference;
-		VAR cRef: XML.CharReference; code, res: LONGINT; s: String;
+		VAR cRef: XML.CharReference; code: LONGINT; res: WORD; s: String;
 		BEGIN
 			s := scanner.GetString(Scanner.CharRef);
 			IF s[0] = 'x' THEN	(* hexadecimal *)

+ 2 - 2
source/XYModem.Mod

@@ -697,7 +697,7 @@ END GetPars;
 PROCEDURE xySend(context : Commands.Context; mode: LONGINT);
 VAR
 	name: Files.FileName; F: Files.File;
-	port: Serials.Port; portn, bps, parity, stop, res: LONGINT;
+	port: Serials.Port; portn, bps, parity, stop: LONGINT; res: WORD;
 	send: Sender; error: ARRAY 64 OF CHAR;
 	W: Streams.Writer; R: Streams.Reader;
 BEGIN
@@ -744,7 +744,7 @@ END YSend;
 PROCEDURE xyReceive(context : Commands.Context; mode: LONGINT);
 VAR
 	name: Files.FileName; F: Files.File;
-	port: Serials.Port; portn, bps, parity, stop, res: LONGINT;
+	port: Serials.Port; portn, bps, parity, stop: LONGINT; res: WORD;
 	recv: Receiver; error: ARRAY 64 OF CHAR; awaitF: BOOLEAN;
 	W: Streams.Writer; R: Streams.Reader;
 BEGIN

+ 1 - 1
source/Zip.Mod

@@ -94,7 +94,7 @@ TYPE
 		zr: ZlibReaders.Reader
 	END;
 
-PROCEDURE ShowError*(errorCode : LONGINT; out : Streams.Writer);
+PROCEDURE ShowError*(errorCode : WORD; out : Streams.Writer);
 BEGIN
 	ASSERT(out # NIL);
 	CASE errorCode OF

+ 1 - 1
source/ZipFS.Mod

@@ -11,7 +11,7 @@ MODULE ZipFS; (** AUTHOR "ejz"; PURPOSE "mount a zipped file as a file-system";
 			END Init;
 
 			PROCEDURE Old0*(name: ARRAY OF CHAR): Files.File;
-				VAR E: Unzip.Entry; key, res: LONGINT; F: File; F0: Files.File; W: Files.Writer;
+				VAR E: Unzip.Entry; key: LONGINT; res: WORD; F: File; F0: Files.File; W: Files.Writer;
 			BEGIN {EXCLUSIVE}
 				key := 0;
 				E := zip.GetFirst();

+ 4 - 4
source/ZipTool.Mod

@@ -225,7 +225,7 @@ VAR
 	options : Options.Options;
 	archive: Zip.Archive; entry: Zip.Entry;
 	path, overwrite, stopOnError: BOOLEAN;
-	nofExtracted, nofErrors, res: LONGINT;
+	nofExtracted, nofErrors: LONGINT; res: WORD;
 BEGIN
 	NEW(options);
 	options.Add("d", "directory", Options.Flag);
@@ -296,7 +296,7 @@ VAR
 	path, overwrite, stopOnError, silent: BOOLEAN;
 	archive: Zip.Archive;
 	entry: Zip.Entry;
-	nofExtracted, nofErrors, res: LONGINT;
+	nofExtracted, nofErrors: LONGINT; res: WORD;
 BEGIN
 	NEW(options);
 	options.Add("d", "directory", Options.Flag);
@@ -409,7 +409,7 @@ VAR
 	archive: Zip.Archive;
 	strategy, level: LONGINT; stopOnError : BOOLEAN;
 	oldname, newname: ARRAY 256 OF CHAR;
-	nofAdded, nofErrors, res : LONGINT;
+	nofAdded, nofErrors: LONGINT; res: WORD;
 
 	PROCEDURE ShowFile(CONST oldname, newname : ARRAY OF CHAR; out : Streams.Writer);
 	BEGIN
@@ -496,7 +496,7 @@ VAR
 	archive: Zip.Archive;
 	entry: Zip.Entry;
 	stopOnError : BOOLEAN;
-	nofDeleted, nofErrors, res: LONGINT;
+	nofDeleted, nofErrors: LONGINT; res: WORD;
 BEGIN
 	NEW(options);
 	options.Add("i", "ignore", Options.Flag);