Browse Source

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 years ago
parent
commit
529508e1a4

+ 1 - 1
source/UnicodeBidirectionality.Mod

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

+ 2 - 2
source/UnicodeProperties.Mod

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

+ 2 - 2
source/Unzip.Mod

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

+ 3 - 3
source/VirtualDisks.Mod

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

+ 1 - 1
source/WMGraphics.Mod

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

+ 3 - 3
source/WMProperties.Mod

@@ -131,7 +131,7 @@ TYPE
 		END IsLink;
 		END IsLink;
 
 
 		PROCEDURE WriteLink*(w : Streams.Writer; context: ANY;  indent : LONGINT): BOOLEAN;
 		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
 		BEGIN
 			IF object # NIL THEN
 			IF object # NIL THEN
 				Indent(w, indent);
 				Indent(w, indent);
@@ -1093,7 +1093,7 @@ TYPE
 		END FromXML;
 		END FromXML;
 
 
 		PROCEDURE ToXML*(VAR element: XML.Element);
 		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
 		BEGIN
 			IF (GetName # NIL) & nonDefault THEN
 			IF (GetName # NIL) & nonDefault THEN
 				ToXML^(element);
 				ToXML^(element);
@@ -1998,7 +1998,7 @@ TYPE
 		END ToXML;
 		END ToXML;
 
 
 		PROCEDURE WriteXML*(w : Streams.Writer; context: ANY;  indent : LONGINT);
 		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
 		BEGIN
 			name := GetName();
 			name := GetName();
 			IF name = NIL THEN KernelLog.String("Nameless boolean property encountered. Ignored"); KernelLog.Ln; RETURN END;
 			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;
 END CheckWhitespace;
 
 
 (** Removed all end-of-line whitespace from file named 'filename' *)
 (** 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;
 VAR file : Files.File; text : Texts.Text; format : LONGINT;
 BEGIN
 BEGIN
 	file := Files.Old(filename);
 	file := Files.Old(filename);
@@ -102,7 +102,7 @@ VAR
 	filename : Files.FileName;
 	filename : Files.FileName;
 	fileflags : SET;
 	fileflags : SET;
 	time, date, size : LONGINT;
 	time, date, size : LONGINT;
-	nofRemovedTotal, res : LONGINT;
+	nofRemovedTotal: LONGINT; res : WORD;
 	nofFiles, nofErrors : LONGINT;
 	nofFiles, nofErrors : LONGINT;
 
 
 	PROCEDURE RemoveFromThisFile(VAR filename : Files.FileName);
 	PROCEDURE RemoveFromThisFile(VAR filename : Files.FileName);

+ 1 - 1
source/Windows.TCP.Mod

@@ -165,7 +165,7 @@ TYPE
 		END Send;
 		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). *)
 	(** 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;
 		VAR ret: LONGINT;
 		BEGIN
 		BEGIN
 			ASSERT ( (ofs >= 0) & (ofs + size <= LEN( data )) & (min <= size) );
 			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.
 		Wait until at least min bytes (possibly zero) are available.
 			res is non-zero on error. *)
 			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;
 		VAR i, l, read, ret: LONGINT;
 		BEGIN
 		BEGIN
 			ASSERT ( LEN( buf ) >= ofs + size );
 			ASSERT ( LEN( buf ) >= ofs + size );

+ 1 - 1
source/Windows.WinDisks.Mod

@@ -116,7 +116,7 @@ TYPE
 			END;
 			END;
 		END Transfer;
 		END Transfer;
 
 
-		PROCEDURE GetSize*( VAR size, res: LONGINT );
+		PROCEDURE GetSize*( VAR size: LONGINT; VAR res: WORD );
 		BEGIN
 		BEGIN
 			size := SELF.size;  res := Disks.Ok;
 			size := SELF.size;  res := Disks.Ok;
 		END GetSize;
 		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;
 			Prefix( name, fname );  f :=  fs.Old0( fname ); IF f # NIL THEN  f.fs := SELF; END; RETURN f;
 		END Old0;
 		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;
 		VAR fname: FileName;
 		BEGIN
 		BEGIN
 			Prefix( name, fname );  fs.Delete0( fname, key, res );
 			Prefix( name, fname );  fs.Delete0( fname, key, res );
@@ -192,7 +192,7 @@ TYPE
 			Prefix( name, fname );  fs.CreateDirectory0( fname, res );
 			Prefix( name, fname );  fs.CreateDirectory0( fname, res );
 		END CreateDirectory0;
 		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;
 		VAR fname: FileName;
 		BEGIN
 		BEGIN
 			Prefix( name, fname );  fs.RemoveDirectory0( fname, force, key, res );
 			Prefix( name, fname );  fs.RemoveDirectory0( fname, force, key, res );
@@ -244,7 +244,7 @@ TYPE
 			RETURN NIL
 			RETURN NIL
 		END Old0;
 		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;
 		VAR fname: FileName;  F: File;  ret: Kernel32.BOOL;
 		BEGIN {EXCLUSIVE}
 		BEGIN {EXCLUSIVE}
 			ConvertChar( name, Files.PathDelimiter, PathDelimiter );  key := 0;  res := 1;
 			ConvertChar( name, Files.PathDelimiter, PathDelimiter );  key := 0;  res := 1;
@@ -397,7 +397,7 @@ TYPE
 			ELSE res := 1 END
 			ELSE res := 1 END
 		END CreateDirectory0;
 		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;
 		VAR ret: Kernel32.BOOL;
 		BEGIN {EXCLUSIVE}
 		BEGIN {EXCLUSIVE}
 			ConvertChar( name, Files.PathDelimiter, PathDelimiter );  key := 0;  res := 1;
 			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;
 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;
 	root: XML.Element; name, moduleName, procedureName, generator, elementName: XML.String; contents: XMLObjects.Enumerator; content: ANY;
 	module: Modules.Module; generatorProc : XML.GeneratorProcedure;
 	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;
 	reader: Files.Reader;
 BEGIN
 BEGIN
 	xgsFile := Files.Old(xgsName);
 	xgsFile := Files.Old(xgsName);

+ 1 - 1
source/XMLParser.Mod

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

+ 2 - 2
source/XYModem.Mod

@@ -697,7 +697,7 @@ END GetPars;
 PROCEDURE xySend(context : Commands.Context; mode: LONGINT);
 PROCEDURE xySend(context : Commands.Context; mode: LONGINT);
 VAR
 VAR
 	name: Files.FileName; F: Files.File;
 	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;
 	send: Sender; error: ARRAY 64 OF CHAR;
 	W: Streams.Writer; R: Streams.Reader;
 	W: Streams.Writer; R: Streams.Reader;
 BEGIN
 BEGIN
@@ -744,7 +744,7 @@ END YSend;
 PROCEDURE xyReceive(context : Commands.Context; mode: LONGINT);
 PROCEDURE xyReceive(context : Commands.Context; mode: LONGINT);
 VAR
 VAR
 	name: Files.FileName; F: Files.File;
 	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;
 	recv: Receiver; error: ARRAY 64 OF CHAR; awaitF: BOOLEAN;
 	W: Streams.Writer; R: Streams.Reader;
 	W: Streams.Writer; R: Streams.Reader;
 BEGIN
 BEGIN

+ 1 - 1
source/Zip.Mod

@@ -94,7 +94,7 @@ TYPE
 		zr: ZlibReaders.Reader
 		zr: ZlibReaders.Reader
 	END;
 	END;
 
 
-PROCEDURE ShowError*(errorCode : LONGINT; out : Streams.Writer);
+PROCEDURE ShowError*(errorCode : WORD; out : Streams.Writer);
 BEGIN
 BEGIN
 	ASSERT(out # NIL);
 	ASSERT(out # NIL);
 	CASE errorCode OF
 	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;
 			END Init;
 
 
 			PROCEDURE Old0*(name: ARRAY OF CHAR): Files.File;
 			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}
 			BEGIN {EXCLUSIVE}
 				key := 0;
 				key := 0;
 				E := zip.GetFirst();
 				E := zip.GetFirst();

+ 4 - 4
source/ZipTool.Mod

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