Quellcode durchsuchen

Replaced LONGINT by WORD

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8111 8c9fc860-2736-0410-a75d-ab315db34111
negelef vor 7 Jahren
Ursprung
Commit
8660177350
7 geänderte Dateien mit 34 neuen und 34 gelöschten Zeilen
  1. 4 4
      source/Commands.Mod
  2. 1 1
      source/In.Mod
  3. 10 10
      source/Locks.Mod
  4. 3 3
      source/Out.Mod
  5. 9 9
      source/Reflection.Mod
  6. 5 5
      source/RelativeFileSystem.Mod
  7. 2 2
      source/Streams.Mod

+ 4 - 4
source/Commands.Mod

@@ -30,7 +30,7 @@ TYPE
 		in-, arg- : Streams.Reader;
 		out-, error- : Streams.Writer;
 		caller-: OBJECT;
-		result*: LONGINT;
+		result*: WORD;
 
 		PROCEDURE &Init*(in, arg : Streams.Reader; out, error : Streams.Writer; caller: OBJECT);
 		BEGIN
@@ -109,7 +109,7 @@ TYPE
 		msg : ARRAY 128 OF CHAR; res : WORD;
 
 		module : Modules.Module;
-		state : LONGINT;
+		state : WORD;
 		exception : BOOLEAN;
 
 		PROCEDURE &Init*(CONST moduleName, commandName : Modules.Name; context : Context);
@@ -129,7 +129,7 @@ TYPE
 			state := Started;
 		END Init;
 
-		PROCEDURE Join(this : LONGINT; VAR res : WORD; VAR msg : ARRAY OF CHAR);
+		PROCEDURE Join(this : WORD; VAR res : WORD; VAR msg : ARRAY OF CHAR);
 		BEGIN {EXCLUSIVE}
 			AWAIT(state >= this);
 			res := SELF.res; COPY(SELF.msg, msg);
@@ -201,7 +201,7 @@ END SendNothing;
 	command string is syntactically correct, i.e. is of the form 'ModuleName "." [ProcedureName]' *)
 
 PROCEDURE Split*(CONST cmdstr : ARRAY OF CHAR; VAR moduleName, procedureName : Modules.Name; VAR res : WORD; VAR msg : ARRAY OF CHAR);
-VAR i, j : LONGINT; maxlen, cmdlen : LONGINT;
+VAR i, j, maxlen, cmdlen : SIZE;
 BEGIN
 	res := CommandParseError;
 	moduleName := ""; procedureName := ""; msg := "";

+ 1 - 1
source/In.Mod

@@ -12,7 +12,7 @@ BEGIN
 	RETURN GetArg().GetChar(ch);
 END Char;
 
-PROCEDURE Int*(VAR i: LONGINT; hex = TRUE: BOOLEAN): BOOLEAN;
+PROCEDURE Int*(VAR i: WORD; hex = TRUE: BOOLEAN): BOOLEAN;
 (* hex = TRUE means that hex numbers are allowed. A hex number must have the "H" postfix *)
 BEGIN
 	RETURN GetArg().GetInteger(i, hex);

+ 10 - 10
source/Locks.Mod

@@ -45,7 +45,7 @@ TYPE
 	(** Implements a recursive lock *)
 	RecursiveLock* = OBJECT
 	VAR
-		lockLevel : LONGINT;
+		lockLevel : SIZE;
 		lockedBy : ANY;
 
 		PROCEDURE &New*;
@@ -90,7 +90,7 @@ TYPE
 
 	ReaderLockInfo = RECORD
 		owner : ANY;
-		lockLevel : LONGINT
+		lockLevel : SIZE
 	END;
 
 	ReaderLockList = POINTER TO ARRAY OF ReaderLockInfo;
@@ -104,14 +104,14 @@ TYPE
 	*)
 	RWLock* = OBJECT
 	VAR
-		lockLevel : LONGINT;
+		lockLevel : SIZE;
 		lockedBy : ANY; (* writer *)
 		lastReader : ANY;
-		nofReaders : LONGINT;
+		nofReaders : SIZE;
 		readers : ReaderLockList;
 		wlReleaseHandler : LockReleasedHandler;
 		DEADLOCK : BOOLEAN;
-		nofReadLocks, nofWriteLocks : LONGINT; (* statistics *)
+		nofReadLocks, nofWriteLocks : SIZE; (* statistics *)
 
 		PROCEDURE &New*;
 		BEGIN
@@ -166,7 +166,7 @@ TYPE
 		END HasWriteLock;
 
 		(** Returns the locklevel of the write lock. [Must hold write lock] *)
-		PROCEDURE GetWLockLevel*() : LONGINT;
+		PROCEDURE GetWLockLevel*() : SIZE;
 		BEGIN
 			ASSERT(HasWriteLock(), 3000);
 			RETURN lockLevel
@@ -179,7 +179,7 @@ TYPE
 
 		(** acquire a read-lock on the object *)
 		PROCEDURE AcquireRead*;
-		VAR me, other : ANY; i : LONGINT; found : BOOLEAN; t : ReaderLockList;
+		VAR me, other : ANY; i : SIZE; found : BOOLEAN; t : ReaderLockList;
 		BEGIN {EXCLUSIVE}
 			IF Statistics THEN INC(nofReadLocks); END;
 			me := Objects.ActiveObject();
@@ -203,7 +203,7 @@ TYPE
 
 		(** release the read lock on the object. MUST hold lock *)
 		PROCEDURE ReleaseRead*;
-		VAR me : ANY; i : LONGINT; found : BOOLEAN;
+		VAR me : ANY; i : SIZE; found : BOOLEAN;
 		BEGIN {EXCLUSIVE}
 			me := Objects.ActiveObject();
 			found := FALSE;
@@ -233,7 +233,7 @@ TYPE
 		END HasReadLock;
 
 		PROCEDURE InternalHasReadLock(): BOOLEAN;
-		VAR me : ANY; i : LONGINT;
+		VAR me : ANY; i : SIZE;
 		BEGIN
 			me := Objects.ActiveObject();
 			i := 0; WHILE (i < nofReaders) DO
@@ -245,7 +245,7 @@ TYPE
 
 		(** Remove all locks owned by the caller *)
 		PROCEDURE Reset*;
-		VAR i, j : LONGINT;me : ANY;
+		VAR i, j : SIZE;me : ANY;
 		BEGIN {EXCLUSIVE}
 			me := Objects.ActiveObject();
 			KernelLog.String("!!! LOCK RESET !!!");

+ 3 - 3
source/Out.Mod

@@ -29,12 +29,12 @@ BEGIN
 	Commands.GetContext().out.Set(s);
 END Set;
 
-PROCEDURE Int*(i: HUGEINT; n = 1: LONGINT);
+PROCEDURE Int*(i: HUGEINT; n = 1: WORD);
 BEGIN
 	Commands.GetContext().out.Int(i,n);
 END Int;
 
-PROCEDURE Hex*(i: HUGEINT; n = -16: LONGINT);
+PROCEDURE Hex*(i: HUGEINT; n = -16: WORD);
 BEGIN
 	Commands.GetContext().out.Hex(i,n);
 END Hex;
@@ -44,7 +44,7 @@ BEGIN
 	Commands.GetContext().out.Address(a);
 END Address;
 
-PROCEDURE Float*(x: LONGREAL; n = 4, f= 3, d=0: LONGINT);
+PROCEDURE Float*(x: LONGREAL; n = 4, f= 3, d=0: WORD);
 BEGIN
 	Commands.GetContext().out.FloatFix(x,n,f,d);
 END Float;

+ 9 - 9
source/Reflection.Mod

@@ -133,7 +133,7 @@ CONST
 	END CheckHeapAddress;
 	
 	PROCEDURE Wait(w: Streams.Writer);
-	VAR i: LONGINT;
+	VAR i: WORD;
 	BEGIN
 		IF LineDelay > 0 THEN
 			FOR i := 0 TO LineDelay DO END;
@@ -754,14 +754,14 @@ CONST
 	Search = RECORD
 		name: ARRAY 256 OF CHAR; 	(* for search by name *)
 		nameOffset: SIZE;				(* to incrementally search through scopes *)
-		minLevel: LONGINT; 					(* in order to stop scope search *)
+		minLevel: SIZE; 					(* in order to stop scope search *)
 		pc: ADDRESS;							(* for search by address *)
 		pos: SIZE;							(* symbol position in stream, -1 if not found *)
 		found: BOOLEAN;						(* if found *)
 	END;
 
 	(* check if stream contains the string part stored in search record with respective offset *)
-	PROCEDURE FindString(refs: Modules.Bytes; VAR offset: SIZE; level: LONGINT; VAR find: Search);
+	PROCEDURE FindString(refs: Modules.Bytes; VAR offset: SIZE; level: SIZE; VAR find: Search);
 	VAR ofs: SIZE;
 	BEGIN
 		IF find.minLevel > level THEN
@@ -785,7 +785,7 @@ CONST
 	END FindString;
 
 	(* find a symbol by name or pc starting from the procedure stream section *)
-	PROCEDURE FindInProcedure(refs: Modules.Bytes; VAR offset: SIZE; level: LONGINT; VAR find: Search);
+	PROCEDURE FindInProcedure(refs: Modules.Bytes; VAR offset: SIZE; level: SIZE; VAR find: Search);
 	VAR name: ARRAY 128 OF CHAR;  start, end: ADDRESS; pos: SIZE; 
 	BEGIN
 		pos := offset; 
@@ -813,7 +813,7 @@ CONST
 	END FindInProcedure;
 
 	(* find a symbol by name or pc starting from the variable stream section *)
-	PROCEDURE FindInVariable(refs: Modules.Bytes; VAR offset: SIZE; level: LONGINT; VAR find: Search);
+	PROCEDURE FindInVariable(refs: Modules.Bytes; VAR offset: SIZE; level: SIZE; VAR find: Search);
 	VAR name: ARRAY 128 OF CHAR;  pos: SIZE; 
 	BEGIN
 		pos := offset; 
@@ -830,7 +830,7 @@ CONST
 	END FindInVariable; 
 
 	(* find a symbol by name or pc starting from the type declaration stream section *)
-	PROCEDURE FindInTypeDeclaration(refs: Modules.Bytes; VAR offset: SIZE; level: LONGINT; VAR find: Search);
+	PROCEDURE FindInTypeDeclaration(refs: Modules.Bytes; VAR offset: SIZE; level: SIZE; VAR find: Search);
 	VAR name: ARRAY 128 OF CHAR;  adr, pos: SIZE; 
 	BEGIN
 		pos := offset;
@@ -845,7 +845,7 @@ CONST
 		IF refs[offset] = sfScopeBegin THEN FindInScope(refs, offset, level+1, find) END;
 	END FindInTypeDeclaration; 
 	
-	PROCEDURE FindInModule(refs: Modules.Bytes; VAR offset: SIZE; level: LONGINT; VAR find: Search);
+	PROCEDURE FindInModule(refs: Modules.Bytes; VAR offset: SIZE; level: SIZE; VAR find: Search);
 	VAR pos: SIZE;
 	BEGIN
 		pos := offset;
@@ -860,7 +860,7 @@ CONST
 	END FindInModule;
 
 	(* find a symbol by name or pc in a scope in the stream *)
-	PROCEDURE FindInScope(refs: Modules.Bytes; VAR offset: SIZE; level: LONGINT; VAR find: Search);
+	PROCEDURE FindInScope(refs: Modules.Bytes; VAR offset: SIZE; level: SIZE; VAR find: Search);
 	VAR no,i: SIZE;
 	BEGIN
 		IF ~Expect(offset, GetChar(refs, offset) = sfScopeBegin) THEN RETURN END;
@@ -1000,7 +1000,7 @@ CONST
 
 	(** Write a process's state in one line. *)
 	PROCEDURE WriteProcess*(w: Streams.Writer; p: Objects.Process);
-	VAR adr: ADDRESS; mode: LONGINT; m: Modules.Module;
+	VAR adr: ADDRESS; mode: WORD; m: Modules.Module;
 	BEGIN
 		IF p # NIL THEN
 			w.Int(p.id, 5);

+ 5 - 5
source/RelativeFileSystem.Mod

@@ -7,7 +7,7 @@ TYPE PathName=ARRAY 272 OF CHAR;
 	VAR relTo: PathName; fs: Files.FileSystem;
 
 		PROCEDURE &InitFileSystem*( relTo: ARRAY OF CHAR; fs: Files.FileSystem);
-		VAR ch: CHAR;i: LONGINT;
+		VAR ch: CHAR;i: SIZE;
 		BEGIN
 			SELF.fs := fs;
 			INCL(flags,Files.NeedsPrefix);
@@ -54,7 +54,7 @@ TYPE PathName=ARRAY 272 OF CHAR;
 			MakeRel(name,new); fs.CreateDirectory0(new,res);
 		END CreateDirectory0;
 
-		PROCEDURE Delete0* (name: ARRAY OF CHAR;     VAR key, res: LONGINT);
+		PROCEDURE Delete0* (name: ARRAY OF CHAR;     VAR key: LONGINT; VAR res: WORD);
 		VAR new: PathName;
 		BEGIN
 			MakeRel(name,new); fs.Delete0(new,key,res);
@@ -76,7 +76,7 @@ TYPE PathName=ARRAY 272 OF CHAR;
 			RETURN fs.FileKey(new);
 		END FileKey;
 
-		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 new: PathName;
 		BEGIN
 			MakeRel(name,new);  fs.RemoveDirectory0(new,force,key,res);
@@ -91,7 +91,7 @@ TYPE PathName=ARRAY 272 OF CHAR;
 	END FileSystem;
 
 	PROCEDURE RemovePrefix(VAR name: ARRAY OF CHAR);
-	VAR i,j: LONGINT;
+	VAR i,j: SIZE;
 	BEGIN
 		WHILE(name[i] # 0X) & (name[i] # ":") DO
 			INC(i);
@@ -137,4 +137,4 @@ FSTools.Unmount Test ~
 
 
 
-System.Directory src:/*
+System.Directory src:/*

+ 2 - 2
source/Streams.Mod

@@ -388,7 +388,7 @@ TYPE
 
 
 	(** Write LONGREAL x  using n character positions. *)
-		PROCEDURE Float*( x: LONGREAL;  n: LONGINT );
+		PROCEDURE Float*( x: LONGREAL;  n: WORD );
 		(* BM 1993.4.22. Do not simplify rounding! *)
 		VAR e, h, l, i: LONGINT;  z: LONGREAL;
 			d: ARRAY 16 OF CHAR;
@@ -429,7 +429,7 @@ TYPE
 		END Float;
 
 	(** Write LONGREAL x in a fixed point notation. n is the overall minimal length for the output field, f the number of fraction digits following the decimal point, D the fixed exponent (printed only when D # 0). *)
-		PROCEDURE FloatFix*( x: LONGREAL;  n, f, D: LONGINT );
+		PROCEDURE FloatFix*( x: LONGREAL;  n, f, D: WORD );
 		(* BM 1993.4.22. Do not simplify rounding! / JG formatting adjusted *)
 		VAR e, h, l, i: LONGINT;  r, z: LONGREAL;
 			d: ARRAY 16 OF CHAR;