ソースを参照

Removed end-of-line whitespace in all modules

git-svn-id: https://svn-dept.inf.ethz.ch/svn/lecturers/a2/trunk@8731 8c9fc860-2736-0410-a75d-ab315db34111
negelef 6 年 前
コミット
38473b9849
100 ファイル変更1628 行追加1631 行削除
  1. 2 2
      source/ACPI.Timer.Mod
  2. 1 1
      source/AMD64.EFIMachine.Mod
  3. 16 16
      source/AMD64.FoxArrayBaseOptimized.Mod
  4. 16 16
      source/ARM.Builtins.Mod
  5. 1 1
      source/ARM.FPE64.Mod
  6. 10 10
      source/ARM.Machine.Mod
  7. 1 1
      source/ARM.MathL.Mod
  8. 1 1
      source/ARM.Network.Mod
  9. 7 7
      source/ARM.Objects.Mod
  10. 1 1
      source/ARM.Traps.Mod
  11. 14 14
      source/ARM.UsbEhci.Mod
  12. 31 31
      source/ARM.UsbHidDriver.Mod
  13. 1 1
      source/ARM.UsbMouse.Mod
  14. 29 29
      source/ARM.UsbVarTdAlloc.Mod
  15. 1 1
      source/ARM.Usbdi.Mod
  16. 49 49
      source/ASN1.Mod
  17. 1 1
      source/AcStreamVideoOut.Mod
  18. 17 17
      source/Activities.Mod
  19. 68 68
      source/AdaptiveHuffman.Mod
  20. 63 63
      source/BB.StdCoder.Mod
  21. 2 2
      source/BIOS.ACPI.Mod
  22. 4 4
      source/BIOS.AMD64.Machine.Mod
  23. 2 2
      source/BIOS.ATADisks.Mod
  24. 1 1
      source/BIOS.Clock.Mod
  25. 9 9
      source/BIOS.I386.Machine.Mod
  26. 3 3
      source/BIOS.I386.Traps.Mod
  27. 6 6
      source/BIOS.MemCache.Mod
  28. 8 8
      source/BIOS.Objects.Mod
  29. 10 10
      source/BIOS.PCI.Mod
  30. 24 24
      source/BIOS.WebNetworkTimeProtocol.Mod
  31. 2 2
      source/BSplineCurves.Mod
  32. 2 2
      source/BenchTCP.Mod
  33. 1 1
      source/BitSets.Mod
  34. 52 52
      source/BorrowsWheeler.Mod
  35. 5 5
      source/CPU.Mod
  36. 4 4
      source/CRC.Mod
  37. 18 18
      source/Checksum.Mod
  38. 4 4
      source/Clock.Mod
  39. 1 1
      source/Commands.Mod
  40. 19 19
      source/Compiler.Mod
  41. 1 1
      source/ComplexNumbers.Mod
  42. 6 6
      source/ComponentViewer.Mod
  43. 3 3
      source/Coop.ARM.Machine.Mod
  44. 1 1
      source/Coop.Kernel.Mod
  45. 3 3
      source/Coop.Machine.Mod
  46. 8 8
      source/Coop.Objects.Mod
  47. 1 1
      source/Coop.Windows.Display.Mod
  48. 19 19
      source/Coop.Windows.I386.Kernel32.Mod
  49. 20 20
      source/CryptoAES.Mod
  50. 0 1
      source/CryptoARC4.Mod
  51. 39 39
      source/CryptoBase64.Mod
  52. 17 17
      source/CryptoBigNumbers.Mod
  53. 17 17
      source/CryptoBlowfish.Mod
  54. 5 5
      source/CryptoCAST.Mod
  55. 12 12
      source/CryptoCSPRNG.Mod
  56. 1 1
      source/CryptoCiphers.Mod
  57. 67 67
      source/CryptoDES.Mod
  58. 26 26
      source/CryptoDES3.Mod
  59. 3 3
      source/CryptoDiffieHellman.Mod
  60. 40 40
      source/CryptoKeccakF1600.Mod
  61. 20 20
      source/CryptoKeccakSponge.Mod
  62. 8 8
      source/CryptoMD5.Mod
  63. 1 1
      source/CryptoPrimes.Mod
  64. 3 3
      source/CryptoRSA.Mod
  65. 11 11
      source/CryptoSHA1.Mod
  66. 23 23
      source/CryptoSHA256.Mod
  67. 8 8
      source/CryptoSHA3.Mod
  68. 43 43
      source/CryptoTestCiphers.Mod
  69. 1 1
      source/CryptoTestDH.Mod
  70. 17 17
      source/CryptoTestHashes.Mod
  71. 1 1
      source/CryptoTools.Mod
  72. 15 15
      source/CryptoTwofish.Mod
  73. 18 18
      source/CryptoUtils.Mod
  74. 1 1
      source/DTPData.Mod
  75. 61 61
      source/Darwin.Unix.Mod
  76. 0 1
      source/DataErrors.Mod
  77. 2 2
      source/Dates.Mod
  78. 14 14
      source/Debugging.Mod
  79. 6 6
      source/DiskCaches.Mod
  80. 16 16
      source/DiskFS.Mod
  81. 1 1
      source/Displays.Mod
  82. 51 51
      source/Drand48.Mod
  83. 15 15
      source/EFI.AMD64.Machine.Mod
  84. 18 18
      source/EFI.I386.Machine.Mod
  85. 3 3
      source/EFI.Mod
  86. 4 4
      source/EFIGraphicalConsole.Mod
  87. 2 2
      source/EFILib.Mod
  88. 0 1
      source/ExampleTextWriter.Mod
  89. 3 3
      source/Files.Mod
  90. 19 19
      source/FoxAMD64Assembler.Mod
  91. 127 127
      source/FoxAMD64InstructionSet.Mod
  92. 53 53
      source/FoxAMDBackend.Mod
  93. 12 12
      source/FoxARMAssembler.Mod
  94. 60 60
      source/FoxARMBackend.Mod
  95. 21 21
      source/FoxARMInstructionSet.Mod
  96. 2 2
      source/FoxActiveCells.Mod
  97. 148 148
      source/FoxArrayBase.Mod
  98. 1 1
      source/FoxAssembler.Mod
  99. 4 4
      source/FoxBackend.Mod
  100. 19 19
      source/FoxBasic.Mod

+ 2 - 2
source/ACPI.Timer.Mod

@@ -16,13 +16,13 @@ CODE
 END GetInstructionTimer;
 
 PROCEDURE GetCounter- (): Counter;
-BEGIN {UNCOOPERATIVE, UNCHECKED} 
+BEGIN {UNCOOPERATIVE, UNCHECKED}
 	IF counter = NIL THEN RETURN  SHORT(GetInstructionTimer() DIV (1024*1024));  (* return millions of instructions *) END;
 	ASSERT (counter # NIL); RETURN SHORT (counter.value);
 END GetCounter;
 
 PROCEDURE GetFrequency- (): Counter;
-BEGIN {UNCOOPERATIVE, UNCHECKED} 
+BEGIN {UNCOOPERATIVE, UNCHECKED}
 	IF counter = NIL THEN RETURN 1024 (* giga instructions as a rough guess *) END;
 	RETURN frequency;
 END GetFrequency;

+ 1 - 1
source/AMD64.EFIMachine.Mod

@@ -18,7 +18,7 @@ CODE {SYSTEM.AMD64, SYSTEM.Privileged}
 	MOV RAX, [RBP+rax]; btAddr
 	MOV RCX, [RBP+rcx];
 	MOV RDX, [RBP+rdx];
-	
+
 	MOV RBX, [RBP+adr]
 	CALL RBX
 

+ 16 - 16
source/AMD64.FoxArrayBaseOptimized.Mod

@@ -1460,7 +1460,7 @@ VAR
 		JMP	singlepieces	;
 		endL:
 	END AddARARLoopSSE;
-	
+
 (* *)
 	PROCEDURE SubAXAXLoopA( ladr, radr, dadr: ADDRESS; linc, rinc, dinc, len: SIZE );
 	CODE {SYSTEM.AMD64, SYSTEM.FPU}
@@ -1798,7 +1798,7 @@ VAR
 		JMP	singlepieces	;
 		endL:
 	END SubARARLoopSSE;
-	
+
 	(* *)
 	PROCEDURE EMulAXAXLoopA( ladr, radr, dadr: ADDRESS; linc, rinc, dinc, len: SIZE );
 	CODE {SYSTEM.AMD64, SYSTEM.FPU}
@@ -6375,7 +6375,7 @@ VAR
 		END;
 	END MatMulR;
 
-	PROCEDURE MatMulX( matrixA, matrixB, matrixC: ADDRESS; 
+	PROCEDURE MatMulX( matrixA, matrixB, matrixC: ADDRESS;
 		IncA, StrideA, IncB, StrideB, IncC, StrideC, RowsA, ColsA, RowsB, ColsB: SIZE ): BOOLEAN;
 	VAR M, N, K: SIZE;
 	BEGIN
@@ -6502,7 +6502,7 @@ VAR
 		END;
 	END MatMulIncX;
 
-	PROCEDURE MatMulARARBlocked( matrixA, matrixB, matrixC: ADDRESS; 
+	PROCEDURE MatMulARARBlocked( matrixA, matrixB, matrixC: ADDRESS;
 		IncA, StrideA, IncB, StrideB, IncC, StrideC, RowsA, ColsA, RowsB, ColsB: SIZE;
 															 add: BOOLEAN ): BOOLEAN;
 	VAR M, N, K, L2M, L2N, L2K: SIZE;
@@ -6616,7 +6616,7 @@ VAR
 															 ColsB, TRUE )
 	END MatMulIncRTransposed;
 
-	PROCEDURE MatMulXSSEStride( matrixA, matrixB, matrixC: ADDRESS; 
+	PROCEDURE MatMulXSSEStride( matrixA, matrixB, matrixC: ADDRESS;
 		IncA, StrideA, IncB, StrideB, IncC, StrideC, RowsA, ColsA, RowsB, ColsB: SIZE ): BOOLEAN;
 	BEGIN
 		RETURN MatMulAXAXSSEStride( matrixA, matrixB, matrixC,
@@ -7054,7 +7054,7 @@ VAR
 
 		MOVLPS [RCX], XMM0
 	END MatVecMulR2x2;
-	
+
 	(* PH *)
 	(* to do: use MOVAPS when Felix fixes issues with alignment *)
 	PROCEDURE MatVecMulR4x4(dadr, ladr, radr: ADDRESS);
@@ -7068,15 +7068,15 @@ VAR
 		MOVUPS XMM2, [RAX+16] ; XMM2 := [a10,a11,a12,a13]
 		MOVUPS XMM3, [RAX+32] ; XMM3 := [a20,a21,a22,a23]
 		MOVUPS XMM4, [RAX+48] ; XMM4 := [a30,a31,a32,a33]
-		MULPS XMM1, XMM0 
-		MULPS XMM2, XMM0 
-		HADDPS XMM1, XMM2	; adjacent pairs are horizontally  added  
-		
-		MULPS XMM3, XMM0 
-		MULPS XMM4, XMM0 
-		HADDPS XMM3, XMM4	; adjacent pairs are horizontally  added  
-		
-		HADDPS XMM1, XMM3	; adjacent pairs are horizontally  added 
+		MULPS XMM1, XMM0
+		MULPS XMM2, XMM0
+		HADDPS XMM1, XMM2	; adjacent pairs are horizontally  added
+
+		MULPS XMM3, XMM0
+		MULPS XMM4, XMM0
+		HADDPS XMM3, XMM4	; adjacent pairs are horizontally  added
+
+		HADDPS XMM1, XMM3	; adjacent pairs are horizontally  added
 		MOVUPS [RCX], XMM1
 	END MatVecMulR4x4;
 
@@ -7179,7 +7179,7 @@ VAR
 			ArrayBase.matVecMulR4x4 := MatVecMulR4x4;
 		END;
 	END InstallSSE3;
-	
+
 	PROCEDURE Install*;
 	BEGIN
 		KernelLog.String( "ArrayBaseOptimized: installing runtime library optimizations:" );

+ 16 - 16
source/ARM.Builtins.Mod

@@ -16,7 +16,7 @@ TYPE
 	DoubleWord = RECORD
 		low*: UNSIGNED32; high*: SIGNED32;
 	END;
-		
+
 	PROCEDURE DivS8*(left, right: SHORTINT): SHORTINT;
 	VAR result, dummy: LONGINT;
 	BEGIN {UNCOOPERATIVE, UNCHECKED} DivModS32(left, right, result, dummy); RETURN SHORTINT(result)
@@ -105,7 +105,7 @@ TYPE
 	PROCEDURE RorS64*(source: HUGEINT; amount: ULONGINT): HUGEINT;
 	BEGIN {UNCOOPERATIVE, UNCHECKED} RETURN RolS64(source, 64 - (amount MOD 64))
 	END RorS64;
-	
+
 	PROCEDURE RorU64*(source: HUGEINT; amount: ULONGINT): HUGEINT;
 	BEGIN {UNCOOPERATIVE, UNCHECKED} RETURN RolS64(source, 64 - (amount MOD 64))
 	END RorU64;
@@ -143,7 +143,7 @@ TYPE
 		CMP R0, R1
 		BEQ Equal
 		BLS Exit ; nothing to do than setting quotient to 0 and remainder to dividend (R0)
-	
+
 		CLZ R3, R0 ; R3 := clz(dividend)
 		CLZ R4, R1 ; R4 := clz(divisor)
 
@@ -159,13 +159,13 @@ TYPE
 		BPL Loop
 
 		; R0 holds the remainder
-		
+
 		B Exit
-		
+
 	Equal:
 		MOV R2, #1
 		MOV R0, #0
-		
+
 	Exit:
 		LDR R1, [FP,#quotient] ; R1 := address of quotient
 		LDR R3, [FP,#remainder] ; R3 := address of remainder
@@ -309,7 +309,7 @@ TYPE
 		END ;
 		RETURN x
 	END AddF32;
-	
+
 	(* only called when no FPU64 is available *)
 	PROCEDURE AddF64*(x,y: FLOAT64): FLOAT64;
 	VAR z: FLOAT64;
@@ -390,7 +390,7 @@ TYPE
 	(* stub in order to make the runtime itself compile, cf next procedure. This module needs to be compiled with FPU support on *)
 	PROCEDURE ConvF64U32*(x: UNSIGNED32): FLOAT64;
 	BEGIN {UNCOOPERATIVE, UNCHECKED}
-		HALT(100); 
+		HALT(100);
 	END ConvF64U32;
 
 	(* if an FPU64 is available, the result must be made available via FPU register *)
@@ -419,13 +419,13 @@ TYPE
 	BEGIN {UNCOOPERATIVE, UNCHECKED}
 		RETURN ConvF32S32(LONGINT(x))
 	END ConvF32S16;
-	
+
 	(* only called when no FPU32 is available *)
 	PROCEDURE ConvF32S8*(x: SHORTINT): FLOAT32;
 	BEGIN {UNCOOPERATIVE, UNCHECKED}
 		RETURN ConvF32S16(INTEGER(x))
 	END ConvF32S8;
-	
+
 	(* only called when no FPU64 is available *)
 	PROCEDURE ConvF64S8*(x: SHORTINT): FLOAT64;
 	BEGIN {UNCOOPERATIVE, UNCHECKED}
@@ -449,9 +449,9 @@ TYPE
 			x := (x MOD C + C) * 20H;
 			y := (y MOD C + C) * 20H;
 			xe := xe + ye - B; (* exponent with bias *)
-			
+
 			SYSTEM.MULD(ye, x, y); (* note that this implicitly changes zh *)
-			
+
 			IF zh >= 4*C THEN
 				x := (zh+2) DIV 4;
 				INC(xe);
@@ -468,7 +468,7 @@ TYPE
 		END ;
 		RETURN x
 	END MulF32;
-	
+
 	(* only called when no FPU32 is available *)
 	PROCEDURE DivF32*(x, y: FLOAT32): FLOAT32;
 	VAR xe, ye, q, s: LONGINT;
@@ -524,7 +524,7 @@ TYPE
 		END ;
 		RETURN x
 	END ConvS32F32;
-	
+
 	(** converts an integer into a float, ignores the non-integer part
 	- corresponds to REAL(int)
 	- note that no rounding occurs
@@ -559,9 +559,9 @@ TYPE
 	(* stub in order to make the runtime itself compile, cf next procedure. This module needs to be compiled with FPU support on *)
 	PROCEDURE ConvF32U32*(x: UNSIGNED32): FLOAT32;
 	BEGIN {UNCOOPERATIVE, UNCHECKED}
-		HALT(100); 
+		HALT(100);
 	END ConvF32U32;
-	
+
 	(* if an FPU32 is available, the result must be made available via FPU register *)
 	PROCEDURE ConvF32S64F*(x: DoubleWord): REAL;
 	VAR l,h:REAL;

+ 1 - 1
source/ARM.FPE64.Mod

@@ -9,7 +9,7 @@ MODULE FPE64;
 		Float64* = RECORD
 			low*, high*: LONGINT
 		END;
-		
+
 		Float32* = LONGINT;
 
 	PROCEDURE Addd(VAR x1, x0: LONGINT; y1, y0: LONGINT);

+ 10 - 10
source/ARM.Machine.Mod

@@ -14,7 +14,7 @@ CONST
 
 	(* Interrupts Dummy Test *)
 	DummyTest = FALSE;
-	
+
 	(* Lock levels *)
 	TraceOutput* = 0;
 	Memory* = 1;
@@ -211,7 +211,7 @@ TYPE
 	CacheRefs = POINTER {UNSAFE,UNTRACED} TO ARRAY MaxCacheRefSize OF SHORTINT;
 VAR
 	version -: ARRAY 64 OF CHAR;
-	
+
 	sp, fp: ADDRESS;
 
 	(** Interrupt Mask *)
@@ -502,7 +502,7 @@ VAR
 		ISB
 		MOV R0, #0x40000000;
 		VMSR FPEXC, R0;
-		
+
 		VMRS R0, FPSCR
 		BIC R0, R0, #0x0c00000 ; round to nearest as the default
 		; remark: if we put round to minus infinity as the default, we can spare quite some instructions in emission of ENTIER
@@ -1378,7 +1378,7 @@ VAR
 		ADD R0, R0, #8
 		VST1 D15, R0
 		ADD R0, R0, #8
-		
+
 		VSTR D16, R0, #0
 		ADD R0, R0, #8
 		VSTR D17, R0, #0
@@ -2287,7 +2287,7 @@ VAR
 	BEGIN	(* {interrupts off} *)
 		timer(ID(), state);
 		SYSTEM.PUT32(Platform.PrivateTimerInterruptStatusRegister, 1);
-		
+
 		(* Shutdown if requested *)
 		IF ~(ID() IN allProcessors) THEN ShutdownSecondary END;
 		IF enableWatchdog THEN PrivateWatchdog.Feed(Second) END;
@@ -2531,7 +2531,7 @@ VAR
 		CMP	R2, #0
 		BNE	loop
 	END AtomicInc;
-	
+
 	(* Atomic INC(x) *)
 	PROCEDURE -AtomicDec*(VAR x: LONGINT);
 	CODE
@@ -3076,7 +3076,7 @@ VAR
 			END
 		ELSE
 			Acquire(TraceOutput);
-			Trace.StringLn("Address not in stack");Trace.Address(virtAdr); 
+			Trace.StringLn("Address not in stack");Trace.Address(virtAdr);
 			Release(TraceOutput);
 			ok := FALSE
 		END;
@@ -3118,7 +3118,7 @@ VAR
 		s.adr := s.high - InitStackSize;	(* at the top of the virtual area *)
 		initSP := s.high;
 		b := AllocatePage(s.adr, FullAccess, flags); (* allocate one physical page first *)
-		
+
 		ASSERT(b);
 		FlushDCacheRange(sysSecondLvlPtStart, sysSecondLvlPtStop - sysSecondLvlPtStart);
 		Release(Memory)
@@ -3595,10 +3595,10 @@ VAR
 		InitLocks;
 		InitGlobalTimer
 	END Init;
-	
+
 	PROCEDURE {INITIAL} Initial;
 	BEGIN
 		Init;
 	END Initial;
-	
+
 END Machine.

+ 1 - 1
source/ARM.MathL.Mod

@@ -18,7 +18,7 @@ VAR
 	y: Flt; h: HUGEINT;
 BEGIN
 	y := SYSTEM.VAL(Flt, x);
-	h := y[0] + LSH(SYSTEM.VAL(HUGEINT, SYSTEM.VAL(SET, y[1])*{0..19}), 32); 
+	h := y[0] + LSH(SYSTEM.VAL(HUGEINT, SYSTEM.VAL(SET, y[1])*{0..19}), 32);
 	RETURN h;
 END Mantissa;
 

+ 1 - 1
source/ARM.Network.Mod

@@ -262,7 +262,7 @@ TYPE
 			ELSE
 				KernelLog.String("Registered NON ARP receiver"); KernelLog.Ln
 			END;
-			
+
 			(* exists the type already? *)
 			typeItem := typeList;
 			WHILE (typeItem # NIL) & (typeItem^.type # type) DO

+ 7 - 7
source/ARM.Objects.Mod

@@ -43,7 +43,7 @@ CONST
 
 	AddressSize = SIZEOF(ADDRESS);
 	ReturnStackDisplacement = 2 * AddressSize;
-	
+
 TYPE
 	CpuCyclesArray* = ARRAY Machine.MaxCPU OF HUGEINT;
 
@@ -128,7 +128,7 @@ TYPE
 							Trace.String("[Objects.FindRoots sp=0]")
 						END
 					END;
-					
+
 					IF TraceProcessHook # NIL THEN
 						bp := state.BP; pc := state.PC; sp := state.SP;
 						TraceProcessHook(SELF,pc,bp,sp,stack.high);
@@ -180,7 +180,7 @@ TYPE
 			END
 
 		END FindRoots;
-		
+
 		(*!TODO: adapt the code according to the new Modules/Reflection *)
 		PROCEDURE FindPointers(bp, pc : ADDRESS; VAR diff0, diff1: SIZE);
 		(*VAR data: Modules.ProcTableEntry; startIndex, i: LONGINT; ptr : ADDRESS; success: BOOLEAN;
@@ -835,16 +835,16 @@ BEGIN
 			processingIRQ[state.INT-MinIRQ] := TRUE;
 		END;
 	END;
-	
+
 	(* if the reenabling of interrupts cannot be circumvented, then it is REQUIRED to acknowledge interrupts
 		BEFORE reenabling. Otherwise spurious IRQs cannot be identified as such.
 		Please note that this particular problem with spurious IRQs cannot observed on many machines but IF it is observed
 		then the machine will behave unexpected. Very hard to debug and trace!
 
-		Machine.Ack(state.INT); 
+		Machine.Ack(state.INT);
 		Machine.Sti ();	(* avoid Processors.StopAll deadlock when waiting for locks below (remove this) *)
 	*)
-	
+
 	Machine.Acquire(Machine.Objects);
 	(*IF state.INT = 53 THEN Trace.String("|") END;*)
 	t := interrupt[state.INT-MinIRQ].process;
@@ -1153,7 +1153,7 @@ BEGIN
 END TerminateThis;
 
 (* called by WMProcessInfo to obtain the current state of a running process *)
-PROCEDURE UpdateProcessState*( p: Process );	
+PROCEDURE UpdateProcessState*( p: Process );
 BEGIN
 	(*  update p.stat.{PC,BP,SP}  *)
 END UpdateProcessState;

+ 1 - 1
source/ARM.Traps.Mod

@@ -96,7 +96,7 @@ CONST
 	ExceptionRaisedDesc = "exception";
 	ProcessResurrectedDesc = "process resurrected";
 	RecursiveExclusiveDesc = "recursive entrance in EXCLUSIVE section";
-	AwaitOutsideExclusiveDesc = "AWAIT statement outside EXCLUSIVE section";	
+	AwaitOutsideExclusiveDesc = "AWAIT statement outside EXCLUSIVE section";
 
 TYPE
 	Variable* = RECORD	(** variable descriptor *)

+ 14 - 14
source/ARM.UsbEhci.Mod

@@ -569,7 +569,7 @@ TYPE
 			*)
 			ASSERT(pipe.descriptors[0] # 0);
 			qh := pipe.descriptors[0];
-			
+
 			(* Queue Head Horizontal Link Pointer is not set here *)
 			(* Queue Head Endpoint Capabilities 1 *)
 			nakRL := 3;
@@ -1159,8 +1159,8 @@ TYPE
 			(*Machine.FlushDCacheRange(ADDRESSOF(buffer[0]), bufferLen);*)
 			(* pipe.tdBase = pipe.descriptors[0] + 32 in UsbHcdi *)
 (*			pipe.firstTD := pipe.tdBase;
-			ASSERT(pipe.firstTD = pipe.descriptors[0] + alignQh); 
-*)			
+			ASSERT(pipe.firstTD = pipe.descriptors[0] + alignQh);
+*)
 			pipe.firstTD := pipe.tdBase - 32 + alignQh;
 			AssertAlignment(pipe.firstTD, alignQtd);
 			ASSERT(SYSTEM.VAL(SET, pipe.firstTD) * {0..4} = {}); (* qTDs must be 32byte aligned *)
@@ -1273,10 +1273,10 @@ TYPE
 			Machine.FlushDCacheRange(ADDRESSOF(buffer[offset]), bufferLen);
 			SYSTEM.PUT32(pipe.descriptors[0] + QhCurrentQtdPointer, 0);
 (*			pipe.firstTD := pipe.tdBase;
-			ASSERT(pipe.firstTD = pipe.descriptors[0] + alignQh); 
+			ASSERT(pipe.firstTD = pipe.descriptors[0] + alignQh);
 *)
 			pipe.firstTD :=  pipe.tdBase - 32 + alignQh;
-			
+
 			AssertAlignment(pipe.firstTD, alignQtd);
 			ASSERT(pipe.firstTD MOD alignQtd = 0);
 			ASSERT(SYSTEM.VAL(SET, pipe.firstTD) * {0..4} = {}); (* qTDs must be 32byte aligned *)
@@ -1440,7 +1440,7 @@ TYPE
 				SYSTEM.PUT32(qtd + QtdExtBufferPtr4, 0);*)
 			END;
 			(*Machine.FlushDCacheRange(curr, sizeQtd);*)
-	
+
 			(* Setup phase always starts with dataToggle = FALSE, so now it must be TRUE *)
 			pipe.dataToggle := TRUE;
 
@@ -1949,7 +1949,7 @@ TYPE
 				(* The HC hasn't yet executed the transaction *)
 				RETURN
 			END;*)
-			(*! 
+			(*!
 				Disabling scheduling here leads to problems: some of the transfers does not get finished!
 			*)
 			(*REPEAT UNTIL (SYSTEM.VAL(SET, qh.token) * TdActive = {}) OR (SYSTEM.GET32(iobase + HcAsyncListAddr) # qh);*)
@@ -2509,16 +2509,16 @@ TYPE
 	  	 *)
 		PROCEDURE Start * ():BOOLEAN;
 		VAR dword : SET;
-		TYPE 
+		TYPE
 			IRQPoller = OBJECT (* support polling i/o IRQ -- for testing *)
 				VAR handler: PROCEDURE {DELEGATE}; timer: Kernel.Timer;
-				
+
 				PROCEDURE & Init* (h: PROCEDURE {DELEGATE});
 				BEGIN
 					handler := h;
-					NEW(timer); 
+					NEW(timer);
 				END Init;
-				
+
 			BEGIN{ACTIVE}
 				LOOP
 					handler();
@@ -2529,7 +2529,7 @@ TYPE
 		BEGIN
 			IF Debug.Trace & Debug.traceInit THEN KernelLog.String("UsbEhci: Starting host controller... "); KernelLog.Ln; END;
 			(* Enable Interrupts *)
-			
+
 			IF Polling THEN
 				NEW(is, InterruptHandler)
 			ELSE
@@ -2538,7 +2538,7 @@ TYPE
 
 			(* Clear interrupts *)
 			SYSTEM.PUT32(iobase + HcUsbSts, 0);
-			
+
 			(* Enable all interrupts except the frame list rollover interrupt *)
 			dword := SYSTEM.VAL(SET, SYSTEM.GET32(iobase + HcUsbIntr));
 			interruptsEnabled := dword + {0..5}  - StsFrameListRollover;
@@ -2829,7 +2829,7 @@ BEGIN
 		next := sgList[idx].adr + size
 	END;
 	RETURN next
-END AdvancePhysBuf;	
+END AdvancePhysBuf;
 
 PROCEDURE Indent(spaces : LONGINT);
 VAR i : LONGINT;

+ 31 - 31
source/ARM.UsbHidDriver.Mod

@@ -47,8 +47,8 @@ CONST
 	MouseSpeed = 50;
 	MouseWheelSpeed = 3;
 	MouseAcceleration = 0;
-	
-	
+
+
 
 TYPE
 
@@ -74,7 +74,7 @@ TYPE
 		prevx, prevy: LONGINT;
 		prevkeys: SET;
 		prevTip: BOOLEAN;
-		tipTime: LONGINT; 
+		tipTime: LONGINT;
 	END;
 
 	(*Handling keyboard devices*)
@@ -428,7 +428,7 @@ TYPE
 		consumerState			: ConsumerState;
 		joystickState			: JoystickState;
 		useReportIDMechanism	: BOOLEAN;
-		
+
 		recentStatus: Usbdi.Status;
 
 		(*
@@ -533,7 +533,7 @@ TYPE
 			RETURN TRUE;
 		END Connect;
 
-		
+
 
 		(*called when detaching a usb hid device*)
 		PROCEDURE Disconnect;
@@ -680,22 +680,22 @@ TYPE
 		BEGIN
 			RETURN touchscreenState # NIL
 		END IsTouchscreen;
-		
+
 		PROCEDURE GetPipeStatus*(): Usbdi.Status;
 		VAR len: LONGINT;
 		BEGIN
-			IF pipe # NIL THEN RETURN pipe.GetStatus(len) 
+			IF pipe # NIL THEN RETURN pipe.GetStatus(len)
 			ELSE RETURN Usbdi.Error
 			END;
 		END GetPipeStatus;
-		
-		
+
+
 		PROCEDURE GetRecentStatus*(): Usbdi.Status;
 		BEGIN
 			RETURN recentStatus;
 		END GetRecentStatus;
-		
-		
+
+
 		(**
 		 * Is called by handleHidEvent when mouse device is found
 		 *)
@@ -743,38 +743,38 @@ TYPE
 		PROCEDURE HandleTouchscreenDriver;
 		VAR
 			mm : 			Inputs.AbsMouseMsg;
-			x,y: LONGINT; 
+			x,y: LONGINT;
 			displayWidth, displayHeight: LONGINT;
 		BEGIN
-			getDisplayDimensions(displayWidth, displayHeight); 
+			getDisplayDimensions(displayWidth, displayHeight);
 			x := (touchscreenState.x.usageValue-touchscreenState.minX) * displayWidth DIV (touchscreenState.maxX-touchscreenState.minX +1);
 			y := (touchscreenState.y.usageValue-touchscreenState.minY) * displayHeight DIV  (touchscreenState.maxY -touchscreenState.minY + 1);
-			
+
 			(*
 			TRACE(touchscreenState.inRange.usageValue);
-			IF touchscreenState.confidence # NIL THEN 
+			IF touchscreenState.confidence # NIL THEN
 				TRACE(touchscreenState.confidence.usageValue);
 			END;
 			*)
-			
-			IF (touchscreenState.tipSwitch.usageValue#0) THEN 
+
+			IF (touchscreenState.tipSwitch.usageValue#0) THEN
 				IF (touchConfidenceDelay#0) & ~touchscreenState.prevTip THEN
 					touchscreenState.tipTime := Kernel.GetTicks();
 					touchscreenState.prevTip := TRUE
 				ELSIF (touchConfidenceDelay =0) OR (Kernel.GetTicks()-touchscreenState.tipTime > touchConfidenceDelay) THEN
-					mm.keys := mm.keys + {0}; 
+					mm.keys := mm.keys + {0};
 				END
 			ELSE
 				touchscreenState.prevTip := FALSE;
 			END;
-			
-			
+
+
 			mm.x := x; mm.y := y;
 
 			IF ~(0 IN mm.keys) THEN (* up event  *)
 				touchscreenState.prev := FALSE;
-				(* 
-					There are touchscreen devices that report a (0,0) coordinate with up-events. 
+				(*
+					There are touchscreen devices that report a (0,0) coordinate with up-events.
 					This does not work well together with an external mouse.
 					We keep the coordinate for the time being -- with the side effect that there may be a pointer-over status after a touchscreen click
 				*)
@@ -1222,13 +1222,13 @@ TYPE
 				touchscreenState.maxY := temp.logicalMaximum;
 				touchscreenState.tipSwitch := reportManager.GetUsage(0DH, 042H, mouseCollection,temp);
 				touchscreenState.inRange := reportManager.GetUsage(0DH, 032H, mouseCollection,temp);
-				touchscreenState.confidence := reportManager.GetUsage(0DH, 047H, mouseCollection, temp); 
+				touchscreenState.confidence := reportManager.GetUsage(0DH, 047H, mouseCollection, temp);
 				KernelLog.String("Touchscreen device registered with ");
-				KernelLog.String("minX = "); KernelLog.Int(touchscreenState.minX,1); 
-				KernelLog.String(", maxX = "); KernelLog.Int(touchscreenState.maxX,1); 
-				KernelLog.String(", minY = "); KernelLog.Int(touchscreenState.minY,1); 
-				KernelLog.String(", maxY = "); KernelLog.Int(touchscreenState.maxY,1); 
-				IF touchscreenState.confidence # NIL THEN KernelLog.String(", confidence"); END; 
+				KernelLog.String("minX = "); KernelLog.Int(touchscreenState.minX,1);
+				KernelLog.String(", maxX = "); KernelLog.Int(touchscreenState.maxX,1);
+				KernelLog.String(", minY = "); KernelLog.Int(touchscreenState.minY,1);
+				KernelLog.String(", maxY = "); KernelLog.Int(touchscreenState.maxY,1);
+				IF touchscreenState.confidence # NIL THEN KernelLog.String(", confidence"); END;
 				KernelLog.Ln;
 				RETURN TRUE;
 			ELSE
@@ -1570,7 +1570,7 @@ END Cleanup;
 PROCEDURE Install*;
 END Install;
 
-TYPE 
+TYPE
 	DimensionGetter= PROCEDURE {DELEGATE} (VAR w,h: LONGINT);
 VAR
 	getDisplayDimensions: DimensionGetter;
@@ -1585,7 +1585,7 @@ PROCEDURE InstallDisplayDimensions*(poller: DimensionGetter); (* for touchscreen
 BEGIN
 	IF poller # NIL THEN
 		getDisplayDimensions := poller;
-	ELSE 
+	ELSE
 		getDisplayDimensions := DefaultDisplayDimensions;
 	END;
 END InstallDisplayDimensions;
@@ -1599,7 +1599,7 @@ BEGIN
 	IF s[0] # 0X THEN
 		p := 0;  touchConfidenceDelay := Machine.StrToInt(p, s)
 	ELSE
-		touchConfidenceDelay := 0; 
+		touchConfidenceDelay := 0;
 	END;
 	Usbdi.drivers.Add(Probe, Name, Description, 10);
 END Setup;

+ 1 - 1
source/ARM.UsbMouse.Mod

@@ -140,4 +140,4 @@ BEGIN
 	Usbdi.drivers.Add(Probe, Name, Description, 10)
 END UsbMouse.
 
-UsbMouse.Install ~  System.Free UsbMouse ~ 
+UsbMouse.Install ~  System.Free UsbMouse ~

+ 29 - 29
source/ARM.UsbVarTdAlloc.Mod

@@ -36,7 +36,7 @@ TYPE
 		BEGIN
 			INCL(used[block DIV SetSize], block MOD SetSize);
 		END SetUsed;
-		
+
 		(* faster version of SetUsed for blocks
 		PROCEDURE SetUsedR(from, to: LONGINT);
 		VAR startSet, stopSet, startBit, stopBit: LONGINT;
@@ -51,7 +51,7 @@ TYPE
 				INC(startSet);
 				WHILE startSet < stopSet DO
 					used[startSet] := {MIN(SET)..MAX(SET)};
-					INC(startSet); 
+					INC(startSet);
 				END;
 				used[stopSet] := used[stopSet] + {MIN(SET) .. stopBit};
 			ELSE
@@ -59,7 +59,7 @@ TYPE
 			END;
 		END SetUsedR;
 		*)
-				
+
 		PROCEDURE SetFree(block: LONGINT);
 		BEGIN
 			EXCL(used[block DIV SetSize], block MOD SetSize);
@@ -79,7 +79,7 @@ TYPE
 				INC(startSet);
 				WHILE startSet < stopSet DO
 					used[startSet] := {};
-					INC(startSet); 
+					INC(startSet);
 				END;
 				used[stopSet] := used[stopSet] - {MIN(SET) .. stopBit};
 			ELSE
@@ -87,16 +87,16 @@ TYPE
 			END;
 		END SetFreeR;
 		*)
-		
+
 
 	END TdBuffer;
 
 	(**
 		Allocator.
-		
+
 		The allocator is created with a page size and a block size. It can then allocate memory blocks with a granularity of the block size.
 		Each allocated block is guaranteed not to cross a page boundary.
-		
+
 		Allocated blocks must be freed manually.
 	*)
 	CONST SetSize = SIZEOF(SET) * 8;
@@ -121,7 +121,7 @@ TYPE
 			buf: TdBuffer;
 			start, pos, count: LONGINT;
 			adr: ADDRESS;
-			
+
 			(** Allocate a new TD buffer and mark as used the last 32-byte block before a 4kB page boundary. *)
 			PROCEDURE AllocateBuffer;
 			VAR
@@ -147,17 +147,17 @@ TYPE
 				LOOP
 					IF count >= AllocSize DIV blockSize THEN EXIT END;
 					IF (ADDRESSOF(buf.buffer[buf.ofs + count * blockSize]) MOD pageSize) = pageSize - blockSize THEN
-						buf.SetUsed(count); 
+						buf.SetUsed(count);
 					END;
 					INC(count)
 				END;
 			END AllocateBuffer;
 
-			
+
 		BEGIN {EXCLUSIVE}
 			ASSERT(size MOD blockSize = 0);
 			size := size DIV blockSize;
-			
+
 			buf := tdBuffers;
 			LOOP
 				IF buf = NIL THEN
@@ -167,35 +167,35 @@ TYPE
 				END;
 				count := 0;
 				pos := 0;
-				start := pos;  
+				start := pos;
 				WHILE (count < size) & (pos < bitmaskSize) DO
 					IF buf.Used(pos) THEN
-						count := 0; 
+						count := 0;
 						start := pos + 1;
 					ELSE
 						INC(count);
 					END;
-					INC(pos); 
-				END; 
+					INC(pos);
+				END;
 
 				IF count = size THEN EXIT END;
 				buf := buf.next
 			END;
-			
+
 			ASSERT(buf # NIL);
 
 			adr := ADDRESSOF(buf.buffer[buf.ofs + start*blockSize]);
-			
+
 			(* faster version:
 			buf.SetUsedR(start, start+count-1);
 			*)
 			WHILE(count > 0) DO
-				ASSERT(~buf.Used(start)); 
-				buf.SetUsed(start); 
-				INC(start); DEC(count); 
+				ASSERT(~buf.Used(start));
+				buf.SetUsed(start);
+				INC(start); DEC(count);
 			END;
 			Machine.Fill32(adr, size * blockSize, 0);
-			RETURN adr; 
+			RETURN adr;
 		END Allocate;
 
 		(** Marks a TD as free, so that its memory can be used again *)
@@ -206,7 +206,7 @@ TYPE
 			slot: LONGINT;
 		BEGIN {EXCLUSIVE}
 			ASSERT(size MOD blockSize = 0);
-			size := size DIV blockSize; 
+			size := size DIV blockSize;
 
 			buf := tdBuffers;
 			LOOP
@@ -221,10 +221,10 @@ TYPE
 			(* faster version:
 			buf.SetFreeR(slot, slot+size-1);
 			*)
-			WHILE (size > 0) DO 
+			WHILE (size > 0) DO
 				ASSERT(buf.Used(slot));
 				buf.SetFree(slot);
-				INC(slot); DEC(size); 
+				INC(slot); DEC(size);
 			END;
 		END Free;
 	END Allocator;
@@ -265,12 +265,12 @@ VAR allocator: UsbVarTdAlloc.Allocator; adr: POINTER TO ARRAY OF ADDRESS;
 gen: Random.Generator; i,j, k: LONGINT; size: POINTER TO ARRAY OF SIZE;
 BEGIN
 	NEW(allocator, 4096, 32);
-	NEW(gen); 
+	NEW(gen);
 	NEW(adr, 1024); NEW(size, 1024);
 	FOR j := 0 TO 100 DO
 		FOR i := 0 TO LEN(adr)-1  DO
 			size[i] := 32+gen.Dice(120)*32;
-			adr[i] := allocator.Allocate(size[i]); 
+			adr[i] := allocator.Allocate(size[i]);
 			ASSERT(adr[i] MOD 32 = 0);
 			ASSERT(adr[i] DIV 4096 = (adr[i] + size[i]) DIV 4096);
 			FOR k := 0 TO i-1 DO
@@ -278,14 +278,14 @@ BEGIN
 			END;
 		END;
 		FOR i := 0 TO LEN(adr)-1 DO
-			allocator.Free(adr[i], size[i]); 
+			allocator.Free(adr[i], size[i]);
 		END;
-		TRACE(j); 
+		TRACE(j);
 	END;
 	TRACE("done");
 END Test;
 
-	
+
 
 END TestUsbVarTdAlloc.
 

+ 1 - 1
source/ARM.Usbdi.Mod

@@ -214,7 +214,7 @@ TYPE
 		maxPacketSize* : LONGINT;
 
 		mode* : LONGINT;
-		
+
 		(** Transfer 'bufferLen' bytes from/to the specified buffer, starting at 'offset' *)
 
 		PROCEDURE Transfer*(bufferLen, offset : LONGINT; VAR buffer : Buffer) : Status;

+ 49 - 49
source/ASN1.Mod

@@ -21,46 +21,46 @@ ASN1Context*=2;
 ASN1Private*=3;
 
 (*
-BER_TAG_UNKNOWN 0 
-BER_TAG_BOOLEAN 1 
-BER_TAG_INTEGER 2 
-BER_TAG_BIT_STRING 3 
-BER_TAG_OCTET_STRING 4 
-BER_TAG_NULL 5 
-BER_TAG_OID 6 
-BER_TAG_OBJECT_DESCRIPTOR 7 
-BER_TAG_EXTERNAL 8 
-BER_TAG_REAL 9 
+BER_TAG_UNKNOWN 0
+BER_TAG_BOOLEAN 1
+BER_TAG_INTEGER 2
+BER_TAG_BIT_STRING 3
+BER_TAG_OCTET_STRING 4
+BER_TAG_NULL 5
+BER_TAG_OID 6
+BER_TAG_OBJECT_DESCRIPTOR 7
+BER_TAG_EXTERNAL 8
+BER_TAG_REAL 9
 BER_TAG_ENUMERATED 10
-  12 to 15 are reserved for future versions of the recommendation 
+  12 to 15 are reserved for future versions of the recommendation
 BER_TAG_PKIX_UTF8_STRING 12
-BER_TAG_SEQUENCE 16 
+BER_TAG_SEQUENCE 16
 BER_TAG_SET 17
-BER_TAG_NUMERIC_STRING 18 
-BER_TAG_PRINTABLE_STRING 19 
-BER_TAG_T61_STRING 20 
-BER_TAG_TELETEX_STRING BER_TAG_T61_STRING 
-BER_TAG_VIDEOTEX_STRING 21 
+BER_TAG_NUMERIC_STRING 18
+BER_TAG_PRINTABLE_STRING 19
+BER_TAG_T61_STRING 20
+BER_TAG_TELETEX_STRING BER_TAG_T61_STRING
+BER_TAG_VIDEOTEX_STRING 21
 BER_TAG_IA5_STRING 22
-BER_TAG_UTC_TIME 23 
+BER_TAG_UTC_TIME 23
 BER_TAG_GENERALIZED_TIME 24
-BER_TAG_GRAPHIC_STRING 25 
-BER_TAG_ISO646_STRING 26 
-BER_TAG_GENERAL_STRING 27 
+BER_TAG_GRAPHIC_STRING 25
+BER_TAG_ISO646_STRING 26
+BER_TAG_GENERAL_STRING 27
 BER_TAG_VISIBLE_STRING BER_TAG_ISO646_STRING
- 28 - are reserved for future versions of the recommendation 
-BER_TAG_PKIX_UNIVERSAL_STRING 28 
-BER_TAG_PKIX_BMP_STRING 30 
+ 28 - are reserved for future versions of the recommendation
+BER_TAG_PKIX_UNIVERSAL_STRING 28
+BER_TAG_PKIX_BMP_STRING 30
 *)
 
 Boolean* =1H;
 Integer* =2H;
 BitString* =3H;
 (*
-BIT STRING: BER encoding. Primitive or constructed. 
-In a primitive encoding, the first contents octet gives the number of bits by which the length of the bit string 
-is less than the next multiple of eight (this is called the "number of unused bits"). 
-The second and following contents octets give the value of the bit string, converted to an octet string. 
+BIT STRING: BER encoding. Primitive or constructed.
+In a primitive encoding, the first contents octet gives the number of bits by which the length of the bit string
+is less than the next multiple of eight (this is called the "number of unused bits").
+The second and following contents octets give the value of the bit string, converted to an octet string.
 The conversion process is as follows:
      1.   The bit string is padded after the last bit with zero to seven bits of any value to make the length
           of the bit string a multiple of eight. If the  length of the bit string is a multiple of eight
@@ -120,20 +120,20 @@ TYPE Triplet* = OBJECT (* todo: 1 Byte tags are sufficient for certificates, but
 				unusedbits*:LONGINT;
 				constructed*:BOOLEAN;
 				definite*: BOOLEAN;
-				
+
 				bvalue*:BOOLEAN;
 				ivalue*:LONGINT;
 				svalue*:POINTER TO ARRAY OF CHAR;
-				
+
 				child*, curchild:Triplet;
 				next*:Triplet;
 				level*:LONGINT; (*pretty print*)
-				
+
 			PROCEDURE AppendChild*(t:Triplet);
 			BEGIN
 				IF child=NIL THEN child:=t; curchild:=t ELSE curchild.next:=t; curchild:=t; END;
 			END AppendChild;
-			
+
 			PROCEDURE Print*(w: Streams.Writer);
 			VAR i:LONGINT;
 			BEGIN
@@ -141,7 +141,7 @@ TYPE Triplet* = OBJECT (* todo: 1 Byte tags are sufficient for certificates, but
 				FOR i:=0 TO level-1 DO w.String("- "); END;
 				w.Hex(tag,4); w.String("H[");
 				w.Int(length,0); w.String("]");
-				CASE tag OF 
+				CASE tag OF
 				| Boolean: IF bvalue THEN w.String("true") ELSE w.String("false") END;
 				| Integer: IF length<=4 THEN w.Int(ivalue,0);ELSE PrintHexString(w,svalue^) END;
 				| Oid: PrintNumericString(w, svalue^); w.String("  "); PrintHexString(w, svalue^);
@@ -149,22 +149,22 @@ TYPE Triplet* = OBJECT (* todo: 1 Byte tags are sufficient for certificates, but
 				| UTCTime: PrintString(w,svalue^);
 				| BitString: w.Char("("); w.Int(unusedbits,0); w.Char(")"); IF svalue#NIL THEN PrintHexString(w, svalue^) END;
 				| Sequence, Set:
-				ELSE 
+				ELSE
 					IF svalue#NIL THEN PrintHexString(w,svalue^);END;
 				END;
 				w.Ln;
 			END Print;
 		END Triplet;
-		
+
 VAR log*: Streams.Writer;
-		
+
 PROCEDURE PrintHexString*(w:Streams.Writer; CONST s: ARRAY OF CHAR);
 CONST hex="0123456789ABCDEF";
 VAR i:LONGINT; c:CHAR;
 BEGIN
 	FOR i:=0 TO LEN(s)-1 DO
 		c:=s[i];
-		w.Char(hex[ORD(c) DIV 16]); 
+		w.Char(hex[ORD(c) DIV 16]);
 		w.Char(hex[ORD(c) MOD 16]);
 		w.Char(" ");
 	END;
@@ -210,7 +210,7 @@ BEGIN
 	IF ORD(c)<128 THEN t.length:=ORD(c); t.definite:=TRUE;
 	ELSIF ORD(c)=128 THEN t.definite:=FALSE;
 	(* to do: class=0, length=0 is used to encode end of bit stream of undefined length, see ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc*)
-	ELSE 
+	ELSE
 		lengthbytes:= ORD(c) MOD 128; t.definite:=TRUE;
 		FOR i:=0 TO lengthbytes-1 DO (* read all length bytes here ...*)
 			t.length:=256*t.length;
@@ -220,30 +220,30 @@ BEGIN
 	END;
 	CASE t.tag OF
 	| Boolean: reader.Char(c);INC(len); t.bvalue:=c#0X;
-	| Integer: 
-		IF t.length<=4 THEN 
-			 NEW(t.svalue,t.length); 
-			 FOR i:=0 TO t.length-1 DO 
+	| Integer:
+		IF t.length<=4 THEN
+			 NEW(t.svalue,t.length);
+			 FOR i:=0 TO t.length-1 DO
 					t.ivalue:=256*t.ivalue;
 					reader.Char(c); INC(len);
 					t.svalue[i]:=c;
 					t.ivalue:=t.ivalue+ORD(c);
 			END;
 		ELSE
-			NEW(t.svalue,t.length); 
+			NEW(t.svalue,t.length);
 			reader.Bytes(t.svalue^,0,t.length,len0); len:=len+len0;
 		END;
-	| BitString: 
+	| BitString:
 		reader.Char(c); t.unusedbits:=ORD(c); INC(len);
 		IF FALSE & (ORD(reader.Peek())=30H) (*rsa bit string 1024b*) THEN (*unreliable hack. to do: pass info about recursive bitstring to child*)
 			IF Trace & (log#NIL) THEN log.String("(BitSRec  "); log.Int(len,0); log.String(")");t.Print(log);  END;
 			t.child:=Decode(reader,level+1, len0);  len:=len+len0;
 		ELSE
-			NEW(t.svalue,t.length-1); 
+			NEW(t.svalue,t.length-1);
 			IF t.length>0 THEN reader.Bytes(t.svalue^,0,t.length-1,len0); len:=len+len0; END;
 		END;
 	| String:
-		NEW(t.svalue,t.length); 
+		NEW(t.svalue,t.length);
 		reader.Bytes(t.svalue^,0,t.length,len0);len:=len+len0;
 	| Set:
 		IF Trace & (log#NIL) THEN log.String("(Set  "); log.Int(len,0); log.String("+)"); t.Print(log); END; (*bytes not including body*)
@@ -256,13 +256,13 @@ BEGIN
 			t.AppendChild(t1);
 		END;
 	ELSE
-		NEW(t.svalue,t.length); 
+		NEW(t.svalue,t.length);
 		IF t.length>0 THEN reader.Bytes(t.svalue^,0,t.length,len0); len:=len+len0; END;
 	END;
 	IF Trace & (log#NIL) THEN
 		CASE t.tag OF
 		| Integer: log.String("(Integer  "); log.Int(len,4); log.Char(")"); t.Print(log);(*bytes including header*)
-		| BitString: 
+		| BitString:
 			IF t.constructed THEN log.String("(constrBitString "); ELSE log.String("(BitString "); END;
 			log.Int(len,4); log.Char(")"); t.Print(log); (*bytes including header*)
 		| String: log.String("(String   ");log.Int(len,4); log.Char(")"); t.Print(log);(*bytes including header*)
@@ -270,7 +270,7 @@ BEGIN
 		| Oid: log.String("(OID");log.Int(len,4); log.Char(")"); t.Print(log);(*bytes including header*)
 		| PrintableString: log.String("(Printable");log.Int(len,4); log.Char(")"); t.Print(log);(*bytes including header*)
 		| UTCTime: log.String("(UTCTime");log.Int(len,4); log.Char(")"); t.Print(log);(*bytes including header*)
-		| Set: 
+		| Set:
 		| Sequence:
 		ELSE log.String("(t.tag="); log.Hex(t.tag,4);log.Int(len,4); log.Char(")"); t.Print(log); (*bytes including header*)
 		END;

+ 1 - 1
source/AcStreamVideoOut.Mod

@@ -21,7 +21,7 @@ type
 	Controller* = record
 		cfg-: port out; (** configuration port *)
 		enabled-: boolean; (** TRUE if the PWM output is enabled *)
-		
+
 		pixelClock-: real; (** pixel clock in Hz *)
 
 		horizActiveSize-: longint;

+ 17 - 17
source/Activities.Mod

@@ -428,11 +428,11 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 END EnqueueWaiting;
 
 PROCEDURE  ReturnToStackSegment*;
-VAR 
+VAR
 	stackFrame {UNTRACED}: BaseTypes.StackFrame;
-	currentActivity {UNTRACED}: Activity; 
+	currentActivity {UNTRACED}: Activity;
 	newStack {UNTRACED}: Stack;
-	stackRecord {UNTRACED}: StackRecord; 
+	stackRecord {UNTRACED}: StackRecord;
 BEGIN{UNCOOPERATIVE, UNCHECKED}
 	(* old stack pointer and base pointer have been pushed again, we have to revert this *)
 	stackFrame := SYSTEM.GetFramePointer();
@@ -460,24 +460,24 @@ END ReturnToStackSegment0;
 
 (** Expands the stack memory of the current activity to include the specified stack address and returns the new stack pointer to be set after the call. *)
 PROCEDURE ExpandStack- (address: ADDRESS; parSize: SIZE): ADDRESS;
-VAR 
-	currentActivity {UNTRACED}: Activity; 
+VAR
+	currentActivity {UNTRACED}: Activity;
 	varSize, minSize, newSize: SIZE;  sp: ADDRESS;
-	newStack {UNTRACED}: POINTER {DISPOSABLE} TO ARRAY OF CHAR; 
+	newStack {UNTRACED}: POINTER {DISPOSABLE} TO ARRAY OF CHAR;
 	stackFrame {UNTRACED}, previousFrame {UNTRACED}, newFrame {UNTRACED}: BaseTypes.StackFrame;
 	stackRecord{UNTRACED}, newStackRecord{UNTRACED}: StackRecord;
 BEGIN {UNCOOPERATIVE, UNCHECKED}
 	(* check for valid argument *)
 	currentActivity := SYSTEM.GetActivity ()(Activity);
-	
+
 	stackFrame := SYSTEM.GetFramePointer ();
 	previousFrame := stackFrame.previous;
 	varSize := stackFrame.previous - address;
-	
+
 	(*
 	TRACE(SYSTEM.GetFramePointer(), address, varSize, parSize, size, stackFrame.caller);
 	*)
-	ASSERT(varSize >= 0); 
+	ASSERT(varSize >= 0);
 	ASSERT(parSize >= 0);
 
 	newSize := LEN (currentActivity.stack); (* current stack size *)
@@ -486,20 +486,20 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 	ASSERT (newSize <= MaximumStackSize);
 	stackRecord := ADDRESS OF currentActivity.stack[0];
 	newStack := stackRecord.next;
-	IF (newStack = NIL) OR (LEN(newStack) < newSize) THEN 
-		NEW (newStack, newSize); 
+	IF (newStack = NIL) OR (LEN(newStack) < newSize) THEN
+		NEW (newStack, newSize);
 		ASSERT (newStack # NIL);
 		newStackRecord := ADDRESS OF newStack[0];
 		newStackRecord.prev := currentActivity.stack;
 		newStackRecord.next := NIL;
 		stackRecord.next := newStack;
-	ELSE 
+	ELSE
 		newStackRecord := ADDRESS OF newStack[0];
 		ASSERT(newStackRecord.prev = currentActivity.stack);
 		ASSERT(stackRecord.next = newStack);
 	END;
-	newSize := LEN(newStack); 
-	newFrame := ADDRESS OF newStack[0] + newSize- parSize -  3*SIZE OF ADDRESS; 
+	newSize := LEN(newStack);
+	newFrame := ADDRESS OF newStack[0] + newSize- parSize -  3*SIZE OF ADDRESS;
 	newFrame.previous := stackFrame.previous;
 	newFrame.descriptor := previousFrame.descriptor;
 	newFrame.caller := ReturnToStackSegment0;
@@ -507,12 +507,12 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 
 	stackFrame.previous := newFrame;
 	SYSTEM.MOVE(ADDRESS OF previousFrame.caller + SIZE OF ADDRESS, ADDRESS OF newFrame.caller + SIZE OF ADDRESS, parSize); (* copy parameters *)
-		
-	sp := ADDRESSOF(newFrame.descriptor) - varSize; 
+
+	sp := ADDRESSOF(newFrame.descriptor) - varSize;
 	DISPOSE (currentActivity.stack); currentActivity.stack := newStack;
 	currentActivity.stackLimit := ADDRESS OF newStack[SafeStackSize + 3 * SIZE OF ADDRESS];
 
-	RETURN sp; 
+	RETURN sp;
 END ExpandStack;
 
 (** Returns whether the specified address corresponds to a local variable that resides on the stack of the current activity calling this procedure. *)

+ 68 - 68
source/AdaptiveHuffman.Mod

@@ -8,25 +8,25 @@ CONST
 	AlphabetSize = 256;		(* byte *)
 	BlockSize* = 8*1024;
 	ScaleLimit = 4*1024;
-	
+
 	Encode = 0;  Decode = 1;
 
-TYPE	
+TYPE
 	BitReader = OBJECT
 		VAR
 			in: Streams.Reader;
 			curByte, curBit: LONGINT;
-			
+
 			PROCEDURE &New( r: Streams.Reader );
 			BEGIN
 				in := r;  curBit := -1;  curByte := 0
 			END New;
-			
+
 			PROCEDURE Initialize;
 			BEGIN
 				curBit := -1;  curByte := 0
 			END Initialize;
-			
+
 			PROCEDURE Bit( ): LONGINT;
 			VAR
 				bit: LONGINT;  ch: CHAR;
@@ -38,21 +38,21 @@ TYPE
 				DEC( curBit );
 				RETURN bit
 			END Bit;
-	
+
 	END BitReader;
-	
+
 
 TYPE
 	BitWriter = OBJECT
 		VAR
 			out: Streams.Writer;
 			curByte, curBit: LONGINT;
-			
+
 			PROCEDURE &New( w: Streams.Writer );
 			BEGIN
 				out := w;  curBit := 0;  curByte := 0
 			END New;
-			
+
 			PROCEDURE Bit( bit: LONGINT );
 			BEGIN
 				curByte := 2*curByte + bit;
@@ -61,20 +61,20 @@ TYPE
 					out.Char( CHR( curByte ) );  curByte := 0;  curBit := 0
 				END
 			END Bit;
-		
+
 			PROCEDURE Finish;	(* flush last few bits *)
 			BEGIN
 				WHILE curBit # 0 DO  Bit( 0 )  END;
 				out.Update
 			END Finish;
-				
+
 	END BitWriter;
-	
-	
+
+
 
 
 TYPE
-	HuffmanCoder = OBJECT		
+	HuffmanCoder = OBJECT
 		TYPE
 			Index = INTEGER;		(* 16-bit integer to keep the table small *)
 			Pattern = INTEGER;
@@ -88,50 +88,50 @@ TYPE
 			mode: SHORTINT;	(* Encode, Decode *)
 			in: BitReader;		(* input from archive *)
 			out: BitWriter;	(* output to archive *)
-			
+
 			esc: Index;		(* the current escape node	*)
 			root: Index;         (* the root of the tree	*)
 			map: ARRAY AlphabetSize OF Index;			(* mapping of patterns to nodes	*)
 			table: ARRAY 2*AlphabetSize + 2 OF Node;	(* the Huffman tree	*)
-		
-		
-		
+
+
+
 		PROCEDURE &New( m: SHORTINT;  input: Streams.Reader;  output: Streams.Writer );
 		BEGIN
 			ASSERT( m IN {Encode, Decode} );
 			mode := m;
 			IF mode = Encode THEN  NEW( out, output )  ELSE  NEW( in, input )  END;
 		END New;
-		
+
 		PROCEDURE Initialize;
 		VAR  i: Index;
 		BEGIN
-			root := 2*AlphabetSize + 2 - 1; 
+			root := 2*AlphabetSize + 2 - 1;
 			FOR i := 0 TO root DO
 				table[i].up := 0;  table[i].down := 0;  table[i].pattern := 0;  table[i].weight := 0
 			END;
 			FOR i := 0 TO AlphabetSize - 1 DO  map[i]  := 0  END;
 			esc := root;
 			IF mode = Decode THEN  in.Initialize  END
-		END Initialize;		
-		
-		PROCEDURE Finish;	
+		END Initialize;
+
+		PROCEDURE Finish;
 		BEGIN
 			ASSERT( mode = Encode );
 			out.Finish  (* flush last few bits *)
-		END Finish;	
+		END Finish;
+
 
-		
 		PROCEDURE GetPattern(  ): Pattern;
 		VAR  i: INTEGER;  patt: Pattern;
 		BEGIN
-			patt := 0; 
+			patt := 0;
 			FOR i := 0 TO 7 DO
 				IF in.Bit() = 1 THEN  patt := patt + INTEGER(ASH( 1, i ))  END;
 			END;
 			RETURN patt
 		END GetPattern;
-		
+
 		PROCEDURE PutPattern( patt: Pattern );
 		VAR i: LONGINT;
 		BEGIN
@@ -140,27 +140,27 @@ TYPE
 			END
 		END PutPattern;
 
-		
+
 		(* split escape node to incorporate a new pattern *)
 		PROCEDURE AddPattern( patt: Pattern ): Index;
 		VAR  pair, node: Index;
 		BEGIN
 			ASSERT( esc > 1 );
 			pair := esc;  node := esc - 1;  esc := esc - 2 ;
-			
-			table[pair].down := node;  table[pair].weight := 1;  
-			
+
+			table[pair].down := node;  table[pair].weight := 1;
+
 			table[node].up := pair;
-			table[node].down := 0;  table[node].weight := 0;  table[node].pattern := patt; 
-			
+			table[node].down := 0;  table[node].weight := 0;  table[node].pattern := patt;
+
 			table[esc].up := pair;
-			table[esc].down := 0;  table[esc].weight := 0;  
-			
+			table[esc].down := 0;  table[esc].weight := 0;
+
 			map[patt] := node;
-			
+
 			RETURN node;
-		END AddPattern;		
-		
+		END AddPattern;
+
 
 		(* swap leaf to group leader position, return pattern's new node *)
 		PROCEDURE GroupLeader( node: Index ): Index;
@@ -171,7 +171,7 @@ TYPE
 		BEGIN
 			weight := table[node].weight;  leader := node;
 			WHILE (leader < root) & (weight = table[leader + 1].weight) DO  INC( leader )  END;
-			IF leader # node THEN  
+			IF leader # node THEN
 				(* swap the leaf nodes *)
 				patt := table[node].pattern;
 				prev := table[leader].pattern;
@@ -181,8 +181,8 @@ TYPE
 				map[prev] := node;
 			END;
 			RETURN leader
-		END GroupLeader;		
-				
+		END GroupLeader;
+
 
 		(*	slide internal node up over all leaves of equal weight
 			or exchange leaf with next smaller weight internal node.
@@ -209,7 +209,7 @@ TYPE
 				map[swap.pattern] := next;
 			END;
 			RETURN next;
-		END SlideNode;		
+		END SlideNode;
 
 
 		(* increment pattern weight and re balance the tree. *)
@@ -237,20 +237,20 @@ TYPE
 				INC( table[node].weight, 2 );  up := table[node].up
 			END;
 		END IncrementWeight;
-		
-			
+
+
 		(*  scale all weights and rebalance the tree,
 		    zero weight nodes are removed from the tree	*)
 		PROCEDURE Scale;
 		VAR  node, prev: Index;  weight: INTEGER;
-		
+
 			PROCEDURE Weight( idx: Index ): INTEGER;
 			VAR w: INTEGER;
 			BEGIN
 				w := table[idx].weight;
 				IF ODD( w ) THEN  RETURN w - 1  ELSE  RETURN w  END
 			END Weight;
-			
+
 		BEGIN
 			node := esc + 1;
 			(* work up the tree from the escape node scaling weights *)
@@ -276,23 +276,23 @@ TYPE
 			(* prepare a new escape node *)
 			table[esc].down := 0;  table[esc].weight := 0;
 		END Scale;
-		
-		
-		
-	
+
+
+
+
 		PROCEDURE EncodeByte( ch: CHAR );
 		VAR
-			code, bits: LONGINT;  
+			code, bits: LONGINT;
 			cur, node: Index;  patt: Pattern;
 		BEGIN
-			patt := ORD( ch );  node := map[patt];  
-			
+			patt := ORD( ch );  node := map[patt];
+
 			(* accumulate the code bits by working up from the node to the root	*)
 			cur := node;  code := 0;  bits := 0;
 			IF cur = 0 THEN  cur := esc  END;
 			WHILE table[cur].up # 0 DO
 				IF ODD( cur ) THEN  code := code*2 + 1  ELSE  code := code*2  END;
-				INC( bits );  cur := table[cur].up	
+				INC( bits );  cur := table[cur].up
 			END;
 			(* send the code *)
 			WHILE bits > 0 DO
@@ -309,7 +309,7 @@ TYPE
 
 		PROCEDURE ExtractByte( ): CHAR;
 		VAR
-			node, down: Index; 
+			node, down: Index;
 			patt: Pattern;
 		BEGIN
 			(* work down the tree from the root until reaching either a leaf or the escape node *)
@@ -327,7 +327,7 @@ TYPE
 			IncrementWeight( node );
 			RETURN CHR( patt );
 		END ExtractByte;
-		
+
 	END HuffmanCoder;
 
 
@@ -336,16 +336,16 @@ TYPE
 	Encoder* =OBJECT
 		VAR
 			huff: HuffmanCoder;
-			
+
 			PROCEDURE & New*( archive: Streams.Writer );
 			BEGIN
 				NEW( huff, Encode, NIL, archive );
 			END New;
-			
+
 			PROCEDURE CompressBlock*( CONST source: ARRAY OF CHAR; len: LONGINT );
 			VAR  i: LONGINT;
 			BEGIN
-				huff.Initialize;	
+				huff.Initialize;
 				i := 0;
 				WHILE i < len DO
 					huff.EncodeByte( source[i] );  INC( i );
@@ -355,23 +355,23 @@ TYPE
 			END CompressBlock;
 
 	END Encoder;
-	
-	
-	
+
+
+
 TYPE
 	Decoder* =OBJECT
 		VAR
 			huff: HuffmanCoder;
-			
+
 			PROCEDURE & New*( archive: Streams.Reader );
 			BEGIN
 				NEW( huff, Decode, archive, NIL );
 			END New;
-			
+
 			PROCEDURE ExtractBlock*( VAR buf: ARRAY OF CHAR; len: LONGINT );
-			VAR  i: LONGINT; 
+			VAR  i: LONGINT;
 			BEGIN
-				huff.Initialize;  
+				huff.Initialize;
 				i := 0;
 				WHILE i < len DO
 					buf[i] := huff.ExtractByte( );  INC( i );
@@ -380,8 +380,8 @@ TYPE
 			END ExtractBlock;
 
 	END Decoder;
-	
-	
+
+
 END AdaptiveHuffman.
 
 

+ 63 - 63
source/BB.StdCoder.Mod

@@ -3,7 +3,7 @@ MODULE StdCoder; (** AUTHOR "GF"; PURPOSE "Extract sources from BlackBox standar
 IMPORT Streams, Commands, Files, Strings, Log := KernelLog;
 
 CONST
-	Tag = "StdCoder.Decode";	
+	Tag = "StdCoder.Decode";
 	Ok = Streams.Ok;
 	OldVersion = 0; ThisVersion = 1;
 	View = 1; File = 2; List = 3;
@@ -11,15 +11,15 @@ CONST
 
 TYPE
 	FileType = ARRAY 16 OF CHAR;
-	
+
 	FileList = POINTER TO RECORD
 		next: FileList;
 		oberonSource: BOOLEAN;
 		oberonDoku: BOOLEAN;
 		name: Files.FileName
 	END;
-	
-	
+
+
 VAR
 	code: ARRAY 64 OF CHAR;
 	revCode: ARRAY 256 OF SHORTINT;
@@ -29,18 +29,18 @@ VAR
 	BEGIN
 		Log.String( "### StdCoder.Decode: " );
 		CASE n OF
-		|  1: Log.String("bad characters or EOT" ); 
-		|  2: Log.String("checksum error" ); 
-		|  3: Log.String("incompatible version" ); 
-		|  4: Log.String("filing error" ); 
-		|  5: Log.String("directory ^0 not found" ); 
-		|  6: Log.String("file ^0 not found" ); 
-		|  7: Log.String("illegal path" ); 
-		|  8: Log.String("bad tag" ); 
-		|  9: Log.String("disk write protected" ); 
-		| 10: Log.String("io error" ); 
+		|  1: Log.String("bad characters or EOT" );
+		|  2: Log.String("checksum error" );
+		|  3: Log.String("incompatible version" );
+		|  4: Log.String("filing error" );
+		|  5: Log.String("directory ^0 not found" );
+		|  6: Log.String("file ^0 not found" );
+		|  7: Log.String("illegal path" );
+		|  8: Log.String("bad tag" );
+		|  9: Log.String("disk write protected" );
+		| 10: Log.String("io error" );
 		END;
-		Log.Ln	
+		Log.Ln
 	END ShowError;
 
 
@@ -54,8 +54,8 @@ VAR
 		IF res # 0 THEN  x := 0  END;
 		RETURN x
 	END read;
-	
-	
+
+
 	PROCEDURE peeknext( r: Streams.Reader ): CHAR;
 	VAR ch: CHAR;
 	BEGIN
@@ -63,9 +63,9 @@ VAR
 	END peeknext;
 
 
-	PROCEDURE ReadHeader(		r: Streams.Reader; 
+	PROCEDURE ReadHeader(		r: Streams.Reader;
 									VAR res: WORD;  VAR name: ARRAY OF CHAR;  VAR type: LONGINT );
-	VAR 
+	VAR
 		x, bits, i: LONGINT; ch: CHAR; tag: ARRAY 16 OF CHAR;
 	BEGIN
 		tag := Tag; i := 0;  res := 0;
@@ -78,11 +78,11 @@ VAR
 		IF res = 0 THEN
 			i := 0;  bits := 0;  x := 0;
 			REPEAT
-				WHILE (res = 0) & (bits < 8) DO 
-					INC( x, ASH( read( r, res ), bits ) ); INC( bits, 6 ) 
+				WHILE (res = 0) & (bits < 8) DO
+					INC( x, ASH( read( r, res ), bits ) ); INC( bits, 6 )
 				END;
 				IF res = 0 THEN
-					ch := CHR(x MOD 256);  x := x DIV 256;  DEC( bits, 8 ); 
+					ch := CHR(x MOD 256);  x := x DIV 256;  DEC( bits, 8 );
 					name[i] := ch; INC(i);
 				END
 			UNTIL (res # 0) OR (ch = 0X);
@@ -93,24 +93,24 @@ VAR
 				END
 			END
 		ELSE  res := 8
-		END 
+		END
 	END ReadHeader;
-	
-	
+
+
 	PROCEDURE SkipFileType(r: Streams.Reader; VAR res: WORD ): BOOLEAN;
-	VAR x, bits, i: LONGINT; ch: CHAR;  ftype: FileType; 
+	VAR x, bits, i: LONGINT; ch: CHAR;  ftype: FileType;
 	BEGIN
 		res := 0;  i := 0; bits := 0;  x := 0;
 		REPEAT
 			WHILE (res = 0) & (bits < 8) DO  INC( x, ASH( read( r, res ), bits ) ); INC( bits, 6 )  END;
-			IF res = 0 THEN  
-				ch := CHR( x MOD 256 );  x := x DIV 256;  DEC( bits, 8 );  ftype[i] := ch;  INC( i )  
+			IF res = 0 THEN
+				ch := CHR( x MOD 256 );  x := x DIV 256;  DEC( bits, 8 );  ftype[i] := ch;  INC( i )
 			END
 		UNTIL (res # 0) OR (ch = 0X);
 		RETURN res = 0
 	END SkipFileType;
-	
-	
+
+
 	PROCEDURE ReadInteger( r: Streams.Reader; VAR res: WORD ): LONGINT;
 	VAR bits, val: LONGINT;
 	BEGIN
@@ -118,10 +118,10 @@ VAR
 		REPEAT  val := val + ASH( read( r, res ), bits ); INC( bits, 6 )  UNTIL (res # 0) OR (bits >= 32);
 		RETURN val
 	END ReadInteger;
-	
-	
+
+
 	PROCEDURE ReadFile( r: Streams.Reader; VAR res: WORD ): Files.File;
-	VAR 
+	VAR
 		hash, x, bits, i, len, sum, s: LONGINT; byte: SHORTINT;  f: Files.File;  w: Files.Writer;
 	BEGIN
 		f := Files.New( "" );  Files.OpenWriter( w, f, 0 );
@@ -137,11 +137,11 @@ VAR
 				byte := SHORTINT( i );  x := x DIV 256;  DEC( bits, 8 );
 				table[hash] := byte
 			ELSE  (* correct prediction *)
-				byte := table[hash];  x := x DIV 2;  DEC( bits )	
+				byte := table[hash];  x := x DIV 2;  DEC( bits )
 			END;
 			hash := (16 * hash + byte MOD 256) MOD N;
 			sum := (sum + byte MOD 256) MOD (16 * 1024);
-			
+
 			w.Char( CHR( byte ) );  DEC( len );
 		END;
 		IF res = 0 THEN
@@ -151,11 +151,11 @@ VAR
 		w.Update;
 		RETURN f
 	END ReadFile;
-	
-	
+
+
 	PROCEDURE NewFile( CONST name: ARRAY OF CHAR ): Files.File;
 	VAR
-		f: Files.File;  res: WORD;  name2: Files.FileName; 
+		f: Files.File;  res: WORD;  name2: Files.FileName;
 	BEGIN
 		f := Files.Old( name );
 		IF f # NIL THEN
@@ -164,26 +164,26 @@ VAR
 		END;
 		RETURN Files.New( name );
 	END NewFile;
-	
-	
+
+
 	PROCEDURE CutSuffixODC( VAR n: Files.FileName );
 	VAR i: LONGINT
 	BEGIN
 		i := 0;  WHILE n[i] # 0X DO  INC(i)  END;
-		IF (i > 4) & (n[i -4] = ".") & (CAP(n[i-3]) = "O") & (CAP(n[i-2]) = "D") & (CAP(n[i-1]) = "C") THEN 
+		IF (i > 4) & (n[i -4] = ".") & (CAP(n[i-3]) = "O") & (CAP(n[i-2]) = "D") & (CAP(n[i-1]) = "C") THEN
 			n[i - 4] := 0X
 		END;
 	END CutSuffixODC;
-	
-	
+
+
 	PROCEDURE PositionReader( VAR r: Files.Reader; str: ARRAY OF CHAR );
-	VAR pos, i: LONGINT; c: CHAR; 
+	VAR pos, i: LONGINT; c: CHAR;
 	BEGIN
 		pos := 0;
 		LOOP
 			r.SetPos( pos );
 			REPEAT r.Char( c ); INC( pos )  UNTIL (c = str[0]) OR (r.res # Ok);
-			i := 1; 
+			i := 1;
 			LOOP
 				IF r.res = Ok THEN  r.Char( c )  ELSE (*failed*) r.SetPos( 0 );  RETURN  END;
 				IF c # str[i] THEN  (*try again*)  EXIT  END;
@@ -192,26 +192,26 @@ VAR
 			END
 		END
 	END PositionReader;
-	
-	
+
+
 	PROCEDURE ExtractAscii( src: Files.File;  CONST startstring, destname: ARRAY OF CHAR );
 	CONST CR = 0DX; LF = 0AX;  HT = 09X;
 	VAR r: Files.Reader; w: Files.Writer; destfile: Files.File; ch: CHAR;
 	BEGIN
-		Log.String( "extract: " ); Log.String( destname ); Log.Ln; 
+		Log.String( "extract: " ); Log.String( destname ); Log.Ln;
 		destfile := NewFile( destname );  Files.OpenWriter( w, destfile, 0 );
-		Files.OpenReader( r, src, 0 );  PositionReader( r, startstring );  
+		Files.OpenReader( r, src, 0 );  PositionReader( r, startstring );
 		r.Char( ch );
 		REPEAT
 			IF (ch = CR) OR (ch = LF) THEN  w.Ln
-			ELSIF ((ch >= ' ') & (ch <= '~')) OR (ch = HT) THEN  w.Char( ch ) 
+			ELSIF ((ch >= ' ') & (ch <= '~')) OR (ch = HT) THEN  w.Char( ch )
 			END;
 			r.Char( ch )
 		UNTIL r.res # Ok;
 		w.Update;  Files.Register( destfile )
 	END ExtractAscii;
-	
-	
+
+
 	PROCEDURE DecodeFile( r: Streams.Reader; CONST name: Files.FileName );
 	VAR res: WORD; f: Files.File;
 	BEGIN
@@ -223,10 +223,10 @@ VAR
 		ELSE  ShowError( res )
 		END
 	END DecodeFile;
-	
-	
+
+
 	PROCEDURE DecodeFileList ( r: Streams.Reader; VAR res: WORD );
-	VAR 
+	VAR
 		i: LONGINT; p, files: FileList; ch: CHAR;
 		f: Files.File; fr: Files.Reader; path: Files.FileName;
 		sa: Strings.StringArray; suffix: ARRAY 16 OF CHAR;
@@ -257,10 +257,10 @@ VAR
 					ELSE res := 1
 					END
 				END;
-				p := files; 
+				p := files;
 				WHILE (res = 0) & (p # NIL) DO
 					IF SkipFileType( r, res ) THEN
-						f := ReadFile( r, res ); 
+						f := ReadFile( r, res );
 						IF res = 0 THEN
 							IF p.oberonSource THEN  ExtractAscii( f, "MODULE", p.name )
 							ELSIF p.oberonDoku THEN  ExtractAscii( f, "DEFINITION", p.name )
@@ -273,12 +273,12 @@ VAR
 			END
 		END
 	END DecodeFileList;
-	
-	
+
+
 	PROCEDURE Decode* ( c: Commands.Context );
 	VAR
 		name: Files.FileName;
-		res, type: LONGINT; 
+		res, type: LONGINT;
 		r: Streams.Reader;
 	BEGIN
 		r := c.arg;
@@ -300,7 +300,7 @@ VAR
 	VAR i: SHORTINT;  j: LONGINT;
 	BEGIN
 		FOR j := 0 TO 255 DO  revCode[j] := -1  END;
-		code[0] := ".";  revCode[ORD(".")] := 0; 
+		code[0] := ".";  revCode[ORD(".")] := 0;
 		code[1] := ",";  revCode[ORD(",")] := 1;
 		i := 2;  j := ORD("0");
 		WHILE j <= ORD("9") DO code[i] := CHR(j); revCode[j] := i; INC(i); INC(j) END;
@@ -309,8 +309,8 @@ VAR
 		j := ORD("a");
 		WHILE j <= ORD("z") DO code[i] := CHR(j); revCode[j] := i; INC(i); INC(j) END;
 		ASSERT(i = 64, 60)
-	END InitCodes;		
-		
+	END InitCodes;
+
 BEGIN
 	InitCodes
 END StdCoder.

+ 2 - 2
source/BIOS.ACPI.Mod

@@ -78,7 +78,7 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 END GetTable;
 
 PROCEDURE Initialize-;
-TYPE BiosEBDA = POINTER {UNSAFE} TO RECORD val: INTEGER END; 
+TYPE BiosEBDA = POINTER {UNSAFE} TO RECORD val: INTEGER END;
 VAR address := 0E0000H: ADDRESS; size := 020000H: SIZE; biosEBDA {UNTRACED}: BiosEBDA;
 
 BEGIN {UNCOOPERATIVE, UNCHECKED}
@@ -87,7 +87,7 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 		IF (rdsp.signature = RDSPSignature) & (Checksum (address, 20) = 0) THEN RETURN END;
 		INC (address, 16); DEC (size, 16);
 	END;
-	
+
 	biosEBDA := 40EH;
 	(* try Extended Bios Data Area EBDA *)
 	address := ADDRESS(biosEBDA.val) MOD 10000H * 16;

+ 4 - 4
source/BIOS.AMD64.Machine.Mod

@@ -573,9 +573,9 @@ CONST
 	SSE2Flag = 26;
 	SSE3Flag = 0; (*IN features2 from ECX*) (*PH 04/11*)
 	SSSE3Flag =9;
-	SSE41Flag =19; 
+	SSE41Flag =19;
 	SSE42Flag =20;
-	SSE5Flag = 11; 
+	SSE5Flag = 11;
 	AVXFlag = 28;
 BEGIN
 	SSE2Support := FALSE;
@@ -2641,7 +2641,7 @@ entry:
 
 	LEA RBP, [RSP + 136]
 	MOV RBX, [RSP + 128]	; RBX = int number
-	
+
 	IMUL RBX, RBX, MaxNumHandlers
 	IMUL RBX, RBX, SizeOfHandlerRec
 	; todo: replace LEA by MOV when compiler supports this
@@ -3834,7 +3834,7 @@ CODE{SYSTEM.AMD64}
 	REP MOVSB
 	POP RDI
 	POP RSI
-	POP RAX	
+	POP RAX
 
 
 

+ 2 - 2
source/BIOS.ATADisks.Mod

@@ -2253,7 +2253,7 @@ VAR idx, bus, dev, fkt: LONGINT;
 BEGIN
 	idx := 0; Dot();
 	WHILE PCI.FindPCIDevice(id, vendor, idx, bus, dev, fkt) = PCI.Done DO
-		Show("Found PCI device "); KernelLogHex(vendor, 4, 0); KernelLog.String(":"); KernelLogHex(id, 4, 0); KernelLog.Ln; 
+		Show("Found PCI device "); KernelLogHex(vendor, 4, 0); KernelLog.String(":"); KernelLogHex(id, 4, 0); KernelLog.Ln;
 		IdentifyController(bus, dev, fkt);
 		INC(idx);
 	END;
@@ -2265,7 +2265,7 @@ BEGIN
 	idx := 0; Dot();
 	WHILE PCI.FindPCIClassCode(class, idx, bus, dev, fkt) = PCI.Done DO
 		Show("Found PCI device on bus "); KernelLog.Int(bus, 0); KernelLog.String(", device "); KernelLog.Int(dev, 0);
-		KernelLog.String(", function "); KernelLog.Int(fkt, 0); KernelLog.Ln; 
+		KernelLog.String(", function "); KernelLog.Int(fkt, 0); KernelLog.Ln;
 		IdentifyController(bus, dev, fkt);
 		INC(idx);
 	END;

+ 1 - 1
source/BIOS.Clock.Mod

@@ -101,7 +101,7 @@ TYPE
 				KernelLog.String("Clock: ClockMode = ");  KernelLog.Int(clockmode, 1);  KernelLog.Ln
 			END
 		END InitClock;
-		
+
 		PROCEDURE Terminate;
 		BEGIN
 			IF clockmode # 1 THEN

+ 9 - 9
source/BIOS.I386.Machine.Mod

@@ -592,9 +592,9 @@ CONST
 	SSE2Flag = 26;
 	SSE3Flag = 0; (*IN features2 from ECX*) (*PH 04/11*)
 	SSSE3Flag =9;
-	SSE41Flag =19; 
+	SSE41Flag =19;
 	SSE42Flag =20;
-	SSE5Flag = 11; 
+	SSE5Flag = 11;
 	AVXFlag = 28;
 BEGIN
 	SSE2Support := FALSE;
@@ -2085,7 +2085,7 @@ END InModuleHeap;
 (* returns if an address is a currently allocated heap address *)
 PROCEDURE ValidHeapAddress*(p: ADDRESS): BOOLEAN;
 BEGIN
-	RETURN 
+	RETURN
 		(p >= memBlockHead.beginBlockAdr) & (p <= memBlockTail.endBlockAdr)
 		OR InModuleHeap(p);
 END ValidHeapAddress;
@@ -3480,8 +3480,8 @@ VAR status: SHORTINT;
 	PROCEDURE Scroll;
 	VAR adr: ADDRESS; off: SIZE; i,j: LONGINT;
 	BEGIN
-		IF (traceDelay > 0) & (scrollLines MOD TraceHeight = 0) THEN 
-			FOR i := 0 TO traceDelay-1 DO 
+		IF (traceDelay > 0) & (scrollLines MOD TraceHeight = 0) THEN
+			FOR i := 0 TO traceDelay-1 DO
 				FOR j := 0 TO 1000000 DO END;
 			END;
 		END;
@@ -3525,7 +3525,7 @@ PROCEDURE TraceColor (c: SHORTINT);
 BEGIN traceColor := c;
 END TraceColor;
 
-VAR traceDelay: LONGINT; 
+VAR traceDelay: LONGINT;
 (* Initialise tracing. *)
 PROCEDURE InitTrace;
 CONST MaxPorts = 8;
@@ -3544,8 +3544,8 @@ BEGIN
 		Portout8(3D5H, CHR((TraceWidth*TraceHeight) DIV 100H));
 		Portout8(3D4H, 0FX);
 		Portout8(3D5H, CHR((TraceWidth*TraceHeight) MOD 100H));
-		GetConfig("TraceDelay", s); 
-		p := 0; traceDelay := StrToInt(p, s); 
+		GetConfig("TraceDelay", s);
+		p := 0; traceDelay := StrToInt(p, s);
 
 	END;
 	IF TraceV24 IN traceMode THEN
@@ -3594,7 +3594,7 @@ BEGIN (* no PAF --> no variables !! *)
 		MOV bootFlag, EAX
 		MOV initRegs0,ESI
 		MOV initRegs1, EDI
-	END; 
+	END;
 	Init; (* call initializer as first action of the kernel *)
 END FirstAddress;
 

+ 3 - 3
source/BIOS.I386.Traps.Mod

@@ -90,17 +90,17 @@ VAR
 				w.String(", Locks: "); w.Set(exc.locks)
 			END;
 			w.Ln; w.String("System: "); w.String(Machine.version); w.String(" Kernel_CRC=");(* w.Hex(SystemVersion.BootCRC,8);*)
-			IF long THEN 
+			IF long THEN
 				w.Char(0EX);	(* "fixed font" *)
 				w.Ln;
 				w.String("Processor:");
 				(* output values *)
 				Val("CS", int.CS); Val("DS", exc.DS); Val("ES", exc.ES); Val("SS", exc.SS); Val("CR0", exc.CR[0]);
-				Val("FPU", SYSTEM.VAL(LONGINT, exc.FPU[1] * {0..15} + LSH(exc.FPU[2], 16))); 
+				Val("FPU", SYSTEM.VAL(LONGINT, exc.FPU[1] * {0..15} + LSH(exc.FPU[2], 16)));
 				Val("PC", int.PC); Val("ESI", int.ESI); Val("EDI", int.EDI); Val("SP", exc.SP); Val("CR2", exc.CR[2]);
 				Val("PID", id);
 				Val("EAX", int.EAX); Val("EBX", int.EBX); Val("ECX", int.ECX); Val("EDX", int.EDX); Val("CR3", exc.CR[3]);
-				Val("LCK", SYSTEM.VAL(LONGINT, exc.locks)); 
+				Val("LCK", SYSTEM.VAL(LONGINT, exc.locks));
 				Val("BP", int.BP); Val("FS", exc.FS); Val("GS", exc.GS); Val("ERR", int.ERR); Val("CR4", exc.CR[4]);
 				Val("TMR", Kernel.GetTicks()); w.Ln;
 				IF SYSTEM.VAL(CHAR, exc.DR[7]) # 0X THEN	(* some breakpoints enabled *)

+ 6 - 6
source/BIOS.MemCache.Mod

@@ -32,7 +32,7 @@ CODE
 	RDMSR
 #ELSE
 	unimplemented
-#END	
+#END
 END GetMTTRcapLow;
 
 (*
@@ -49,7 +49,7 @@ CODE
 	RDMSR
 #ELSE
 	unimplemented
-#END	
+#END
 END GetMTTRdefTypeLow;
 *)
 
@@ -70,7 +70,7 @@ CODE
 	RDMSR
 #ELSE
 	unimplemented
-#END	
+#END
 END GetMTTRphysBaseLow;
 
 (* Return the value of the specified MTTRphysMask register. *)
@@ -90,7 +90,7 @@ CODE
 	RDMSR
 #ELSE
 	unimplemented
-#END	
+#END
 END GetMTTRphysMaskLow;
 
 (* Set the specified MTTRphysBase register. *)
@@ -113,7 +113,7 @@ CODE
 	WRMSR
 #ELSE
 	unimplemented
-#END	
+#END
 END SetMTTRphysBase;
 
 (* Set the specified MTTRphysMask register. *)
@@ -136,7 +136,7 @@ CODE
 	WRMSR
 #ELSE
 	unimplemented
-#END	
+#END
 END SetMTTRphysMask;
 
 (** Set the cache properties of the specified physical memory area on the current processor. {physAdr, size MOD PS = 0}  Must be called from supervisor mode. *)

+ 8 - 8
source/BIOS.Objects.Mod

@@ -690,7 +690,7 @@ PROCEDURE CurrentProcess*( ): Process;
 BEGIN
 	RETURN SYSTEM.VAL(Process, Machine.GetProcessPtr());
 END CurrentProcess;
-	
+
 PROCEDURE CurrentContext*(): ANY;
 VAR p: Process;
 BEGIN
@@ -827,16 +827,16 @@ BEGIN
 			processingIRQ[state.INT-MinIRQ] := TRUE;
 		END;
 	END;
-	
+
 	(* if the reenabling of interrupts cannot be circumvented, then it is REQUIRED to acknowledge interrupts
 		BEFORE reenabling. Otherwise spurious IRQs cannot be identified as such.
 		Please note that this particular problem with spurious IRQs cannot observed on many machines but IF it is observed
 		then the machine will behave unexpected. Very hard to debug and trace!
 
-		Machine.Ack(state.INT); 
+		Machine.Ack(state.INT);
 		Machine.Sti ();	(* avoid Processors.StopAll deadlock when waiting for locks below (remove this) *)
 	*)
-	
+
 	Machine.Acquire(Machine.Objects);
 	t := interrupt[state.INT-MinIRQ].process;
 	IF StrongChecks THEN ASSERT(t.mode = AwaitingEvent) END;
@@ -1007,8 +1007,8 @@ PROCEDURE CancelTimeout*(t: Timer);
 BEGIN
 	Machine.Acquire(Machine.Objects);
 	ASSERT(t # event);
-	IF t.next # NIL THEN 
-		t.next.prev := t.prev; 
+	IF t.next # NIL THEN
+		t.next.prev := t.prev;
 		IF t.prev #NIL THEN t.prev.next := t.next END;
 	END;
 	t.next := NIL; t.prev := NIL;
@@ -1161,7 +1161,7 @@ BEGIN
 END TerminateThis;
 
 (* called by WMProcessInfo to obtain the current state of a running process *)
-PROCEDURE UpdateProcessState*( p: Process );	
+PROCEDURE UpdateProcessState*( p: Process );
 BEGIN
 	(*  update p.stat.{PC,BP,SP}  *)
 END UpdateProcessState;
@@ -1801,7 +1801,7 @@ END InitPrioRequest;
 VAR
 	(* for compatibility and later extension *)
 	TraceProcessHook*: PROCEDURE (prcoess: Process; pc, bp: ADDRESS; stacklow, stackhigh: ADDRESS);
-	
+
 BEGIN
 	TraceProcessHook := NIL;
 	IF Stats THEN InitStats; END;

+ 10 - 10
source/BIOS.PCI.Mod

@@ -91,11 +91,11 @@ MODULE PCI;	 (** author: fof -- PCI without using PCI bios (using PCI tables des
 						IF idx = index THEN
 							busNr := pci.bus; devNr := pci.device; fktNr := pci.function;
 							IF debug THEN
-								KernelLog.String("FindPCIDevice "); 
-								KernelLog.Int(devId,1); KernelLog.String(", "); 
-								KernelLog.Int(vendId,1); KernelLog.String(","); 
+								KernelLog.String("FindPCIDevice ");
+								KernelLog.Int(devId,1); KernelLog.String(", ");
+								KernelLog.Int(vendId,1); KernelLog.String(",");
 								KernelLog.Int(idx,1);
-								KernelLog.String(" found."); KernelLog.Ln; 
+								KernelLog.String(" found."); KernelLog.Ln;
 							END;
 							RETURN Done
 						ELSE INC(index)
@@ -124,9 +124,9 @@ MODULE PCI;	 (** author: fof -- PCI without using PCI bios (using PCI tables des
 						IF idx = index THEN
 							busNr := pci.bus; devNr := pci.device; fktNr := pci.function;
 							IF debug THEN
-								KernelLog.String("FindPCIClassCode "); 
+								KernelLog.String("FindPCIClassCode ");
 								KernelLog.Int(classCode,1); KernelLog.String(","); KernelLog.Int(idx,1);
-								KernelLog.String(" found."); KernelLog.Ln; 
+								KernelLog.String(" found."); KernelLog.Ln;
 							END;
 							RETURN Done
 						ELSE INC(index)
@@ -465,7 +465,7 @@ MODULE PCI;	 (** author: fof -- PCI without using PCI bios (using PCI tables des
 		ELSE multifunction := TRUE
 		END;
 		INC(pci.function);
-		
+
 		IF ~multifunction OR (pci.function >= 8) THEN
 			pci.function := 0;
 			INC(pci.device);
@@ -613,7 +613,7 @@ MODULE PCI;	 (** author: fof -- PCI without using PCI bios (using PCI tables des
 						KernelLog.String(" class="); KernelLog.Int(class,1);
 						KernelLog.String(" subclass="); KernelLog.Int(subclass,1);
 						KernelLog.String(" api="); KernelLog.Int(api,1);
-						KernelLog.String(" classCode= "); KernelLog.Address(r8 DIV 100H MOD 1000000H); 
+						KernelLog.String(" classCode= "); KernelLog.Address(r8 DIV 100H MOD 1000000H);
 						KernelLog.String(" : ");
 						DisplayDeviceClass(class, subclass);
 						KernelLog.Ln;
@@ -642,10 +642,10 @@ BEGIN
 	Show;
 END PCI.
 
-useful sources: 
+useful sources:
 
 http://tldp.org/LDP/tlk/dd/pci.html
-http://my.execpc.com/~geezer/code/pci.c 
+http://my.execpc.com/~geezer/code/pci.c
 
 
 (**

+ 24 - 24
source/BIOS.WebNetworkTimeProtocol.Mod

@@ -1,17 +1,17 @@
 MODULE WebNetworkTimeProtocol; (** AUTHOR "Patrick Hunziker"; PURPOSE "SimpleNetworkTimeProtocol RFC4330 and NetworkTimeProtocol RFC5905 "; *)
 
 (**
-NTP operates over the User Datagram Protocol (UDP). An NTP server listens for client NTP packets on port 123. 
-The NTP server is stateless and responds to each received client NTP packet in a simple transactional manner 
+NTP operates over the User Datagram Protocol (UDP). An NTP server listens for client NTP packets on port 123.
+The NTP server is stateless and responds to each received client NTP packet in a simple transactional manner
 by adding fields to the received packet and passing the packet back to the original sender, without reference to preceding NTP transactions.
 
-Upon receipt of a client NTP packet, the receiver time-stamps receipt of the packet as soon as possible within the packet assembly logic of the server. 
-The packet is then passed to the NTP server process. 
-This process interchanges the IP Header Address and Port fields in the packet, overwrites numerous fields in the NTP packet with local clock values, 
+Upon receipt of a client NTP packet, the receiver time-stamps receipt of the packet as soon as possible within the packet assembly logic of the server.
+The packet is then passed to the NTP server process.
+This process interchanges the IP Header Address and Port fields in the packet, overwrites numerous fields in the NTP packet with local clock values,
 time-stamps the egress of the packet, recalculates the checksum, and sends the packet back to the client.
 
-Time is given as 64-bit time-stamp value. 
-This value is an unsigned 32-bit seconds value, and a 32-bit fractional part. 
+Time is given as 64-bit time-stamp value.
+This value is an unsigned 32-bit seconds value, and a 32-bit fractional part.
 The unit of time is in seconds, and the epoch is 1 January 1900, meaning that the NTP time will cycle in the year 2036 (two years before the 32-bit Unix time cycle event in 2038).
 
 for best NTP server pools for a given region see wikipedia: NTP-Pool
@@ -67,8 +67,8 @@ BEGIN
 		sw.Net32(LONGINT(packet.TransmitTimestamp DIV 100000000H));    sw.Net32(LONGINT(packet.TransmitTimestamp MOD 100000000H));
 		sw.Update;
 		sw.GetRaw(buf, len);
-		socket.Send( fip, fport, buf, 0, 48, res );  
-		
+		socket.Send( fip, fport, buf, 0, 48, res );
+
 		socket.Receive(buf,0,48, 1000, fip1, fport1, len, res);
 		IF (res=UDP.Ok)&(len>=48) THEN (* receive the modified NTP record *)
 			NEW(sr,1024);
@@ -93,18 +93,18 @@ END Get;
 PROCEDURE SetSystemTime* (time: HUGEINT; timeZone, daylightSaving: LONGINT);
 VAR dt: Dates.DateTime; frac:HUGEINT;
 BEGIN {EXCLUSIVE}
-		frac:=time MOD 100000000H; 
-	time:=time DIV 100000000H MOD 100000000H; 
+		frac:=time MOD 100000000H;
+	time:=time DIV 100000000H MOD 100000000H;
 	dt:=Dates.ZeroDateNTP;
 	Dates.AddSeconds(dt, LONGINT(time MOD (60*60*24)));
 	Dates.AddMinutes(dt, timeZone+daylightSaving);
 	time:=time DIV (60*60*24);
 	Dates.AddDays(dt, LONGINT(time));
-	
+
 	Machine.PutNVByte(0BH, 82X);	(* disable clock & interrupt *)
-	Machine.PutNVByte(0, CHR(dt.seconds0)); 
-	Machine.PutNVByte(2, CHR(dt.minutes)); 
-	Machine.PutNVByte(4, CHR(dt.hours)); 
+	Machine.PutNVByte(0, CHR(dt.seconds0));
+	Machine.PutNVByte(2, CHR(dt.minutes));
+	Machine.PutNVByte(4, CHR(dt.hours));
 	Machine.PutNVByte(7, CHR(dt.day));
 	Machine.PutNVByte(8, CHR(dt.month));
 	Machine.PutNVByte(9, CHR(dt.year));
@@ -130,26 +130,26 @@ BEGIN
 	DNS.HostByName("0.ch.pool.ntp.org", fip, port);
 	Get(fip, NTPPort, packet, res);
 	IF res=UDP.Ok THEN
-		SetSystemTime(packet.TransmitTimestamp, 60, 60);  
-		context.out.String("Set system time to "); 
-		context.out.Int(packet.TransmitTimestamp  MOD 100000000H, 16); 
-		context.out.Int(packet.TransmitTimestamp  DIV 100000000H MOD 100000000H, 16); 
-		context.out.Ln; context.out.Update; 
+		SetSystemTime(packet.TransmitTimestamp, 60, 60);
+		context.out.String("Set system time to ");
+		context.out.Int(packet.TransmitTimestamp  MOD 100000000H, 16);
+		context.out.Int(packet.TransmitTimestamp  DIV 100000000H MOD 100000000H, 16);
+		context.out.Ln; context.out.Update;
 	END;
 END SynchronizeSNTP;
 
 
 PROCEDURE GetSimpleTime*(context:Commands.Context);
 VAR ipstr: ARRAY 64 OF CHAR; port, res, i:LONGINT;machineTimer1,machineTimer2: HUGEINT; fip: IP.Adr; packet:Packet;
-BEGIN 
-	
+BEGIN
+
 	IF ~context.arg.GetString(ipstr) THEN	Configuration.Get("NTP.Server0",ipstr,res); END;
 	(* note that DNS.HostByName might also deliver a default NTP server when an empty string and an NTP port number is given*)
 	DNS.HostByName(ipstr, fip, port);
-	
+
 	IF ~context.arg.GetInteger(port,FALSE) THEN port:=NTPPort END;
 	Get(fip, port, packet, res);
-	
+
 	context.out.String("checking server "); context.out.String(ipstr);context.out.Char(":"); context.out.Int(port,0);  context.out.Ln; context.out.Update;
 	context.out.String("SNTP result, transmit time [seconds.fraction]: "); context.out.Ln;
 

+ 2 - 2
source/BSplineCurves.Mod

@@ -214,7 +214,7 @@ TYPE
 			closed - TRUE for closed curve
 		*)
 		PROCEDURE &Init*(degree: LONGINT; closed: BOOLEAN);
-		BEGIN		
+		BEGIN
 			IF closed THEN boundary := Periodic; ELSE boundary := MirrorW; END;
 
 			IF degree > 1 THEN
@@ -646,6 +646,6 @@ TYPE
 		ELSE
 			RETURN 0;
 		END;
-	END IPower;	
+	END IPower;
 
 END BSplineCurves.

+ 2 - 2
source/BenchTCP.Mod

@@ -74,7 +74,7 @@ TYPE
 					KernelLog.Int(time MOD 60,6); time:=time DIV 60; KernelLog.String("min");
 					KernelLog.Int(time MOD 24,6); time:=time DIV 24; KernelLog.String("hh");
 					KernelLog.Int(time,7);  KernelLog.String("days since 1.1.1900");
-					KernelLog.Ln;   
+					KernelLog.Ln;
 				ELSE
 					NEW(sender, c, buf, num);
 					IF port = EchoPort THEN
@@ -82,7 +82,7 @@ TYPE
 						WHILE (res = 0) & (num > 0) DO
 							num0 := LEN(buf^) DIV 1024;
 							IF num0 > num THEN num0 := num END;
-							
+
 							c.Receive(buf^, 0, num0*1024, num0*1024, len, res);
 							DEC(num, num0)
 						END

+ 1 - 1
source/BitSets.Mod

@@ -74,7 +74,7 @@ TYPE BitSet* = OBJECT
 			END;
 		END;
 	END SetBits;
-	
+
 	PROCEDURE SetBytes*(startPos, bytes: SIZE; CONST values: ARRAY OF CHAR);
 	VAR adr: ADDRESS;
 	BEGIN

+ 52 - 52
source/BorrowsWheeler.Mod

@@ -1,18 +1,18 @@
 MODULE BorrowsWheeler;  (** AUTHOR GF; PURPOSE  "Borrows Wheeler Transformation"; *)
-	
+
 CONST
 	BlockSize* = 8*1024;
-	
-TYPE 	
+
+TYPE
 	MTF = OBJECT (* move to front *)
-		TYPE 
+		TYPE
 			Node = POINTER TO RECORD
 				byte: CHAR;  next: Node
 			END;
 		VAR
 			alpha: Node;
-			
-			
+
+
 			PROCEDURE Initialize;
 			VAR n: Node;  i: LONGINT;
 			BEGIN
@@ -31,33 +31,33 @@ TYPE
 					IF alpha.byte = ch THEN  k := 0
 					ELSE
 						l := alpha;  m := alpha.next;  k := 1;
-						WHILE m.byte # ch DO  
-							INC( k );  l := m;  m := m.next  
+						WHILE m.byte # ch DO
+							INC( k );  l := m;  m := m.next
 						END;
 						l.next := m.next;  m.next := alpha;  alpha := m
 					END;
 					buf[i] := CHR( k )
 				END
 			END Encode;
-			
+
 			PROCEDURE Decode( VAR buf: ARRAY OF CHAR; len: LONGINT );
 			VAR l, m: Node;  i, c: LONGINT;  ch: CHAR;
 			BEGIN
 				Initialize;
 				FOR i := 0 TO len - 1 DO
 					ch := buf[i];
-					IF ch # 0X THEN 
+					IF ch # 0X THEN
 						c := ORD( ch );  l := alpha;
 						WHILE c > 1 DO  l := l.next;  DEC( c )  END;
-						m := l.next;  l.next := m.next;  m.next := alpha;  
+						m := l.next;  l.next := m.next;  m.next := alpha;
 						alpha := m
 					END;
 					buf[i] := alpha.byte;
 				END
 			END Decode;
-	
+
 	END MTF;
-	
+
 TYPE
 	Encoder* = OBJECT
 		TYPE
@@ -66,40 +66,40 @@ TYPE
 			mtf: MTF;  length: LONGINT;
 			sbuf: ARRAY 2*BlockSize OF CHAR;
 			rotation: ARRAY BlockSize OF Index;
-			
+
 			PROCEDURE &New*;
 			BEGIN
 				NEW( mtf );
 			END New;
-			
-	
+
+
 			PROCEDURE Less( a, b: Index ): BOOLEAN;
-			VAR i1, i2: Index;  n, diff: LONGINT;  
+			VAR i1, i2: Index;  n, diff: LONGINT;
 			BEGIN
 				n := 0;  i1 := rotation[a];  i2 := rotation[b];
 				REPEAT
 					diff := ORD( sbuf[i1]) - ORD( sbuf[i2] );
-					INC( i1 );  INC( i2 );  INC( n ); 
+					INC( i1 );  INC( i2 );  INC( n );
 				UNTIL (diff # 0) OR (n = length);
 				RETURN diff < 0
 			END Less;
-			
+
 			PROCEDURE Swap( a, b: Index );
 			VAR  tmp: Index;
 			BEGIN
 				tmp := rotation[a];  rotation[a] := rotation[b];  rotation[b] := tmp
 			END Swap;
-			
+
 			PROCEDURE InsertSort( lo, hi: Index );
-			VAR x, i, l, h, m, ip, tmp: Index; 
+			VAR x, i, l, h, m, ip, tmp: Index;
 			BEGIN
-				x := lo + 1; 
+				x := lo + 1;
 				WHILE x <= hi DO
 					IF Less( x, x - 1 )  THEN
 						(* find insert position ip *)
 						ip := x - 1;  l := lo;  h := ip - 1;
 						WHILE l <= h DO
-							m := (l + h) DIV 2; 
+							m := (l + h) DIV 2;
 							IF Less( x, m ) THEN  ip := m;  h := m - 1  ELSE  l := m + 1  END
 						END;
 						(* insert rotation[x] at position ip*)
@@ -110,21 +110,21 @@ TYPE
 					INC( x )
 				END
 			END InsertSort;
-			
+
 			PROCEDURE SortR( lo, hi: LONGINT );
 			VAR i, j, m, n: LONGINT;
 			BEGIN
 				IF lo < hi THEN
 					n := hi - lo + 1;
-					IF n = 2 THEN 
+					IF n = 2 THEN
 						IF Less( hi, lo ) THEN  Swap( lo, hi )  END
-					ELSIF n < 16 THEN  
+					ELSIF n < 16 THEN
 						InsertSort( lo, hi )  (* less expensive string compares! *)
 					ELSE
 						(* QuickSort *)
 						i := lo;  j := hi;  m := (lo + hi) DIV 2;
 						REPEAT
-							WHILE Less( i, m ) DO  INC( i )  END;  
+							WHILE Less( i, m ) DO  INC( i )  END;
 							WHILE Less( m, j ) DO  DEC( j )  END;
 							IF i <= j THEN
 								IF m = i THEN  m := j  ELSIF  m = j THEN  m := i  END;
@@ -135,12 +135,12 @@ TYPE
 					END
 				END
 			END SortR;
-	
+
 			PROCEDURE EncodeBlock*( VAR buf: ARRAY OF CHAR; len: LONGINT ): LONGINT;
-			VAR  i, index: LONGINT;  
+			VAR  i, index: LONGINT;
 			BEGIN
 				ASSERT( len <= BlockSize );  length := len;
-				FOR i := 0 TO length - 1 DO  sbuf[i] := buf[i];  sbuf[i+length] := buf[i]  END; 
+				FOR i := 0 TO length - 1 DO  sbuf[i] := buf[i];  sbuf[i+length] := buf[i]  END;
 				FOR i := 0 TO length - 1 DO  rotation[i] := INTEGER( i )  END;
 				SortR( 0, length - 1 );
 				(* find index of the original row *)
@@ -150,43 +150,43 @@ TYPE
 				mtf.Encode( buf, length );
 				RETURN index
 			END EncodeBlock;
-			
+
 	END Encoder;
-			
-				
+
+
 TYPE
 	Decoder* = OBJECT
 		TYPE
 			Index = LONGINT;
 		VAR
 			mtf: MTF;
-			f, l: ARRAY BlockSize OF CHAR; 
+			f, l: ARRAY BlockSize OF CHAR;
 			lc, fc: ARRAY BlockSize OF INTEGER;
-			
+
 			PROCEDURE &New*;
 			BEGIN
 				NEW( mtf );
 			END New;
-			
-			
+
+
 			PROCEDURE -Swap( a, b: Index );
 			VAR  tmp: CHAR;
 			BEGIN
 				tmp := f[a];  f[a] := f[b];  f[b] := tmp
 			END Swap;
-			
-			
+
+
 			PROCEDURE SortF( lo, hi: Index );
-			VAR i, j, m: Index;  
+			VAR i, j, m: Index;
 			BEGIN
 				IF lo < hi THEN
-					IF (hi - lo) = 1 THEN 
+					IF (hi - lo) = 1 THEN
 						IF f[hi] < f[lo] THEN  Swap( lo, hi )  END;
 					ELSE
 						(* QuickSort *)
-						i := lo;  j := hi;  m := (lo + hi) DIV 2; 
+						i := lo;  j := hi;  m := (lo + hi) DIV 2;
 						REPEAT
-							WHILE f[i] < f[m] DO  INC( i )  END;  
+							WHILE f[i] < f[m] DO  INC( i )  END;
 							WHILE f[m] < f[j] DO  DEC( j )  END;
 							IF i <= j THEN
 								IF m = i THEN  m := j  ELSIF m = j THEN  m := i  END;
@@ -197,23 +197,23 @@ TYPE
 					END
 				END
 			END SortF;
-			
-			
+
+
 			PROCEDURE DecodeBlock*( VAR buf: ARRAY OF CHAR; len, index: LONGINT );
-			VAR 
+			VAR
 				i, j, n: LONGINT;  ch: CHAR;
-				xn: ARRAY 256 OF INTEGER;  
+				xn: ARRAY 256 OF INTEGER;
 			BEGIN
 				ASSERT( len <= BlockSize );
 				mtf.Decode( buf, len );
 				FOR i := 0 TO 255 DO  xn[i] := 0  END;
-				FOR i := 0 TO len - 1 DO 
+				FOR i := 0 TO len - 1 DO
 					l[i] := buf[i];  f[i] := buf[i];
 					j := ORD( l[i] );  lc[i] := xn[j];  INC( xn[j] )
 				END;
 				SortF( 0, len - 1 );
 				FOR i := 0 TO 255 DO  xn[i] := 0  END;
-				FOR i := 0 TO len - 1 DO 
+				FOR i := 0 TO len - 1 DO
 					j := ORD( f[i] );  fc[i] := xn[j];  INC( xn[j] )
 				END;
 				FOR i := 0 TO len - 1 DO
@@ -221,8 +221,8 @@ TYPE
 					WHILE (l[index] # ch) OR (lc[index] # n) DO  INC( index )  END
 				END;
 			END DecodeBlock;
-			
+
 	END Decoder;
-	
-	
+
+
 END BorrowsWheeler.

+ 5 - 5
source/CPU.Mod

@@ -238,7 +238,7 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 	SYSTEM.SetActivity (NIL);
 
 	IF handlers[index] # NIL THEN handlers[index] (index) ELSE HALT (1234) END;
-	
+
 	IF index >= IRQ8 THEN
 		OutByte (PIC2CommandPort, PIC_EOI); OutByte (PIC1CommandPort, PIC_EOI);
 	ELSIF index >= IRQ0 THEN
@@ -319,7 +319,7 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 	(* mask all maskable interrupts *)
 	OutChar (PIC1DataPort, 0FBX);
 	OutChar (PIC2DataPort, 0FFX);
-	
+
 	FOR i := 0 TO Interrupts - 1 DO
 		IF (i # 9) & (i # 15) & ((i < 20) OR (i > 29)) & (i # 31) THEN
 			idt[i][0] := INTEGER (ADDRESS OF wrapper[i] MOD 10000H);
@@ -354,7 +354,7 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 			idt[i][3] := 0;
 		END;
 	END;
-	
+
 	CODE
 		LEA	EAX, idt
 		PUSH	EAX
@@ -393,7 +393,7 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 	(* mask all maskable interrupts *)
 	OutChar (PIC1DataPort, 0FBX);
 	OutChar (PIC2DataPort, 0FFX);
-	
+
 	FOR i := 0 TO Interrupts - 1 DO
 		IF (i # 9) & (i # 15) & ((i < 20) OR (i > 29)) & (i # 31) THEN
 			idt[i][0] := INTEGER (ADDRESS OF wrapper[i] MOD 10000H);
@@ -434,7 +434,7 @@ BEGIN {UNCOOPERATIVE, UNCHECKED}
 		idt[i][6] := 0;
 		idt[i][7] := 0;
 	END;
-	
+
 	CODE
 		LEA	RAX, idt
 		PUSH	RAX

+ 4 - 4
source/CRC.Mod

@@ -104,7 +104,7 @@ TYPE CRC32*= OBJECT
 		BEGIN
 			crc := LONGINT(0FFFFFFFFH);
 		END Init;
-		
+
 		(* standard use: one character at a time *)
 		PROCEDURE Char*(c: CHAR);
 		VAR idx: LONGINT;
@@ -112,10 +112,10 @@ TYPE CRC32*= OBJECT
 			idx := SYSTEM.VAL(LONGINT, SYSTEM.VAL(SET, crc) / SYSTEM.VAL(SET, LONG(ORD(c)))) MOD 100H;
 			crc := SYSTEM.VAL(LONGINT, SYSTEM.VAL(SET, CRC32Table[idx])/SYSTEM.VAL(SET, LSH(crc, -8)));
 		END Char;
-		
+
 		(* nonstandard use - add a LONGINT; LSB *)
 		PROCEDURE Add*(i: LONGINT);
-		VAR idx: LONGINT; 
+		VAR idx: LONGINT;
 		BEGIN
 			i:= SYSTEM.VAL(LONGINT, SYSTEM.VAL(SET, crc) / SYSTEM.VAL(SET, i));
 			idx := i MOD 100H;
@@ -132,7 +132,7 @@ TYPE CRC32*= OBJECT
 		BEGIN
 			RETURN SYSTEM.VAL(LONGINT, SYSTEM.VAL(SET, crc)/{0..31})
 		END Get;
-	
+
 	END CRC32;
 
 VAR

+ 18 - 18
source/Checksum.Mod

@@ -2,7 +2,7 @@ MODULE Checksum;	(** AUTHOR "GF"; PURPOSE "compute md5, sha1 and sha3 checksums"
 
 IMPORT Commands, Files, Streams, Hashes := CryptoHashes;
 
-VAR 
+VAR
 	hexdigits: ARRAY 17 OF CHAR;
 
 
@@ -10,7 +10,7 @@ VAR
 	BEGIN
 		Do( c, Hashes.NewHash( "CryptoMD5" ) )
 	END MD5;
-	
+
 	PROCEDURE SHA1*( c: Commands.Context );
 	BEGIN
 		Do( c, Hashes.NewHash( "CryptoSHA1" ) )
@@ -23,10 +23,10 @@ VAR
 	(*	h.SetNameAndSize( "", 32 )	*)	(* 256 bit, default *)
 		Do( c, h )
 	END SHA3;
-	
-	
+
+
 	PROCEDURE Do( c: Commands.Context; h: Hashes.Hash );
-	VAR 
+	VAR
 		f: Files.File;  r: Files.Reader;
 		fname: ARRAY 256 OF CHAR;
 	BEGIN
@@ -34,19 +34,19 @@ VAR
 			Files.OpenReader( r, f, 0 );
 			ComputeHash( r, h, c.out );
 			f.GetName( fname );
-			c.out.String( '    ' );  c.out.String( fname );  c.out.Ln;		
-			c.out.Update		
+			c.out.String( '    ' );  c.out.String( fname );  c.out.Ln;
+			c.out.Update
 		END;
 	END Do;
 
 	PROCEDURE OpenNextFile( c: Commands.Context;  VAR f: Files.File ): BOOLEAN;
-	VAR 
+	VAR
 		fname: ARRAY 64 OF CHAR;
 	BEGIN
 		IF c.arg.GetString( fname ) THEN
 			f := Files.Old( fname );
 			IF f = NIL THEN
-				c.error.String( "File " );  c.error.String( fname );  c.error.String( " not fond" ); 
+				c.error.String( "File " );  c.error.String( fname );  c.error.String( " not fond" );
 				c.error.Ln; c.error.Update;
 				RETURN FALSE
 			ELSE
@@ -59,8 +59,8 @@ VAR
 
 
 	PROCEDURE ComputeHash( r: Files.Reader; h: Hashes.Hash; out: Streams.Writer );
-	VAR 
-		buf: ARRAY 128 OF CHAR;  
+	VAR
+		buf: ARRAY 128 OF CHAR;
 		got, i, x: LONGINT;
 	BEGIN
 		h.Initialize;
@@ -68,7 +68,7 @@ VAR
 			r.Bytes( buf, 0, 64, got );
 			h.Update( buf, 0, got )
 		END;
-		h.GetHash( buf, 0 );  
+		h.GetHash( buf, 0 );
 		FOR i := 0 TO h.size - 1 DO
 			x := ORD( buf[i] );
 			out.Char( hexdigits[x DIV 16] );
@@ -77,20 +77,20 @@ VAR
 	END ComputeHash;
 
 
-BEGIN 
+BEGIN
 	hexdigits := "0123456789abcdef"
 END Checksum.
 
 
 
-	Checksum.MD5  
-			Files.Mod 
+	Checksum.MD5
+			Files.Mod
 			Unix.UnixFiles.Mod
 			NoFile.Mod
 			~
-	
+
 	Checksum.SHA1  Files.Mod  ~
-	
+
 	Checksum.SHA3  Files.Mod  ~
-	
+
 	System.Free Checksum ~

+ 4 - 4
source/Clock.Mod

@@ -8,10 +8,10 @@
 MODULE Clock;
 
 TYPE
-	
+
 	(*
 		Function for getting time from an RTC device
-		
+
 		second: seconds \in [0,59]
 		minute: minutes \in [0,59]
 		hour: hours \in [0,23]
@@ -20,10 +20,10 @@ TYPE
 		year: the actual year minus 1900
 	*)
 	GetRtcTimeFunc = PROCEDURE{DELEGATE}(VAR second, minute, hour, day, month: SHORTINT; VAR year: INTEGER): BOOLEAN;
-	
+
 	(*
 		Function for setting up time on an RTC device
-		
+
 		second: seconds \in [0,59]
 		minute: minutes \in [0,59]
 		hour: hours \in [0,23]

+ 1 - 1
source/Commands.Mod

@@ -90,7 +90,7 @@ TYPE
 			AWAIT(state >= this);
 			res := SELF.res; COPY(SELF.msg, msg);
 		END Join;
-		
+
 	BEGIN {ACTIVE, SAFE}
 		Objects.SetContext(context);
 		IF ~exception THEN

+ 19 - 19
source/Compiler.Mod

@@ -106,7 +106,7 @@ TYPE
 		BEGIN
 			message := "";
 			IF module # NIL THEN
-				Global.GetModuleName(module, message); 
+				Global.GetModuleName(module, message);
 			END;
 			Strings.Append (message, msg);
 			IF error THEN
@@ -160,7 +160,7 @@ TYPE
 		REPEAT
 			(** first phase: scan and parse **)
 			module := options.frontend.Parse();
-			IF options.frontend.Error() THEN 
+			IF options.frontend.Error() THEN
 				FinalMessage(TRUE," could not be compiled (parser errors).");
 				RETURN FALSE;
 			END;
@@ -279,11 +279,11 @@ TYPE
 	BEGIN
 		result := TRUE;
 		NEW(options);
-		
+
 		options.Add("p","platform",Options.String);
 		options.Add(0X,"showOptions",Options.Flag);
 		options.Add("l","lineNumbers", Options.Flag);
-		
+
 		options.Add(0X,"print",Options.Flag);
 		options.Add(0X,"Print",Options.Flag);
 		options.Add(0X,"silent",Options.Flag);
@@ -312,14 +312,14 @@ TYPE
 		parsed := options.ParseStaged(input, error);
 		IF options.GetString("platform", name) OR GetDefaultPlatform(name) THEN
 			defaults := platforms.Get(name);
-			IF defaults = NIL THEN 	
+			IF defaults = NIL THEN
 				error.String("Unknown platform"); error.Ln; result := FALSE;
 			ELSE
 				parsed := options.ParseStaged(defaults, error) & parsed;
 				input.SetPos(position);
 				parsed := options.ParseStaged(input, error) & parsed; (* reparse overwrites *)
 			END;
-		ELSE 
+		ELSE
 			defaults := NIL;
 		END;
 
@@ -334,7 +334,7 @@ TYPE
 		ELSE compilerOptions.backend := Backend.GetBackendByName(DefaultBackend);
 			IF compilerOptions.backend = NIL THEN Error("default backend could not be installed"); result := FALSE END;
 		END;
-		
+
 		IF options.GetString("F", name) THEN
 			IF name = "" THEN compilerOptions.frontend := NIL
 			ELSE
@@ -518,20 +518,20 @@ TYPE
 		END;
 	END CompileReader;
 
-	VAR 
+	VAR
 		platforms: Options.Defaults;
 		defaultPlatform: ARRAY 32 OF CHAR;
-	
+
 	PROCEDURE DoAddPlatform(CONST name: ARRAY OF CHAR; CONST defaults: ARRAY OF CHAR);
 	BEGIN
 		platforms.Add(name, defaults);
 	END DoAddPlatform;
-	
+
 	PROCEDURE ShowDefaults*(context: Commands.Context);
 	BEGIN
 		platforms.Show(context.out)
 	END ShowDefaults;
-	
+
 	PROCEDURE AddPlatform*(context: Commands.Context);
 	VAR name: ARRAY 32 OF CHAR; defaults: ARRAY 1024 OF CHAR;
 	BEGIN
@@ -541,7 +541,7 @@ TYPE
 			context.result := Commands.CommandParseError;
 		END;
 	END AddPlatform;
-	
+
 	PROCEDURE SetDefaultPlatform*(context: Commands.Context);
 	VAR name: ARRAY 32 OF CHAR;
 	BEGIN
@@ -549,7 +549,7 @@ TYPE
 			COPY(name, defaultPlatform);
 		END;
 	END SetDefaultPlatform;
-	
+
 	PROCEDURE GetDefaultPlatform(VAR name: ARRAY OF CHAR): BOOLEAN;
 	BEGIN
 		IF defaultPlatform # "" THEN
@@ -559,7 +559,7 @@ TYPE
 			RETURN FALSE
 		END
 	END GetDefaultPlatform;
-	
+
 	PROCEDURE SetupDefaults;
 	VAR extension: Files.FileName;
 	BEGIN
@@ -570,9 +570,9 @@ TYPE
 		(* infer platform from default object file extension *)
 		platforms.Find("objectFileExtension", extension, defaultPlatform);
 	END SetupDefaults;
-	
-	
-	
+
+
+
 BEGIN
 	NEW(platforms);
 
@@ -582,12 +582,12 @@ BEGIN
 	DoAddPlatform("Win32","-b=AMD --bits=32 --mergeSections --objectFileExtension=.GofW --symbolFileExtension=.SymW --preciseGC --trackLeave --cellsAreObjects --platformCC=WINAPI --define=WIN,I386");
 	DoAddPlatform("Win64","-b=AMD --bits=64 --mergeSections --objectFileExtension=.GofWw --symbolFileExtension=.SymWw --preciseGC --trackLeave --cellsAreObjects --platformCC=WINAPI --define=WIN,AMD64");
 	DoAddPlatform("ARM","-b=ARM --metaData=simple --objectFileExtension=.Goa --symbolFileExtension=.Sya --define=ARM");
-	DoAddPlatform("Minos","-b=ARM --objectFile=Minos --define=ARM"); 
+	DoAddPlatform("Minos","-b=ARM --objectFile=Minos --define=ARM");
 	DoAddPlatform("TRM","-b=TRM --objectFile=Generic --metaData=simple --objectFileExtension=.GofT --symbolFileExtension=.SymT --define=TRM");
 	DoAddPlatform("TRMI","-b=TRM --objectFile=Intermediate --metaData=simple --objectFileExtension=.IroT --symbolFileExtension=.IrsT --define=TRM");
 	DoAddPlatform("ARMA2","-b=ARM --mergeSections --define=ARM --objectFileExtension=.Gof --symbolFileExtension=.Sym");
 	DoAddPlatform("Unix32","-b=AMD --bits=32 --mergeSections --traceModule=Trace --objectFileExtension=.GofU --symbolFileExtension=.SymU --preciseGC --cellsAreObjects --platformCC=C --define=UNIX,I386");
 	DoAddPlatform("Unix64","-b=AMD --bits=64 --mergeSections --traceModule=Trace --objectFileExtension=.GofUu --symbolFileExtension=.SymUu --preciseGC --cellsAreObjects --platformCC=C --define=UNIX,AMD64");
-	
+
 	SetupDefaults;
 END Compiler.

+ 1 - 1
source/ComplexNumbers.Mod

@@ -1,5 +1,5 @@
 MODULE ComplexNumbers;
-(* 
+(*
 	operators for complex numbers
 	this module is automatically loaded (FoxSemanticChecker) when operators on complex numbers are encountered
 *)

+ 6 - 6
source/ComponentViewer.Mod

@@ -10,7 +10,7 @@ CONST
 	InvalidPosition* =MIN(LONGINT);
 	FlagMoveable* = 20;
 	FlagSmoothGraphics* = 21;
-	
+
 TYPE
 
 	KillerMsg = OBJECT
@@ -59,7 +59,7 @@ TYPE
 			ELSE Handle^(m);
 			END;
 		END Handle;
-		
+
 		PROCEDURE PointerDown*(x, y:LONGINT; keys:SET);
 		BEGIN
 			lastX := bounds.l + x; lastY:=bounds.t + y;
@@ -67,7 +67,7 @@ TYPE
 				dragging := TRUE;
 				PointerDown^(x,y,keys);
 			ELSE
-				PointerDown^(x,y,keys); 
+				PointerDown^(x,y,keys);
 			END;
 		END PointerDown;
 
@@ -88,7 +88,7 @@ TYPE
 			dragging := FALSE;
 			PointerDown^(x,y,keys);
 		END PointerUp;
-		
+
 	END Window;
 
 VAR
@@ -143,7 +143,7 @@ BEGIN
 	ELSE
 		window.SetContent(vc);
 	END;
-	
+
 END DoShow;
 
 PROCEDURE DoLoad*(CONST filename: ARRAY OF CHAR; error: Streams.Writer): WMComponents.VisualComponent;
@@ -208,7 +208,7 @@ PROCEDURE SetProperties(c:WMComponents.Component; CONST attr: ARRAY OF CHAR);
 VAR property, value: ARRAY 32 OF CHAR;
 VAR r: Streams.StringReader;
 BEGIN
-	NEW(r, LEN(attr)); 
+	NEW(r, LEN(attr));
 	r.Set(attr);
 	WHILE r.GetString(property) & r.GetString(value) DO
 		IF ~c.properties.SetPropertyValue(property, value) THEN END;

+ 3 - 3
source/Coop.ARM.Machine.Mod

@@ -52,7 +52,7 @@ TYPE
 		adr*: ADDRESS;		(* lowest address on allocated stack *)	(* exported for Objects only *)
 		high*: ADDRESS;	(* next virtual address after stack *)	(* exported for Objects only *)
 	END;
-	
+
 	Address32* = LONGINT;
 
 VAR
@@ -322,12 +322,12 @@ END NumberOfProcessors;
 
 PROCEDURE InvalidateDCacheRange*(a: ADDRESS; s: SIZE);
 BEGIN
-	
+
 END InvalidateDCacheRange;
 
 PROCEDURE FlushDCacheRange*(a: ADDRESS; s: SIZE);
 BEGIN
-	
+
 END FlushDCacheRange;
 
 

+ 1 - 1
source/Coop.Kernel.Mod

@@ -1,4 +1,4 @@
-	
+
 (* Aos, Copyright 2001, Pieter Muller, ETH Zurich *)
 (* red marked parts are specific for WinAos, fof *)
 

+ 3 - 3
source/Coop.Machine.Mod

@@ -64,7 +64,7 @@ TYPE
 		adr*: ADDRESS;		(* lowest address on allocated stack *)	(* exported for Objects only *)
 		high*: ADDRESS;	(* next virtual address after stack *)	(* exported for Objects only *)
 	END;
-	
+
 	Address32* = LONGINT;
 
 VAR
@@ -792,12 +792,12 @@ END PutNVByte;
 
 PROCEDURE InvalidateDCacheRange*(a: ADDRESS; s: SIZE);
 BEGIN
-	
+
 END InvalidateDCacheRange;
 
 PROCEDURE FlushDCacheRange*(a: ADDRESS; s: SIZE);
 BEGIN
-	
+
 END FlushDCacheRange;
 
 

+ 8 - 8
source/Coop.Objects.Mod

@@ -22,7 +22,7 @@ CONST
 
 	(** Process priorities *)
 	Low* = Activities.DefaultPriority;								(* "user" priorities *)
-	Normal* = Activities.DefaultPriority;	
+	Normal* = Activities.DefaultPriority;
 	High* = Activities.HighPriority;
 	Realtime* = Activities.RealtimePriority;						(* reserved for interrupt handling and realtime apps *)
 
@@ -91,7 +91,7 @@ TYPE
 		restartSP-: LONGINT;   (** stack level at start of body, for SAFE exception recovery *)
 		cpuCycles, lastCpuCycles : CpuCyclesArray;
 	END Process;
-	
+
 	InterruptList = POINTER TO RECORD
 		next: InterruptList;
 		handler: EventHandler
@@ -102,7 +102,7 @@ TYPE
 		VAR root: InterruptList;
 		VAR cancelled: BOOLEAN;
 		VAR interrupt: Interrupts.Interrupt;
-		
+
 		PROCEDURE &Init (irq: SIZE);
 		BEGIN
 			Interrupts.Install (interrupt, irq);
@@ -116,7 +116,7 @@ TYPE
 			item.handler := handler;
 			root := item;
 		END Add;
-		
+
 		PROCEDURE Remove (handler: EventHandler);
 		VAR previous, current: InterruptList;
 		BEGIN {EXCLUSIVE}
@@ -132,7 +132,7 @@ TYPE
 				END;
 			END;
 		END Remove;
-		
+
 		PROCEDURE Count(): SIZE;
 		VAR count := 0: SIZE; item: InterruptList;
 		BEGIN {EXCLUSIVE}
@@ -140,7 +140,7 @@ TYPE
 			WHILE item # NIL DO INC (count); item := item.next END;
 			RETURN count;
 		END Count;
-		
+
 		PROCEDURE Cancel;
 		BEGIN {EXCLUSIVE}
 			IF ~cancelled THEN
@@ -178,7 +178,7 @@ VAR
 
 	(* for compatibility and later extension *)
 	TraceProcessHook* := NIL: PROCEDURE (prcoess: Process; pc, bp: ADDRESS; stacklow, stackhigh: ADDRESS);
-	
+
 (* Set the current process' priority. *)
 PROCEDURE SetPriority*( priority: LONGINT );
 BEGIN
@@ -249,7 +249,7 @@ PROCEDURE TerminateThis*( t: Process;  halt: BOOLEAN );
 END TerminateThis;
 
 (* called by WMProcessInfo to obtain the current state of a running process *)
-PROCEDURE UpdateProcessState*( p: Process );	
+PROCEDURE UpdateProcessState*( p: Process );
 BEGIN
 	(*  update p.stat.{PC,BP,SP}  *)
 END UpdateProcessState;

+ 1 - 1
source/Coop.Windows.Display.Mod

@@ -405,7 +405,7 @@ VAR
 	VAR m: AosInputs.AbsMouseMsg;  oldx, oldy: LONGINT;  keys: SET; ret: Kernel32.BOOL;
 	BEGIN
 		(* User32.SetCursor(hCurrentCursor);*)
-		oldx := win.track.X;  oldy := win.track.Y;  
+		oldx := win.track.X;  oldy := win.track.Y;
 		win.track.X := SHORT( lParam MOD ASH( 1, 16 ) ) - win.dx;
 		win.track.Y := SHORT( (* win.height-*) ASH( lParam, -16 ) - 1 ) - win.dy;
 		m.x := win.track.X;  m.y := win.track.Y;  m.z := win.track.Z;

+ 19 - 19
source/Coop.Windows.I386.Kernel32.Mod

@@ -56,7 +56,7 @@ CONST
 	HeapNoSerialize* = 2H;
 	HeapGenerateExceptions* = 4H;
 	HeapZeroMemory* = 8H;
-	
+
 	(** protect (VirtualAlloc) flags *)
 	PageReadWrite* = 2;  PageExecuteReadWrite* = 6;
 
@@ -152,7 +152,7 @@ CONST
 	(** GetLastError *)
 	ErrorSuccess* = 0;  ErrorFileNotFound* = 2;  ErrorAccessDenied* = 5;
 	ErrorInvalidParameter* = 87;
-	
+
 	ErrorIoPending* = 997; (** Overlapped I/O operation is in progress *)
 TYPE
 	(* OutputStringProc* = PROCEDURE (VAR str: ARRAY OF CHAR); *)
@@ -216,7 +216,7 @@ TYPE
 	Wow64Context*= RECORD (Context)
 		extension: ARRAY 512 (* MaxWOW64Extension *) OF CHAR;
 	END;
-	
+
 	ExceptionRecordPtr* = POINTER TO ExceptionRecord;
 	ExceptionRecord* = RECORD
 		ExceptionCode*, ExceptionFlags*: LONGINT;
@@ -338,7 +338,7 @@ TYPE
 		DaylightDate*: SystemTime;
 		DaylightBias*: LONGINT;
 	END;
-	
+
 	(** Contains information used in asynchronous (or overlapped) input and output (I/O). *)
 	Overlapped* = RECORD
 		Internal*: LONGINT;
@@ -518,11 +518,11 @@ VAR
 	(** The GetModuleHandle function returns a module handle for the specified module if the file has been mapped
 			into the address space of the calling process. *)
 	GetModuleHandle-: PROCEDURE {WINAPI} ( CONST lpModuleName: ARRAY   OF CHAR ): HMODULE;
-	
-	(** Retrieves the results of an overlapped operation on the specified file, named pipe, or communications device. 
+
+	(** Retrieves the results of an overlapped operation on the specified file, named pipe, or communications device.
 			To specify a timeout interval or wait on an alertable thread. *)
 	GetOverlappedResult-: PROCEDURE {WINAPI} ( hFile: HANDLE; VAR lpOverlapped: Overlapped; VAR lpNumberOfBytesTransferred: LONGINT; bWait: BOOL ): BOOL;
-	
+
 	(** The GetPrivateProfileString function retrieves a string from the specified section in an initialization file.*)
 	GetPrivateProfileString-: PROCEDURE {WINAPI} ( CONST lpAppName: ARRAY OF CHAR;
 																			CONST lpKeyName: ARRAY OF CHAR;
@@ -996,9 +996,9 @@ VAR
 		IF isEXE THEN hInstance := GetModuleHandle( NIL ) END;
 		END Init;
 
-		(* The following procedure is linked as the first block in the code section of a PE32 executable file 
+		(* The following procedure is linked as the first block in the code section of a PE32 executable file
 			It contains the import table for the two procedures Kernel32.GetProcAddress and Kernel32.LoadLibrary that
-			are patched by the PE linker. 
+			are patched by the PE linker.
 			[CF. Microsoft Portable Executable and Common Object File Format Specification]
 		*)
 		PROCEDURE {NOPAF, FIXED(401000H)} EntryPoint;
@@ -1009,31 +1009,31 @@ VAR
 			DB 0
 
 		ImportTable:
-			DD Kernel32Import + 1000H 
+			DD Kernel32Import + 1000H
 			DD 0
 			DD -1
 			DD Kernel32Name + 1000H
 			DD Kernel32Import + 1000H
 			DD 0, 0, 0, 0, 0
-		
+
 		Kernel32Import:
-		adrLoadLibrary:			
+		adrLoadLibrary:
 			DD LoadLibraryA + 1000H
-		adrGetProcAddress:			
+		adrGetProcAddress:
 			DD GetProcAddress + 1000H
 			DD 0
-			
+
 		Kernel32Name:
 			DB 'KERNEL32.DLL' , 0
-			
-		LoadLibraryA:			
+
+		LoadLibraryA:
 			DW 0
 			DB 'LoadLibraryA',0,0
-			
+
 		GetProcAddress:
 			DW 0
 			DB 'GetProcAddress',0
-			
+
 		end:
 			MOV EAX,[401000H+adrLoadLibrary]
 			MOV LoadLibrary, EAX
@@ -1043,4 +1043,4 @@ VAR
 		END EntryPoint;
 
 END Kernel32.
-	
+

+ 20 - 20
source/CryptoAES.Mod

@@ -5,16 +5,16 @@ MODULE CryptoAES;   (** AES (Rijndael) de/encryption *)
 IMPORT  S := SYSTEM, Ciphers := CryptoCiphers, U := CryptoUtils;
 
 CONST
-	MaxRounds = 14;  
+	MaxRounds = 14;
 	ECB = Ciphers.ECB;  CBC = Ciphers.CBC;  CTR = Ciphers.CTR;
-	
-	b0 = S.VAL( SET32, 0000000FFH );  b1 = S.VAL( SET32, 00000FF00H );  
+
+	b0 = S.VAL( SET32, 0000000FFH );  b1 = S.VAL( SET32, 00000FF00H );
 	b2 = S.VAL( SET32, 000FF0000H );  b3 = S.VAL( SET32, 0FF000000H );
 
 TYPE
 	RTable = ARRAY 256 OF SET32;
 	RKeys = ARRAY 4*(MaxRounds + 1) OF SET32;
-	
+
 VAR
 	e0, e1, e2, e3, e4: RTable;
 	d0, d1, d2, d3, d4: RTable;
@@ -45,7 +45,7 @@ TYPE
 					SetIV^( src, mode );   (* set mode *)
 					U.BufferToBlockBE( src, 0, iv );
 				END SetIV;
-				
+
 				PROCEDURE IncIV;
 				VAR i, x: LONGINT;
 				BEGIN
@@ -157,7 +157,7 @@ TYPE
 					b[2] := (d4[t2.d]*b3)/(d4[t1.c]*b2)/(d4[t0.b]*b1)/(d4[t3.a]*b0)/dkey[p + 2];
 					b[3] := (d4[t3.d]*b3)/(d4[t2.c]*b2)/(d4[t1.b]*b1)/(d4[t0.a]*b0)/dkey[p + 3];
 				END RoundD;
-				
+
 				PROCEDURE -split( s: SET32;  VAR b: Ind4 );   (* split set into 4 indexes *)
 				BEGIN
 					b.a := S.VAL( LONGINT, s ) MOD 100H;
@@ -184,7 +184,7 @@ TYPE
 					END;
 					RETURN 10
 				END Init128;
-				
+
 				PROCEDURE Init192( CONST src: ARRAY OF CHAR ): SHORTINT;
 				VAR i, p: LONGINT;  ib: Ind4;
 				BEGIN
@@ -204,7 +204,7 @@ TYPE
 					END;
 					RETURN 12
 				END Init192;
-	
+
 				PROCEDURE Init256( CONST src: ARRAY OF CHAR ): SHORTINT;
 				VAR i, p: LONGINT;  ib: Ind4;
 				BEGIN
@@ -227,16 +227,16 @@ TYPE
 					END;
 					RETURN 14
 				END Init256;
-				
-				
+
+
 				PROCEDURE InvertKeys;
 				VAR i, j, k, p: LONGINT;  t: SET32;  ib: Ind4;
-				
+
 					PROCEDURE ind( s: SET32 ): LONGINT;   (* extract index byte 0 *)
 					BEGIN
 						RETURN S.VAL( LONGINT, s ) MOD 100H
 					END ind;
-					
+
 				BEGIN
 					dkey := key;
 					(* invert the order of the round keys: *)
@@ -247,7 +247,7 @@ TYPE
 					END;
 					(* apply the inverse MixColumn transform to all round keys but the first and the last: *)
 					FOR i := 1 TO rounds - 1 DO
-						p := 4*i;  
+						p := 4*i;
 						split( dkey[p + 0], ib );
 						dkey[p + 0] := d0[ind( e4[ib.d] )] / d1[ind( e4[ib.c] )] / d2[ind( e4[ib.b] )] / d3[ind( e4[ib.a] )];
 						split( dkey[p + 1], ib );
@@ -258,8 +258,8 @@ TYPE
 						dkey[p + 3] := d0[ind( e4[ib.d] )] / d1[ind( e4[ib.c] )] / d2[ind( e4[ib.b] )] / d3[ind( e4[ib.a] )];
 					END;
 				END InvertKeys;
-	
-	
+
+
 				PROCEDURE & Init*;
 				BEGIN
 					SetNameAndBlocksize( "aes", 16 )
@@ -276,7 +276,7 @@ TYPE
 (*-------------------------------------------------------------------------------*)
 
 	PROCEDURE Initialize;
-	VAR 
+	VAR
 		i1, i2, i4, i8, i9, ib, id, ie, v1, v2, v3, t: LONGINT;
 		buf: U.InitBuffer;
 
@@ -284,7 +284,7 @@ TYPE
 		BEGIN
 			RETURN S.VAL( LONGINT, S.VAL( SET32, a ) / S.VAL( SET32, b ) )
 		END xor;
-		
+
 		PROCEDURE f1( x: LONGINT ): LONGINT;
 		VAR y: LONGINT;
 		BEGIN
@@ -310,10 +310,10 @@ TYPE
 		buf.Add( " 70 3E B5 66 48 03 F6 0E 61 35 57 B9 86 C1 1D 9E " );
 		buf.Add( " E1 F8 98 11 69 D9 8E 94 9B 1E 87 E9 CE 55 28 DF " );
 		buf.Add( " 8C A1 89 0D BF E6 42 68 41 99 2D 0F B0 54 BB 16 " );
-		
+
 		FOR i1 := 0 TO 255 DO
 			v1 := buf.GetInt();  v2 := f1( v1 );  v3 := xor( v2, v1 );
-			i2 := f1( i1 );  i4 := f1( i2 );  i8 := f1( i4 );  i9 := xor( i8, i1 );  
+			i2 := f1( i1 );  i4 := f1( i2 );  i8 := f1( i4 );  i9 := xor( i8, i1 );
 			ib := xor( i9, i2 );  id := xor( i9, i4 );  ie := xor( i8, xor( i4, i2 ) );
 
 			e0[i1] := S.VAL( SET32, ((v2*100H + v1)*100H + v1)*100H + v3 );
@@ -334,7 +334,7 @@ TYPE
 			t := f1( t );
 		END;
 	END Initialize;
-	
+
 
 BEGIN
 	Initialize;

+ 0 - 1
source/CryptoARC4.Mod

@@ -74,4 +74,3 @@ TYPE
 
 END CryptoARC4.
 
- 

+ 39 - 39
source/CryptoBase64.Mod

@@ -16,23 +16,23 @@ VAR
 		group := 0;  i := 0;  ix := 0;  ox := 0;
 		WHILE ix < len DO
 			group := group*100H + ORD( image[ix] );  INC( ix );  INC( i );
-			IF i = 3 THEN  
-				b64[ox] := etab[group DIV 40000H MOD 64];  
-				b64[ox+1] := etab[group DIV 1000H MOD 64];  
-				b64[ox+2] := etab[group DIV 40H MOD 64];  
-				b64[ox+3] := etab[group MOD 64];  
+			IF i = 3 THEN
+				b64[ox] := etab[group DIV 40000H MOD 64];
+				b64[ox+1] := etab[group DIV 1000H MOD 64];
+				b64[ox+2] := etab[group DIV 40H MOD 64];
+				b64[ox+3] := etab[group MOD 64];
 				INC( ox, 4 );
 				group := 0;
-				i := 0 
+				i := 0
 			END;
 		END;
-		
+
 		IF i > 0 THEN	(*encode rest *)
 			IF i = 1 THEN  group := group*256  END;
-			b64[ox] := etab[group DIV 400H MOD 64];  
-			b64[ox+1] := etab[group DIV 10H MOD 64];  
+			b64[ox] := etab[group DIV 400H MOD 64];
+			b64[ox+1] := etab[group DIV 10H MOD 64];
 			IF i = 1 THEN  b64[ox+2] := '='  ELSE  b64[ox+2] := etab[group*4 MOD 64]  END;
-			b64[ox+3] := '=';  
+			b64[ox+3] := '=';
 			INC( ox, 4 );
 		END;
 		b64[ox] := 0X;
@@ -47,30 +47,30 @@ VAR
 		c: CHAR;
 	BEGIN
 		len := 0;  ix := 0;  group := 0;  i := 0;
-		
+
 		REPEAT  c := b64[ix];  INC( ix )  UNTIL (c > ' ') OR (c = 0X);
-		code := dtab[ORD( c )]; 
+		code := dtab[ORD( c )];
 		WHILE code >= 0 DO
 			group := group*64 + code;  INC( i );
-			IF i = 4 THEN  
+			IF i = 4 THEN
 				image[len] := CHR( group DIV 10000H MOD 100H );  INC( len );
 				image[len] := CHR( group DIV 100H MOD 100H );  INC( len );
 				image[len] := CHR( group MOD 100H );  INC( len );
 				group := 0;  i := 0
 			END;
 			REPEAT  c := b64[ix];  INC( ix )  UNTIL (c > ' ') OR (c = 0X);
-			code := dtab[ORD( c )]; 
+			code := dtab[ORD( c )];
 		END;
-					
+
 		IF c = '=' THEN  (* decode rest *)
 			IF i < 2 THEN  (* error *)  RETURN -1  END;
-			group := group*64;  d := 1;  c := b64[ix];  
+			group := group*64;  d := 1;  c := b64[ix];
 			IF c = '=' THEN  group := group*64;  d := 2  END;
 			image[len] := CHR( group DIV 10000H );  INC( len );
 			IF d = 1 THEN  image[len] := CHR( group DIV 100H MOD 100H );  INC( len )  END
 		ELSIF i > 0 THEN  (* error *)  RETURN -1
 		END;
-		
+
 		RETURN len
 	END Decode;
 
@@ -85,7 +85,7 @@ VAR
 		group := 0;  i := 0; ix := 0;  ll := 0;
 		WHILE ix < len DO
 			group := group*100H + ORD( image[ix] );  INC( ix );  INC( i );
-			IF i = 3 THEN  
+			IF i = 3 THEN
 				w.Char( etab[group DIV 40000H MOD 64] );
 				w.Char( etab[group DIV 1000H MOD 64] );
 				w.Char( etab[group DIV 40H MOD 64] );
@@ -93,16 +93,16 @@ VAR
 				INC( ll, 4 );
 				IF ll >= 72 THEN  w.Ln;  ll := 0  END;
 				group := 0;
-				i := 0  
+				i := 0
 			END;
 		END;
-		
+
 		IF i > 0 THEN   (* encode rest *)
 			IF i = 1 THEN  group := group*100H  END;
-			w.Char( etab[group DIV 400H MOD 64] );  
-			w.Char( etab[group DIV 10H MOD 64] );  
+			w.Char( etab[group DIV 400H MOD 64] );
+			w.Char( etab[group DIV 10H MOD 64] );
 			IF i = 1 THEN  w.Char( '=' )  ELSE  w.Char( etab[group*4 MOD 64] )  END;
-			w.Char( '=' );  
+			w.Char( '=' );
 		END;
 		w.Update
  	END EncodeStream;
@@ -116,30 +116,30 @@ VAR
 		c: CHAR;
 	BEGIN
 		len := 0; group := 0;  i := 0;
-		
+
 		REPEAT  r.Char( c )  UNTIL (c > ' ') OR (c = 0X);
-		code := dtab[ORD( c )]; 
+		code := dtab[ORD( c )];
 		WHILE code >= 0 DO
 			group := group*64 + code;  INC( i );
-			IF i = 4 THEN  
+			IF i = 4 THEN
 				image[len] := CHR( group DIV 10000H MOD 100H );  INC( len );
 				image[len] := CHR( group DIV 100H MOD 100H );  INC( len );
 				image[len] := CHR( group MOD 100H );  INC( len );
 				group := 0;  i := 0
 			END;
 			REPEAT  r.Char( c )  UNTIL (c > ' ') OR (c = 0X);
-			code := dtab[ORD( c )];  
+			code := dtab[ORD( c )];
 		END;
-		
+
 		IF c = '=' THEN   (* decode rest *)
 			IF i < 2 THEN  (* error *)  RETURN -1  END;
-			group := group*64;  rest := 2;  r.Char( c );  
+			group := group*64;  rest := 2;  r.Char( c );
 			IF c = '=' THEN  group := group*64;  rest := 1  END;
 			image[len] := CHR( group DIV 10000H );  INC( len );
 			IF rest = 2 THEN  image[len] := CHR( group DIV 100H MOD 100H );  INC( len )  END
 		ELSIF i > 0 THEN  (* error *)  RETURN -1
 		END;
-		
+
 		RETURN len
 	END DecodeStream;
 
@@ -147,7 +147,7 @@ VAR
 	PROCEDURE InitTables;
 	CONST
 		letters = 26;  digits = 10;
-	VAR 
+	VAR
 		i, j: INTEGER;
 	BEGIN
 		j := 0;
@@ -159,13 +159,13 @@ VAR
 		FOR i := 0 TO 127 DO  dtab[i] := -1  END;
 		FOR i := 0 TO 63 DO  dtab[ORD( etab[i] )] := i  END
 	END InitTables;
-	
+
 	(*
 	(* testing: expected behaviour:  "admin:1234"  =>  "YWRtaW46MTIzNA=="  =>  "admin:1234"*)
 	PROCEDURE Test*( c: Commands.Context );
 	VAR image, base64: ARRAY 80 OF CHAR;  len: LONGINT; r: Streams.StringReader;
 	BEGIN
-		c.out.String( 'admin:1234  =>  ' ); 
+		c.out.String( 'admin:1234  =>  ' );
 		image := 'admin:123456789';
 		Encode( image, 10, base64 );
 		c.out.String( base64 ); c.out.String( "  =>  " );
@@ -174,25 +174,25 @@ VAR
 			image[len] := 0X;
 			c.out.String(image); c.out.Ln;
 		END;
-		
+
 		c.out.String( 'admin:1234  =>  ' );
 		EncodeStream( 'admin:123456789', 10, c.out );  c.out.String( "  =>  " );
 		NEW( r, 80 );  r.Set( base64 );
-		len := DecodeStream( r, image );  
-		IF len > 0 THEN  
+		len := DecodeStream( r, image );
+		IF len > 0 THEN
 			image[len] := 0X;
 			c.out.String( image ); c.out.Ln
 		END
 	END Test;
 	*)
-	
+
 
 BEGIN
 	InitTables();
 END CryptoBase64.
 
-	
-	
+
+
 	CryptoBase64.Test ~
 
 	System.Free CryptoBase64 ~

+ 17 - 17
source/CryptoBigNumbers.Mod

@@ -32,7 +32,7 @@ TYPE
 					END;
 					len := 0;  neg := FALSE
 				END Init;
-				
+
 				PROCEDURE Mask*( bits: LONGINT );
 				VAR w, b: LONGINT;
 				BEGIN
@@ -42,27 +42,27 @@ TYPE
 					END
 				END Mask;
 
-				
+
 				PROCEDURE IsZero*( ): BOOLEAN;
 				BEGIN
 					RETURN (len = 0) OR ((len = 1) & (d[0] = 0))
 				END IsZero;
-				
+
 				PROCEDURE EQ* ( b: BigNumber ): BOOLEAN;
 				BEGIN
 					RETURN Cmp( SELF, b ) = 0
 				END EQ;
-				
+
 				PROCEDURE NEQ* ( b: BigNumber ): BOOLEAN;
 				BEGIN
 					RETURN Cmp( SELF, b ) # 0
 				END NEQ;
-				
+
 				PROCEDURE GT* ( b: BigNumber ): BOOLEAN;
 				BEGIN
 					RETURN Cmp( SELF, b ) > 0
 				END GT;
-				
+
 				PROCEDURE GEQ* ( b: BigNumber ): BOOLEAN;
 				BEGIN
 					RETURN Cmp( SELF, b ) >= 0
@@ -76,16 +76,16 @@ TYPE
 					IF len = 0 THEN  RETURN  END;
 					IF n < 0 THEN  right := TRUE;  n := ABS( n )  ELSE  right := FALSE  END;
 					w := n DIV 32;  bits := n MOD 32;
-					IF ~right THEN  
+					IF ~right THEN
 						adjust( len + w + 1 );
 						IF w > 0 THEN
 							FOR i := len - 1 TO 0 BY -1 DO  d[i + w] := d[i]  END;
 							FOR i := 0 TO w - 1 DO  d[i] := 0  END;
 							INC( len, w )
 						END;
-						IF bits > 0 THEN  
+						IF bits > 0 THEN
 							d[len] := 0;
-							FOR i := len TO 0 BY -1 DO  
+							FOR i := len TO 0 BY -1 DO
 								a := d[i];
 								IF i > 0 THEN  b := d[i - 1]  ELSE  b := 0  END;
 								d[i] := LSH( a, bits ) + LSH( b, -32 + bits )
@@ -97,7 +97,7 @@ TYPE
 							FOR i := 0 TO len - w - 1 DO  d[i] := d[i + w]  END;
 							DEC( len, w )
 						END;
-						IF bits > 0 THEN  
+						IF bits > 0 THEN
 							l := len;
 							FOR i := 0 TO  l - 1 DO  a := d[i];
 								IF i < l - 1 THEN  b := d[i + 1]  ELSE  b := 0  END;
@@ -107,7 +107,7 @@ TYPE
 						END
 					END;
 				END Shift;
-				
+
 
 				PROCEDURE Dec*;
 				VAR i: LONGINT;
@@ -141,7 +141,7 @@ TYPE
 				BEGIN
 					IF ~IsZero( ) THEN  neg := ~neg  END
 				END Negate;
-	
+
 				PROCEDURE BitSize*( ): LONGINT;
 				VAR n: LONGINT; t: BNdigit;
 				BEGIN
@@ -150,7 +150,7 @@ TYPE
 					END;
 					t := d[len - 1];
 					WHILE t # 0 DO  INC( n );  t := LSH( t, -1 )  END;
-					RETURN n 
+					RETURN n
 				END BitSize;
 
 				PROCEDURE BitSet*( n: LONGINT ): BOOLEAN;
@@ -197,7 +197,7 @@ TYPE
 				PROCEDURE Convert( VAR val: BigNumber ); 	(* val := val ^ R mod n *)
 				VAR i: LONGINT;
 				BEGIN
-					FOR i := 0 TO bits - 1 DO  
+					FOR i := 0 TO bits - 1 DO
 						val.Shift( 1 );
 						IF ucmp( val, n ) >= 0 THEN  val := Sub( val, n )  END
 					END
@@ -841,9 +841,9 @@ VAR
 	BEGIN
 		REPEAT
 			REPEAT r.Char( c ) UNTIL (c > ' ') OR (r.Available() = 0);
-		UNTIL	(r.Available() = 0) OR 
-				(c >= '0') & (c <= '9') OR 
-				(c >= 'A') & (c <= 'F') OR 
+		UNTIL	(r.Available() = 0) OR
+				(c >= '0') & (c <= '9') OR
+				(c >= 'A') & (c <= 'F') OR
 				(c >= 'a') & (c <= 'f') OR (c = '.');
 		RETURN c
 	END nibble;

+ 17 - 17
source/CryptoBlowfish.Mod

@@ -9,11 +9,11 @@ MODULE CryptoBlowfish;   (** AUTHOR "GF"; PURPOSE "Blowfish en/decryption"; *)
 IMPORT Ciphers := CryptoCiphers, S := SYSTEM, U := CryptoUtils;
 
 CONST
-	N = 16;  
+	N = 16;
 
 TYPE
 	TP = ARRAY N + 2 OF SET32;
-	TS = RECORD 
+	TS = RECORD
 			a	: ARRAY 256 OF LONGINT;
 			b	: ARRAY 256 OF LONGINT;
 			c	: ARRAY 256 OF SET32;
@@ -34,32 +34,32 @@ TYPE
 				VAR i, m: LONGINT;  xl, xr: SET32;
 				BEGIN
 					InitKey^( src, keybits );  m := keybits DIV 8;  s := s0;
-					FOR i := 0 TO N + 1 DO  
-						p[i] := p0[i] / U.SetFromBufferBE( src, (4*i) MOD m )  
+					FOR i := 0 TO N + 1 DO
+						p[i] := p0[i] / U.SetFromBufferBE( src, (4*i) MOD m )
 					END;
 					xl := {};  xr := {};
 					FOR i := 0 TO N BY 2 DO  encrypt0( xl, xr, xl, xr );  p[i] := xl;  p[i + 1] := xr  END;
 					FOR i := 0 TO 254 BY 2 DO
-						encrypt0( xl, xr, xl, xr );  
+						encrypt0( xl, xr, xl, xr );
 						s.a[i] := S.VAL( LONGINT, xl );  s.a[i + 1] := S.VAL( LONGINT, xr );
 					END;
 					FOR i := 0 TO 254 BY 2 DO
-						encrypt0( xl, xr, xl, xr );  
+						encrypt0( xl, xr, xl, xr );
 						s.b[i] := S.VAL( LONGINT, xl );  s.b[i + 1] := S.VAL( LONGINT, xr );
 					END;
 					FOR i := 0 TO 254 BY 2 DO
-						encrypt0( xl, xr, xl, xr );  
+						encrypt0( xl, xr, xl, xr );
 						s.c[i] := xl;  s.c[i + 1] := xr;
 					END;
 					FOR i := 0 TO 254 BY 2 DO
-						encrypt0( xl, xr, xl, xr );  
+						encrypt0( xl, xr, xl, xr );
 						s.d[i] := S.VAL( LONGINT, xl );  s.d[i + 1] := S.VAL( LONGINT, xr );
 					END
 				END InitKey;
 
 				PROCEDURE SetIV*( CONST src: ARRAY OF CHAR; mode: SHORTINT );
 				BEGIN
-					SetIV^( src, mode );  
+					SetIV^( src, mode );
 					ivl := U.SetFromBufferBE( src, 0 );  ivr := U.SetFromBufferBE( src, 4 );
 				END SetIV;
 
@@ -99,11 +99,11 @@ TYPE
 					IF mode = Ciphers.CBC THEN  yl := yl/ivl;  yr := yr/ivr;  ivl := xl;  ivr := xr  END;
 					U.SetToBufferBE( yl, buf, pos );  U.SetToBufferBE( yr, buf, pos + 4 )
 				END DecryptBlock;
-				
-				
+
+
 				PROCEDURE F( x: LONGINT ): SET32;
-				VAR 
-					ab, c: SET32; d: LONGINT; 
+				VAR
+					ab, c: SET32; d: LONGINT;
 				BEGIN
 					ab := S.VAL( SET32, s.a[x DIV 1000000H MOD 100H] + s.b[x DIV 10000H MOD 100H] );
 					c := s.c[x DIV 100H MOD 100H];
@@ -160,7 +160,7 @@ TYPE
 		buf.Add( "452821E6 38D01377 BE5466CF 34E90C6C C0AC29B7 C97C50DD 3F84D5B5 B5470917" );
 		buf.Add( "9216D5D9 8979FB1B" );
 		FOR i := 0 TO N + 2 - 1 DO   p0[i] := buf.GetSet()  END;
-		
+
 		buf.Init( 4096 );
 		buf.Add( "D1310BA6 98DFB5AC 2FFD72DB D01ADFB7 B8E1AFED 6A267E96 BA7C9045 F12C7F99" );
 		buf.Add( "24A19947 B3916CF7 0801F2E2 858EFC16 636920D8 71574E69 A458FEA3 F4933D7E" );
@@ -195,7 +195,7 @@ TYPE
 		buf.Add( "D60F573F BC9BC6E4 2B60A476 81E67400 08BA6FB5 571BE91F F296EC6B 2A0DD915" );
 		buf.Add( "B6636521 E7B9F9B6 FF34052E C5855664 53B02D5D A99F8FA1 08BA4799 6E85076A" );
 		FOR i := 0 TO 255 DO  s0.a[i] :=  buf.GetInt()  END;
-		
+
 		buf.Init( 4096 );
 		buf.Add( "4B7A70E9 B5B32944 DB75092E C4192623 AD6EA6B0 49A7DF7D 9CEE60B8 8FEDB266" );
 		buf.Add( "ECAA8C71 699A17FF 5664526C C2B19EE1 193602A5 75094C29 A0591340 E4183A3E" );
@@ -230,7 +230,7 @@ TYPE
 		buf.Add( "9E447A2E C3453484 FDD56705 0E1E9EC9 DB73DBD3 105588CD 675FDA79 E3674340" );
 		buf.Add( "C5C43465 713E38D8 3D28F89E F16DFF20 153E21E7 8FB03D4A E6E39F2B DB83ADF7" );
 		FOR i := 0 TO 255 DO  s0.b[i] :=  buf.GetInt()  END;
-		
+
 		buf.Init( 4096 );
 		buf.Add( "E93D5A68 948140F7 F64C261C 94692934 411520F7 7602D4F7 BCF46B2E D4A20068" );
 		buf.Add( "D4082471 3320F46A 43B7D4B7 500061AF 1E39F62E 97244546 14214F74 BF8B8840" );
@@ -265,7 +265,7 @@ TYPE
 		buf.Add( "ED545578 08FCA5B5 D83D7CD3 4DAD0FC4 1E50EF5E B161E6F8 A28514D9 6C51133C" );
 		buf.Add( "6FD5C7E7 56E14EC4 362ABFCE DDC6C837 D79A3234 92638212 670EFA8E 406000E0" );
 		FOR i := 0 TO 255 DO  s0.c[i] :=  buf.GetSet()  END;
-		
+
 		buf.Init( 4096 );
 		buf.Add( "3A39CE37 D3FAF5CF ABC27737 5AC52D1B 5CB0679E 4FA33742 D3822740 99BC9BBE" );
 		buf.Add( "D5118E9D BF0F7315 D62D1C7E C700C47B B78C1B6B 21A19045 B26EB1BE 6A366EB4" );

+ 5 - 5
source/CryptoCAST.Mod

@@ -196,7 +196,7 @@ TYPE
 		b := T1[t MOD 256];  t := t DIV 256;
 		a := T0[t MOD 256];  t := t DIV 256;
 		d := T3[t MOD 256];  t := t DIV 256;
-		c := T2[t MOD 256];  
+		c := T2[t MOD 256];
 		L := L / (S.VAL( SET32, a - b + c ) / S.VAL( SET32, d ) );
 	END CAST2;
 
@@ -207,7 +207,7 @@ TYPE
 		b := T1[t MOD 256];  t := t DIV 256;
 		a := T0[t MOD 256];  t := t DIV 256;
 		d := T3[t MOD 256];  t := t DIV 256;
-		c := T2[t MOD 256];  
+		c := T2[t MOD 256];
 		L := L / S.VAL( SET32, S.VAL( LI, S.VAL( SET32, a + b ) / S.VAL( SET32, c ) ) - d );
 	END CAST3;
 
@@ -244,7 +244,7 @@ TYPE
 	END decrypt;
 
 
-	
+
 	PROCEDURE Init;
 	VAR  buf: U.InitBuffer;  i: LONGINT;
 	BEGIN
@@ -282,7 +282,7 @@ TYPE
 		buf.Add( "BD91E046  9A56456E  DC39200C  20C8C571  962BDA1C  E1E696FF  B141AB08  7CCA89B9" );
 		buf.Add( "1A69E783  02CC4843  A2F7C579  429EF47D  427B169C  5AC9F049  DD8F0F00  5C8165BF" );
 		FOR i := 0 TO 255 DO  T0[i] := buf.GetInt()  END;
-		
+
 		buf.Init( 4096 );
 		buf.Add( "1F201094  EF0BA75B  69E3CF7E  393F4380  FE61CF7A  EEC5207A  55889C94  72FC0651" );
 		buf.Add( "ADA7EF79  4E1D7235  D55A63CE  DE0436BA  99C430EF  5F0C0794  18DCDB7D  A1D6EFF3" );
@@ -528,7 +528,7 @@ TYPE
 		buf.Add( "04F19130  BA6E4EC0  99265164  1EE7230D  50B2AD80  EAEE6801  8DB2A283  EA8BF59E" );
 		FOR i := 0 TO 255 DO  T7[i] := buf.GetSet()  END;
 	END Init;
-	
+
 
 
 BEGIN

+ 12 - 12
source/CryptoCSPRNG.Mod

@@ -1,19 +1,19 @@
 MODULE CryptoCSPRNG;	(** AUTHOR "GF"; PURPOSE "Cryptographically Secure Pseudo-Random Generator."*)
- 
- 
+
+
 IMPORT  Machine, Clock, Heaps, SHA3 := CryptoSHA3(*, Out := KernelLog*);
 
 
 	PROCEDURE CSRand*( VAR rand: ARRAY OF CHAR; bits: LONGINT );
-	VAR 
+	VAR
 		seed: HUGEINT; i, j, len: LONGINT;
 		h: SHA3.Hash;
 		buf: ARRAY 64 OF CHAR;
 	BEGIN
 		ASSERT( (bits MOD 8 = 0) & (bits DIV 8 <= LEN( rand )) );
 		seed := Noise();
-		FOR i := 0 TO 7 DO  
-			buf[i] := CHR( seed MOD 100H );  seed := seed DIV 100H  
+		FOR i := 0 TO 7 DO
+			buf[i] := CHR( seed MOD 100H );  seed := seed DIV 100H
 		END;
 		NEW( h );  h.SetNameAndSize( "", 64 );
 		h.Update( buf, 0, 8 );
@@ -21,7 +21,7 @@ IMPORT  Machine, Clock, Heaps, SHA3 := CryptoSHA3(*, Out := KernelLog*);
 		i := 0;  j := 0;  len := bits DIV 8;
 		WHILE j < len DO
 			IF i = 64 THEN
-				h.Initialize;  
+				h.Initialize;
 				h.Update( buf, 0, 64 );
 				h.GetHash( buf, 0 );
 				i := 0
@@ -29,17 +29,17 @@ IMPORT  Machine, Clock, Heaps, SHA3 := CryptoSHA3(*, Out := KernelLog*);
 			rand[j] := buf[i];  INC( j ); INC( i )
 		END
 	END CSRand;
-	
+
 	PROCEDURE Noise( ): HUGEINT;
 	VAR tm, dt: HUGEINT; t, d: LONGINT;  total, free, largest: SIZE;
 	BEGIN
 		tm := Machine.GetTimer( );
-		Clock.Get( t, d );  
+		Clock.Get( t, d );
 		dt := LONG( d ) * 1000000H + t;
-		Heaps.GetHeapInfo( total, free, largest ); 
+		Heaps.GetHeapInfo( total, free, largest );
 		RETURN  (tm + 4*dt + Heaps.Nmark) * (Heaps.Ngc + 1) + (total - free + largest )
 	END Noise;
-	
+
 	(*
 	PROCEDURE Test*;
 	CONST HT = 09X;
@@ -55,11 +55,11 @@ IMPORT  Machine, Clock, Heaps, SHA3 := CryptoSHA3(*, Out := KernelLog*);
 		Out.Ln
 	END Test;
 	*)
-	
+
 
 END CryptoCSPRNG.
 
 
 	CryptoCSPRNG.Test ~
-	
+
 	System.Free CryptoCSPRNG ~

+ 1 - 1
source/CryptoCiphers.Mod

@@ -50,7 +50,7 @@ TYPE
 				BEGIN
 					ASSERT( isKeyInitialized );   (* initKey must have been called before *)
 					ASSERT( mode IN {CBC, CTR} );
-					SELF.mode := mode;  
+					SELF.mode := mode;
 					IF mode = CBC THEN  appmode( "-cbc" ) ELSE  appmode( "-ctr" )  END
 				END SetIV;
 

+ 67 - 67
source/CryptoDES.Mod

@@ -5,7 +5,7 @@ MODULE CryptoDES;	(** AUTHOR "G.F."; PUROSE "DES Cipher";	 *)
 
 
 IMPORT S := SYSTEM, U := CryptoUtils, Ciphers := CryptoCiphers;
-CONST 
+CONST
 	Mask01 = S.VAL( SET32, 0AAAAAAAAH );
 	Mask02 = S.VAL( SET32, 33333333H );
 	Mask04 = S.VAL( SET32, 0F0F0F0FH );
@@ -16,41 +16,41 @@ TYPE
 	Sandbox = ARRAY 64 OF SET32;
 	BitSwap = ARRAY 16 OF SET32;
 	Ind4* = RECORD a-, b-, c-, d-: LONGINT END;
-	
+
 VAR
 	sb1-, sb2-, sb3-, sb4-, sb5-, sb6-, sb7-, sb8-: Sandbox;
 	LHs, RHs: BitSwap;
-	
-TYPE 
-	Cipher* = OBJECT (Ciphers.Cipher)		
+
+TYPE
+	Cipher* = OBJECT (Ciphers.Cipher)
 	VAR
 		ske, skd: ARRAY 32 OF SET32;  ki: LONGINT;
 		ivx, ivy: SET32;
-	
+
 		PROCEDURE InitKey*( CONST src: ARRAY OF CHAR;  keybits: LONGINT );
 		VAR X, Y: SET32;  i: LONGINT;
 		BEGIN
 			ASSERT( keybits = 64 );
 			InitKey^( src, keybits );
-			
+
 			X := U.SetFromBufferBE( src, 0 );  Y := U.SetFromBufferBE( src, 4 );
-			
+
 			ComputeSubkeys( X, Y, ske, 0 );
-			
-			FOR i := 0 TO 31 BY 2 DO  
-				skd[i] := ske[30 - i];  
+
+			FOR i := 0 TO 31 BY 2 DO
+				skd[i] := ske[30 - i];
 				skd[i + 1] := ske[31 - i]
 			END;
 		END InitKey;
-		
-		
+
+
 		PROCEDURE SetIV*( CONST src: ARRAY OF CHAR; mode: SHORTINT );
 		BEGIN
 			SetIV^( src, mode );   (* set mode *)
 			ivx := U.SetFromBufferBE( src, 0 );  ivy := U.SetFromBufferBE( src, 4 )
 		END SetIV;
-		
-		
+
+
 		PROCEDURE  Encrypt* ( VAR buf: ARRAY OF CHAR; ofs, len: LONGINT );
 		VAR i, r: LONGINT;   X, Y: SET32;
 		BEGIN
@@ -60,19 +60,19 @@ TYPE
 			WHILE i < len DO
 				X := U.SetFromBufferBE( buf, ofs + i );  Y := U.SetFromBufferBE( buf, ofs + i + 4 );
 				IF mode = Ciphers.CBC THEN  X := X / ivx;  Y := Y / ivy   END;
-				IP( X, Y );  
+				IP( X, Y );
 				ki := 0;
-				FOR r := 0 TO 7 DO  
+				FOR r := 0 TO 7 DO
 					RoundE( Y, X );  RoundE( X, Y );
 				END;
 				FP( Y, X );
-				U.SetToBufferBE( Y, buf, ofs + i );   U.SetToBufferBE( X, buf, ofs + i + 4); 
+				U.SetToBufferBE( Y, buf, ofs + i );   U.SetToBufferBE( X, buf, ofs + i + 4);
 				IF mode = Ciphers.CBC THEN  ivx := Y;  ivy := X  END;
 				INC( i, blockSize )
 			END
-		END Encrypt;	
-		
-		
+		END Encrypt;
+
+
 		PROCEDURE  Decrypt* ( VAR buf: ARRAY OF CHAR; ofs, len: LONGINT );
 		VAR i, r: LONGINT;  X, Y: SET32;  X0, Y0: SET32;
 		BEGIN
@@ -82,22 +82,22 @@ TYPE
 			WHILE i < len DO
 				X := U.SetFromBufferBE( buf, ofs + i );  Y := U.SetFromBufferBE( buf, ofs + i + 4 );
 				IF mode = Ciphers.CBC THEN  X0 := X;  Y0 := Y  END;
-				IP( X, Y );  
+				IP( X, Y );
 				ki := 0;
-				FOR r := 0 TO 7 DO  
+				FOR r := 0 TO 7 DO
 					RoundD( Y, X );  RoundD( X, Y );
 				END;
 				FP( Y, X );
-				IF mode = Ciphers.CBC THEN  
-					Y := Y / ivx;  X := X / ivy  ; 
-					ivx := X0;  ivy := Y0  
+				IF mode = Ciphers.CBC THEN
+					Y := Y / ivx;  X := X / ivy  ;
+					ivx := X0;  ivy := Y0
 				END;
-				U.SetToBufferBE( Y, buf, ofs + i );   U.SetToBufferBE( X, buf, ofs + i + 4); 
+				U.SetToBufferBE( Y, buf, ofs + i );   U.SetToBufferBE( X, buf, ofs + i + 4);
 				INC( i, blockSize )
 			END
 		END Decrypt;
-		
-				
+
+
 		PROCEDURE RoundE*( VAR x, y: SET32 );
 		VAR i: Ind4;
 		BEGIN
@@ -106,7 +106,7 @@ TYPE
 			Split( ske[ki] / ROT( x, -4 ), i );  INC( ki );
 			y := y / sb7[i.a] / sb5[i.b] / sb3[i.c] / sb1[i.d]
 		END RoundE;
-		
+
 		PROCEDURE RoundD*( VAR x, y: SET32 );
 		VAR i: Ind4;
 		BEGIN
@@ -115,32 +115,32 @@ TYPE
 			Split( skd[ki] / ROT( x, -4 ), i );  INC( ki );
 			y := y / sb7[i.a] / sb5[i.b] / sb3[i.c] / sb1[i.d]
 		END RoundD;
-		
-		
+
+
 		PROCEDURE & Init*;
 		BEGIN
 			SetNameAndBlocksize( "des", 8 );
 		END Init;
-	
+
 	END Cipher;
-	
+
 	PROCEDURE -Split*( x: SET32; VAR i4: Ind4 );
 	BEGIN
 		i4.a := S.VAL( LONGINT, x ) MOD 40H;
 		i4.b := S.VAL( LONGINT, x ) DIV 100H MOD 40H;
 		i4.c := S.VAL( LONGINT, x ) DIV 10000H MOD 40H;
 		i4.d := S.VAL( LONGINT, x ) DIV 1000000H MOD 40H
-	END Split; 
-	
-	
+	END Split;
+
+
 	PROCEDURE NewCipher*( ): Ciphers.Cipher;
 	VAR cipher: Cipher;
 	BEGIN
 		NEW( cipher );  RETURN cipher
 	END NewCipher;
-	
-	
-			
+
+
+
 	PROCEDURE IP*( VAR x, y: SET32 );	(* initial permutation *)
 	VAR t: SET32;
 	BEGIN
@@ -149,10 +149,10 @@ TYPE
 		t := (LSH( y,   -2 ) / x) * Mask02;	 x := x / t;  y := y / LSH( t, 2 );
 		t := (LSH( y,   -8 ) / x) * Mask08;	 x := x / t;  y := y / LSH( t, 8 );
 		y := ROT( y, 1 );
-		t := (x / y) * Mask01;  y := y / t;  x := x / t; 
-		x := ROT( x, 1 );			
+		t := (x / y) * Mask01;  y := y / t;  x := x / t;
+		x := ROT( x, 1 );
 	END IP;
-		
+
 	PROCEDURE FP*( VAR x, y: SET32 );	(* final permutation *)
 	VAR t: SET32;
 	BEGIN
@@ -164,32 +164,32 @@ TYPE
 		t := (LSH( x, -16 ) / y) * Mask16;	 y := y / t;  x := x / LSH( t, 16 );
 		t := (LSH( x,   -4 ) / y) * Mask04;	 y := y / t;  x := x / LSH( t, 4 );
 	END FP;
-	
-	
-	
+
+
+
 	PROCEDURE ComputeSubkeys*( x, y: SET32;  VAR sk: ARRAY OF SET32; ofs: LONGINT );
 	VAR t: SET32; i: LONGINT;
-		
+
 		PROCEDURE sms( CONST LRHs: BitSwap;  x: SET32; rs, ls: LONGINT ): SET32;
 		VAR i: LONGINT;
 		BEGIN
 			i := S.VAL( LONGINT, LSH( x, -rs ) ) MOD 16;
-			RETURN LSH( LRHs[i], ls ) 
+			RETURN LSH( LRHs[i], ls )
 		END sms;
-			
+
 		PROCEDURE sm( b: SET32; shift, mask: LONGINT ): SET32;
 		BEGIN
 			RETURN LSH( b, shift ) * S.VAL( SET32,  mask )
 		END sm;
-		
+
 	BEGIN
-		t := (LSH( y, -4 ) / x) * S.VAL( SET32, 0F0F0F0FH );  x := x / t;  y := y / LSH( t, 4 );		
+		t := (LSH( y, -4 ) / x) * S.VAL( SET32, 0F0F0F0FH );  x := x / t;  y := y / LSH( t, 4 );
 		t := (y / x) * S.VAL( SET32, 10101010H ); x := x / t;  y := y / t;
-			
-		x := 
+
+		x :=
 			sms( LHs, x, 0, 3 ) + sms( LHs, x, 8, 2 ) + sms( LHs, x, 16, 1 ) + sms( LHs, x, 24, 0 ) +
 			sms( LHs, x, 5, 7 ) + sms( LHs, x, 13, 6 ) + sms( LHs, x, 21, 5 ) + sms( LHs, x, 29, 4 );
-		y :=	
+		y :=
 			sms( RHs, y, 1, 3 ) + sms( RHs, y, 9, 2 ) + sms( RHs, y, 17, 1 ) + sms( RHs, y, 25, 0 ) +
 			sms( RHs, y, 4, 7 ) + sms( RHs, y, 12, 6 ) + sms( RHs, y, 20, 5 ) + sms( RHs, y, 28, 4 );
 
@@ -199,8 +199,8 @@ TYPE
 			ELSE
 				x := LSH( x, 2 ) + LSH( x, -26 );  y := LSH( y, 2 ) + LSH( y, -26 )
 			END;
-					
-			sk[ofs + 2*i] :=	
+
+			sk[ofs + 2*i] :=
 					sm( x, 4,		24000000H ) + sm( x, 28,	10000000H ) +
 					sm( x, 14, 	08000000H ) + sm( x, 18,	02080000H ) +
 					sm( x, 6,		01000000H ) + sm( x, 9,		00200000H ) +
@@ -213,7 +213,7 @@ TYPE
 					sm( y, -3,		00000008H ) + sm( y, -18,	00000004H ) +
 					sm( y, -26,	00000002H ) + sm( y, -24,	00000001H );
 
-	        	sk[ofs + 2*i + 1] :=   
+	        	sk[ofs + 2*i + 1] :=
 	        			sm( x, 15,		20000000H ) + sm( x, 17,	10000000H ) +
 					sm( x, 10,		08000000H ) + sm( x, 22,	04000000H ) +
 					sm( x, -2,		02000000H ) + sm( x, 1,		01000000H ) +
@@ -228,18 +228,18 @@ TYPE
 		END
 	END ComputeSubkeys;
 
-	
+
 	PROCEDURE InitializeSandboxes;
-	VAR 
+	VAR
 		buf: U.InitBuffer;
-		
-	
+
+
 		PROCEDURE InitTable( VAR tab: ARRAY OF SET32 );
-		VAR i: LONGINT; 
+		VAR i: LONGINT;
 		BEGIN
 			FOR i := 0 TO LEN( tab ) - 1 DO  tab[i] := buf.GetSet( )  END
 		END InitTable;
-	
+
 	BEGIN
 		NEW( buf, 1024 );
 		buf.Add( "01010400 00000000 00010000 01010404 01010004 00010404 00000004 00010000 " );
@@ -284,7 +284,7 @@ TYPE
 		buf.Add( "00802081 00000081 00000001 00002000 00800001 00002001 00802080 00800081 " );
 		buf.Add( "00002001 00002080 00800000 00802001 00000080 00800000 00002000 00802080 " );
 		InitTable( sb4 );
-	    
+
 		buf.Init( 1024 );
 		buf.Add( "00000100 02080100 02080000 42000100 00080000 00000100 40000000 02080000 " );
 		buf.Add( "40080100 00080000 02000100 40080100 42000100 42080000 00080100 40000000 " );
@@ -328,17 +328,17 @@ TYPE
 		buf.Add( "00000000 10041040 00040040 10000040 10040000 10001000 10001040 00000000 " );
 		buf.Add( "10041040 00041000 00041000 00001040 00001040 00040040 10000000 10041000 " );
 		InitTable( sb8 );
-		
+
 		buf.Init( 512 );
 		buf.Add( "00000000 00000001 00000100 00000101 00010000 00010001 00010100 00010101 " );
 		buf.Add( "01000000 01000001 01000100 01000101 01010000 01010001 01010100 01010101 " );
 		InitTable( LHs );
-		
+
 		buf.Init( 512 );
 		buf.Add( "00000000 01000000 00010000 01010000 00000100 01000100 00010100 01010100 " );
 		buf.Add( "00000001 01000001 00010001 01010001 00000101 01000101 00010101 01010101 " );
 		InitTable( RHs );
-				
+
 	END InitializeSandboxes;
 
 BEGIN

+ 26 - 26
source/CryptoDES3.Mod

@@ -5,11 +5,11 @@ MODULE CryptoDES3;   (** AUTHOR "G.F."; PUROSE "Triple DES Cipher";	 *)
 
 IMPORT Ciphers := CryptoCiphers, U := CryptoUtils, D := CryptoDES;
 
-	
-	
+
+
 TYPE
 	Cipher* = OBJECT (Ciphers.Cipher)
-			VAR 
+			VAR
 				ske, skd: ARRAY 96 OF SET32; ski: LONGINT;
 				ivx, ivy: SET32;
 
@@ -18,23 +18,23 @@ TYPE
 				BEGIN
 					ASSERT( keybits = 192 );
 					InitKey^( src, 64 );
-					
+
 					X := U.SetFromBufferBE( src, 0 );  Y := U.SetFromBufferBE( src, 4 );
 					D.ComputeSubkeys( X, Y, ske, 0 );
-					
+
 					X := U.SetFromBufferBE( src, 8 );  Y := U.SetFromBufferBE( src, 12 );
 					D.ComputeSubkeys( X, Y, skd, 32 );
-					
+
 					X := U.SetFromBufferBE( src, 16);  Y := U.SetFromBufferBE( src, 20 );
 					D.ComputeSubkeys( X, Y, ske, 64 );
-					
+
 					FOR i := 0 TO 30 BY 2 DO
 						skd[i + 0] := ske[94 - i];
 						skd[i + 1] := ske[95 - i];
-						
+
 						ske[i + 32] := skd[62 - i];
 						ske[i + 33] := skd[63 - i];
-						
+
 						skd[i + 64] := ske[30 - i];
 						skd[i + 65] := ske[31 - i]
 					END
@@ -58,18 +58,18 @@ TYPE
 
 						D.IP( X, Y );
 						ski := 0;
-						FOR r := 0 TO 7 DO  
+						FOR r := 0 TO 7 DO
 							RoundE( Y, X );  RoundE( X, Y );
 						END;
-						FOR r := 0 TO 7 DO  
+						FOR r := 0 TO 7 DO
 							RoundE( X, Y );  RoundE( Y, X );
 						END;
-						FOR r := 0 TO 7 DO  
+						FOR r := 0 TO 7 DO
 							RoundE( Y, X );  RoundE( X, Y );
 						END;
 						D.FP( Y, X );
-						
-						U.SetToBufferBE( Y, buf, ofs + i );   U.SetToBufferBE( X, buf, ofs + i + 4); 
+
+						U.SetToBufferBE( Y, buf, ofs + i );   U.SetToBufferBE( X, buf, ofs + i + 4);
 						IF mode = Ciphers.CBC THEN  ivx := Y;  ivy := X  END;
 						INC( i, blockSize )
 					END
@@ -84,30 +84,30 @@ TYPE
 					WHILE i < len DO
 						X := U.SetFromBufferBE( buf, ofs + i );  Y := U.SetFromBufferBE( buf, ofs + i + 4 );
 						IF mode = Ciphers.CBC THEN  X0 := X;  Y0 := Y  END;
-						
+
 						D.IP( X, Y );
 						ski := 0;
-						FOR r := 0 TO 7 DO  
+						FOR r := 0 TO 7 DO
 							RoundD( Y, X );  RoundD( X, Y );
 						END;
-						FOR r := 0 TO 7 DO  
+						FOR r := 0 TO 7 DO
 							RoundD( X, Y );  RoundD( Y, X );
 						END;
-						FOR r := 0 TO 7 DO  
+						FOR r := 0 TO 7 DO
 							RoundD( Y, X );  RoundD( X, Y );
 						END;
 						D.FP( Y, X );
-						
-						IF mode = Ciphers.CBC THEN  
-							Y := Y / ivx;  X := X / ivy  ; 
-							ivx := X0;  ivy := Y0  
+
+						IF mode = Ciphers.CBC THEN
+							Y := Y / ivx;  X := X / ivy  ;
+							ivx := X0;  ivy := Y0
 						END;
-						U.SetToBufferBE( Y, buf, ofs + i );   U.SetToBufferBE( X, buf, ofs + i + 4); 
+						U.SetToBufferBE( Y, buf, ofs + i );   U.SetToBufferBE( X, buf, ofs + i + 4);
 						INC( i, blockSize )
 					END
 				END Decrypt;
 
-				
+
 				PROCEDURE RoundE*( VAR x, y: SET32 );
 				VAR i: D.Ind4;
 				BEGIN
@@ -116,7 +116,7 @@ TYPE
 					D.Split( ske[ski] / ROT( x, -4 ), i );  INC( ski );
 					y := y / D.sb7[i.a] / D.sb5[i.b] / D.sb3[i.c] / D.sb1[i.d]
 				END RoundE;
-				
+
 				PROCEDURE RoundD*( VAR x, y: SET32 );
 				VAR i: D.Ind4;
 				BEGIN
@@ -132,7 +132,7 @@ TYPE
 				END Init;
 
 			END Cipher;
-			
+
 
 
 	PROCEDURE NewCipher*( ): Ciphers.Cipher;

+ 3 - 3
source/CryptoDiffieHellman.Mod

@@ -50,14 +50,14 @@ TYPE
 
 
 	PROCEDURE GetDHPrime( CONST name: ARRAY OF CHAR;  VAR p, g: B.BigNumber );
-	VAR 
-		buf: ARRAY 1048 OF CHAR; 
+	VAR
+		buf: ARRAY 1048 OF CHAR;
 		pos: LONGINT;
 
 		PROCEDURE Append( CONST val: ARRAY OF CHAR );
 		VAR i: LONGINT;  c: CHAR;
 		BEGIN
-			FOR i := 0 TO LEN( val ) - 1 DO  
+			FOR i := 0 TO LEN( val ) - 1 DO
 				c := val[i];
 				IF c > ' ' THEN  buf[pos] := c;  INC( pos )  END
 			END;

+ 40 - 40
source/CryptoKeccakF1600.Mod

@@ -10,19 +10,19 @@ IMPORT S := SYSTEM;
 CONST
 	Width* = 1600;			(* state size in bits *)
 	LaneSize* = 8;			(* lane size in bytes *)
-	
-CONST 
+
+CONST
 	nrRounds = 24;  nrLanes = 25;
-	
+
 TYPE
 	Lane = RECORD  low, high: SET32  END;
 	State = ARRAY nrLanes OF Lane;
 
-VAR 
+VAR
 	roundConstants: ARRAY nrRounds OF Lane;
 	rhoOffsets: ARRAY nrLanes OF LONGINT;
-	
-TYPE 
+
+TYPE
 	Instance* = OBJECT
 	VAR
 		state: State;
@@ -32,7 +32,7 @@ TYPE
 		BEGIN
 			Initialize
 		END Init;
-		
+
 		PROCEDURE Initialize*;
 		VAR i: LONGINT;
 		BEGIN
@@ -47,9 +47,9 @@ TYPE
 			ASSERT( (laneNo < nrLanes) & (laneOffset < LaneSize) & (laneOffset+length <= LaneSize) );
 			lane.low := {};  lane.high := {};
 			S.MOVE( ADDRESSOF( data[dataOffset] ), ADDRESSOF( lane ) + laneOffset, length );
-			
+
 			ToBitInterleaving( lane, lane );
-			
+
 			state[laneNo].low := state[laneNo].low / lane.low;
 			state[laneNo].high := state[laneNo].high / lane.high;
 		END XORBytesInLane;
@@ -62,9 +62,9 @@ TYPE
 			ASSERT( laneCount <= nrLanes );
 			FOR laneNo := 0 TO laneCount - 1 DO
 				S.MOVE( ADDRESSOF( data[offset + laneNo*LaneSize] ), ADDRESSOF( lane ), LaneSize );
-				
+
 				ToBitInterleaving( lane, lane );
-				
+
 				state[laneNo].low := state[laneNo].low / lane.low;
 				state[laneNo].high := state[laneNo].high / lane.high;
 			END
@@ -76,7 +76,7 @@ TYPE
 			laneNo, bit: LONGINT;
 		BEGIN
 			ASSERT( position < 1600 );
-			laneNo := position DIV 64;  bit := position MOD 64; 
+			laneNo := position DIV 64;  bit := position MOD 64;
 			IF bit < 32 THEN
 				state[laneNo].low := SET32( state[laneNo].low / {bit} )
 			ELSE
@@ -96,7 +96,7 @@ TYPE
 
 
 		PROCEDURE ExtractLanes*( VAR data: ARRAY OF CHAR; offset, laneCount: LONGINT );
-		VAR 
+		VAR
 			lane: Lane;  laneNo: LONGINT;
 		BEGIN
 			ASSERT( laneCount <= nrLanes );
@@ -111,9 +111,9 @@ TYPE
 			XORLanes( inData, offset, count );
 			Permute;
 		END XORPermute;
-		
-		
-		PROCEDURE XORPermuteExtract*(	CONST inData: ARRAY OF CHAR; inOffset, inLaneCount: LONGINT; 
+
+
+		PROCEDURE XORPermuteExtract*(	CONST inData: ARRAY OF CHAR; inOffset, inLaneCount: LONGINT;
 												VAR outData: ARRAY OF CHAR; outOffset, outLaneCount: LONGINT );
 		BEGIN
 			XORLanes( inData, inOffset, inLaneCount );
@@ -145,7 +145,7 @@ TYPE
 	        temp := (temp0 / LSH( temp0, -2 )) * S.VAL( SET32, 00C0C0C0CH );  temp0 := temp0 / temp / LSH( temp, 2 );
 	        temp := (temp0 / LSH( temp0, -4 )) * S.VAL( SET32, 000F000F0H );  temp0 := temp0 / temp / LSH( temp, 4 );
 	        temp := (temp0 / LSH( temp0, -8 )) * S.VAL( SET32, 00000FF00H );  temp0 := temp0 / temp / LSH( temp, 8 );
-	        
+
 	        temp := (temp1 / LSH( temp1, -1 )) * S.VAL( SET32, 022222222H );  temp1 := temp1 / temp / LSH( temp, 1 );
 	        temp := (temp1 / LSH( temp1, -2 )) * S.VAL( SET32, 00C0C0C0CH );  temp1 := temp1 / temp / LSH( temp, 2 );
 	        temp := (temp1 / LSH( temp1, -4 )) * S.VAL( SET32, 000F000F0H );  temp1 := temp1 / temp / LSH( temp, 4 );
@@ -158,16 +158,16 @@ TYPE
 	PROCEDURE FromBitInterleaving( CONST in: Lane;  VAR out: Lane );
 	VAR temp, temp0, temp1: SET32;
 	BEGIN
-	        temp0 := in.low; 
-	        temp1 := in.high; 
-	        temp := (temp0 * S.VAL( SET32, 00000FFFFH )) + LSH( temp1, 16 ); 
-	        temp1 := LSH( temp0, - 16) + (temp1 * S.VAL( SET32, 0FFFF0000H )); 
-	        temp0 := temp; 
-	        temp := (temp0 / LSH( temp0, -8 )) * S.VAL( SET32, 00000FF00H );  temp0 := temp0 / temp / LSH( temp, 8 ); 
-	        temp := (temp0 / LSH( temp0, -4 )) * S.VAL( SET32, 000F000F0H );  temp0 := temp0 / temp / LSH( temp, 4 ); 
-	        temp := (temp0 / LSH( temp0, -2 )) * S.VAL( SET32, 00C0C0C0CH );  temp0 := temp0 / temp / LSH( temp, 2 ); 
-	        temp := (temp0 / LSH( temp0, -1 )) * S.VAL( SET32, 022222222H );  temp0 := temp0 / temp / LSH( temp, 1 ); 
-	        
+	        temp0 := in.low;
+	        temp1 := in.high;
+	        temp := (temp0 * S.VAL( SET32, 00000FFFFH )) + LSH( temp1, 16 );
+	        temp1 := LSH( temp0, - 16) + (temp1 * S.VAL( SET32, 0FFFF0000H ));
+	        temp0 := temp;
+	        temp := (temp0 / LSH( temp0, -8 )) * S.VAL( SET32, 00000FF00H );  temp0 := temp0 / temp / LSH( temp, 8 );
+	        temp := (temp0 / LSH( temp0, -4 )) * S.VAL( SET32, 000F000F0H );  temp0 := temp0 / temp / LSH( temp, 4 );
+	        temp := (temp0 / LSH( temp0, -2 )) * S.VAL( SET32, 00C0C0C0CH );  temp0 := temp0 / temp / LSH( temp, 2 );
+	        temp := (temp0 / LSH( temp0, -1 )) * S.VAL( SET32, 022222222H );  temp0 := temp0 / temp / LSH( temp, 1 );
+
 	        temp := (temp1 / LSH( temp1, -8 )) * S.VAL( SET32, 00000FF00H );  temp1 := temp1 / temp / LSH( temp, 8 );
 	        temp := (temp1 / LSH( temp1, -4 )) * S.VAL( SET32, 000F000F0H );  temp1 := temp1 / temp / LSH( temp, 4 );
 	        temp := (temp1 / LSH( temp1, -2 )) * S.VAL( SET32, 00C0C0C0CH );  temp1 := temp1 / temp / LSH( temp, 2 );
@@ -190,7 +190,7 @@ TYPE
 			lane.high := ROT( lane.high, offset DIV 2 )
 		END;
 	END ROL64;
-	
+
 
 	PROCEDURE ROL64_1XOR( CONST in1, in2: Lane; VAR out: Lane );
 	BEGIN
@@ -202,15 +202,15 @@ TYPE
 	PROCEDURE Round( VAR a: State; r: LONGINT );
 	VAR
 		x, y, i, i1, i2: LONGINT;
-		c, d: ARRAY 5 OF Lane;  
-		a0: State;  
+		c, d: ARRAY 5 OF Lane;
+		a0: State;
 	BEGIN
 		(* theta *)
 		FOR x := 0 TO 4 DO
 			c[x].low := {};  c[x].high := {};
 			FOR y := 0 TO 20 BY 5 DO
-				c[x].low := c[x].low / a[x+y].low;  
-				c[x].high := c[x].high / a[x+y].high;	
+				c[x].low := c[x].low / a[x+y].low;
+				c[x].high := c[x].high / a[x+y].high;
 			END
 		END;
 		FOR x := 0 TO 4 DO
@@ -219,13 +219,13 @@ TYPE
 		FOR x := 0 TO 4 DO
 			FOR y := 0 TO 4 DO
 				i := x + 5*y;
-				a[i].low := a[i].low / d[x].low;  
-				a[i].high := a[i].high / d[x].high	
+				a[i].low := a[i].low / d[x].low;
+				a[i].high := a[i].high / d[x].high
 			END
 		END;
 		(* rho *)
 		FOR i := 0 TO 24 DO
-			ROL64( a[i], rhoOffsets[i] );	
+			ROL64( a[i], rhoOffsets[i] );
 		END;
 		(* pi *)
 		a0 := a;
@@ -247,7 +247,7 @@ TYPE
 			i := 4 + y;  i1 := 0 + y;  i2 := 1 + y;
 			c[4].low := a[i].low / ((-a[i1].low) * a[i2].low);
 			c[4].high := a[i].high / ((-a[i1].high) * a[i2].high);
-			FOR x := 0 TO 4 DO  
+			FOR x := 0 TO 4 DO
 				a[x+y].low := c[x].low;
 				a[x+y].high := c[x].high
 			END
@@ -256,8 +256,8 @@ TYPE
 		a[0].low := a[0].low / roundConstants[r].low;
 		a[0].high := a[0].high / roundConstants[r].high;
 	END Round;
-	
-	
+
+
 
 	(* ---------------------------------------------------------------- *)
 
@@ -272,7 +272,7 @@ TYPE
 		FOR i := 0 TO nrRounds - 1 DO
 			lane.low := {};  lane.high := {};
 			FOR j := 0 TO 6 DO
-	       		bit := ASH( 1, j ) - 1; 
+	       		bit := ASH( 1, j ) - 1;
 	 			IF LFSR86540( LFSRstate ) THEN
 	      			IF bit < 32 THEN  INCL( lane.low, bit )  ELSE  INCL( lane.high, bit - 32 )  END
 	   			END
@@ -317,4 +317,4 @@ BEGIN
 	InitializeRhoOffsets;
 END CryptoKeccakF1600.
 
-	
+

+ 20 - 20
source/CryptoKeccakSponge.Mod

@@ -12,13 +12,13 @@ CONST
 	Width* = Keccak.Width;
 	DefaultRate* = 1024;
 	DefaultCapacity* = 576;
-	
-TYPE 
-	Instance* = OBJECT 
+
+TYPE
+	Instance* = OBJECT
 	VAR
 		state: Keccak.Instance;	(* The state processed by the permutation. *)
 		chunk: LONGINT;		(* The value of the rate in bytes *)
-		index: LONGINT;			(* The position in the state of the next byte to be 
+		index: LONGINT;			(* The position in the state of the next byte to be
 									input (when absorbing) or output (when squeezing). *)
 		squeezing: BOOLEAN	;	(* false: in the absorbing phase; otherwise, in the squeezing phase. *)
 		cmodl: LONGINT;		(* chunk MOD LaneSize *)
@@ -29,8 +29,8 @@ TYPE
 			NEW( state );
 			Initialize( DefaultRate, DefaultCapacity )
 		END Init;
-		
-		
+
+
 		PROCEDURE Initialize*( rate, capacity: LONGINT );
 		BEGIN
 			ASSERT( rate + capacity = Width );
@@ -42,20 +42,20 @@ TYPE
 			cdivl := chunk DIV LaneSize;
 			squeezing := FALSE
 		END Initialize;
-	
-		
+
+
 		PROCEDURE Absorb*( CONST data: ARRAY OF CHAR; offset, len: LONGINT );
-		VAR 
+		VAR
 			piece, lanes, laneNo, laneOffset, bytes: LONGINT;
 		BEGIN
-			ASSERT( squeezing = FALSE ); 
+			ASSERT( squeezing = FALSE );
 			WHILE len > 0 DO
 				IF (index = 0) & ( len >= chunk) THEN
 					(* fast lane: processing whole blocks first *)
 					state.XORLanes( data, offset, cdivl );
 					IF cmodl # 0 THEN  state.XORBytesInLane( cdivl, 0, cmodl, data, offset )  END;
 					state.Permute;
-					INC( offset, chunk );  DEC( len, chunk );  
+					INC( offset, chunk );  DEC( len, chunk );
 				ELSE
 					(* normal lane: using the message queue*)
 					piece := len;
@@ -63,8 +63,8 @@ TYPE
 					IF (index = 0) & (piece >=  LaneSize) THEN
 						lanes := piece DIV LaneSize;  bytes := lanes*LaneSize;
 						state.XORLanes( data, offset, lanes );
-						INC( offset, bytes );  DEC( len, bytes );  DEC( piece, bytes ); 
-						INC( index, bytes );   
+						INC( offset, bytes );  DEC( len, bytes );  DEC( piece, bytes );
+						INC( index, bytes );
 					END;
 					WHILE piece > 0 DO
 						laneNo := index DIV LaneSize;
@@ -79,9 +79,9 @@ TYPE
 				END
 			END
 		END Absorb;
-		
-		
-		
+
+
+
 		PROCEDURE Squeeze*( VAR data: ARRAY OF CHAR;  offset, len: LONGINT );
 		VAR piece, lanes, laneNo, laneOffset, bytes: LONGINT;
 		BEGIN
@@ -116,11 +116,11 @@ TYPE
 				END
 			END;
 		END Squeeze;
-		
+
 		PROCEDURE AbsorbLastFewBits*( data: CHAR );
 		VAR tmp: ARRAY 4 OF CHAR;
 		BEGIN
-			ASSERT( (data # 0X) & (squeezing = FALSE) ); 
+			ASSERT( (data # 0X) & (squeezing = FALSE) );
 			tmp[0] := data;
 			state.XORBytesInLane( index DIV LaneSize, index MOD LaneSize, 1, tmp, 0 );
 			IF (data >= 80X) & (index = chunk - 1) THEN  state.Permute  END;
@@ -129,9 +129,9 @@ TYPE
 			index := 0;
 			squeezing := TRUE
 		END AbsorbLastFewBits;
-	
+
 	END Instance;
-	
+
 
 
 END CryptoKeccakSponge.

+ 8 - 8
source/CryptoMD5.Mod

@@ -23,9 +23,9 @@ TYPE
 		BEGIN
 			N := 0;
 			(* Initialize chaining values *)
-			A := LONGINT( 067452301H );  
-			B := LONGINT( 0EFCDAB89H );  
-			C := LONGINT( 098BADCFEH );  
+			A := LONGINT( 067452301H );
+			B := LONGINT( 0EFCDAB89H );
+			C := LONGINT( 098BADCFEH );
 			D := LONGINT( 010325476H );
 			initialized := TRUE
 		END Initialize;
@@ -92,11 +92,11 @@ VAR
 		NEW( h );  RETURN h
 	END NewHash;
 
-	
+
 
 	PROCEDURE MD5( CONST X: Buffer; VAR A, B, C, D: LONGINT );
 	VAR  a, b, c, d: LONGINT;
-	
+
 		PROCEDURE -F1( VAR a: LONGINT;  b, c, d, x, s, t: LONGINT );
 		VAR f: LONGINT;
 		BEGIN
@@ -124,7 +124,7 @@ VAR
 			f := S.VAL( LONGINT, S.VAL( SET32, c ) / (S.VAL( SET32, b ) + (-S.VAL( SET32, d ))) );
 			a := ROT( a + f + x + t, s ) + b
 		END F4;
-	
+
 	BEGIN
 		a := A;  b := B;  c := C;  d := D;
 
@@ -166,9 +166,9 @@ VAR
 
 		INC( A, a );  INC( B, b );  INC( C, c );  INC( D, d );
 	END MD5;
-	
+
 	PROCEDURE Initialize;
-	VAR 
+	VAR
 		buf: U.InitBuffer;  i: LONGINT;
 	BEGIN
 		NEW( buf, 1024 );

+ 1 - 1
source/CryptoPrimes.Mod

@@ -220,6 +220,6 @@ VAR
 	END Init;
 
 BEGIN
-	Init;  B.AssignInt( one, 1 ); 
+	Init;  B.AssignInt( one, 1 );
 END CryptoPrimes.
 

+ 3 - 3
source/CryptoRSA.Mod

@@ -313,10 +313,10 @@ VAR
 	VAR str: ARRAY 64 OF CHAR;
 	BEGIN
 		r.SkipWhitespace; r.String( str );
-		ASSERT( str = "ssh-rsa" );	
+		ASSERT( str = "ssh-rsa" );
 		RETURN ExtractPublicKey( r )
 	END LoadPublicKey;
-	
+
 	PROCEDURE ExtractPublicKey*( r: Streams.Reader ): Key;
 	VAR buf: ARRAY 4096 OF CHAR; len, pos: LONGINT;
 		str: ARRAY 64 OF CHAR;
@@ -326,7 +326,7 @@ VAR
 		len := Base64.DecodeStream( r, buf );
 		pos := 0;
 		U.GetString( buf, pos, str );
-		ASSERT( str = "ssh-rsa" );	
+		ASSERT( str = "ssh-rsa" );
 		U.GetBigNumber( buf, pos, k.exponent );
 		U.GetBigNumber( buf, pos, k.modulus );
 		RETURN k

+ 11 - 11
source/CryptoSHA1.Mod

@@ -15,8 +15,8 @@ TYPE
 			Nl, Nh: LONGINT;
 			cdata: ARRAY BlockSize OF CHAR;	(* pending data *)
 			cn: LONGINT	(* number of chars in data *)
-			
-			
+
+
 		PROCEDURE &Init*;
 		BEGIN
 			SetNameAndSize( "sha1", 20 );
@@ -35,8 +35,8 @@ TYPE
 			cn := 0;
 			initialized := TRUE
 		END Initialize;
-		
-		
+
+
 		PROCEDURE HashContextBlock;
 		BEGIN
 			HashBlock( hash, cdata, 0 );  cn := 0
@@ -65,7 +65,7 @@ TYPE
 			END;
 
 			n := 0;
-			WHILE n < len DIV BlockSize  DO  
+			WHILE n < len DIV BlockSize  DO
 				HashBlock( hash, data, pos );  INC( n ); INC( pos, BlockSize )
 			END;
 			len := len MOD BlockSize;
@@ -122,7 +122,7 @@ TYPE
 
 	PROCEDURE -tr0019( a: LONGINT; VAR b: LONGINT; c, d, e: LONGINT; VAR  f: LONGINT; x: SET32 );
 	BEGIN
-		f := S.VAL( LONGINT, x ) + e + 5A827999H + ROT( a, 5 ) + 
+		f := S.VAL( LONGINT, x ) + e + 5A827999H + ROT( a, 5 ) +
 			(*F1( b, c, d );*)
 			S.VAL( LONGINT, ((S.VAL( SET32, c ) / S.VAL( SET32, d )) * S.VAL( SET32, b )) / S.VAL( SET32, d ) );
 		b := ROT( b, 30 );
@@ -130,7 +130,7 @@ TYPE
 
 	PROCEDURE -tr2039( a: LONGINT;  VAR b: LONGINT;  c, d, e: LONGINT;  VAR f: LONGINT;  x: SET32 );
 	BEGIN
-		f := S.VAL( LONGINT, x ) + e + 6ED9EBA1H + ROT( a, 5 ) + 
+		f := S.VAL( LONGINT, x ) + e + 6ED9EBA1H + ROT( a, 5 ) +
 			(*F2( b, c, d );*)
 			S.VAL( LONGINT, S.VAL( SET32, b ) / S.VAL( SET32, c ) / S.VAL( SET32, d ) );
 		b := ROT( b, 30 );
@@ -138,7 +138,7 @@ TYPE
 
 	PROCEDURE -tr4059( a: LONGINT;  VAR b: LONGINT;  c, d, e: LONGINT;  VAR f: LONGINT;  x: SET32);
 	BEGIN
-		f := S.VAL( LONGINT, x ) + e + LONGINT(8F1BBCDCH) + ROT( a, 5 ) + 
+		f := S.VAL( LONGINT, x ) + e + LONGINT(8F1BBCDCH) + ROT( a, 5 ) +
 			(*F3( b, c, d );*)
 			S.VAL( LONGINT, (S.VAL( SET32, b ) * S.VAL( SET32, c )) + ((S.VAL( SET32, b ) + S.VAL( SET32, c )) * S.VAL( SET32, d )) );
 		b := ROT( b, 30 )
@@ -146,14 +146,14 @@ TYPE
 
 	PROCEDURE -tr6079( a: LONGINT;  VAR b: LONGINT;  c, d, e: LONGINT;  VAR f: LONGINT;  x: SET32 );
 	BEGIN
-		f := S.VAL( LONGINT, x ) + e + LONGINT(0CA62C1D6H) + ROT( a, 5 ) + 
+		f := S.VAL( LONGINT, x ) + e + LONGINT(0CA62C1D6H) + ROT( a, 5 ) +
 			(*F2( b, c, d );*)
 			S.VAL( LONGINT, S.VAL( SET32, b ) / S.VAL( SET32, c ) / S.VAL( SET32, d ) );
 		b := ROT( b, 30 );
 	END tr6079;
 
 	PROCEDURE HashBlock( VAR state: State;  CONST buf: ARRAY OF CHAR;  pos: LONGINT );
-	VAR 
+	VAR
 		A, B, C, D, E, T: LONGINT;
 		x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, xa, xb, xc, xd, xe, xf: SET32;
 	BEGIN
@@ -244,7 +244,7 @@ TYPE
 		xe := ROT( xe / x0 / x6 / xb, 1 );		tr6079( A, B, C, D, E, T, xe );
 		xf  := ROT( xf  / x1 / x7 / xc, 1 );		tr6079( T, A, B, C, D, E, xf  );
 
-		INC( state[0], E );  INC( state[1], T );  INC( state[2], A );  
+		INC( state[0], E );  INC( state[1], T );  INC( state[2], A );
 		INC( state[3], B );  INC( state[4], C );
 	END HashBlock;
 

+ 23 - 23
source/CryptoSHA256.Mod

@@ -5,10 +5,10 @@ IMPORT
 
 CONST
 	BlockSize = 64;
-	
-VAR 
+
+VAR
 	K256: ARRAY 64 OF LONGINT;
-	
+
 
 TYPE
 	Hash* = OBJECT (Hashes.Hash)
@@ -20,7 +20,7 @@ TYPE
 
 		PROCEDURE &Init*;
 		BEGIN
-			SetNameAndSize( "sha256", 32 ); 
+			SetNameAndSize( "sha256", 32 );
 			initialized := FALSE
 		END Init;
 
@@ -35,14 +35,14 @@ TYPE
 			cn := 0;
 			initialized := TRUE
 		END Initialize;
-		
+
 		PROCEDURE HashBlock( CONST buf: ARRAY OF CHAR;  pos: LONGINT );
 		VAR a, b, c, d, e, f, g, h, s0, s1, s, T1, T2, i: LONGINT;
 			X: ARRAY 16 OF LONGINT
 		BEGIN
 			a := hash[0];  b := hash[1];  c := hash[2];  d := hash[3];
 			e := hash[4];  f := hash[5];  g := hash[6];  h := hash[7];
-				
+
 			FOR i := 0 TO 63 DO
 				IF i < 16 THEN
 					X[i] := U.IntFromBufferBE( buf, pos );  INC( pos, 4 )
@@ -50,25 +50,25 @@ TYPE
 					s0 := sigma0( X[(i + 1) MOD 16] );
 					s1 := sigma1( X[(i + 14) MOD 16] );
 					s := s0 + s1 + X[(i + 9) MOD 16];
-					INC( X[i MOD 16], s );  
+					INC( X[i MOD 16], s );
 				END;
 				T1 := X[i MOD 16] + h + Sigma1Ch( e, f, g ) + K256[i];
 				T2 := Sigma0Maj( a, b, c );
 				h := g;  g := f;  f := e;  e := d + T1;
 				d := c;  c := b;  b := a;  a := T1 + T2;
 			END;
-			
+
 			INC( hash[0], a );  INC( hash[1],  b );  INC( hash[2],  c );  INC( hash[3],  d );
 			INC( hash[4], e );  INC( hash[5],  f );  INC( hash[6],  g );  INC( hash[7],  h );
 		END HashBlock;
-	
-	
+
+
 		PROCEDURE HashContextBlock;
 		BEGIN
 			HashBlock( cdata, 0 );  cn := 0
 		END HashContextBlock;
-		
-		
+
+
 		(** data: value to be hashed *)
 		PROCEDURE Update*( CONST data: ARRAY OF CHAR;  pos, len: LONGINT );
 			VAR n, i, l: LONGINT;
@@ -110,7 +110,7 @@ TYPE
 			WHILE cn < p  DO  cdata[cn] := 0X;  INC( cn )  END;
 			U.IntToBufferBE( Nh, cdata, p );  U.IntToBufferBE( Nl, cdata, p + 4 );
 			HashContextBlock;
-			
+
 			FOR i := 0 TO 7 DO  U.IntToBufferBE( hash[i], buf, pos );  INC( pos, 4 )  END;
 		END GetHash;
 
@@ -130,17 +130,17 @@ TYPE
 
 
 	PROCEDURE -Sigma0Maj( px, py, pz: LONGINT ): LONGINT;
-	VAR x, y, z, a, b: SET32; 
-	BEGIN 
+	VAR x, y, z, a, b: SET32;
+	BEGIN
 		x := S.VAL( SET32, px );  y := S.VAL( SET32, py );  z := S.VAL( SET32, pz );
 		a := ROT( x, 30 ) / ROT( x, 19 ) / ROT( x, 10 );
 		b := (x*y) / (x*z) / (y*z);
 		RETURN S.VAL( LONGINT, a ) + S.VAL( LONGINT, b )
 	END Sigma0Maj;
-	
+
 	PROCEDURE -Sigma1Ch( px, py, pz: LONGINT ): LONGINT;
 	VAR x, y, z, a, b: SET32;
-	BEGIN 
+	BEGIN
 		x := S.VAL( SET32, px );  y := S.VAL( SET32, py );  z := S.VAL( SET32, pz );
 		a := ROT( x, 26 ) / ROT( x, 21 ) / ROT( x, 7 );
 		b := (x*y) / ((-x)*z);
@@ -149,23 +149,23 @@ TYPE
 
 	PROCEDURE -sigma0( px: LONGINT ): LONGINT;
 	VAR x: SET32;
-	BEGIN 
+	BEGIN
 		x :=S.VAL( SET32, px );
 		RETURN S.VAL( LONGINT, ROT( x , 25 ) / ROT( x, 14 ) / LSH( x, -3 ) )
 	END sigma0;
-	
+
 	PROCEDURE -sigma1( px: LONGINT ): LONGINT;
 	VAR x: SET32;
-	BEGIN 
+	BEGIN
 		x := S.VAL( SET32, px );
 		RETURN S.VAL( LONGINT, ROT( x , 15 ) / ROT( x, 13 ) / LSH( x, -10 ) )
 	END sigma1;
-	
 
 
-	
+
+
 	PROCEDURE InitializeK;
-	VAR 
+	VAR
 		buf: U.InitBuffer; i: LONGINT;
 	BEGIN
 		NEW( buf, 2048 );

+ 8 - 8
source/CryptoSHA3.Mod

@@ -12,12 +12,12 @@ TYPE
 		VAR
 			sponge: Sponge.Instance;
 			capacity: LONGINT;
-			
+
 		PROCEDURE &Init*;	(* sha3-256 (default) *)
 		BEGIN
 			NEW( sponge );
-			capacity := 2*256;   
-			Initialize	
+			capacity := 2*256;
+			Initialize
 		END Init;
 
 		PROCEDURE Initialize*;
@@ -36,22 +36,22 @@ TYPE
 			sponge.Initialize( Sponge.Width - capacity, capacity );
 			initialized := TRUE
 		END Initialize;
-		
+
 		PROCEDURE SetNameAndSize*( CONST name: ARRAY OF CHAR; bytesize: LONGINT );
 		(* valid bytesize values: 28, 32(default), 48, 64 *)
 		BEGIN
 			capacity := 2*8*bytesize;  Initialize;
 			IF name # "" THEN  SetNameAndSize^( name, bytesize )  END
 		END SetNameAndSize;
-		
+
 
 		(** data: value to be hashed *)
 		PROCEDURE Update*( CONST data: ARRAY OF CHAR;  pos, len: LONGINT );
 		BEGIN
-			ASSERT( initialized );	
+			ASSERT( initialized );
 			sponge.Absorb( data, pos, len )
 		END Update;
-		
+
 
 		(** get the hashvalue of length SELF.size *)
 		PROCEDURE GetHash*( VAR buf: ARRAY OF CHAR;  pos: LONGINT );
@@ -64,7 +64,7 @@ TYPE
 
 
 
-	
+
 	(** get an instance of SHA-3 *)
 	PROCEDURE NewHash*( ) : Hashes.Hash;
 		VAR h: Hash;

+ 43 - 43
source/CryptoTestCiphers.Mod

@@ -27,7 +27,7 @@ IMPORT
 		cipher.InitKey( binkey, keybits );
 		cipher.Decrypt( bindata, 0, cipher.blockSize );
 		Out.Ln; Out.String( "Decrypted: " ); U.PrintHex( bindata, 0, cipher.blockSize );
-		bindata[cipher.blockSize] := 0X; 
+		bindata[cipher.blockSize] := 0X;
 		Out.Ln;
 		IF bindata = orig THEN  Out.String( "OK" )  ELSE  Out.String( "FAIL" )  END;
 		Out.Ln
@@ -61,12 +61,12 @@ IMPORT
 		cipher.SetIV( iv, Ciphers.CBC );
 		cipher.Decrypt( bindata, 0, 2 * cipher.blockSize );
 		Out.Ln; Out.String( "Decrypted: " ); U.PrintHex( bindata, 0, 2 * cipher.blockSize );
-		bindata[2 * cipher.blockSize] := 0X; 
+		bindata[2 * cipher.blockSize] := 0X;
 		Out.Ln;
 		IF bindata = orig THEN  Out.String( "OK" )  ELSE  Out.String( "FAIL" )  END;
 		Out.Ln
 	END Cbc1;
-	
+
 	PROCEDURE  Ctr1*(context : Commands.Context);
 		VAR
 			hex, bindata, binkey, modname, iv, orig: ARRAY 64 OF CHAR; cipher: Ciphers.Cipher;
@@ -95,12 +95,12 @@ IMPORT
 		cipher.SetIV( iv, Ciphers.CTR );
 		cipher.Decrypt( bindata, 0, 16 );
 		Out.Ln; Out.String( "Decrypted: " ); U.PrintHex( bindata, 0, 16 );
-		bindata[16] := 0X; 
+		bindata[16] := 0X;
 		Out.Ln;
 		IF bindata = orig THEN  Out.String( "OK" )  ELSE  Out.String( "FAIL" )  END;
 		Out.Ln
 	END Ctr1;
-	
+
 
 	(** encrypt input with key (ebc-mode). output is a testvector *)
 	PROCEDURE  Ecb2*( CONST modname, input, output, key: ARRAY OF CHAR; datalen, keybits: LONGINT );
@@ -142,7 +142,7 @@ IMPORT
 		Out.Ln; Out.String( "Key: " ); U.PrintHex( temp1, 0, keybits DIV 8 );
 		U.Hex2Bin( input, 0, temp1, 0, datalen );
 		Out.Ln; Out.String( "plaintext: " ); U.PrintHex( temp1, 0, datalen );
-		cipher.Encrypt( temp1, 0, datalen ); 
+		cipher.Encrypt( temp1, 0, datalen );
 		Out.Ln; Out.String( "encryption: " ); U.PrintHex( temp1, 0, datalen );
 		U.Hex2Bin( output, 0, temp2, 0, datalen );
 		Out.Ln; Out.String( "correct encryption: " ); U.PrintHex( temp2, 0, datalen );
@@ -151,7 +151,7 @@ IMPORT
 		IF temp1 = temp2 THEN  Out.String( "OK" )  ELSE  Out.String( "FAIL" )  END;
 		Out.Ln
 	END Cbc2;
-	
+
 	(** decrypt input with key (cbc-mode). output is a testvector *)
 	PROCEDURE DecryptCbc2*(CONST modname, input, output, key, iv: ARRAY OF CHAR; datalen, keybits: LONGINT);
 		VAR
@@ -168,7 +168,7 @@ IMPORT
 		Out.Ln; Out.String( "Key: " ); U.PrintHex( temp1, 0, keybits DIV 8 );
 		U.Hex2Bin( input, 0, temp1, 0, datalen );
 		Out.Ln; Out.String( "ciphertext: " ); U.PrintHex( temp1, 0, datalen );
-		cipher.Decrypt( temp1, 0, datalen ); 
+		cipher.Decrypt( temp1, 0, datalen );
 		Out.Ln; Out.String( "decryption: " ); U.PrintHex( temp1, 0, datalen );
 		U.Hex2Bin( output, 0, temp2, 0, datalen );
 		Out.Ln; Out.String( "correct decryption: " ); U.PrintHex( temp2, 0, datalen );
@@ -177,7 +177,7 @@ IMPORT
 		IF temp1 = temp2 THEN  Out.String( "OK" )  ELSE  Out.String( "FAIL" )  END;
 		Out.Ln
 	END DecryptCbc2;
-	
+
 	(** encrypt input with key (counter-mode). output is a testvector *)
 	PROCEDURE  Ctr2*( CONST modname, input, output, key, iv: ARRAY OF CHAR; datalen, keybits: LONGINT );
 		VAR
@@ -194,7 +194,7 @@ IMPORT
 		Out.Ln; Out.String( "Key: " ); U.PrintHex( temp1, 0, keybits DIV 8 );
 		U.Hex2Bin( input, 0, temp1, 0, datalen );
 		Out.Ln; Out.String( "plaintext: " ); U.PrintHex( temp1, 0, datalen );
-		cipher.Encrypt( temp1, 0, datalen ); 
+		cipher.Encrypt( temp1, 0, datalen );
 		Out.Ln; Out.String( "encryption: " ); U.PrintHex( temp1, 0, datalen );
 		U.Hex2Bin( output, 0, temp2, 0, datalen );
 		Out.Ln; Out.String( "correct encryption: " ); U.PrintHex( temp2, 0, datalen );
@@ -242,14 +242,14 @@ IMPORT
 		input := "4E6F772069732074";		output := "3FA40E8A984D4815";
 		Ecb2( "CryptoDES", input, output, key, 8, 64 );
 	END DesEcb2;
-	
+
 	PROCEDURE Des3Ecb2*;
 		VAR input, output, key: ARRAY 64 OF CHAR;
 	BEGIN
 		key := "0123456789ABCDEF23456789ABCDEF01456789ABCDEF0123";
 		input := "4E6F772069732074";		output := "314F8327FA7A09A8";
 		Ecb2( "CryptoDES3", input, output, key, 8, 192 );
-	END Des3Ecb2; 
+	END Des3Ecb2;
 
 	PROCEDURE  IdeaEcb2*;
 		VAR input, output, key: ARRAY 64 OF CHAR;
@@ -263,17 +263,17 @@ IMPORT
 		VAR input, output, key: ARRAY 128 OF CHAR;
 	BEGIN
 		key := "8e73b0f7da0e6452c810f32b809079e562f8ead2522c6b7b";
-		input := "6bc1bee22e409f96e93d7e117393172a";		
+		input := "6bc1bee22e409f96e93d7e117393172a";
 		output := "bd334f1d6e45f25ff712a214571fa5cc";
 		Ecb2( "CryptoAES", input, output, key, 16, 192 );
-		
+
 		key := "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
 		input := "6bc1bee22e409f96e93d7e117393172a";
 		output := "f3eed1bdb5d2a03c064b5a7e3db181f8";
 		Ecb2( "CryptoAES", input, output, key, 16, 256 );
 	END AesEcb2;
-	
-	
+
+
 	PROCEDURE  Arc4Ecb2*;
 		VAR input, output, key: ARRAY 64 OF CHAR;
 	BEGIN
@@ -281,29 +281,29 @@ IMPORT
 		input := "0123456789abcdef";		output := "75b7878099e0c596";
 		Ecb2( "CryptoARC4", input, output, key, 8, 64 );
 	END Arc4Ecb2;
-	
-	
+
+
 	PROCEDURE  CastEcb2*;
 		VAR input, output, key: ARRAY 64 OF CHAR;
 	BEGIN
 		key := "0123456712345678234567893456789A";
 		input := "0123456789abcdef";		output := "238B4FE5847E44B2";
 		Ecb2( "CryptoCAST", input, output, key, 8, 128 );
-		
+
 		output := "EB6A711A2C02271B";
 		Ecb2( "CryptoCAST", input, output, key, 8, 80 );
-		
+
 		output := "7AC816D16E9B302E";
 		Ecb2( "CryptoCAST", input, output, key, 8, 40 );
 	END CastEcb2;
-	
-	
-	
+
+
+
 
 	PROCEDURE  DesCbc2*;
 		VAR input, output, key, iv: ARRAY 64 OF CHAR;
 	BEGIN
-		key := "0123456789ABCDEF";		
+		key := "0123456789ABCDEF";
 		iv := "0123456789ABCDEF";
 		input := "4E6F772069732074";		output := "96C3D4A6DC1C0117";
 		Cbc2( "CryptoDES", input, output, key, iv, 8, 64 );
@@ -312,7 +312,7 @@ IMPORT
 	PROCEDURE  IdeaCbc2*;
 		VAR input, output, key, iv: ARRAY 64 OF CHAR;
 	BEGIN
-		key := "00010002000300040005000600070008";		
+		key := "00010002000300040005000600070008";
 		iv := "0000000000000000";
 		input := "0000000100020003";		output := "11FBED2B01986DE5";
 		Cbc2( "CryptoIDEA", input, output, key, iv, 8, 128 );
@@ -321,21 +321,21 @@ IMPORT
 	PROCEDURE  AesCbc2*;
 		VAR input, output, key, iv: ARRAY 256 OF CHAR;
 	BEGIN
-		key := "2b7e151628aed2a6abf7158809cf4f3c";		
+		key := "2b7e151628aed2a6abf7158809cf4f3c";
 		iv := "000102030405060708090A0B0C0D0E0F";
-		input := "6bc1bee22e409f96e93d7e117393172a";		
+		input := "6bc1bee22e409f96e93d7e117393172a";
 		output := "7649abac8119b246cee98e9b12e9197d";
 		Cbc2( "CryptoAES", input, output, key, iv, 16, 128 );
-		
+
 		key := "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
 		iv := "000102030405060708090A0B0C0D0E0F";
 		input := "6bc1bee22e409f96e93d7e117393172a";
 		output := "f58c4c04d6e5f1ba779eabfb5f7bfbd6";
 		Cbc2( "CryptoAES", input, output, key, iv, 16, 256 );
 
-		key := "2b7e151628aed2a6abf7158809cf4f3c";		
+		key := "2b7e151628aed2a6abf7158809cf4f3c";
 		iv := "000102030405060708090A0B0C0D0E0F";
-		output := "6bc1bee22e409f96e93d7e117393172a";		
+		output := "6bc1bee22e409f96e93d7e117393172a";
 		input := "7649abac8119b246cee98e9b12e9197d";
 		DecryptCbc2( "CryptoAES", input, output, key, iv, 16, 128 );
 
@@ -345,16 +345,16 @@ IMPORT
 		input := "f58c4c04d6e5f1ba779eabfb5f7bfbd6";
 		DecryptCbc2( "CryptoAES", input, output, key, iv, 16, 256 );
 	END AesCbc2;
-	
+
 	PROCEDURE  AesCtr2*;
 		VAR input, output, key, iv: ARRAY 256 OF CHAR;
 	BEGIN
-		key := "2b7e151628aed2a6abf7158809cf4f3c";		
+		key := "2b7e151628aed2a6abf7158809cf4f3c";
 		iv := "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
-		input := "6bc1bee22e409f96e93d7e117393172a";		
+		input := "6bc1bee22e409f96e93d7e117393172a";
 		output := "874d6191b620e3261bef6864990db6ce";
 		Ctr2( "CryptoAES", input, output, key, iv, 16, 128 );
-		
+
 		key := "603deb1015ca71be2b73aef0857d77811f352c073b6108d72d9810a30914dff4";
 		iv := "f0f1f2f3f4f5f6f7f8f9fafbfcfdfeff";
 		input := "6bc1bee22e409f96e93d7e117393172a";
@@ -390,7 +390,7 @@ IMPORT
 		cipher.SetIV( iv, Ciphers.CBC );
 		cipher.Decrypt( bindata, 0, 2 * cipher.blockSize );
 		Out.Ln; Out.String( "Decrypted: " ); U.PrintHex( bindata, 0, 2 * cipher.blockSize );
-		bindata[2 * cipher.blockSize] := 0X; 
+		bindata[2 * cipher.blockSize] := 0X;
 		Out.Ln;
 		IF bindata = orig THEN  Out.String( "OK" )  ELSE  Out.String( "FAIL" )  END;
 		Out.Ln
@@ -398,8 +398,8 @@ IMPORT
 END CryptoTestCiphers.
 
 
-     System.Free  
-     		CryptoTestCiphers CryptoDES3 CryptoDES CryptoIDEA 
+     System.Free
+     		CryptoTestCiphers CryptoDES3 CryptoDES CryptoIDEA
      		CryptoARC4  CryptoCAST CryptoAES ~
 
      CryptoTestCiphers.DesEcb2 ~
@@ -414,10 +414,10 @@ END CryptoTestCiphers.
      CryptoTestCiphers.DesCbc2 ~
      CryptoTestCiphers.IdeaCbc2 ~
      CryptoTestCiphers.AesCbc2 ~
-     
+
      CryptoTestCiphers.AesCtr2 ~
-     
-     
+
+
 
      CryptoTestCiphers.Ecb1	CryptoDES	64 ~
      CryptoTestCiphers.Ecb1	CryptoDES3	192 ~
@@ -434,7 +434,7 @@ END CryptoTestCiphers.
      CryptoTestCiphers.Cbc1	CryptoAES 128 ~
      CryptoTestCiphers.Cbc1	CryptoAES 256 ~
      CryptoTestCiphers.Cbc1	CryptoBlowfish 256 ~
-     
+
      CryptoTestCiphers.CbcRandom CryptoDES	64 ~
      CryptoTestCiphers.CbcRandom CryptoDES3	192 ~
      CryptoTestCiphers.CbcRandom CryptoIDEA	128 ~
@@ -445,7 +445,7 @@ END CryptoTestCiphers.
      CryptoTestCiphers.Ctr1		CryptoAES	128 ~
      CryptoTestCiphers.Ctr1		CryptoAES	256 ~
 
-     
+
      CryptoTestCiphers.MeasureTime	CryptoDES	ECB 64 ~
      CryptoTestCiphers.MeasureTime	CryptoDES	CBC 64 ~
      CryptoTestCiphers.MeasureTime	CryptoDES3	ECB 192 ~
@@ -457,4 +457,4 @@ END CryptoTestCiphers.
      CryptoTestCiphers.MeasureTime	CryptoARC4	ECB 128 ~
 
 
-	
+

+ 1 - 1
source/CryptoTestDH.Mod

@@ -51,7 +51,7 @@ IMPORT D := CryptoDiffieHellman, B := CryptoBigNumbers, Kernel, Out := KernelLog
 	BEGIN
 		Do( "dh.ssh.group1" )
 	END SSH;
-	
+
 	PROCEDURE SSL2048*;
 	BEGIN
 		Do( "dh.2048.MODP.256"  )

+ 17 - 17
source/CryptoTestHashes.Mod

@@ -50,10 +50,10 @@ IMPORT
 	PROCEDURE TestMD5*;
 	BEGIN
 		CheckHash( "CryptoMD5", "", "D41D8CD98F00B204E9800998ECF8427E" );
-		CheckHash( "CryptoMD5", 
-						"abc", 
+		CheckHash( "CryptoMD5",
+						"abc",
 						"900150983CD24FB0D6963F7D28E17F72" );
-		CheckHash( "CryptoMD5", 
+		CheckHash( "CryptoMD5",
 						"abcdefghijklmnopqrstuvwxyz",
 						"C3FCD3D76192E4007DFB496CCA67E13B");
 		MeasureTime( "CryptoMD5" );
@@ -63,7 +63,7 @@ IMPORT
 	BEGIN
 		CheckHash( "CryptoSHA1", "", "DA39A3EE5E6B4B0D3255BFEF95601890AFD80709" );
 		CheckHash( "CryptoSHA1", "abc", "A9993E364706816ABA3E25717850C26C9CD0D89D" );
-		CheckHash( "CryptoSHA1", 
+		CheckHash( "CryptoSHA1",
 						"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
 						"84983E441C3BD26EBAAE4AA1F95129E5E54670F1");
 		MeasureTime( "CryptoSHA1" );
@@ -71,10 +71,10 @@ IMPORT
 
 	PROCEDURE TestSHA256*;
 	BEGIN
-		CheckHash( "CryptoSHA256", 
-				"abc", 
+		CheckHash( "CryptoSHA256",
+				"abc",
 				"BA7816BF8F01CFEA414140DE5DAE2223B00361A396177A9CB410FF61F20015AD" );
-		CheckHash( "CryptoSHA256", 
+		CheckHash( "CryptoSHA256",
 				"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
 				"248D6A61D20638B8E5C026930C3E6039A33CE45964FF2167F6ECEDD419DB06C1" );
 		MeasureTime( "CryptoSHA256" );
@@ -82,25 +82,25 @@ IMPORT
 
 	PROCEDURE TestSHA3*;
 	BEGIN
-		CheckHash( "CryptoSHA3", 
-				"", 
+		CheckHash( "CryptoSHA3",
+				"",
 				"a7ffc6f8bf1ed76651c14756a061d662f580ff4de43b49fa82d80a4b80f8434a" );
-		CheckHash( "CryptoSHA3", 
-				"abc", 
+		CheckHash( "CryptoSHA3",
+				"abc",
 				"3a985da74fe225b2045c172d6bd390bd855f086e3e9d525b46bfe24511431532" );
-		CheckHash( "CryptoSHA3", 
+		CheckHash( "CryptoSHA3",
 				"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq",
 				"41c0dba2a9d6240849100376a8235e2c82e1b9998a999e21db32dd97496d3376" );
-		MeasureTime( "CryptoSHA3" );	
+		MeasureTime( "CryptoSHA3" );
 	END TestSHA3;
 
 END CryptoTestHashes.
 
 
-System.Free 
-	CryptoTestHashes 
-	CryptoSHA3 CryptoKeccakSponge CryptoKeccakF1600 
-	CryptoMD5 CryptoSHA1 CryptoSHA256 
+System.Free
+	CryptoTestHashes
+	CryptoSHA3 CryptoKeccakSponge CryptoKeccakF1600
+	CryptoMD5 CryptoSHA1 CryptoSHA256
 	CryptoHashes
 	~
 

+ 1 - 1
source/CryptoTools.Mod

@@ -63,6 +63,6 @@ IMPORT
 			context.error.Ln
 		END
 	END Hash;
-	
+
 
 END CryptoTools.

+ 15 - 15
source/CryptoTwofish.Mod

@@ -105,9 +105,9 @@ TYPE
 				VAR x0, x: Block;  t0, t1, i, r: LONGINT;  s0, s1: SET32;
 				BEGIN
 					(* copy in the block, add whitening *)
-					FOR i := 0 TO 3 DO  
-						x0[i] := U.SetFromBufferLE( buf, pos + i*4 );  
-						x[i] := x0[i] / S.VAL( SET32, subkeys[4 + i] );   
+					FOR i := 0 TO 3 DO
+						x0[i] := U.SetFromBufferLE( buf, pos + i*4 );
+						x[i] := x0[i] / S.VAL( SET32, subkeys[4 + i] );
 					END;
 					(* main Twofish decryption loop *)
 					FOR r := N - 1 TO 0 BY -1 DO
@@ -150,8 +150,8 @@ CONST
 	Byte0 = S.VAL( SET32, 0FFH );
 	S14d = S.VAL( SET32, 14DH );
 	S0a6 = S.VAL( SET32, 0A6H );
-	
-	
+
+
 	PROCEDURE m1( x: LONGINT ): SET32;
 	BEGIN
 		RETURN S.VAL( SET32, x )
@@ -182,12 +182,12 @@ CONST
 		v[1] := S.VAL( SET32, x DIV 100H MOD 100H );
 		v[0] := S.VAL( SET32, x MOD 100H );
 	END split;
-	
+
 	PROCEDURE -Int( x: SET32 ): LONGINT;
 	BEGIN
 		RETURN S.VAL( LONGINT, x )
 	END Int;
-	
+
 
 	PROCEDURE F32( x: SET32;  CONST k32: ARRAY OF LONGINT;  keybits: LONGINT ): LONGINT;
 	VAR a, b, c, d, l: LONGINT;  k, k1: SKey;
@@ -201,21 +201,21 @@ CONST
 
 		l := ((keybits + 63) DIV 64) MOD 4;
 		IF l = 0 THEN  (* 256 bits of key *)
-			split( k32[3], k );  
-			a := Int( tab1[a] / k[0] );  
-			b := Int( tab0[b] / k[1] );  
+			split( k32[3], k );
+			a := Int( tab1[a] / k[0] );
+			b := Int( tab0[b] / k[1] );
 			c := Int( tab0[c] / k[2] );
 			d := Int( tab1[d] / k[3] );
 		END;
 		IF l IN {0, 3} THEN  (* 192 <= bits of key *)
-			split( k32[2], k );  
+			split( k32[2], k );
 			a := Int( tab1[a] / k[0] );
 			b := Int( tab1[b] / k[1] );
 			c := Int( tab0[c] / k[2] );
 			d := Int( tab0[d] / k[3] )
 		END;
 		(* 128 <= bits of key *)
-		split( k32[1], k1 );  split( k32[0], k );  
+		split( k32[1], k1 );  split( k32[0], k );
 		a := Int( tab1[Int( tab0[Int( tab0[a] / k1[0] )] / k[0] )] );
 		b := Int( tab0[Int( tab0[Int( tab1[b] / k1[1] )] / k[1] )] );
 		c := Int( tab1[Int( tab1[Int( tab0[c] / k1[2] )] / k[2] )] );
@@ -247,7 +247,7 @@ CONST
 				g3s8 := LSH( g3, 8 );
 				g3s24 := LSH( g3s8, 16 );
 
-				r := LSH( r, 8 ) / g3s24 / g2s16 / g3s8 / S.VAL( SET32, b ) 
+				r := LSH( r, 8 ) / g3s24 / g2s16 / g3s8 / S.VAL( SET32, b )
 			END
 		END;
 		RETURN S.VAL( LONGINT, r )
@@ -296,8 +296,8 @@ CONST
 		buf.Add( "022 0C9 0C0 09B 089 0D4 0ED 0AB 012 0A2 00D 052 0BB 002 02F 0A9 " );
 		buf.Add( "0D7 061 01E 0B4 050 004 0F6 0C2 016 025 086 056 055 009 0BE 091 " );
 		FOR i := 0 TO 255 DO  tab1[i] :=  buf.GetSet()  END;
-	END Init0;	
-		
+	END Init0;
+
 BEGIN
 	Init0
 END CryptoTwofish.

+ 18 - 18
source/CryptoUtils.Mod

@@ -3,28 +3,28 @@ MODULE CryptoUtils; (** AUTHOR "GF"; PURPOSE ""; *)
 IMPORT S := SYSTEM, Out := KernelLog, Random, Kernel, B := CryptoBigNumbers;
 
 
-TYPE 
+TYPE
 	InitBuffer* = OBJECT	(**   buffer supporting initialization of large tables with hex values  *)
-	VAR 
+	VAR
 		buf: POINTER TO ARRAY OF CHAR;
 		in, out: LONGINT;
-		
+
 		PROCEDURE & Init*( size: LONGINT );
 		BEGIN
 			NEW( buf, size );  in := 0;  out := 0;
 		END Init;
-		
+
 		PROCEDURE Add*( CONST x: ARRAY OF CHAR );
 		VAR  i: LONGINT;  c: CHAR;
 		BEGIN
 			c := x[0];  i := 1;
-			WHILE c # 0X DO 
+			WHILE c # 0X DO
 				buf[in] := c;  INC( in );  c := x[i];  INC( i )
 			END;
 			buf[in] := ' ';  INC( in );  buf[in] := 0X
 		END Add;
-		
-		
+
+
 		PROCEDURE GetInt*( ): LONGINT;
 		VAR x: LONGINT; c: CHAR;
 		BEGIN
@@ -40,12 +40,12 @@ TYPE
 			UNTIL c <= ' ';
 			RETURN x
 		END GetInt;
-		
+
 		PROCEDURE GetSet*(): SET32;
 		BEGIN
 			RETURN S.VAL( SET32, GetInt() )
 		END GetSet;
-		
+
 	END InitBuffer
 
 
@@ -272,8 +272,8 @@ VAR
 			INC( a, 4 );  INC( pos, 4 )
 		END
 	END BufferToBlockBE;
-	
-	
+
+
 	(* copy char buffer to 32-bit words in block. little endian format *)
 	PROCEDURE BufferToBlockLE*( CONST buf: ARRAY OF CHAR;  pos: LONGINT;  VAR block: ARRAY OF S.BYTE );
 	VAR i: LONGINT;  a: ADDRESS;
@@ -318,7 +318,7 @@ VAR
 			INC( pos, 4 )
 		END
 	END BlockToBufferLE;
-	
+
 	PROCEDURE SetToBufferBE*( val: SET32;  VAR buf: ARRAY OF CHAR;  pos: LONGINT );
 	BEGIN
 		IntToBufferBE( S.VAL( LONGINT, val ), buf, pos );
@@ -331,12 +331,12 @@ VAR
 		buf[pos + 1] := CHR( val MOD 256 );  val := val DIV 256;
 		buf[pos + 0] := CHR( val MOD 256 );
 	END IntToBufferBE;
-	
+
 	PROCEDURE SetToBufferLE*( val: SET32;  VAR buf: ARRAY OF CHAR;  pos: LONGINT );
 	BEGIN
 		IntToBufferLE( S.VAL( LONGINT, val ), buf, pos );
 	END SetToBufferLE;
-	
+
 	PROCEDURE IntToBufferLE*( val: LONGINT;  VAR buf: ARRAY OF CHAR;  pos: LONGINT );
 	BEGIN
 		buf[pos + 0] := CHR( val MOD 256 );  val := val DIV 256;
@@ -344,13 +344,13 @@ VAR
 		buf[pos + 2] := CHR( val MOD 256 );  val := val DIV 256;
 		buf[pos + 3] := CHR( val MOD 256 );
 	END IntToBufferLE;
-	
-	
+
+
 	PROCEDURE SetFromBufferBE*( CONST buf: ARRAY OF CHAR;  pos: LONGINT ): SET32;
 	BEGIN
 		RETURN  S.VAL( SET32, IntFromBufferBE( buf, pos ) )
 	END SetFromBufferBE;
-	
+
 	PROCEDURE IntFromBufferBE*( CONST buf: ARRAY OF CHAR;  pos: LONGINT ): LONGINT;
 	BEGIN
 		RETURN	ASH( LONG( ORD( buf[pos + 0] ) ), 24 ) +
@@ -372,7 +372,7 @@ VAR
 					ASH( LONG( ORD( buf[pos + 1] ) ), 8 ) +
 					ORD( buf[pos] );
 	END IntFromBufferLE;
-	
+
 
 
 BEGIN

+ 1 - 1
source/DTPData.Mod

@@ -1471,4 +1471,4 @@ BEGIN
 END NewObject;
 
 
-END DTPData.	
+END DTPData.

+ 61 - 61
source/Darwin.Unix.Mod

@@ -76,7 +76,7 @@ CONST
 	rdonly* = SET32({});  rdwr* = SET32({1});  creat* = SET32({6});  trunc* = SET32({9});
 
 	(* access modes *)
-	rwrwr* = 1B4H;  rwxrwxrwx* = 1FFH;  
+	rwrwr* = 1B4H;  rwxrwxrwx* = 1FFH;
 
 	F_OK* = {};  X_Ok* = {0};  W_OK* = {1};  R_OK* = {2};
 
@@ -121,7 +121,7 @@ CONST
 	SIG_BLOCK		= 1;
 	SIG_UNBLOCK	= 2;
 	SIG_SETMASK	= 3;
-	
+
 	SA_ONSTACK		= 0x0001;	(* take signal on signal stack *)
 	SA_RESTART		= 0x0002;	(* restart system on signal return *)
 	SA_RESETHAND	= 0x0004;	(* reset to SIG_DFL when taking signal *)
@@ -132,13 +132,13 @@ CONST
 
 	PTHREAD_CREATE_JOINABLE	= 1;
 	PTHREAD_CREATE_DETACHED	= 2;
-	
+
 	PTHREAD_CANCEL_ENABLE 	= 1;
 	PTHREAD_CANCEL_DISABLE	= 0;
 
 	PTHREAD_CANCEL_ASYNCHRONOUS	= 0;
 	PTHREAD_CANCEL_DEFERRED	= 2;
-	
+
 	PTHREAD_SCOPE_SYSTEM		= 1;
 	PTHREAD_SCOPE_PROCESS	= 2;
 
@@ -146,7 +146,7 @@ CONST
 
 TYPE
 	MachPort = LONGINT;
-	
+
 	Thread_t* = ADDRESS;
 	Mutex_t* = ADDRESS;
 	Condition_t* = ADDRESS;
@@ -156,7 +156,7 @@ TYPE
 	MutexType			= ARRAY 44 OF CHAR;
 	MutexAttributeType	= ARRAY 12 OF CHAR;
 	ConditionType		= ARRAY 28 OF CHAR;
-#ELSIF AMD64 THEN	
+#ELSIF AMD64 THEN
 	PThreadAttrType		= ARRAY 64 OF CHAR;
 	MutexType			= ARRAY 64 OF CHAR;
 	MutexAttributeType	= ARRAY 16 OF CHAR;
@@ -166,10 +166,10 @@ TYPE
 #END
 
 	Key_t* = ADDRESS;
-	
+
 	Sigset = ARRAY 4 OF CHAR;
 	SignalTrap = PROCEDURE ( sig: LONGINT; mc: Mcontext );
-	
+
 	path_t*	= ARRAY OF CHAR;
 	arg_t*		= ARRAY OF CHAR;
 	argv_t*	= ARRAY OF arg_t;
@@ -177,7 +177,7 @@ TYPE
 
 CONST
 	(* Thread priorities *)
-	ThreadLow* = 15; ThreadNormal* = 20; ThreadHigh* = 47;	
+	ThreadLow* = 15; ThreadNormal* = 20; ThreadHigh* = 47;
 	NumPriorities* = 33;	(* number of priority levels *)
 
 	(*---------------------------- IP -----------------------------------*)
@@ -186,14 +186,14 @@ CONST
 	(* domain *)
 		AFINET*		= 2;
 		AFINET6*	= 26;
-		
+
 		PFINET*		= AFINET;
 		PFINET6*	= AFINET6;
-		
+
 	(* types of connection *)
 		SockStream*	= 1;
 		SockDGram*	= 2;
-		
+
 	(* Protocols *)
 		IpProtoUDP*		= 17;
 		IpProtoTCP*		= 6;
@@ -206,27 +206,27 @@ CONST
 
 	(* ioctl *)
 		FioNRead*		= 4004667FH;	(* something to read ? *)
-		
-		
+
+
 	(* recv *)
 		MsgPeek*		= 2;
 		MsgDontWait*	= 80H;		(* non blocking read *)
-		
+
 	(* shutdown *)
 		ShutRDWR*	= 2;
 
 	SockAddrSizeV4*	= 16;
 	SockAddrSizeV6*	= 28;
 
-	
+
 	(*-------------------seral line ---------------------------------------*)
-	
+
 	FIONREAD*		= LONGINT( 4004667FH );
 	TIOCMGET*		= LONGINT( 4004746AH );
 	TIOCMBIC*		= LONGINT( 8004746BH );
 	TIOCMBIS*		= LONGINT( 8004746CH );
 	TIOCMSET*		= LONGINT( 8004746DH );
-	
+
 	(* speeds *)
 	B0*	= 0;
 	B50*	= 50;
@@ -261,7 +261,7 @@ CONST
 	PARODD*	= {13};	(* odd parity, else even *)
 	HUPCL*		= {14};	(* hang up on last close *)
 	CLOCAL*	= {15};	(* ignore modem status lines *)
-	
+
 TYPE
 	Termios* = RECORD
 		iflags*, oflags*, cflags*, lflags*: SET32;
@@ -357,7 +357,7 @@ TYPE
 
 CONST
 	FdSetLen* = 32;
-	
+
 TYPE
 	FdSet* = ARRAY FdSetLen OF SET;
 
@@ -368,8 +368,8 @@ TYPE
 				namlen-	: SHORTINT;
 				name-	:  (*array of*) CHAR;
 			END;
-			
-			
+
+
 
 	Stack* = RECORD
 				sp*		: ADDRESS;
@@ -384,7 +384,7 @@ TYPE
 				stack-	: Stack;
 				link-		: ADDRESS;	(* Ucontext *)
 				mclen-	: SIZE;
-				mc-{UNTRACED}: Mcontext 
+				mc-{UNTRACED}: Mcontext
 			END;
 
 	Mcontext* = POINTER TO McontextDesc;
@@ -393,7 +393,7 @@ TYPE
 				trapno-	: LONGINT;
 				err			: LONGINT;
 				faultvaddr	: ADDRESS;
-				
+
 				r_ax		: ADDRESS;
 				r_bx		: ADDRESS;
 				r_cx		: ADDRESS;
@@ -410,7 +410,7 @@ TYPE
 				r_es		: ADDRESS;
 				r_fs		: ADDRESS;
 				r_gs		: ADDRESS;
-				
+
 				flavor		: LONGINT;
 				count		: LONGINT;
 				(* ... *)
@@ -419,7 +419,7 @@ TYPE
 				cpu		: INTEGER;
 				err			: LONGINT;
 				faultvaddr	: HUGEINT;
-				
+
 				r_ax		: HUGEINT;
 				r_bx		: HUGEINT;
  				r_cx		: HUGEINT;
@@ -446,13 +446,13 @@ TYPE
 			#END
 		END;
 
-	Sigaction = RECORD	
+	Sigaction = RECORD
 		sa_handler: ADDRESS;
 		sa_mask: Sigset;
 		sa_flags: LONGINT;
 	END;
 
-	Sched_param = RECORD	
+	Sched_param = RECORD
 		sched_priority: LONGINT;
 		safety: ARRAY 8 OF LONGINT;
 	END;
@@ -491,7 +491,7 @@ VAR
 	pthread_kill		: PROCEDURE {C} (thr: ADDRESS; sigid: LONGINT): LONGINT;
 	pthread_cancel	: PROCEDURE {C} (thr: ADDRESS);
 	pthread_self		: PROCEDURE {C} (): Thread_t;
-	
+
 	pthread_key_create	: PROCEDURE {C} ( key: ADDRESS; destructor: PROCEDURE {C} ( param: ADDRESS ) ): WORD;
 	pthread_setspecific	: PROCEDURE {C} ( key: Key_t; value: ADDRESS ): WORD;
 	pthread_getspecific	: PROCEDURE {C} ( key: Key_t ): ADDRESS;
@@ -500,21 +500,21 @@ VAR
 	pthread_attr_setscope			: PROCEDURE {C} ( attr: ADDRESS; set: WORD );
 	pthread_attr_setdetachstate	: PROCEDURE {C} ( attr: ADDRESS; set: WORD );
 	pthread_attr_setstacksize		: PROCEDURE {C} ( attr: ADDRESS; stackSize: SIZE );
-	
+
 	pthread_mach_thread_np: PROCEDURE {C} ( thr: Thread_t ): MachPort;
-	
+
 	thread_suspend:	PROCEDURE {C} ( mthr: MachPort );
 	thread_resume:	PROCEDURE {C} ( mthr: MachPort );
-	
+
 	sched_get_priority_max		: PROCEDURE {C} ( policy: LONGINT ): LONGINT;
 	sched_get_priority_min		: PROCEDURE {C} ( policy: LONGINT ): LONGINT;
-	
+
 	pthread_setschedparam 	: PROCEDURE {C} ( thread: Thread_t; policy: LONGINT; param: ADDRESS ): LONGINT;
 	pthread_getschedparam	 	: PROCEDURE {C} ( thread: Thread_t; policy: ADDRESS; param: ADDRESS ): LONGINT;
 	pthread_setcancelstate		: PROCEDURE {C} ( state: LONGINT; oldstate: ADDRESS ): LONGINT;
 	pthread_setcanceltype		: PROCEDURE {C} ( type: LONGINT; oldtype: ADDRESS ): LONGINT;
 	pthread_sigmask 			: PROCEDURE {C} ( how: LONGINT; set: ADDRESS; oldset: ADDRESS ): LONGINT;
-	
+
 	sigaction		: PROCEDURE {C} (signum: LONGINT; CONST act, oldact: ADDRESS): LONGINT;
 	sigemptyset	: PROCEDURE {C} (set: ADDRESS);
 	sigfillset		: PROCEDURE {C} (set: ADDRESS): LONGINT;
@@ -523,15 +523,15 @@ VAR
 	sigdelset		: PROCEDURE {C} (set: ADDRESS; signo: LONGINT);
 	nanosleep		: PROCEDURE {C} (req, rem: ADDRESS): LONGINT;
 	sigaltstack	: PROCEDURE {C} (ss, oss: ADDRESS): LONGINT;
-	
 
-	(*	pid: return param for process id. Only set if initialized non-null. path: pointer to string denoting the executable. 
-		file_actions: modify which files are open for the new process, if NIL it inherits open files from parent process. 
+
+	(*	pid: return param for process id. Only set if initialized non-null. path: pointer to string denoting the executable.
+		file_actions: modify which files are open for the new process, if NIL it inherits open files from parent process.
 		attrp: sets process groups, scheduler, signals etc, leave NIL. argv, evp: char** to the arguments and env. variables*)
 	posix_spawnp- 	: PROCEDURE {C} ( pid: ADDRESS; path: ADDRESS; file_actions: ADDRESS; attrp: ADDRESS; argv: ADDRESS ; envp: ADDRESS ): LONGINT;
 	(*more restrictive than spawnp*)
 	posix_spawn- 	: PROCEDURE {C} ( pid: ADDRESS; path: ADDRESS; file_actions: ADDRESS; attrp: ADDRESS; argv: ADDRESS ; envp: ADDRESS ): LONGINT;
-	
+
 	waitpid-		: PROCEDURE {C} ( pid: pid_t; status: ADDRESS; options: LONGINT ): pid_t;
 	pipe-			: PROCEDURE {C} ( pipefd: ADDRESS ): LONGINT; (*pipefd is assumed to be a pointer to a C array of 2 elements, after pipe creation the array will contain file descriptors for the input and output end of the pipe. returns 0 on success, or -1 on fail*)
 	dup2-			: PROCEDURE {C} ( oldfd, newfd: LONGINT ): LONGINT; (*overwrites file descriptor newfd with a copy of oldfd. useful for redirecting pipes.*)
@@ -565,7 +565,7 @@ VAR
 
 	getpid-		: PROCEDURE {C} ( ): LONGINT;
 	getuid-		: PROCEDURE {C} ( ): LONGINT;
-	
+
 	posix_memalign-	: PROCEDURE {C} ( VAR p: ADDRESS;  alignment, size: SIZE ): LONGINT;
 	malloc-		: PROCEDURE {C} ( size: SIZE ): ADDRESS;
 	free-			: PROCEDURE {C} ( p: ADDRESS );
@@ -625,7 +625,7 @@ VAR
 		ASSERT(pthread_key_create(ADDRESSOF(key), NIL) = 0);
 		RETURN key;
 	END NewKey;
- 
+
 	PROCEDURE ReadKey* (key: Key_t): ADDRESS;
 	BEGIN
 		RETURN pthread_getspecific(key);
@@ -635,8 +635,8 @@ VAR
 	BEGIN
 		ASSERT(pthread_setspecific(key, value) = 0);
 	END WriteKey;
-	
-	
+
+
 	PROCEDURE NewMtx*( ): Mutex_t;
 	VAR
 		mtx: Mutex_t;
@@ -727,7 +727,7 @@ VAR
 	BEGIN
 		res := pthread_getschedparam( thr, ADDRESSOF( policy ), ADDRESSOF( param ) );
 		param.sched_priority := prio;
-		res := pthread_setschedparam( thr, SCHED_RR, ADDRESSOF( param ) ) 
+		res := pthread_setschedparam( thr, SCHED_RR, ADDRESSOF( param ) )
 	END ThrSetPriority;
 
 	PROCEDURE ThrGetPriority*( thr: Thread_t ): LONGINT;
@@ -770,12 +770,12 @@ VAR
 		sigdelset( ADDRESSOF( new ), SIGTERM );
 		sigdelset( ADDRESSOF( new ), SIGUSR1 );
 		res := pthread_sigmask( SIG_SETMASK, ADDRESSOF( new ), ADDRESSOF( old ) );
-		
+
 		res := pthread_setcancelstate( PTHREAD_CANCEL_ENABLE, NIL );
 		res := pthread_setcanceltype( PTHREAD_CANCEL_ASYNCHRONOUS, NIL );
 		param.sched_priority := 0;
 		res := pthread_setschedparam( me, SCHED_RR, ADDRESSOF( param ) );
-		
+
 		proc();
 
 		pthread_exit( NIL );
@@ -830,23 +830,23 @@ VAR
 	BEGIN
 		machthr := pthread_mach_thread_np( thr );
 		thread_resume( machthr );
-	END ThrResume;	
+	END ThrResume;
+
 
-	
 	PROCEDURE ThrSuspend*( thr: Thread_t; saveContext: BOOLEAN );
 	VAR r: LONGINT;  machthr: MachPort;
 	BEGIN
 		IF saveContext THEN
 			handler_done := FALSE;
-			r := pthread_kill( thr, SIGUSR1 );	
+			r := pthread_kill( thr, SIGUSR1 );
 			(*	not working in Solaris when the thread is stalled in a mutex.
-				handler gets arrived but has bad side effects, 
+				handler gets arrived but has bad side effects,
 				yields traps and locks the system *)
 			WHILE ~handler_done DO  ThrSleep( 1 )  END;
 		END;
 		machthr := pthread_mach_thread_np( thr );
 		thread_suspend( machthr )
-	END ThrSuspend;	
+	END ThrSuspend;
 
 
 
@@ -986,16 +986,16 @@ VAR
 	BEGIN
 		trap := h;
 	END InstallTrap;
-	
-	
+
+
 	VAR suspendHandler*: PROCEDURE( c: Ucontext );
-	
+
 	PROCEDURE {C} SigHandler( sig: LONGINT; scp: ADDRESS; ucp: Ucontext ); (* reversed arguments !! *)
 	BEGIN
 		IF sig = SIGUSR1 THEN
 			suspendHandler( ucp );
 			handler_done := TRUE;
-		ELSIF trap # NIL THEN 
+		ELSIF trap # NIL THEN
 			trap( sig, ucp.mc );
 		ELSE
 			Trace.String( "Unix.SigHandler: sig = " ); Trace.Int( sig, 0 ); Trace.Ln;  exit( -1 );
@@ -1021,13 +1021,13 @@ VAR
 		END;
 	END InstallHandler;
 
-	
+
 	PROCEDURE HandleSignal*( sig: LONGINT );
 	BEGIN
 		InstallHandler( sig )
 	END HandleSignal;
-	
-	
+
+
 	PROCEDURE errno*(): LONGINT;
 	VAR loc: ADDRESS;
 	BEGIN
@@ -1083,7 +1083,7 @@ VAR
 		noPaths := 4;
 
 		libc := Dlopen( libcname, 2 );
-		libp := Dlopen( libpthreadname, 2 ); 
+		libp := Dlopen( libpthreadname, 2 );
 
 		Dlsym( libc, "exit",			ADDRESSOF(exit) );
 		Dlsym( libc, "sysconf", 	ADDRESSOF(sysconf) );
@@ -1107,7 +1107,7 @@ VAR
 		Dlsym( libp, "pthread_detach",	ADDRESSOF(pthread_detach) );
 		Dlsym( libp, "pthread_cancel",	ADDRESSOF(pthread_cancel) );
 		Dlsym( libp, "pthread_kill",		ADDRESSOF(pthread_kill) );
-		
+
 		Dlsym( libp, "pthread_key_create", ADDRESSOF( pthread_key_create ) );
 		Dlsym( libp, "pthread_getspecific", ADDRESSOF( pthread_getspecific ) );
 		Dlsym( libp, "pthread_setspecific", ADDRESSOF( pthread_setspecific ) );
@@ -1120,7 +1120,7 @@ VAR
 		Dlsym( libp, "pthread_attr_setdetachstate", ADDRESSOF(pthread_attr_setdetachstate) );
 		Dlsym( libp, "pthread_attr_setstacksize", ADDRESSOF(pthread_attr_setstacksize) );
 		Dlsym( libp, "pthread_self", ADDRESSOF(pthread_self) );
-		
+
 		Dlsym( libc, "pthread_mach_thread_np", ADDRESSOF( pthread_mach_thread_np ) );
 		Dlsym( libc, "thread_suspend", ADDRESSOF( thread_suspend ) );
 		Dlsym( libc, "thread_resume", ADDRESSOF( thread_resume ) );
@@ -1167,7 +1167,7 @@ VAR
 		Dlsym( libc, "chdir",	ADDRESSOF( chdir ) );
 		Dlsym( libc, "mkdir",	ADDRESSOF( mkdir ) );
 		Dlsym( libc, "rmdir",	ADDRESSOF( rmdir ) );
-		
+
 #IF I386 THEN
 		Dlsym( libc, "stat",		ADDRESSOF( stat ) );
 		Dlsym( libc, "lstat",	ADDRESSOF( lstat ) );

+ 0 - 1
source/DataErrors.Mod

@@ -543,4 +543,3 @@ DataErrors.Close ~
 EditTools.OpenAscii  Error.Log ~
 EditTools.OpenAscii  Error.Log.Bak ~
 
-			

+ 2 - 2
source/Dates.Mod

@@ -10,7 +10,7 @@ MODULE Dates; (** AUTHOR "be, tf, staubesv"; PURPOSE "Date and time functions";
 					4-0: day of month
 *)
 
-(*	Problem of leap seconds is handled as in POSIX: 
+(*	Problem of leap seconds is handled as in POSIX:
 		http://www.eecis.udel.edu/~mills/leap.html
 		http://en.wikipedia.org/wiki/Leap_second
 *)
@@ -164,7 +164,7 @@ BEGIN
 	RETURN result;
 END CompareDateTime;
 
-(** Absolute time difference between t1 and t2. 
+(** Absolute time difference between t1 and t2.
 Note that leap seconds are not counted, see http://www.eecis.udel.edu/~mills/leap.html *)
 PROCEDURE TimeDifference*(t1, t2 : DateTime; VAR days, hours, minutes, seconds : LONGINT);
 CONST SecondsPerMinute = 60; SecondsPerHour = 3600; SecondsPerDay = 86400;

+ 14 - 14
source/Debugging.Mod

@@ -21,18 +21,18 @@ VAR
 		Log.Update;
 	END Memory;
 
-	
+
 	PROCEDURE CallerBP(bp: ADDRESS): ADDRESS;
 	VAR n: ADDRESS;
 	BEGIN
 		IF bp # NIL THEN
 			SYSTEM.GET(bp, n);
 			IF ODD(n) THEN INC(bp, SIZEOF(ADDRESS)) END;
-			SYSTEM.GET(bp, bp);			
+			SYSTEM.GET(bp, bp);
 		END;
 		RETURN bp;
 	END CallerBP;
-	
+
 	PROCEDURE ViewStack( ebp, esp: ADDRESS; CONST s: ARRAY OF CHAR);
 	VAR i: ADDRESS; val: LONGINT; prevBP:ADDRESS;
 	CONST adrSize= SIZEOF(ADDRESS);
@@ -206,13 +206,13 @@ VAR
 	PROCEDURE DisableGC*;
 	BEGIN
 		Heaps.GC := Nothing;
-		TRACE(Heaps.GC, "disabled"); 
+		TRACE(Heaps.GC, "disabled");
 	END DisableGC;
 
 	PROCEDURE EnableGC*;
 	BEGIN
 		Heaps.GC := Heaps.InvokeGC;
-		TRACE(Heaps.GC, "enabled"); 
+		TRACE(Heaps.GC, "enabled");
 	END EnableGC;
 
 	(* useful for debugging the GC / metadata *)
@@ -221,17 +221,17 @@ VAR
 	BEGIN
 		m := Modules.root;
 		WHILE (m # NIL) DO
-			TRACE(m.name); 
-			IF m.procTable # NIL THEN 
+			TRACE(m.name);
+			IF m.procTable # NIL THEN
 				FOR i := 0 TO LEN(m.procTable)-1 DO
 					(*TRACE(m.procTable[i]);*)
-					Log.Address(m.procTable[i]); 
-					Log.String(":"); 
-					Reflection.WriteProc(Log, m.procTable[i].pcFrom); 
+					Log.Address(m.procTable[i]);
+					Log.String(":");
+					Reflection.WriteProc(Log, m.procTable[i].pcFrom);
 					Log.String(" ptrs @ ");
 					FOR j := 0 TO LEN(m.procTable[i].offsets)-1 DO
-						Log.Int(m.procTable[i].offsets[j],1); 
-						Log.String(" "); 
+						Log.Int(m.procTable[i].offsets[j],1);
+						Log.String(" ");
 					END;
 					Log.Ln;
 				END;
@@ -258,12 +258,12 @@ VAR
 		END;
 		context.result := Commands.CommandError;
 	END ReportModule;
-	
+
 	PROCEDURE Test*;
 	BEGIN
 		Stack("Stack");
 	END Test;
-	
+
 
 BEGIN
 	Streams.OpenWriter( DefaultLog, KernelLog.Send );  Log := DefaultLog; NEW( lock );

+ 6 - 6
source/DiskCaches.Mod

@@ -13,8 +13,8 @@ IMPORT SYSTEM, Disks;
 		END;
 
 	TYPE
-	
-	(* Yet very simple disk cache. 
+
+	(* Yet very simple disk cache.
 		- synchronous
 		- One-way associative
 		- Write-through
@@ -72,7 +72,7 @@ IMPORT SYSTEM, Disks;
 
 END DiskCaches.
 
-(** USAGE PATTERN: 
+(** USAGE PATTERN:
 
 	VirtualDisk = OBJECT(Disks.Device)
 	VAR
@@ -83,13 +83,13 @@ END DiskCaches.
 		BEGIN
 			.... OLD TRANSFER CODE
 		END TransferX;
-		
+
 		PROCEDURE Transfer(op, block, num: LONGINT; VAR data: ARRAY OF CHAR; ofs: LONGINT; VAR res: WORD);
 		BEGIN{EXCLUSIVE}
-			cache.Transfer(op,block,num,data,ofs,res) 
+			cache.Transfer(op,block,num,data,ofs,res)
 		END Transfer;
 
-		....		
+		....
 
 		PROCEDURE &Init(CONST name : ARRAY OF CHAR; blockSize, cyls, hds, spt : LONGINT);
 		BEGIN

+ 16 - 16
source/DiskFS.Mod

@@ -385,14 +385,14 @@ TYPE
 					vol.MarkBlocks(mark,0,markPosition);
 					markPosition := 0;
 				END FinishMarking;
-				
+
 				PROCEDURE MarkSector(vol: Files.Volume (* ignored *); sec: LONGINT);
 				BEGIN
 					mark[markPosition] := sec DIV SectorFactor;
-					INC(markPosition); 
+					INC(markPosition);
 					IF markPosition = LEN(mark) THEN
 						FinishMarking;
-					END; 
+					END;
 				END MarkSector;
 
 				PROCEDURE sift(L, R: LONGINT);
@@ -783,14 +783,14 @@ TYPE
 				vol.FreeBlocks(free,0,freePosition);
 				freePosition := 0;
 			END FinishFreeing;
-			
+
 			PROCEDURE FreeSector(vol: Files.Volume (* ignored *); sec: LONGINT);
 			BEGIN
 				free[freePosition] := sec DIV SectorFactor;
-				INC(freePosition); 
+				INC(freePosition);
 				IF freePosition = LEN(free) THEN
 					FinishFreeing;
-				END; 
+				END;
 			END FreeSector;
 
 			PROCEDURE FreeExcept(sec: DiskAdr);
@@ -901,20 +901,20 @@ TYPE
 			RETURN FALSE
 		END Contains;
 	END DiskAdrList;
-			
+
 	DiskAdrTable = OBJECT
 		VAR
 			table : DiskAdrArray;
 			count :SIZE;
 			size: SIZE; (* cache: invariant size  = LEN(table) *)
-			
+
 		CONST
 			threshold = 4; (* 1/4 filled -> grow*)
 
 		PROCEDURE &New*;
-		BEGIN NEW(table, 8); size := LEN(table)-1; count := 0; 
+		BEGIN NEW(table, 8); size := LEN(table)-1; count := 0;
 		END New;
-		
+
 		PROCEDURE Clear;
 		VAR i: SIZE;
 		BEGIN{EXCLUSIVE}
@@ -923,7 +923,7 @@ TYPE
 			END;
 			count := 0;
 		END Clear;
-		
+
 		PROCEDURE Grow;
 		VAR old: DiskAdrArray; i,x: LONGINT; index: SIZE;
 		BEGIN
@@ -935,7 +935,7 @@ TYPE
 				x := old[i];
 				IF (x # 0) THEN
 					index := HashValue(x);
-					IF (table[index] = 0) THEN 
+					IF (table[index] = 0) THEN
 						table[index] := x;
 						INC(count);
 					ELSE
@@ -944,7 +944,7 @@ TYPE
 				END;
 			END;
 		END Grow;
-		
+
 		PROCEDURE HashValue(key: DiskAdr):SIZE;
 		VAR index, h, i := 0 : SIZE;
 		BEGIN
@@ -963,14 +963,14 @@ TYPE
 			ASSERT(x # 0);
 			IF count > size DIV threshold THEN Grow END;
 			index := HashValue(x);
-			IF table[index] = 0 THEN 
+			IF table[index] = 0 THEN
 				table[index] := x;
 				INC(count);
 			ELSE
 				ASSERT(table[index] = x);
 			END;
 		END Add;
-		
+
 		PROCEDURE Contains(x: DiskAdr) : BOOLEAN;
 		BEGIN {EXCLUSIVE}
 			RETURN table[HashValue(x)] = x;
@@ -1467,7 +1467,7 @@ VAR fs: FileSystem; fh: FileHeader; skipIndexMapWriteback: BOOLEAN; options: ARR
 BEGIN
 	(* Get options *)
 	context.arg.SkipWhitespace;
-	REPEAT UNTIL ~context.arg.GetString(options) OR (options = '|'); 
+	REPEAT UNTIL ~context.arg.GetString(options) OR (options = '|');
 	IF context.arg.GetString(options) THEN
 		skipIndexMapWriteback := options = 'N'
 	END;

+ 1 - 1
source/Displays.Mod

@@ -42,7 +42,7 @@ TYPE
 				IF reverse THEN
 				dispadr := fbadr + (height-y-1) * fbstride + (width-x-1) * format;
 				END;
-				
+
 				ASSERT((dispadr >= fbadr) & ((y+h-1)*fbstride + (x+w-1)*format <=  fbsize));	(* display index check *)
 				w := w * format;	(* convert to bytes *)
 				CASE op OF

+ 51 - 51
source/Drand48.Mod

@@ -4,146 +4,146 @@ MODULE Drand48;	(** AUTOR "G.F.";  PURPOSE "drand48 random generator"; *)
 CONST
 	m = 1000000000000H;
 	X = 1234ABCD330EH;   A = 5DEECE66DH;  C = 0BH;
-	
-TYPE 
+
+TYPE
 	Generator* = OBJECT
 	VAR
 		x, a: HUGEINT; c: LONGINT;
-		
+
 		PROCEDURE & Init*;
 		BEGIN
 			x := X;   a := A;  c := C
 		END Init;
-		
-		
+
+
 		PROCEDURE Drand48*(): LONGREAL;		(* [0.0 .. 1.0] *)
 		CONST twom = 1.0D0 / m;
 		BEGIN
-			x := (x*a + c) MOD m;  
-			RETURN twom*x 
+			x := (x*a + c) MOD m;
+			RETURN twom*x
 		END Drand48;
-	
+
 		PROCEDURE Lrand48*(): LONGINT;		(* [0 .. 2^31-1] *)
 		BEGIN
-			x := (x*a + c) MOD m;  
+			x := (x*a + c) MOD m;
 			RETURN SHORT( x DIV 20000H )
 		END Lrand48;
-		
+
 		PROCEDURE Mrand48*(): LONGINT;		(* [0 .. 2^32-1] *)
 		BEGIN
-			x := (x*a + c) MOD m;  
+			x := (x*a + c) MOD m;
 			RETURN SHORT( x DIV 10000H )
 		END Mrand48;
-		
+
 		PROCEDURE Xrand48*(): HUGEINT;		(* [0 .. 2^48-1] *)
 		BEGIN
-			x := (x*a + c) MOD m;  
+			x := (x*a + c) MOD m;
 			RETURN x
 		END Xrand48;
-		
+
 		PROCEDURE Srand48*( seed: LONGINT );
 		BEGIN
 			x := LONG(seed)*10000H + X MOD 10000H;  a := A
 		END Srand48;
-		
-		
-		
+
+
+
 		PROCEDURE Seed48*( seed: HUGEINT ): HUGEINT;
 		VAR lastx: HUGEINT;
 		BEGIN
 			lastx := x;
 			x := seed MOD m;  a := A;
-			RETURN lastx 
+			RETURN lastx
 		END Seed48;
-		
+
 		PROCEDURE Lcong48*( par: ARRAY OF HUGEINT );
 		BEGIN
 			x := par[0] MOD m;
 			a := par[1] MOD m;
 			c := SHORT( par[2] MOD 80000000H )
 		END Lcong48;
-		
+
 	END Generator;
 
 
 (*========= Unix implementation =========
 CONST
 	B = 10000H;	(* 16-bit barrier *)
-	
+
 	X0 = 0330EH;  X1 = 0ABCDH;  X2 = 01234H;
 	A0 = 0E66DH;  A1 = 0DEECH;  A2 = 05H;
-	
-TYPE 
+
+TYPE
 	Pair = RECORD h, l: LONGINT END;	(* unsigned 16-bit values *)
-	
+
 	Triple* = ARRAY 3 OF LONGINT;		(* unsigned 16-bit values *)
 	Seed16v* = POINTER TO Triple;
-	
+
 	Generator* = OBJECT
 	VAR
 		x, a: Triple; c: LONGINT;
-		
+
 		PROCEDURE & Init*;
 		BEGIN
-			x[0] := X0;  x[1] := X1;  x[2] := X2;  
-			a[0] := A0;  a[1] := A1;  a[2] := A2;  
+			x[0] := X0;  x[1] := X1;  x[2] := X2;
+			a[0] := A0;  a[1] := A1;  a[2] := A2;
 			c := 0BH
 		END Init;
-		
-		
+
+
 		PROCEDURE Drand48*(): LONGREAL;
 		CONST two16m = 1.0D0 / B;
 		BEGIN
 			Next;  RETURN two16m*(two16m*(two16m*x[0] + x[1]) + x[2])
 		END Drand48;
-	
+
 		PROCEDURE Lrand48*(): LONGINT;		(* [0 .. 2^31-1] *)
 		BEGIN
 			Next;  RETURN x[2]*8000H + x[1] DIV 2 MOD 8000H
 		END Lrand48;
-		
+
 		PROCEDURE Mrand48*(): LONGINT;		(* [0 .. 2^32-1] *)
 		BEGIN
 			Next;  RETURN x[2]*B + x[1]
 		END Mrand48;
-		
+
 		PROCEDURE Xrand48*(): HUGEINT;		(* [0 .. 2^48-1] *)
 		BEGIN
 			Next;  RETURN ASH( LONG( x[2] ), 32 ) + x[1]*B + x[0]
 		END Xrand48;
-		
-		
+
+
 		PROCEDURE Srand48*( seedval: LONGINT );
 		BEGIN
 			Seed( X0, seedval MOD B, seedval DIV B  MOD B )
 		END Srand48;
-		
+
 		PROCEDURE Seed48*( CONST seed16v: ARRAY OF LONGINT ): Seed16v;
 		VAR lastx: Seed16v;
 		BEGIN
 			NEW( lastx );  lastx^ := x;
 			Seed( seed16v[0] MOD B, seed16v[1] MOD B, seed16v[2] MOD B );
-			RETURN lastx 
+			RETURN lastx
 		END Seed48;
-		
+
 		PROCEDURE Lcong48*( CONST param: ARRAY OF LONGINT );
 		BEGIN
 			x[0] := param[0] MOD B;  x[1] := param[1] MOD B;  x[2] := param[2] MOD B;
 			a[0] := param[3] MOD B;  a[1] := param[4] MOD B;  a[2] := param[5] MOD B;
 			c := param[6] MOD B
 		END Lcong48;
-		
-		
-		
-		
-		
+
+
+
+
+
 		PROCEDURE Seed( x0, x1, x2: LONGINT );
 		BEGIN
 			x[0] := x0;  x[1] := x1;  x[2] := x2;
 			a[0] := A0;  a[1] := A1;  a[2] := A2
 		END Seed;
-		
-		
+
+
 		PROCEDURE Next;
 		VAR p, q, r: Pair;  carry: LONGINT;
 		BEGIN
@@ -157,12 +157,12 @@ TYPE
 			x[1] := (p.h + r.l) MOD B;
 			x[0] := p.l MOD B
 		END Next;
-	
+
 	END Generator;
 
 
-	
-	
+
+
 	PROCEDURE Mul( x, y: LONGINT ): Pair;
 	VAR z: Pair;  t: LONGINT;
 	BEGIN
@@ -170,7 +170,7 @@ TYPE
 		z.l := t MOD B;  z.h := t DIV B MOD B;
 		RETURN z
 	END Mul;
-	
+
 	PROCEDURE Addequ( VAR x: LONGINT;  y: LONGINT ): LONGINT;
 	BEGIN
 		x := x + y;
@@ -178,8 +178,8 @@ TYPE
 		x := x MOD B;  RETURN 1
 	END Addequ;
 	*)
-	
-	
+
+
 END Drand48.
 
 

+ 15 - 15
source/EFI.AMD64.Machine.Mod

@@ -300,7 +300,7 @@ VAR
 
 	chs: ARRAY MaxDisks OF RECORD cyls, hds, spt: LONGINT END;
 	initRegs0, initRegs1: HUGEINT;
-	fbadr*, fbInfoPtr*: ADDRESS; 
+	fbadr*, fbInfoPtr*: ADDRESS;
 	initRegs: ARRAY 2 OF HUGEINT;	(* kernel parameters *)
 	config: ARRAY 2048 OF CHAR;	(* config strings *)
 	bootFlag: ADDRESS;
@@ -1531,7 +1531,7 @@ BEGIN
 	ASSERT((virtAdr MOD PS = 0) & (size MOD PS = 0));
 	TRACE(virtAdr, phys, size);
 	WHILE size # 0 DO
-		
+
 		IF ~ODD(MappedPage(virtAdr)) THEN
 			IF ~MapPage(virtAdr, phys) THEN RETURN FALSE END;
 		END;
@@ -1910,12 +1910,12 @@ heapEndAdr := 0;
 	NewPage(kernelPML4); ASSERT(kernelPML4 # NilAdr);
 	Fill32(kernelPML4, TPS, PageNotPresent);
 	IF ~MapDirect(LowAdr, memTop-LowAdr, LowAdr + UserPage) THEN HALT(99) END;	(* map heap direct *)
-	
+
 (*	IF ~MapDirect(fbadr, PS*1024*1, fbadr + UserPage) THEN  (* map frame buffer  direct *)
 		Trace.String("map direct failed at fbadr"); Trace.Address(fbadr); Trace.Ln;
 	ELSE
 		Trace.String("fbuffer mapped"); Trace.Address(fbadr); Trace.Ln;
-	END; 
+	END;
 *)
 END InitPages;
 
@@ -2599,7 +2599,7 @@ entry:
 
 	LEA RBP, [RSP + 136]
 	MOV RBX, [RSP + 128]	; RBX = int number
-	
+
 	IMUL RBX, RBX, MaxNumHandlers
 	IMUL RBX, RBX, SizeOfHandlerRec
 	; todo: replace LEA by MOV when compiler supports this
@@ -2833,7 +2833,7 @@ CODE {SYSTEM.AMD64}
 END CurrentPC;
 
 PROCEDURE -SetRAX(n: SIZE);
-CODE{SYSTEM.AMD64}	
+CODE{SYSTEM.AMD64}
 	NOP
 	POP RAX
 END SetRAX;
@@ -3788,7 +3788,7 @@ BEGIN
 		MOV bootFlag, RAX
 		MOV initRegs0,RSI
 		MOV initRegs1, RCX
-		
+
 		MOV fbadr, RDI
 		MOV fbInfoPtr, RDX
 	END;
@@ -3801,29 +3801,29 @@ PROCEDURE {NOPAF, FIXED(0100000H)} FirstAddress;
 CODE{SYSTEM.AMD64}
 	; relocate the bootfile from 0x1000 to target address 0x100000
 
-	
-	
+
+
 	PUSH RAX
 	PUSH RSI
 	PUSH RDI
 
-	
+
 	MOV RSI,1000H
 	MOV RDI,100000H
 	MOV RCX, LastAddress
 	SUB RCX, RDI
-	
+
 	; CLD
 	; REP MOVSB
-	
+
 	ADD RSI, RCX
 	ADD RDI, RCX
 	STD
-	REP MOVSB 
-	
+	REP MOVSB
+
 	POP RDI
 	POP RSI
-	POP RAX	
+	POP RAX
 
 
 

+ 18 - 18
source/EFI.I386.Machine.Mod

@@ -312,7 +312,7 @@ VAR
 	chs: ARRAY MaxDisks OF RECORD cyls, hds, spt: LONGINT END;
 	initRegs0, initRegs1: LONGINT;
 	initRegs: ARRAY 2 OF LONGINT;	(* kernel parameters *)
-	fbadr*, fbInfoPtr*: ADDRESS; 
+	fbadr*, fbInfoPtr*: ADDRESS;
 	config: ARRAY 2048 OF CHAR;	(* config strings *)
 	bootFlag: ADDRESS;
 
@@ -574,9 +574,9 @@ CONST
 	SSE2Flag = 26;
 	SSE3Flag = 0; (*IN features2 from ECX*) (*PH 04/11*)
 	SSSE3Flag =9;
-	SSE41Flag =19; 
+	SSE41Flag =19;
 	SSE42Flag =20;
-	SSE5Flag = 11; 
+	SSE5Flag = 11;
 	AVXFlag = 28;
 BEGIN
 	SSE2Support := FALSE;
@@ -1847,10 +1847,10 @@ BEGIN
 	NewPage(kernelPD); ASSERT(kernelPD # NilAdr);
 	Fill32(kernelPD, PTEs*4, PageNotPresent);
 	IF ~MapDirect(LowAdr, mTop-LowAdr, LowAdr + UserPage) THEN HALT(99) END	;(* map heap direct *)
-	
+
 	IF ~MapDirect(fbadr, PS*1024*10, fbadr + UserPage) THEN  (* map frame buffer  direct *)
 		Trace.String("map direct failed at fbadr"); Trace.Address(fbadr); Trace.Ln;
-	END; 
+	END;
 
 END InitPages;
 
@@ -2073,7 +2073,7 @@ END InModuleHeap;
 (* returns if an address is a currently allocated heap address *)
 PROCEDURE ValidHeapAddress*(p: ADDRESS): BOOLEAN;
 BEGIN
-	RETURN 
+	RETURN
 		(p >= memBlockHead.beginBlockAdr) & (p <= memBlockTail.endBlockAdr)
 		OR InModuleHeap(p);
 END ValidHeapAddress;
@@ -3468,8 +3468,8 @@ VAR status: SHORTINT;
 	PROCEDURE Scroll;
 	VAR adr: ADDRESS; off: SIZE; i,j: LONGINT;
 	BEGIN
-		IF (traceDelay > 0) & (scrollLines MOD TraceHeight = 0) THEN 
-			FOR i := 0 TO traceDelay-1 DO 
+		IF (traceDelay > 0) & (scrollLines MOD TraceHeight = 0) THEN
+			FOR i := 0 TO traceDelay-1 DO
 				FOR j := 0 TO 1000000 DO END;
 			END;
 		END;
@@ -3513,7 +3513,7 @@ PROCEDURE TraceColor (c: SHORTINT);
 BEGIN traceColor := c;
 END TraceColor;
 
-VAR traceDelay: LONGINT; 
+VAR traceDelay: LONGINT;
 (* Initialise tracing. *)
 PROCEDURE InitTrace;
 CONST MaxPorts = 8;
@@ -3532,8 +3532,8 @@ BEGIN
 		Portout8(3D5H, CHR((TraceWidth*TraceHeight) DIV 100H));
 		Portout8(3D4H, 0FX);
 		Portout8(3D5H, CHR((TraceWidth*TraceHeight) MOD 100H));
-		GetConfig("TraceDelay", s); 
-		p := 0; traceDelay := StrToInt(p, s); 
+		GetConfig("TraceDelay", s);
+		p := 0; traceDelay := StrToInt(p, s);
 
 	END;
 	IF TraceV24 IN traceMode THEN
@@ -3584,7 +3584,7 @@ BEGIN
 		MOV bootFlag, EAX
 		MOV initRegs0,ESI
 		MOV initRegs1, ECX
-		
+
 		MOV fbadr, EDI
 		MOV fbInfoPtr, EDX
 	END;
@@ -3629,11 +3629,11 @@ BEGIN
 	InitPages;	(* create page tables *)
 	InitMemory;	(* switch on segmentation, paging and switch stack *)
 	Trace.Green; Trace.StringLn("Ok"); Trace.Default;
-	
-	
+
+
 	(*FOR i := 0 TO 1024*128 DO SYSTEM.PUT(fbadr+i, 0X)	END;*)
-	
-	
+
+
 	(* allocate empty memory block with enough space for at least one free block *)
 	memBlockHead := SYSTEM.VAL (MemoryBlock, ADDRESSOF (initialMemBlock));
 	memBlockTail := memBlockHead;
@@ -3647,9 +3647,9 @@ BEGIN
 			intHandler[i, j].handler := NIL
 		END
 	END;
-	Trace.String("Machine done."); Trace.Ln; 
+	Trace.String("Machine done."); Trace.Ln;
 	default.valid := FALSE;	(* initialized later *)
-	
+
 
 END Init;
 

+ 3 - 3
source/EFI.Mod

@@ -92,13 +92,13 @@ TYPE GUID* = RECORD
 	Data4*: ARRAY 8 OF Int8;
 END;
 
-TYPE 
+TYPE
 	MemoryDescriptorPointer*= POINTER TO MemoryDescriptor;
 	MemoryDescriptor* = RECORD
 		Type- : Int32;
 		pad-: Int32;
 		PhysicalStart-: PhysicalAddress;
-		VirtualStart-: VirtualAddress; 
+		VirtualStart-: VirtualAddress;
 	(*	PhysicalStart-: Int64;
 		VirtualStart-: Int64;	*)
 		NumberOfPages-: Int64;
@@ -129,7 +129,7 @@ TYPE TableHeader* = RECORD
 END;
 
 (* main EFI tables *)
-TYPE 
+TYPE
 SystemTable* = RECORD
 	Hdr-: TableHeader;
 	FirmwareVendor-{UNTRACED}: POINTER TO ARRAY OF Char16;

+ 4 - 4
source/EFIGraphicalConsole.Mod

@@ -439,13 +439,13 @@ TYPE
 		Trace.String("Graphical Console, depth = "); Trace.Address(depth); Trace.Ln;
 
 		FOR i := 0 TO w*h*depth DIV 8-1  DO SYSTEM.PUT(adr+i,0)	END;
-		
-		
+
+
 		RenderChar("X"); RenderChar("X");
 
 		traceChar := Trace.Char;
 		Trace.Char := RenderChar;
-		
+
 		Trace.String("Graphical Console started"); Trace.Ln;
 	END SetupConsole;
 
@@ -456,7 +456,7 @@ TYPE
 		MakeFont(font);
 		Trace.String("Graphical Console Exit"); Trace.Ln;
 	END Init;
-	
+
 
 (*BEGIN
 	Trace.String("Graphical Console Enter"); Trace.Ln;

+ 2 - 2
source/EFILib.Mod

@@ -99,7 +99,7 @@ BEGIN
 	memsize := 0;
 	FOR i := 0 TO numEntries-1 DO
 		MemMapElement := SYSTEM.VAL(EFI.MemoryDescriptorPointer, ADDRESSOF(MemMap[0])+i*DescriptorSize);
-		
+
 (*		IF (MemMapElement.Type #  EFI.MTConventionalMemory *)
 		IF ( (MemMapElement.Type = EFI.MTRuntimeServicesCode) OR ( MemMapElement.Type = EFI.MTRuntimeServicesData)
 			OR (MemMapElement.Type = EFI.MTUnusableMemory) OR (MemMapElement.Type = EFI.MTACPIReclaimMemory)
@@ -119,7 +119,7 @@ BEGIN
 			Trace.Ln;
 
 
-			
+
 			IF (tmp # MemMapElement.PhysicalStart) THEN
 				SYSTEM.PUT(ADDRESS(adr+(numcritEntries*2+1+1)*8), MemMapElement.PhysicalStart);
 				tmp := MemMapElement.PhysicalStart+MemMapElement.NumberOfPages*LONG(EFI.PageSize);

+ 0 - 1
source/ExampleTextWriter.Mod

@@ -81,4 +81,3 @@ END ExampleTextWriter.
 
 System.Free ExampleTextWriter ~
 ExampleTextWriter.Open
- 

+ 3 - 3
source/Files.Mod

@@ -220,7 +220,7 @@ TYPE
 			FOR i := ofs TO ofs + len -1 DO
 				adr := a[i];
 				IF (adr = 0 ) THEN (* do nothing -- error should have been handled outside *)
-				ELSE 
+				ELSE
 					IF (adr < 1) OR (adr > size) THEN HALT(InvalidAdr) END;
 					EXCL(map[adr DIV SetSize], adr MOD SetSize);
 					DEC(used);
@@ -235,7 +235,7 @@ TYPE
 			INCL(map[adr DIV SetSize], adr MOD SetSize);
 			INC(used)
 		END MarkBlock;
-		
+
 		PROCEDURE MarkBlocks*(CONST a: ARRAY OF Address; ofs, len: TSize);
 		VAR i: SIZE;  adr: Address;
 		BEGIN {EXCLUSIVE}
@@ -243,7 +243,7 @@ TYPE
 			FOR i := ofs TO ofs + len -1 DO
 				adr := a[i];
 				IF (adr = 0 ) THEN (* do nothing -- error should have been handled outside *)
-				ELSE 
+				ELSE
 					IF (adr < 1) OR (adr > size) THEN HALT(InvalidAdr) END;
 					INCL(map[adr DIV SetSize], adr MOD SetSize);
 					INC(used);

+ 19 - 19
source/FoxAMD64Assembler.Mod

@@ -69,7 +69,7 @@ CONST
 	fpStackOperand= InstructionSet.fpStackOperand; directMemoryOffset= InstructionSet.directMemoryOffset;
 	RXB = InstructionSet.RXB;
 	Src1Prefix = InstructionSet.Src1Prefix;
-	
+
 	(* limits *)
 	maxNumberOperands = InstructionSet.maxNumberOperands;
 
@@ -211,7 +211,7 @@ TYPE
 		error-: BOOLEAN;
 		diagnostics: Diagnostics.Diagnostics;
 		assembly: Assembly; (* for error position *)
-		
+
 		(* overal state *)
 		cpuBits: Size; (* supported bit width for this cpu / target *)
 		cpuOptions: InstructionSet.CPUOptions;
@@ -274,7 +274,7 @@ TYPE
 			s.Get(msg);
 			ErrorSS(msg1,msg);
 		END ErrorSI;
-		
+
 		PROCEDURE AddFixup (mode: SHORTINT; size: SHORTINT; pc: LONGINT; symbol: ObjectFile.Identifier; symbolOffset, displacement: LONGINT);
 		VAR fixup: BinaryCode.Fixup; format: BinaryCode.FixupPatterns; id: ObjectFile.Identifier;
 		BEGIN
@@ -313,7 +313,7 @@ TYPE
 					FOR i := 0 TO maxNumberOperands - 1 DO
 						IF (i>=LEN(operands)) OR (operands[i].type = none) THEN (* no operand -> check if instruction has no operand here *)
 							IF InstructionSet.instructions[instr].operands[i] # none THEN
-								RETURN FALSE 
+								RETURN FALSE
 							END;
 						ELSIF ~Matches(operands[i],InstructionSet.instructions[instr].operands[i]) THEN (* instruction operand type and this operand do not match *)
 							RETURN FALSE
@@ -325,8 +325,8 @@ TYPE
 				END MatchesInstruction;
 			BEGIN
 				instr := InstructionSet.mnemonics[mnem].firstInstruction;
-				WHILE (instr <= InstructionSet.mnemonics[mnem].lastInstruction) & (~MatchesInstruction ()) DO 
-					INC (instr); 
+				WHILE (instr <= InstructionSet.mnemonics[mnem].lastInstruction) & (~MatchesInstruction ()) DO
+					INC (instr);
 				END;
 
 				IF instr > InstructionSet.mnemonics[mnem].lastInstruction THEN
@@ -403,12 +403,12 @@ TYPE
 			BEGIN
 				RETURN {InstructionSet.cpuFPU} * InstructionSet.instructions[instr].cpuOptions # {}
 			END FPOperation;
-			
+
 			PROCEDURE IsPreREXPrefix(c1,c2: CHAR): BOOLEAN;
 			BEGIN
 				RETURN (c1 = CHR(opCode)) & ((c2 = 0F2X) OR (c2 = 0F3X) ) ;
 			END IsPreREXPrefix;
-			
+
 
 		BEGIN
 			IF (dump # NIL) & (lastPass) THEN
@@ -512,14 +512,14 @@ TYPE
 							END
 						END;
 						IF (operands[i].sizeInBytes = bits64) & ~(InstructionSet.optD64 IN bitwidthOptions) & ~FPOperation(instr) THEN
-							IF 
+							IF
 								(InstructionSet.instructions[instr].operands[i] = InstructionSet.regmem64)
 								OR
 								(InstructionSet.instructions[instr].operands[i] = InstructionSet.mem)
-							 THEN 
+							 THEN
 								IF Trace THEN KernelLog.String(" rex prefix bits64 "); KernelLog.Ln; END;
 								INCL(rexPrefix,rexW);
-							END; 
+							END;
 						END;
 						IF InstructionSet.instructions[instr].operands[i] = InstructionSet.moffset64 THEN
 							IF Trace THEN KernelLog.String(" moffset64 "); KernelLog.Ln; END;
@@ -572,8 +572,8 @@ TYPE
 				ASSERT(cpuBits = bits64);
 				byte := 40H;
 				WHILE (oppos < LEN(opcode)-1) & IsPreREXPrefix(opcode[oppos], opcode[oppos+1]) DO
-					code.PutByte(ORD(opcode[oppos+1])); 
-					INC(oppos,2); 
+					code.PutByte(ORD(opcode[oppos+1]));
+					INC(oppos,2);
 				END;
 				IF rexB IN rexPrefix THEN byte := byte + 1H END;
 				IF rexX IN rexPrefix THEN byte := byte + 2H END;
@@ -988,20 +988,20 @@ TYPE
 						END;
 					| mem64Operand, mem128Operand: (* ignored *)
 						IF Trace THEN KernelLog.String(" mem64/mem128 "); END;
-					| RXB: 
+					| RXB:
 						IF val # -1 THEN code.PutByte (val); val := -1 END;
 						IF Trace THEN KernelLog.String(" RXB ");  TRACE(rexPrefix) END;
-						INC(oppos); 
+						INC(oppos);
 						byte := ORD(opcode[oppos]);
 						IF ~(rexB IN rexPrefix) THEN byte := byte + 80H END;
 						IF ~(rexX IN rexPrefix) THEN byte := byte + 40H END;
 						IF ~(rexR IN rexPrefix) THEN byte := byte + 20H END;
-						code.PutByte(byte); 
+						code.PutByte(byte);
 					| Src1Prefix:
 						IF val # -1 THEN code.PutByte (val); val := -1 END;
 						IF Trace THEN KernelLog.String(" Src1Prefix "); END;
 						INC(oppos);
-						ASSERT((operands[1].type = xmm) OR (operands[1].type = ymm)); 
+						ASSERT((operands[1].type = xmm) OR (operands[1].type = ymm));
 						code.PutByte(ORD(opcode[oppos])+(0FH -InstructionSet.RegisterIndex(operands[1].register))*0x08);
 					ELSE HALT(100) (* decoding error *)
 					END;
@@ -1513,11 +1513,11 @@ TYPE
 				IF size <= 0 THEN Error("invalid alignment size"); RETURN END;
 				pc := emitter.code.pc DIV 8; (* bytes *)
 				WHILE pc MOD size # 0 DO
-					emitter.code.PutByte(0); 
+					emitter.code.PutByte(0);
 					INC(pc);
 				END;
 			END Align;
-			
+
 
 			PROCEDURE PutData (size: Size): BOOLEAN;
 			VAR i: SIZE; x: HUGEINT; type:SHORTINT; ofs: Operand;

+ 127 - 127
source/FoxAMD64InstructionSet.Mod

@@ -130,89 +130,89 @@ CONST
 	*)
 	(** operand types, numbers assigned to the types do not have a special meaning **)
 	(* register classes first *)
-	reg8*= 0; 
-	reg16*= 1; 
-	reg32*= 2; 
-	reg64*= 3; 
-	CRn*= 4; 
-	DRn*= 5; 
-	segReg*= 6; 
-	mmx*= 7; 
-	xmm*= 8; 
-	ymm*= 9; 
-	sti*= 10; 
+	reg8*= 0;
+	reg16*= 1;
+	reg32*= 2;
+	reg64*= 3;
+	CRn*= 4;
+	DRn*= 5;
+	segReg*= 6;
+	mmx*= 7;
+	xmm*= 8;
+	ymm*= 9;
+	sti*= 10;
 	(* other classes *)
-	mem*= 11; 
-	imm*= 12; 
-	ioffset*= 13; 
-	pntr1616*= 14; 
-	pntr1632*= 15; 
+	mem*= 11;
+	imm*= 12;
+	ioffset*= 13;
+	pntr1616*= 14;
+	pntr1632*= 15;
 	(* special registers *)
-	AL*= 16; 
-	AX*= 17; 
-	CL*= 18; 
-	CR8*= 19; 
-	CS*= 20; 
-	DS*= 21; 
-	DX*= 22; 
-	EAX*= 23; 
-	ECX*= 24; 
-	ES*= 25; 
-	FS*= 26; 
-	GS*= 27; 
-	RAX*= 28; 
-	SS*= 29; 
-	rAX*= 30; 
-	st0*= 31; 
+	AL*= 16;
+	AX*= 17;
+	CL*= 18;
+	CR8*= 19;
+	CS*= 20;
+	DS*= 21;
+	DX*= 22;
+	EAX*= 23;
+	ECX*= 24;
+	ES*= 25;
+	FS*= 26;
+	GS*= 27;
+	RAX*= 28;
+	SS*= 29;
+	rAX*= 30;
+	st0*= 31;
 	(* immediates and memory locations *)
-	imm16*= 32; 
-	imm32*= 33; 
-	imm64*= 34; 
-	imm8*= 35; 
-	uimm16*= 36; 
-	uimm32*= 37; 
-	uimm8*= 38; 
-	simm16*= 39; 
-	simm32*= 40; 
-	simm8*= 41; 
-	mem256*= 42; 
-	mem128*= 43; 
-	mem16*= 44; 
-	mem32*= 45; 
-	mem64*= 46; 
-	mem8*= 47; 
-	moffset16*= 48; 
-	moffset32*= 49; 
-	moffset64*= 50; 
-	moffset8*= 51; 
-	rel16off*= 52; 
-	rel32off*= 53; 
-	rel8off*= 54; 
+	imm16*= 32;
+	imm32*= 33;
+	imm64*= 34;
+	imm8*= 35;
+	uimm16*= 36;
+	uimm32*= 37;
+	uimm8*= 38;
+	simm16*= 39;
+	simm32*= 40;
+	simm8*= 41;
+	mem256*= 42;
+	mem128*= 43;
+	mem16*= 44;
+	mem32*= 45;
+	mem64*= 46;
+	mem8*= 47;
+	moffset16*= 48;
+	moffset32*= 49;
+	moffset64*= 50;
+	moffset8*= 51;
+	rel16off*= 52;
+	rel32off*= 53;
+	rel8off*= 54;
 	(* ambivalent operand types *)
-	reg3264*= 55; 
-	regmem16*= 56; 
-	regmem32*= 57; 
-	regmem64*= 58; 
-	regmem8*= 59; 
-	reg32mem16*= 60; 
-	mmxmem32*= 61; 
-	mmxmem64*= 62; 
-	xmmmem256*= 63; 
-	xmmmem128*= 64; 
-	xmmmem32*= 65; 
-	xmmmem64*= 66; 
-	xmmmem8*= 67; 
-	xmmmem16*= 68; 
-	ymmmem128*= 69; 
-	ymmmem256*= 70; 
+	reg3264*= 55;
+	regmem16*= 56;
+	regmem32*= 57;
+	regmem64*= 58;
+	regmem8*= 59;
+	reg32mem16*= 60;
+	mmxmem32*= 61;
+	mmxmem64*= 62;
+	xmmmem256*= 63;
+	xmmmem128*= 64;
+	xmmmem32*= 65;
+	xmmmem64*= 66;
+	xmmmem8*= 67;
+	xmmmem16*= 68;
+	ymmmem128*= 69;
+	ymmmem256*= 70;
 	(* miscellaneous *)
-	one*= 71; 
-	three*= 72; 
-	vm32x*= 73; 
-	vm32y*= 74; 
-	vm64x*= 75; 
-	vm64y*= 76; 
-	m2z*= 77; 
+	one*= 71;
+	three*= 72;
+	vm32x*= 73;
+	vm32y*= 74;
+	vm64x*= 75;
+	vm64y*= 76;
+	m2z*= 77;
 
 	(** prefixes **)
 	prfOP* = 066H;
@@ -317,20 +317,20 @@ CONST
 	regR8*= 104; regR9*= 105; regR10*= 106; regR11*= 107; regR12*= 108; regR13*= 109; regR14*= 110; regR15*= 111;
 	regRIP*= 112;
 	(** other registers **)
-	regES*= 128; regCS*= 129; regSS*= 130; regDS*= 131; regFS*= 132; regGS*= 133; regCR0*= 134; regCR1*= 135; 
-	regCR2*= 136; regCR3*= 137; regCR4*= 138; regCR5*= 139; regCR6*= 140; regCR7*= 141; regCR8*= 142; regCR9*= 143; 
-	regCR10*= 144; regCR11*= 145; regCR12*= 146; regCR13*= 147; regCR14*= 148; regCR15*= 149; regDR0*= 150; regDR1*= 151; 
-	regDR2*= 152; regDR3*= 153; regDR4*= 154; regDR5*= 155; regDR6*= 156; regDR7*= 157; regDR8*= 158; regDR9*= 159; 
-	regDR10*= 160; regDR11*= 161; regDR12*= 162; regDR13*= 163; regDR14*= 164; regDR15*= 165; regST0*= 166; regST1*= 167; 
-	regST2*= 168; regST3*= 169; regST4*= 170; regST5*= 171; regST6*= 172; regST7*= 173; regXMM0*= 174; regXMM1*= 175; 
-	regXMM2*= 176; regXMM3*= 177; regXMM4*= 178; regXMM5*= 179; regXMM6*= 180; regXMM7*= 181; regXMM8*= 182; regXMM9*= 183; 
-	regXMM10*= 184; regXMM11*= 185; regXMM12*= 186; regXMM13*= 187; regXMM14*= 188; regXMM15*= 189; regMMX0*= 190; regMMX1*= 191; 
-	regMMX2*= 192; regMMX3*= 193; regMMX4*= 194; regMMX5*= 195; regMMX6*= 196; regMMX7*= 197; regYMM0*= 198; regYMM1*= 199; 
-	regYMM2*= 200; regYMM3*= 201; regYMM4*= 202; regYMM5*= 203; regYMM6*= 204; regYMM7*= 205; regYMM8*= 206; regYMM9*= 207; 
-	regYMM10*= 208; regYMM11*= 209; regYMM12*= 210; regYMM13*= 211; regYMM14*= 212; regYMM15*= 213; 
-	numberRegisters*= 214; 
+	regES*= 128; regCS*= 129; regSS*= 130; regDS*= 131; regFS*= 132; regGS*= 133; regCR0*= 134; regCR1*= 135;
+	regCR2*= 136; regCR3*= 137; regCR4*= 138; regCR5*= 139; regCR6*= 140; regCR7*= 141; regCR8*= 142; regCR9*= 143;
+	regCR10*= 144; regCR11*= 145; regCR12*= 146; regCR13*= 147; regCR14*= 148; regCR15*= 149; regDR0*= 150; regDR1*= 151;
+	regDR2*= 152; regDR3*= 153; regDR4*= 154; regDR5*= 155; regDR6*= 156; regDR7*= 157; regDR8*= 158; regDR9*= 159;
+	regDR10*= 160; regDR11*= 161; regDR12*= 162; regDR13*= 163; regDR14*= 164; regDR15*= 165; regST0*= 166; regST1*= 167;
+	regST2*= 168; regST3*= 169; regST4*= 170; regST5*= 171; regST6*= 172; regST7*= 173; regXMM0*= 174; regXMM1*= 175;
+	regXMM2*= 176; regXMM3*= 177; regXMM4*= 178; regXMM5*= 179; regXMM6*= 180; regXMM7*= 181; regXMM8*= 182; regXMM9*= 183;
+	regXMM10*= 184; regXMM11*= 185; regXMM12*= 186; regXMM13*= 187; regXMM14*= 188; regXMM15*= 189; regMMX0*= 190; regMMX1*= 191;
+	regMMX2*= 192; regMMX3*= 193; regMMX4*= 194; regMMX5*= 195; regMMX6*= 196; regMMX7*= 197; regYMM0*= 198; regYMM1*= 199;
+	regYMM2*= 200; regYMM3*= 201; regYMM4*= 202; regYMM5*= 203; regYMM6*= 204; regYMM7*= 205; regYMM8*= 206; regYMM9*= 207;
+	regYMM10*= 208; regYMM11*= 209; regYMM12*= 210; regYMM13*= 211; regYMM14*= 212; regYMM15*= 213;
+	numberRegisters*= 214;
 
-VAR 
+VAR
 	opAAA*,
 	opAAD*,
 	opAAM*,
@@ -1403,10 +1403,10 @@ VAR
 	(* repository *)
 	mnemonics-: ARRAY maxNumberMnemonics OF Mnemonic;
 	numberMnemonics: LONGINT;
-	
+
 	instructions-: ARRAY maxNumberInstructions OF Instruction;
-	numberInstructions: LONGINT; 
-	
+	numberInstructions: LONGINT;
+
 	registers-: ARRAY numberRegisters OF Register;
 	registersByClass-: ARRAY sti+1 OF ARRAY 17 OF LONGINT;
 
@@ -1596,26 +1596,26 @@ VAR
 					ELSIF name = "vm64x" THEN RETURN vm64x
 					ELSIF name = "vm64y" THEN RETURN vm64y
 					ELSIF name = "m2z" THEN RETURN m2z
-					ELSE HALT(200) 
+					ELSE HALT(200)
 					END;
 				END StringToOperand;
 
 			PROCEDURE ParseOperand(CONST op: ARRAY OF CHAR; VAR at: LONGINT): SHORTINT;
 			VAR name: ARRAY 32 OF CHAR; i: LONGINT;
 			BEGIN
-				i := 0; 
+				i := 0;
 				WHILE(op[at] # 0X) & (op[at] # ",") DO
 					name[i] := op[at];
-					INC(i); INC(at); 
+					INC(i); INC(at);
 				END;
 				name[i] := 0X;
 				IF op[at] = "," THEN INC(at) END;
-				RETURN StringToOperand(name); 
+				RETURN StringToOperand(name);
 			END ParseOperand;
 
 	(** setup instruction and mnemonic tables **)
 	PROCEDURE InitInstructions;
-	VAR 
+	VAR
 
 		PROCEDURE AddMnemonic(VAR op: LONGINT; CONST name: ARRAY OF CHAR);
 		BEGIN
@@ -1739,13 +1739,13 @@ VAR
 
 			all symbols 8 bit wide, numbers also 8 bits wide
 		*)
-		
+
 			PROCEDURE GetCode(CONST charcode: ARRAY OF CHAR; VAR at: LONGINT; VAR cd: ARRAY OF CHAR): BOOLEAN;
 			VAR i: LONGINT;
 			BEGIN
 				WHILE(charcode[at] = " ") DO INC(at) END;
 				IF charcode[at] = 0X THEN RETURN FALSE END;
-				i := 0; 
+				i := 0;
 				WHILE (charcode[at] # " ") & (charcode[at] # 0X) DO
 					cd[i] := charcode[at];
 					INC(i); INC(at);
@@ -1753,7 +1753,7 @@ VAR
 				cd[i] := 0X;
 				RETURN TRUE;
 			END GetCode;
-		
+
 		VAR i,k,length: SHORTINT; ch1,ch2: CHAR; cdc: ARRAY 32 OF CHAR; at,mul,val: LONGINT;
 		BEGIN
 			i := 0; k := 0; at := 0;
@@ -1769,30 +1769,30 @@ VAR
 						IF (cdc[i] ="0") OR (cdc[i]="X") THEN
 							mul := mul DIV 2;
 						ELSIF cdc[i] = "1" THEN
-							INC(val, mul); 
+							INC(val, mul);
 							mul := mul DIV 2;
 						ELSIF cdc[i] = "." (* next *) THEN
 						ELSIF cdc[i] = "c" THEN
-							INC(i); ASSERT(cdc[i] ="o"); 
+							INC(i); ASSERT(cdc[i] ="o");
 							INC(i); ASSERT(cdc[i] ="u");
 							INC(i); ASSERT(cdc[i] ="n");
 							INC(i); ASSERT(cdc[i] ="t");
 							code[k] := CHR(CountPrefix);
 							mul := mul DIV 10H;
 						ELSIF cdc[i] = "d" THEN
-							INC(i); ASSERT(cdc[i] ="e"); 
+							INC(i); ASSERT(cdc[i] ="e");
 							INC(i); ASSERT(cdc[i] ="s");
 							INC(i); ASSERT(cdc[i] ="t");
 							code[k] := CHR(DestPrefix);
 							mul := mul DIV 10H;
 						ELSIF cdc[i] = "s" THEN
-							INC(i); ASSERT(cdc[i] ="r"); 
+							INC(i); ASSERT(cdc[i] ="r");
 							INC(i); ASSERT(cdc[i] ="c");
 							code[k] := CHR(Src1Prefix);
-							ASSERT(mul = 64); 
-							IF (cdc[i+1] = "1") THEN 
+							ASSERT(mul = 64);
+							IF (cdc[i+1] = "1") THEN
 								INC(i);
-							ELSIF (cdc[i+1] = "2") THEN 
+							ELSIF (cdc[i+1] = "2") THEN
 								code[k] := CHR(Src2Prefix);
 								INC(i);
 							END;
@@ -1804,7 +1804,7 @@ VAR
 					INC(k);
 					code[k] := CHR(val); INC(k);
 				ELSIF (ch1="R") THEN
-					code[k] := CHR(RXB); INC(k); 
+					code[k] := CHR(RXB); INC(k);
 					IF (cdc = "RXB.00001") OR  (cdc ="RXB.01") THEN
 						code[k] := CHR(1);
 					ELSIF (cdc ="RXB.00011") OR (cdc = "RXB.03") THEN
@@ -1830,12 +1830,12 @@ VAR
 						CASE ch2 OF
 							'r': code[k] := CHR(modRMBoth); INC(k);
 							|'0'..'7': code[k] := CHR(modRMExtension); INC(k); code[k] := CHR(HexOrd(ch2)); INC(k);
-						ELSE 
-							IF cdc = "/imm8" THEN 
+						ELSE
+							IF cdc = "/imm8" THEN
 								(*todo*)
-							ELSIF cdc = "/is4" THEN 
+							ELSIF cdc = "/is4" THEN
 								(*todo*)
-							ELSIF cdc = "/ib" THEN 
+							ELSIF cdc = "/ib" THEN
 								code[k] := CHR(ib); INC(k);
 							ELSE
 								HALT(100)
@@ -1855,7 +1855,7 @@ VAR
 							|'w': code[k] := CHR(iw); INC(k);
 							|'d': code[k] := CHR(id); INC(k);
 							|'q': code[k] := CHR(iq); INC(k);
-						ELSE 
+						ELSE
 							IF cdc = "is4" THEN
 								(*todo*)
 							ELSIF cdc = "is5" THEN
@@ -1895,7 +1895,7 @@ VAR
 				INC(k);
 			END;
 		END EncodeV;
-		
+
 		PROCEDURE AddInstructionV(mnemonic: LONGINT; CONST operands, code: ARRAY OF CHAR);
 		VAR i, at: LONGINT; name: ARRAY 32 OF CHAR;
 		BEGIN
@@ -1905,9 +1905,9 @@ VAR
 				INC(i);
 			END;
 			ASSERT(operands[at] = 0X); (* all operands parsed *)
-			
+
 			EncodeV(code,instructions[numberInstructions].code);
-			
+
 			COPY(mnemonics[mnemonic].name,name);
 			IF mnemonics[mnemonic].firstInstruction = -1 THEN
 				mnemonics[mnemonic].firstInstruction := numberInstructions;
@@ -1922,9 +1922,9 @@ VAR
 
 		PROCEDURE AddInstruction(mnemonic: LONGINT; CONST op,code: ARRAY OF CHAR; bitwidthOptions, cpuOptions: SET);
 		VAR i: SHORTINT; at: LONGINT;
-		
-		
-			
+
+
+
 		BEGIN
 			i := 0; at := 0;
 			WHILE (i<maxNumberOperands) DO
@@ -1935,7 +1935,7 @@ VAR
 
 			instructions[numberInstructions].bitwidthOptions := bitwidthOptions;
 			instructions[numberInstructions].cpuOptions := cpuOptions;
-			
+
 			IF mnemonics[mnemonic].firstInstruction = -1 THEN
 				mnemonics[mnemonic].firstInstruction := numberInstructions;
 				mnemonics[mnemonic].lastInstruction := numberInstructions;
@@ -1943,7 +1943,7 @@ VAR
 				ASSERT(mnemonics[mnemonic].lastInstruction = numberInstructions-1);
 				mnemonics[mnemonic].lastInstruction := numberInstructions;
 			END;
-			
+
 			INC(numberInstructions);
 		END AddInstruction;
 
@@ -1956,9 +1956,9 @@ VAR
 
 
 	BEGIN
-		numberMnemonics := 0; 
-		numberInstructions := 0; 
-		
+		numberMnemonics := 0;
+		numberInstructions := 0;
+
 		AddMnemonic(opAAA, "AAA");
 		AddMnemonic(opAAD, "AAD");
 		AddMnemonic(opAAM, "AAM");
@@ -2969,7 +2969,7 @@ VAR
 		AddMnemonic(opXOR, "XOR");
 		AddMnemonic(opXORPD, "XORPD");
 		AddMnemonic(opXORPS, "XORPS");
-		
+
 
 		AddInstruction(opAAA, "", "37", {optNot64}, {cpu8086});
 		AddInstruction(opAAD, "", "D50A", {optNot64}, {cpu8086});

+ 53 - 53
source/FoxAMDBackend.Mod

@@ -558,7 +558,7 @@ TYPE
 				ASSERT(~error);
 			ELSIF cpuBits=64 THEN
 				NEW(physicalRegisters64, backend.forceFPU, backend.cooperative); physicalRegisters := physicalRegisters64; error := ~emitter.SetBits(64);
-				opBP := opRBP; opSP := opRSP; 
+				opBP := opRBP; opSP := opRSP;
 				opRA := registerOperands[RAX]; opRC := registerOperands[RCX];
 				opRB := registerOperands[RBX]; opRD := registerOperands[RDX];
 				opRDI := registerOperands[RDI]; opRSI := registerOperands[RSI];
@@ -606,7 +606,7 @@ TYPE
 			END;
 			ASSERT(fpStackPointer = 0);
 			CheckEmptySpillStack;
-			IF backend.cooperative THEN 
+			IF backend.cooperative THEN
 				UnmapTicket(ap);
 			END;
 			error := error OR emitter.error;
@@ -855,7 +855,7 @@ TYPE
 		END GetTemporaryRegister;
 
 		PROCEDURE GetImmediateMem(CONST vop: IntermediateCode.Operand; part: LONGINT; VAR imm: Assembler.Operand);
-		VAR data: IntermediateCode.Section;pc: LONGINT; source, dest: Assembler.Operand; ticket: Ticket; 
+		VAR data: IntermediateCode.Section;pc: LONGINT; source, dest: Assembler.Operand; ticket: Ticket;
 		BEGIN
 			data := GetDataSection();
 			pc := IntermediateBackend.EnterImmediate(data,vop);
@@ -890,12 +890,12 @@ TYPE
 				value := value DIV 10000H DIV 10000H;
 				RETURN (value = 0) OR (value=-1);
 			END IsImm32;
-			
+
 			PROCEDURE IsSignedImm32(value: HUGEINT): BOOLEAN;
 			BEGIN
 				RETURN (value <= MAX(SIGNED32)) & (value >= MIN(SIGNED32));
 			END IsSignedImm32;
-			
+
 
 		BEGIN
 			ASSERT(virtual.mode = IntermediateCode.ModeImmediate);
@@ -910,8 +910,8 @@ TYPE
 
 				IF virtual.symbol.name # "" THEN size := SHORT(type.sizeInBits DIV 8);
 				ELSIF forbidden16Bit & IsImm16(value) & ~(IsImm8(value)) THEN size := Assembler.bits32;
-				ELSIF (type.sizeInBits = 64) & (type.form = IntermediateCode.UnsignedInteger) & (value > MAX(LONGINT)) THEN 
-					size := 8; (* don't use negative signed 32-bit value  to encode 64-bit unsigned value! *)	
+				ELSIF (type.sizeInBits = 64) & (type.form = IntermediateCode.UnsignedInteger) & (value > MAX(LONGINT)) THEN
+					size := 8; (* don't use negative signed 32-bit value  to encode 64-bit unsigned value! *)
 				ELSE size := 0
 				END;
 				Assembler.InitImm(physical,size ,value);
@@ -984,7 +984,7 @@ TYPE
 				Assembler.SetSymbol(physical,virtual.symbol.name,virtual.symbol.fingerprint,virtual.symbolOffset,virtual.offset+ (cpuBits DIV 8) *part);
 			END;
 		END GetMemory;
-		
+
 		PROCEDURE GetRegister(CONST virtual: IntermediateCode.Operand; part:LONGINT; VAR physical: Assembler.Operand; VAR ticket: Ticket);
 		VAR type: IntermediateCode.Type; virtualRegister, tempReg: LONGINT;
 			tmp,imm: Assembler.Operand; index: LONGINT;
@@ -1281,13 +1281,13 @@ TYPE
 		PROCEDURE EmitEnter(CONST instruction: IntermediateCode.Instruction);
 		VAR op1,imm,target: Assembler.Operand; cc,size,numberMachineWords,destPC,firstPC,secondPC,x: LONGINT; body: SyntaxTree.Body; name: Basic.SegmentedName;
 		parametersSize: SIZE;
-		CONST initialize=TRUE; FirstOffset = 5; SecondOffset = 11; 
+		CONST initialize=TRUE; FirstOffset = 5; SecondOffset = 11;
 		BEGIN
 			stackSize := SHORT(instruction.op2.intValue);
 			size := stackSize;
 
 			INC(traceStackSize, stackSize);
-			
+
 			IF initialize THEN
 				(* always including this instruction make trace insertion possible *)
 				IF backend.traceable THEN
@@ -1372,7 +1372,7 @@ TYPE
 					emitter.Emit1(InstructionSet.opPOP,opRDI);
 					emitter.Emit1(InstructionSet.opPOP,opRB);
 				END;
-				
+
 			END;
 		END EmitLeave;
 
@@ -1433,7 +1433,7 @@ TYPE
 		BEGIN
 			sizeInBytes := SHORTINT(vdest.type.sizeInBits DIV 8);
 			stackSize := sizeInBytes;
-			Basic.Align(stackSize, cpuBits DIV 8); 
+			Basic.Align(stackSize, cpuBits DIV 8);
 			IF vdest.type.form IN IntermediateCode.Integer THEN
 				(* e.g. in SYSTEM.VAL(LONGINT, r) *)
 				IF vsrc.mode = IntermediateCode.ModeMemory THEN
@@ -1575,7 +1575,7 @@ TYPE
 		PROCEDURE EmitConvertFloat(CONST instruction: IntermediateCode.Instruction);
 		VAR destType, srcType, dtype: IntermediateCode.Type; dest,src,espm,imm: Assembler.Operand; sizeInBytes, index: LONGINT;
 		temp, temp2, temp3, temp4, zero: Assembler.Operand; ticket: Ticket; vdest, vsrc: IntermediateCode.Operand;
-			unsigned: BOOLEAN; 
+			unsigned: BOOLEAN;
 		BEGIN
 			vdest := instruction.op1; vsrc := instruction.op2;
 			srcType := vsrc.type;
@@ -1622,9 +1622,9 @@ TYPE
 						sizeInBytes := 8;
 						Assembler.InitImm(zero,0,0);
 						emitter.Emit1(InstructionSet.opPUSH,zero);
-						EmitPush(vsrc,Low);						
+						EmitPush(vsrc,Low);
 					ELSIF unsigned & ( vsrc.type.sizeInBits = IntermediateCode.Bits32) THEN (* UNSIGNED32 on 64-bit *)
-						MakeRegister(vsrc, Low, src); 
+						MakeRegister(vsrc, Low, src);
 						index := src.register;
 						index := index MOD 32 + RAX;
 						src := registerOperands[index];
@@ -1915,10 +1915,10 @@ TYPE
 
 				(* make sure that result registers are not used during emission of Low / High *)
 				lowReserved := physicalRegisters.Reserved(register);
-				physicalRegisters.SetReserved(register, TRUE); 
+				physicalRegisters.SetReserved(register, TRUE);
 				highReserved := physicalRegisters.Reserved(highRegister);
 				physicalRegisters.SetReserved(highRegister,TRUE);
-				
+
 				MakeOperand(instruction.op1,Low,op, NIL);
 				IF Assembler.SameOperand(op, resultHigh) THEN
 					emitter.Emit2(InstructionSet.opXCHG, result, resultHigh); (* low register already mapped ok *)
@@ -2290,7 +2290,7 @@ TYPE
 
 		BEGIN
 			IF IntermediateCode.IsConstantInteger(instruction.op3,value) & IntermediateBackend.PowerOf2(value,exp) THEN
-				IF instruction.opcode = IntermediateCode.div THEN					
+				IF instruction.opcode = IntermediateCode.div THEN
 					IntermediateCode.InitImmediate(iop3, IntermediateCode.uint32, exp);
 					IntermediateCode.InitInstruction(inst, Basic.invalidPosition, IntermediateCode.shr, instruction.op1, instruction.op2, iop3);
 					EmitShift(inst);
@@ -2299,7 +2299,7 @@ TYPE
 					IntermediateCode.InitImmediate(iop3, instruction.op3.type, value-1);
 					IntermediateCode.InitInstruction(inst, Basic.invalidPosition, IntermediateCode.and, instruction.op1, instruction.op2, iop3);
 					EmitArithmetic3(inst,InstructionSet.opAND);
-					RETURN;					
+					RETURN;
 				END;
 			END;
 
@@ -2479,7 +2479,7 @@ TYPE
 
 			IF instruction.op3.mode # IntermediateCode.ModeImmediate THEN
 				IF backend.cooperative THEN ap.spillable := TRUE END;
-				Spill(physicalRegisters.Mapped(ECX)); 
+				Spill(physicalRegisters.Mapped(ECX));
 				ecx := ReservePhysicalRegister(IntermediateCode.GeneralPurposeRegister,IntermediateCode.int32,ECX,inPC);
 			END;
 
@@ -2603,18 +2603,18 @@ TYPE
 				MakeRegister(instruction.op2,Low,op2);
 				Assembler.InitMem(op2,SHORTINT(size),op2.register,0);
 
-				type := IntermediateCode.NewType(IntermediateCode.SignedInteger, SHORTINT(size*8)); 
+				type := IntermediateCode.NewType(IntermediateCode.SignedInteger, SHORTINT(size*8));
 				rd := TemporaryTicket(IntermediateCode.GeneralPurposeRegister, type);
 				TicketToOperand(rd,op3);
-				
-				
-				Move(op3, op2, type); 
-				Move(op1, op3, type); 
+
+
+				Move(op3, op2, type);
+				Move(op1, op3, type);
 			ELSE
 				Spill(physicalRegisters.Mapped(RS));
 				Spill(physicalRegisters.Mapped(RD));
 				IF backend.cooperative THEN ap.spillable := TRUE END;
-				Spill(physicalRegisters.Mapped(RC)); 
+				Spill(physicalRegisters.Mapped(RC));
 
 				rs := ReservePhysicalRegister(IntermediateCode.GeneralPurposeRegister,instruction.op1.type,RS,inPC);
 				rd := ReservePhysicalRegister(IntermediateCode.GeneralPurposeRegister,instruction.op1.type,RD,inPC);
@@ -3028,7 +3028,7 @@ TYPE
 			ELSE
 				sizeInBytes := vop.type.sizeInBits DIV 8;
 				length := vop.type.length;
-				IF sizeInBytes * length * 8 < cpuBits THEN 
+				IF sizeInBytes * length * 8 < cpuBits THEN
 					ModifyStackPointer(cpuBits DIV 8);
 				ELSE
 					ModifyStackPointer(sizeInBytes*length);
@@ -3064,7 +3064,7 @@ TYPE
 					MakeOperand(vop,Low,op,NIL);
 					Move(op, memop, vop.type)
 				END;
-				IF sizeInBytes * length * 8 < cpuBits THEN 
+				IF sizeInBytes * length * 8 < cpuBits THEN
 					ModifyStackPointer(-cpuBits DIV 8);
 				ELSE
 					ModifyStackPointer(-sizeInBytes*length);
@@ -3248,19 +3248,19 @@ TYPE
 			InitIntermediateBackend;
 			bits := 32;
 			forceFPU := FALSE;
-						
+
 			winAPIRegisters[0] := RCX - RAX;
 			winAPIRegisters[1] := RDX - RAX;
 			winAPIRegisters[2] := R8 - RAX;
-			winAPIRegisters[3] := R9 - RAX; 
-			
+			winAPIRegisters[3] := R9 - RAX;
+
 			cRegisters[0] := RDI - RAX;
 			cRegisters[1] := RSI - RAX;
 			cRegisters[2] := RDX - RAX;
-			cRegisters[3] := RCX - RAX; 
+			cRegisters[3] := RCX - RAX;
 			cRegisters[4] := R8 - RAX;
-			cRegisters[5] := R9 - RAX; 
-			
+			cRegisters[5] := R9 - RAX;
+
 			SetName("AMD");
 		END InitBackendAMD64;
 
@@ -3334,15 +3334,15 @@ TYPE
 			END;
 			RETURN system
 		END GetSystem;
-			
+
 		(* returns the following register (or part thereof)
-			0: regRAX; 
-			1: regRCX; 
-			2: regRDX; 
+			0: regRAX;
+			1: regRCX;
+			2: regRDX;
 			3: regRBX;
-			4: regRSP; 
-			5: regRBP; 
-			6: regRSI; 
+			4: regRSP;
+			5: regRBP;
+			6: regRSI;
 			7: regRDI;
 			8 .. 15: regRx;
 		*)
@@ -3358,28 +3358,28 @@ TYPE
 		END HardwareIntegerRegister;
 
 		PROCEDURE HardwareFloatRegister(index: LONGINT; sizeInBits: LONGINT): LONGINT;
-		BEGIN 
+		BEGIN
 			ASSERT((sizeInBits = 32) OR (sizeInBits = 64));
 			RETURN XMM0 + index;
 		END HardwareFloatRegister;
-		
+
 		PROCEDURE ResetParameterRegisters*;
 		BEGIN
 			intParameterIndex := 0;
-			floatParameterIndex := 0; 
+			floatParameterIndex := 0;
 		END ResetParameterRegisters;
-		
+
 		PROCEDURE GetParameterRegister*(callingConvention: SyntaxTree.CallingConvention;  type: IntermediateCode.Type; VAR register: WORD): BOOLEAN;
 		VAR index: WORD;
 		BEGIN
 			IF bits = 32 THEN register := -1; RETURN FALSE END;
-			
+
 			IF type.form IN IntermediateCode.Integer THEN
 				CASE callingConvention OF
-					|SyntaxTree.WinAPICallingConvention:  
+					|SyntaxTree.WinAPICallingConvention:
 						IF intParameterIndex >= 4 THEN register := -1; RETURN FALSE END;
 						index := winAPIRegisters[intParameterIndex];
-					|SyntaxTree.CCallingConvention: 
+					|SyntaxTree.CCallingConvention:
 						IF intParameterIndex >= 6 THEN register := -1; RETURN FALSE END;
 						index := cRegisters[intParameterIndex];
 				ELSE
@@ -3390,11 +3390,11 @@ TYPE
 				RETURN TRUE;
 			ELSIF type.form = IntermediateCode.Float THEN
 				CASE callingConvention OF
-					|SyntaxTree.WinAPICallingConvention:  
+					|SyntaxTree.WinAPICallingConvention:
 						IF intParameterIndex >= 4 THEN register := -1; RETURN FALSE END;
 						index := intParameterIndex;
 						INC(intParameterIndex);
-					|SyntaxTree.CCallingConvention: 
+					|SyntaxTree.CCallingConvention:
 						IF floatParameterIndex >= 8 THEN register := -1; RETURN FALSE END;
 						index := floatParameterIndex;
 						INC(floatParameterIndex);
@@ -3589,11 +3589,11 @@ TYPE
 		PROCEDURE CanPassInRegister*(type: SyntaxTree.Type): BOOLEAN;
 		VAR length: LONGINT; baseType: SyntaxTree.Type; b: BOOLEAN;
 		BEGIN
-			b := SemanticChecker.IsStaticMathArray(type, length, baseType) & (baseType IS SyntaxTree.FloatType) & 
+			b := SemanticChecker.IsStaticMathArray(type, length, baseType) & (baseType IS SyntaxTree.FloatType) &
 			(baseType.sizeInBits <= 32) & (length = 4);
-			b := b OR SemanticChecker.IsStaticMathArray(type, length, baseType) & (baseType IS SyntaxTree.CharacterType) & 
+			b := b OR SemanticChecker.IsStaticMathArray(type, length, baseType) & (baseType IS SyntaxTree.CharacterType) &
 			(baseType.sizeInBits = 8) & (length = 4);
-			b := b OR SemanticChecker.IsStaticArray(type, baseType, length) & (baseType.resolved IS SyntaxTree.CharacterType) & 
+			b := b OR SemanticChecker.IsStaticArray(type, baseType, length) & (baseType.resolved IS SyntaxTree.CharacterType) &
 			(baseType.resolved.sizeInBits = 8) & (length = 4);
 			RETURN b
 		END CanPassInRegister;

+ 12 - 12
source/FoxARMAssembler.Mod

@@ -27,7 +27,7 @@ TYPE
 			END;
 			RETURN result
 		END GetRegister;
-		
+
 		PROCEDURE GetRegisterList(VAR registerList: SET): BOOLEAN;
 		VAR num: LONGINT;
 		BEGIN
@@ -42,7 +42,7 @@ TYPE
 						INCL(registerList, num);
 					END;
 				UNTIL token.symbol # Scanner.Comma;
-				IF token.symbol # Scanner.RightBrace THEN 
+				IF token.symbol # Scanner.RightBrace THEN
 					Error(errorPosition, "'}' expected.")
 				ELSE
 					NextToken;
@@ -51,7 +51,7 @@ TYPE
 			END;
 			RETURN FALSE;
 		END GetRegisterList;
-		
+
 
 		(** parse a special register name, along with fields **)
 		PROCEDURE GetSpecialRegisterWithFields(VAR registerNumber: LONGINT; VAR fields: SET): BOOLEAN;
@@ -169,12 +169,12 @@ TYPE
 		VAR
 			instruction: InstructionSet.Instruction;
 			operands: ARRAY InstructionSet.MaxOperands OF InstructionSet.Operand;
-			position: Basic.Position; 
+			position: Basic.Position;
 			opCode, condition, i, operandNumber: LONGINT;
 			flags: SET;
 			newOperandExpected: BOOLEAN;
 			result: FoxAssembler.Result;
-			
+
 			(** parse an operand
 				- note that a subsequent comma is consumed as well
 				- 'newOperandExpected' indicates if any more operands are expected
@@ -265,8 +265,8 @@ TYPE
 							(* pc label of the form [labelName], translated to [PC, #labelName - $ - 8] *)
 							registerNumber := InstructionSet.PC;
 							isImmediateOffset := TRUE;
-							DEC(offsetImmediateValue, 8); 
-							DEC(offsetImmediateValue, code.pc); 
+							DEC(offsetImmediateValue, 8);
+							DEC(offsetImmediateValue, code.pc);
 							IF ABS(offsetImmediateValue) < InstructionSet.Bits12 THEN
 								IF offsetImmediateValue >= 0 THEN
 									INCL(indexingMode, InstructionSet.Increment)
@@ -325,7 +325,7 @@ TYPE
 						IF ThisSymbol(Scanner.Arrow) THEN
 							INCL(flags, InstructionSet.flagUserMode);
 						END;
-	
+
 					ELSIF GetCoprocessor(value) THEN
 						(* coprocessor name *)
 						InstructionSet.InitCoprocessor(operand, value)
@@ -359,7 +359,7 @@ TYPE
 					IF ~newOperandExpected THEN newOperandExpected := ThisSymbol(Scanner.Comma) END; (* a comma means that there is one more operand *)
 
 					operands[operandNumber] := operand;
-					
+
 				END
 			END ParseOperand;
 
@@ -370,13 +370,13 @@ TYPE
 
 			position := errorPosition;
 			IF InstructionSet.FindMnemonic(mnemonic, opCode, condition, flags) THEN
-				
+
 				(*IF Trace THEN
 					D.String("    opCode="); D.Int(opCode, 0); D.Ln;
 					D.String("    condition="); D.Int(condition, 0); D.Ln;
 					D.String("    flags="); D.Set(flags); D.Ln;
 				END;*)
-				
+
 
 				FOR i := 0 TO InstructionSet.MaxOperands - 1 DO
 					InstructionSet.InitOperand(operands[i])
@@ -401,7 +401,7 @@ TYPE
 						ELSE
 							(* last pass: emit the instruction *)
 							IF ~InstructionSet.EmitInstruction(instruction, section.resolved) THEN
-								ErrorSS(position, "wrong instruction format (encoding failed): ", mnemonic);								
+								ErrorSS(position, "wrong instruction format (encoding failed): ", mnemonic);
 							END;
 						END
 					END

+ 60 - 60
source/FoxARMBackend.Mod

@@ -124,18 +124,18 @@ TYPE
 	VAR
 		firstCitation, lastCitation: Citation; (* linked list of citations *)
 		next: Reference;
-		size: LONGINT; (* storage size of this reference *) 
+		size: LONGINT; (* storage size of this reference *)
 
 		PROCEDURE & Init(size: LONGINT);
 		BEGIN
 			firstCitation := NIL; lastCitation := NIL; next := NIL; SELF.size := size;
 		END Init;
-		
+
 		PROCEDURE Emit(out: BinaryCode.Section);
 		BEGIN
 			HALT(100);
 		END Emit;
-		
+
 
 		PROCEDURE AddCitation(pc: LONGINT; bits: LONGINT; shift: LONGINT);
 		VAR
@@ -156,7 +156,7 @@ TYPE
 			Init(4);
 			SELF.value := v;
 		END InitImm;
-		
+
 		PROCEDURE Emit(out: BinaryCode.Section);
 		BEGIN
 			IF out.comments # NIL THEN
@@ -217,15 +217,15 @@ TYPE
 			fixup := BinaryCode.NewFixup(BinaryCode.Absolute, out.pc, identifier, symbolOffset, 0, 0, rFixupPattern);
 			out.fixupList.AddFixup(fixup);
 			out.PutBits(0, 32);
-		END Emit; 
-		
+		END Emit;
+
 	END SymbolReference;
 
 	ListOfReferences = OBJECT
 	VAR
 		firstReference, lastReference: Reference; (* linked list of all symbol references *)
 		size: LONGINT; (* length of the required fixup block *)
-		due: LONGINT; (* the PC at which the reference block has to be written (the latest) *) 
+		due: LONGINT; (* the PC at which the reference block has to be written (the latest) *)
 
 		PROCEDURE & Init;
 		BEGIN
@@ -233,7 +233,7 @@ TYPE
 			size := 0;
 			due := MAX(LONGINT);
 		END Init;
-		
+
 		PROCEDURE UpdateDue(pc: LONGINT; bits: LONGINT; shift: LONGINT);
 		VAR max: LONGINT;
 		BEGIN
@@ -243,13 +243,13 @@ TYPE
 				due := max;
 			END;
 		END UpdateDue;
-		
+
 		PROCEDURE AddCitation(reference: Reference; pc: LONGINT; bits: LONGINT; shift: LONGINT);
 		BEGIN
 			reference.AddCitation(pc, bits, shift);
 			UpdateDue(pc, bits, shift);
 		END AddCitation;
-		
+
 		PROCEDURE AddReference(reference: Reference): Reference;
 		BEGIN
 			IF firstReference = NIL THEN firstReference := reference ELSE lastReference.next := reference END;
@@ -349,7 +349,7 @@ TYPE
 		toVirtual: ARRAY InstructionSet.NumberRegisters OF Ticket; (* registers real register -> none / reserved / split / blocked / virtual register (>0) *)
 		reserved: ARRAY InstructionSet.NumberRegisters OF BOOLEAN;
 		unusable: Ticket;
-		blocked: Ticket; 
+		blocked: Ticket;
 		hint: LONGINT;
 		useFPU32:BOOLEAN;
 		useFPU64:BOOLEAN;
@@ -396,7 +396,7 @@ TYPE
 			IF ~useFPU64 THEN
 				(* disable double precision VFP registers *)
 				FOR i := InstructionSet.DR0 TO InstructionSet.DR31 DO toVirtual[i] := unusable END;
-			END; 
+			END;
 
 		END InitPhysicalRegisters;
 
@@ -420,9 +420,9 @@ TYPE
 				index := physicalRegisterNumber - InstructionSet.DR0;
 				IF index*2 < 32 THEN
 					toVirtual[InstructionSet.SR0 + index *2] := blocked;
-					toVirtual[InstructionSet.SR0 + index *2 + 1] := blocked;				
+					toVirtual[InstructionSet.SR0 + index *2 + 1] := blocked;
 				END;
-			END; 
+			END;
 		END Allocate;
 
 		(** set whether a certain physical register is reserved or not **)
@@ -457,7 +457,7 @@ TYPE
 					toVirtual[InstructionSet.SR0 + index *2] := NIL;
 					toVirtual[InstructionSet.SR0 + index *2 + 1] := NIL;
 				END;
-			END; 
+			END;
 		END Free;
 
 		(** get the number of the next free physical register for a certain data type
@@ -640,11 +640,11 @@ TYPE
 		BEGIN
 			CASE irInstruction.opcode OF
 			| IntermediateCode.add, IntermediateCode.sub, IntermediateCode.mul, IntermediateCode.abs, IntermediateCode.neg:
-				
+
 				result :=  ~IsFloat(irInstruction.op1) OR backend.useFPU32 & IsSinglePrecisionFloat(irInstruction.op1) OR backend.useFPU64 & IsDoublePrecisionFloat(irInstruction.op1);
 
 			| IntermediateCode.div:
-				result :=  backend.useFPU32 & IsSinglePrecisionFloat(irInstruction.op1) 
+				result :=  backend.useFPU32 & IsSinglePrecisionFloat(irInstruction.op1)
 							OR backend.useFPU64 & IsDoublePrecisionFloat(irInstruction.op1)
 							OR backend.useFPU64 & IsNonComplexInteger(irInstruction.op1);
 				result := result OR IntermediateCode.IsConstantInteger(irInstruction.op3,value) & IntermediateBackend.PowerOf2(value,exp)
@@ -661,7 +661,7 @@ TYPE
 				END;
 			| IntermediateCode.mod:
 				result :=  IntermediateCode.IsConstantInteger(irInstruction.op3,value) & IntermediateBackend.PowerOf2(value,exp)
-				
+
 			| IntermediateCode.rol, IntermediateCode.ror:
 				result := ~IsComplex(irInstruction.op1)
 			ELSE
@@ -747,8 +747,8 @@ TYPE
 
 			(* emit the instruction *)
 			InstructionSet.Emit(opCode, condition, flags, operands, out);
-			
-			
+
+
 		END Emit;
 
 		(** emit an ARM instruction with no operand **)
@@ -1585,7 +1585,7 @@ TYPE
 		*)
 		PROCEDURE EmitFixupBlockIfNeeded;
 		BEGIN
-			IF out.pc >= listOfReferences.due THEN 
+			IF out.pc >= listOfReferences.due THEN
 				listOfReferences.due := MAX(LONGINT);
 				Emit1(opB, InstructionSet.NewImmediate(4 + listOfReferences.size - 8 )); (* emit branch instruction that skips the fixup block *)
 				EmitFixupBlock; (* emit the fixup block *)
@@ -1982,7 +1982,7 @@ TYPE
 			Basic.Align(allocationSize, 4); (* 4 byte alignment *)
 			AllocateStack(allocationSize, TRUE, backend.initLocals);
 			(* allocate space on stack for register spills *)
-			spillStackStart := -stackSize; 
+			spillStackStart := -stackSize;
 			IF spillStack.MaxSize() > 0 THEN AllocateStack(spillStack.MaxSize(), TRUE, FALSE) END
 		END EmitEnter;
 
@@ -2206,7 +2206,7 @@ TYPE
 
 		PROCEDURE EmitMul(VAR irInstruction: IntermediateCode.Instruction);
 		VAR
-			destination, left, right: ARRAY 2 OF Operand; inst: IntermediateCode.Instruction; 
+			destination, left, right: ARRAY 2 OF Operand; inst: IntermediateCode.Instruction;
 			value: HUGEINT;exp: LONGINT; op3:IntermediateCode.Operand;
 			temp: Operand;
 		BEGIN
@@ -2217,7 +2217,7 @@ TYPE
 				RETURN;
 			END;
 
-		
+
 			IF IsSinglePrecisionFloat(irInstruction.op1) THEN
 				ASSERT(backend.useFPU32);
 				PrepareDoubleSourceOp(irInstruction, Low, destination[Low], left[Low], right[Low]);
@@ -2229,11 +2229,11 @@ TYPE
 				Emit3(opFMULD, destination[Low], left[Low], right[Low]);
 				WriteBack(irInstruction.op1, Low, destination[Low])
 			ELSIF IsInteger(irInstruction.op1) THEN
-				IF IsComplex(irInstruction.op1) THEN					
+				IF IsComplex(irInstruction.op1) THEN
 					PrepareDoubleSourceOp(irInstruction, Low, destination[Low], left[Low], right[Low]);
 					PrepareDoubleSourceOp(irInstruction, High, destination[High], left[High], right[High]);
 					temp := GetFreeRegister(IntermediateCode.UnsignedIntegerType(32));
-					Emit3(opMUL, temp, left[Low], right[High]); 
+					Emit3(opMUL, temp, left[Low], right[High]);
 					Emit4(opMLA, temp, left[High], right[Low], temp);
 					Emit4(opUMULL, destination[Low], destination[High], left[Low], right[Low]); (* signed long multiplication *)
 					Emit3(opADD, destination[High], destination[High],temp);
@@ -2254,7 +2254,7 @@ TYPE
 
 		PROCEDURE EmitDiv(VAR irInstruction: IntermediateCode.Instruction);
 		VAR
-			destination, left, right, float, leftd, rightd, fpstatus: Operand; 
+			destination, left, right, float, leftd, rightd, fpstatus: Operand;
 			value: HUGEINT; exp: LONGINT; op3: IntermediateCode.Operand;
 			inst: IntermediateCode.Instruction;
 		BEGIN
@@ -2265,7 +2265,7 @@ TYPE
 				RETURN;
 			END;
 
-		
+
 			IF IsSinglePrecisionFloat(irInstruction.op1) THEN
 				ASSERT(backend.useFPU32);
 				PrepareDoubleSourceOp(irInstruction, Low, destination, left, right);
@@ -2440,7 +2440,7 @@ TYPE
 			ELSE
 				shiftAmountImmediate := 0;
 				shiftAmountRegister := RegisterFromIrOperand(irShiftOperand, Low, emptyOperand);
-				IF ~IsComplex(irShiftOperand) THEN 
+				IF ~IsComplex(irShiftOperand) THEN
 					ZeroExtendOperand(shiftAmountRegister, irShiftOperand.type.sizeInBits)
 				END;
 			END;
@@ -2478,8 +2478,8 @@ TYPE
 					ELSIF irInstruction.op1.type.sizeInBits = 16 THEN
 						(* simple 16 bit rotation: *)
 						ZeroExtendOperand(source[Low], 16);
-						IF IsSameRegister(destination[Low], source[Low]) THEN 
-							temp := GetFreeRegister(IntermediateCode.UnsignedIntegerType(32)) ELSE temp := destination[Low] 
+						IF IsSameRegister(destination[Low], source[Low]) THEN
+							temp := GetFreeRegister(IntermediateCode.UnsignedIntegerType(32)) ELSE temp := destination[Low]
 						END;
 						Emit2(opMOV, temp, InstructionSet.NewRegister(source[Low].register, InstructionSet.shiftROR, shiftAmountRegister.register, shiftAmountImmediate));
 						Emit3(opORR, destination[Low], temp, InstructionSet.NewRegister(temp.register, InstructionSet.shiftLSR, None, 16))
@@ -2571,7 +2571,7 @@ TYPE
 							Emit3(opORR, destination[Low], temp, InstructionSet.NewRegister(source[Low].register, InstructionSet.shiftLSR, None, shiftAmountImmediate));
 							Emit2(opMOV, destination[High], InstructionSet.NewRegister(source[High].register, shiftMode, None, shiftAmountImmediate))
 						ELSIF shiftAmountImmediate >= 32 THEN
-							ASSERT(shiftAmountImmediate < 64); 
+							ASSERT(shiftAmountImmediate < 64);
 							Emit2(opMOV, destination[Low], InstructionSet.NewRegister(source[High].register, shiftMode, None, shiftAmountImmediate - 32));
 							IF  irInstruction.op1.type.form = IntermediateCode.UnsignedInteger THEN
 								Emit2(opMOV, destination[High], InstructionSet.NewImmediate(0))
@@ -2816,7 +2816,7 @@ TYPE
 			fixupPatternList: ObjectFile.FixupPatterns;
 			identifier: ObjectFile.Identifier;
 			hiHit, hiFail, lowHit: LONGINT;
-			unsigned: BOOLEAN; 
+			unsigned: BOOLEAN;
 
 			PROCEDURE JmpDest(branchConditionCode: LONGINT);
 			BEGIN
@@ -2911,41 +2911,41 @@ TYPE
 							left[Low] := RegisterFromIrOperand(irLeft, Low, left[High]);
 							right[Low] := RegisterOrImmediateFromIrOperand(irRight, Low, right[High]);
 							Emit2WithCondition(opCMP, left[Low], right[Low], lowHit);
-							
+
 							IF irInstruction.opcode = IntermediateCode.brne THEN lowHit := InstructionSet.conditionNE END;
 
 						| IntermediateCode.brlt, IntermediateCode.brge: (* left < right, left >= right *)
 							CASE irInstruction.opcode OF
 							IntermediateCode.brge:
 								IF isSwapped THEN
-									IF unsigned THEN 
-										hiHit := InstructionSet.conditionLO; hiFail := InstructionSet.conditionHI; 
+									IF unsigned THEN
+										hiHit := InstructionSet.conditionLO; hiFail := InstructionSet.conditionHI;
 									ELSE
-										hiHit := InstructionSet.conditionLT; hiFail := InstructionSet.conditionGT; 
+										hiHit := InstructionSet.conditionLT; hiFail := InstructionSet.conditionGT;
 									END;
 									lowHit := InstructionSet.conditionLS
 								ELSE
-									IF unsigned THEN 
-										hiHit := InstructionSet.conditionHI; hiFail := InstructionSet.conditionLO; 
+									IF unsigned THEN
+										hiHit := InstructionSet.conditionHI; hiFail := InstructionSet.conditionLO;
 									ELSE
-										hiHit := InstructionSet.conditionGT; hiFail := InstructionSet.conditionLT; 
+										hiHit := InstructionSet.conditionGT; hiFail := InstructionSet.conditionLT;
 									END;
 									lowHit := InstructionSet.conditionHS
-									
+
 								END;
 							|IntermediateCode.brlt:
 								IF isSwapped THEN
-									IF unsigned THEN 
-										hiHit := InstructionSet.conditionHI; hiFail := InstructionSet.conditionLO; 
+									IF unsigned THEN
+										hiHit := InstructionSet.conditionHI; hiFail := InstructionSet.conditionLO;
 									ELSE
-										hiHit := InstructionSet.conditionGT; hiFail := InstructionSet.conditionLT; 
-									END; 
+										hiHit := InstructionSet.conditionGT; hiFail := InstructionSet.conditionLT;
+									END;
 									lowHit := InstructionSet.conditionHI
 								ELSE
-									IF unsigned THEN 
-										hiHit := InstructionSet.conditionLO; hiFail := InstructionSet.conditionHI; 
+									IF unsigned THEN
+										hiHit := InstructionSet.conditionLO; hiFail := InstructionSet.conditionHI;
 									ELSE
-										hiHit := InstructionSet.conditionLT; hiFail := InstructionSet.conditionGT; 
+										hiHit := InstructionSet.conditionLT; hiFail := InstructionSet.conditionGT;
 									END;
 									lowHit := InstructionSet.conditionLO
 								END;
@@ -3108,14 +3108,14 @@ TYPE
 			Emit3(opORR, fpstatus, fpstatus, InstructionSet.NewImmediate(0x800000));
 			Emit2(InstructionSet.opVMSR, fpscr, fpstatus);
 		END RoundDown;
-		
+
 		PROCEDURE ResetRounding(VAR fpstatus: Operand);
 		BEGIN
 			(* reset rounding mode *)
 			Emit3(opBIC, fpstatus, fpstatus, InstructionSet.NewImmediate(0x800000));
 			Emit2(InstructionSet.opVMSR, fpscr, fpstatus);
 		END ResetRounding;
-		
+
 
 		PROCEDURE EmitConv(VAR irInstruction: IntermediateCode.Instruction);
 		VAR
@@ -3123,8 +3123,8 @@ TYPE
 			destination, source: ARRAY 2 OF Operand;
 			temp, fpstatus: Operand;
 			partType: IntermediateCode.Type;
-			
-			
+
+
 		BEGIN
 			irDestination := irInstruction.op1; irSource := irInstruction.op2;
 
@@ -3174,7 +3174,7 @@ TYPE
 						ASSERT(backend.useFPU32);
 						(* single precision float to non-complex integer: *)
 						temp := GetFreeRegister(IntermediateCode.FloatType(32));
-						
+
 						RoundDown(fpstatus);
 						IF irDestination.type.form = IntermediateCode.UnsignedInteger THEN
 							(* single precision float to non-complex unsigned integer: *)
@@ -3252,7 +3252,7 @@ TYPE
 			 	ELSE
 			 		(* anything else to single precision float: *)
 			 		HALT(200)
-			 	END				
+			 	END
 			ELSE
 				(* to anything else: *)
 				HALT(200)
@@ -3273,10 +3273,10 @@ TYPE
 				ELSE HALT(200)
 				END
 			ELSIF type.form = IntermediateCode.Float THEN
-				IF (type.sizeInBits = 32) THEN 
+				IF (type.sizeInBits = 32) THEN
 					IF backend.useFPU32 THEN
 						result := opRESFS
-					ELSE 
+					ELSE
 						result := opRES
 					END;
 				ELSE
@@ -3339,7 +3339,7 @@ TYPE
 				Emit3WithCondition(opSTREX, tempReg, comparatorReg, addressReg, InstructionSet.conditionEQ);
 				Emit2WithCondition(opCMP, tempReg, InstructionSet.NewImmediate(1), InstructionSet.conditionEQ);
 				Emit1WithCondition(opB, InstructionSet.NewImmediate (-24), InstructionSet.conditionEQ);
-			END;	
+			END;
 		END EmitCas;
 
 		(* possible optimization: use a combination of LDR and LDRB (would be 4x faster on average) *)
@@ -3668,7 +3668,7 @@ TYPE
 			BEGIN
 				IF (fixup.symbol.name # "") & (fixup.resolved = NIL) THEN fixup.resolved := module.allSections.FindByName(fixup.symbol.name) END;
 			END Resolve;
-			
+
 		 	(* recompute fixup positions and assign binary sections *)
 		 	PROCEDURE PatchFixups(section: BinaryCode.Section);
 			VAR resolved: BinaryCode.Section; fixup: BinaryCode.Fixup; symbolOffset, offsetWithinSection: LONGINT; in: IntermediateCode.Section;
@@ -3850,7 +3850,7 @@ TYPE
 VAR
 	emptyOperand: Operand;
 	rFixupPattern: ObjectFile.FixupPatterns; (* pattern for an absolute 32-bit fixup *)
-	
+
 	PROCEDURE Assert(condition: BOOLEAN; CONST message: ARRAY OF CHAR);
 	BEGIN ASSERT(condition, 100)
 	END Assert;
@@ -3884,7 +3884,7 @@ VAR
 
 	(** initialize the module **)
 	PROCEDURE Init;
-	BEGIN 
+	BEGIN
 		InstructionSet.InitOperand(emptyOperand);
 		NEW(rFixupPattern, 1);
 		rFixupPattern[0].offset := 0;

+ 21 - 21
source/FoxARMInstructionSet.Mod

@@ -124,7 +124,7 @@ CONST
 	opVSUB* = 157;
 	opVABS* = 158;
 	opVABD* = 159;
-	
+
 	(* Usual shifts *)
 	opLSL* = 160;
 	opLSR* = 161;
@@ -134,7 +134,7 @@ CONST
 	opVST1* = 163;
 	opVPADD* = 164;
 	opVMOV* = 165;
-	
+
 	(* Non NEON Instructions *)
 	opSEV* = 166;
 	opDSB* = 167;
@@ -150,7 +150,7 @@ CONST
 	opUXTH* = 177;
 	opWFE* = 178;
 	opWFI* = 179;
-	
+
 	opMOVW* = 180;
 
 	NumberMnemonics*= 181;
@@ -176,7 +176,7 @@ CONST
 
 	(* Flags not used *)
 	flagCondition*= 23; flagUserMode*= 24;
-	flagBaseRegisterUpdate*= 25;	
+	flagBaseRegisterUpdate*= 25;
 
 	NumberInstructions= NumberMnemonics + 19;
 
@@ -213,7 +213,7 @@ CONST
 	encodingNEONQorDd = 44; encodingNEONQorDn = 45; encodingNEONQorDm = 46;
 	encodingNEONDorSd = 47; encodingNEONDorSn = 48; encodingNEONDorSm = 49;
 	encodingNEONDRegList = 50; encodingNEONSysReg = 51; encodingNEONSigned8bitImm = 52;
-	
+
 	encodingImm7to11 = 53;
 	encodingImm12a0imm4a16 = 54; (* immediate encoded 19...16, 11..0 *)
 
@@ -272,7 +272,7 @@ CONST
 	(* Continue at 82 to skip CPSR and SPSR *)
 	SR16*= 82; SR17*= SR0+17; SR18*= SR0+18; SR19*= SR0+19; SR20*= SR0+20; SR21*= SR0+21; SR22*= SR0+22; SR23*= SR0+23;
 	SR24*= SR0+24; SR25*= SR0+25; SR26*= SR0+26; SR27*= SR0+27; SR28*= SR0+28; SR29*= SR0+29; SR30*= SR0+30; SR31*= SR0+31;
-	
+
 	(* NEON SIMD quadword registers *)
 	QR0* = 98; QR1* = QR0 + 1; QR2* = QR0 + 2;QR3* = QR0 + 3; QR4* = QR0 + 4; QR5* = QR0 + 5; QR6* = QR0 + 6;
 	QR7* = QR0 + 7; QR8* = QR0 + 8; QR9* = QR0 + 9; QR10* = QR0 + 10; QR11* = QR0 + 11; QR12* = QR0 + 12;
@@ -493,7 +493,7 @@ CONST
 			InitOperand(instruction.operands[i]);
 		END;
 	END InitInstruction;
-	
+
 	(* generate immediate operand with fixup *)
 	PROCEDURE InitFixup*(VAR operand: Operand; bits: SHORTINT; fixup: BinaryCode.Fixup (*symbol: Sections.Section; offset, displacement: LONGINT *));
 	BEGIN
@@ -969,13 +969,13 @@ CONST
 		VAR
 			imm, rot, firstRegister, num, shiftMode, shiftImmediate: LONGINT;
 			NEONRegisterPos: ARRAY 5 OF INTEGER;
-			
+
 			PROCEDURE Fixup(from, to: LONGINT);
 			VAR patterns: ObjectFile.FixupPatterns; displacement: LONGINT; mode: SHORTINT;
 			BEGIN
 				NEW(patterns, 1);
 				patterns[0].offset := from; patterns[0].bits := to-from+1;
-				
+
 				(*ASSERT(format.mnemonic = opBL); currently only implemented for this case *)
 				(*
 				IF (opBL <= instructionFormat.mnemonic) & (instructionFormat.mnemonic <= opBF) THEN
@@ -987,7 +987,7 @@ CONST
 					mode := BinaryCode.Relative;
 					displacement := operand.fixup.displacement;
 				END;
-					
+
 				(*
 				ELSE
 					mode := BinaryCode.Absolute;
@@ -996,7 +996,7 @@ CONST
 				*)
 				operand.fixup.InitFixup(mode, 0, operand.fixup.symbol, operand.fixup.symbolOffset, displacement, -2, patterns);
 			END Fixup;
-			
+
 		BEGIN
 			CASE operandEncoding OF
 				|None: error :=  operand.mode # None;
@@ -1420,13 +1420,13 @@ CONST
 						D.String("Register list too long");
 						error := TRUE
 					END
-				
+
 				|encodingNEONSysReg:
 					IF operand.mode # modeRegister THEN error := TRUE
 					ELSIF operand.shiftMode # None THEN error := TRUE
 					ELSIF (operand.register < FPSID) & (operand.register > FPEXC) THEN error := TRUE
 					END;
-					
+
 					CASE operand.register OF
 						(* FPSID - 0b0; FPSCR - 0b1; FPEXC - 0b1000 at bits 19:16 *)
 						 FPSCR: INCL(codeSet, 16)
@@ -1465,12 +1465,12 @@ CONST
 					codeSet := codeSet + format.Unsigned
 				END
 			END;
-			
+
 			(* Set the Float bit *)
 			IF flagNEONFloat IN instruction.flags THEN
 				codeSet := codeSet + format.Float
 			END;
-			
+
 			(* Set the Q bit *)
 			FOR i := 0 TO MaxOperands - 1 DO
 				CASE format.operands[i] OF
@@ -1832,7 +1832,7 @@ CONST
 	VAR
 		encoding: LONGINT;
 		(*decoded: Instruction;*)
-		
+
 		PROCEDURE PatchFixup(op: Operand);
 		BEGIN
 			IF op.fixup # NIL THEN
@@ -1845,7 +1845,7 @@ CONST
 		VAR i: LONGINT;
 		BEGIN
 			FOR i := 0 TO LEN(instruction.operands)-1 DO
-				PatchFixup(instruction.operands[i]);				
+				PatchFixup(instruction.operands[i]);
 			END;
 		END PatchFixups;
 
@@ -1857,7 +1857,7 @@ CONST
 		END;
 		IF ~Encode(instruction, encoding) THEN RETURN FALSE END;
 		PatchFixups();
-		
+
 		(*
 		IF (code.comments # NIL) THEN
 			IF ~Decode(encoding, decoded) THEN HALT(100) END;
@@ -1988,7 +1988,7 @@ CONST
 			END;
 			(* Only allow 32 elements wide formats *)
 			ASSERT(count = 32);
-			
+
 			(* DEBUG *)
 			(*D.String("Parsing results:"); D.Ln;
 			D.String("    "); D.String(format); D.Ln;
@@ -2599,7 +2599,7 @@ CONST
 		EnterInstruction(opTST, {20, 24}, {20..24, 26, 27}, {flagCondition}, encodingR16, encodingAddressingMode1, None, None, None, None);
 		EnterInstruction(opUMLAL, {4, 7, 21, 23}, {4..7, 21..27}, {flagCondition, flagS}, encodingR12, encodingR16, encodingR0, encodingR8, None, None);
 		EnterInstruction(opUMULL, {4, 7, 23}, {4..7, 21..27}, {flagCondition, flagS}, encodingR12, encodingR16, encodingR0, encodingR8, None, None);
-		
+
 		EnterNEONInstruction(opMOVW,	"XXXX 0011 0000 XXXX XXXX XXXX XXXX XXXX",{flagCondition}, encodingR12, encodingImm12a0imm4a16, None, None, None, None);
 		EnterNEONInstruction(opLDM, 	"XXXX 100X X101 XXXX 0XXX XXXX XXXX XXXX", {flagCondition, flagIA, flagDA, flagIB, flagDB, flagUserMode}, encodingR16, encodingRegisterList, None, None, None, None);
 		EnterNEONInstruction(opSTM, 	"XXXX 100X X100 XXXX XXXX XXXX XXXX XXXX", {flagCondition, flagIA, flagDA, flagIB, flagDB, flagUserMode}, encodingR16, encodingRegisterList, None, None, None, None);
@@ -2880,7 +2880,7 @@ CONST
 						(* LDR? ..., [PC, #...] or STR? ..., [PC, #...] *)
 						ASSERT(instruction.operands[1].mode = modeMemory);
 						IF (instruction.operands[1].register = PC) & (instruction.operands[1].offsetRegister = None) THEN
-							IF Decrement IN instruction.operands[1].indexing THEN 
+							IF Decrement IN instruction.operands[1].indexing THEN
 								value := -instruction.operands[1].offsetImmediate + adr + 8;
 							ELSE
 								value := instruction.operands[1].offsetImmediate + adr + 8;

+ 2 - 2
source/FoxActiveCells.Mod

@@ -1673,13 +1673,13 @@ TYPE
 		END;
 		IF name[i] # 0X THEN RETURN NIL ELSE RETURN symbol END;
 	END GetSymbol;
-	
+
 	PROCEDURE Clone*(symbol: Symbol): Symbol;
 	BEGIN
 		RETURN symbol;
 		(* does nothing -- for compatibility with ActiveCells2 *)
 	END Clone;
-	
+
 
 	PROCEDURE FlattenNetwork*(scope: Scope);
 	VAR instance,subInstance,newInstance: Instance; oldChannel,channel: Channel;

ファイルの差分が大きいため隠しています
+ 148 - 148
source/FoxArrayBase.Mod


+ 1 - 1
source/FoxAssembler.Mod

@@ -118,7 +118,7 @@ TYPE
 	Result*= RECORD
 		type*: INTEGER; (* ConstantInteger, ConstantFloat, Fixup, Offset *)
 		sizeInBits*: INTEGER;
-		value*: HUGEINT; 
+		value*: HUGEINT;
 		valueR*: LONGREAL;
 		fixup*: BinaryCode.Fixup;
 	END;

+ 4 - 4
source/FoxBackend.Mod

@@ -51,7 +51,7 @@ TYPE
 		BEGIN
 			SELF.capabilities := capabilities;
 		END SetCapabilities;
-		
+
 		PROCEDURE SetHasLinkRegister*;
 		BEGIN
 			hasLinkRegister := TRUE;
@@ -77,7 +77,7 @@ TYPE
 			SELF.checker := checker;
 			SELF.system := system;
 		END Initialize;
-		
+
 		PROCEDURE SetName*(CONST name: ARRAY OF CHAR);
 		BEGIN
 			COPY(name, SELF.name);
@@ -88,7 +88,7 @@ TYPE
 		BEGIN
 			RETURN Global.DefaultSystem();
 		END GetSystem;
-		
+
 
 
 		PROCEDURE Error*(CONST source: ARRAY OF CHAR; position: Basic.Position; errorNumber: LONGINT; CONST err: ARRAY OF CHAR);
@@ -125,7 +125,7 @@ TYPE
 		PROCEDURE GetDescription*(VAR instructionSet: ARRAY OF CHAR);
 		BEGIN instructionSet := "undefined";
 		END GetDescription;
-		
+
 		PROCEDURE CanPassInRegister*(type: SyntaxTree.Type): BOOLEAN;
 		BEGIN RETURN FALSE
 		END CanPassInRegister;

+ 19 - 19
source/FoxBasic.Mod

@@ -49,12 +49,12 @@ TYPE
 	ErrorMsgs = POINTER TO ARRAY OF StringPool.Index;
 
 	ComparisonFunction = PROCEDURE {DELEGATE} (object1, object2: ANY): BOOLEAN;
-	
+
 	Position*= RECORD
 		start*, end*, line*, linepos*: LONGINT;
 		reader*: Streams.Reader;
 	END;
-	
+
 	ErrorCode*=LONGINT;
 
 	Fingerprint* = ObjectFile.Fingerprint;
@@ -585,27 +585,27 @@ TYPE
 	VAR
 		table: HashIntArray;
 		count : LONGINT;
-		
+
 		PROCEDURE & Init(t: HashIntArray);
 		BEGIN
 			table := t;
 			count := -1;
 		END Init;
-		
+
 		PROCEDURE GetNext*(VAR key: LONGINT; VAR value: ANY): BOOLEAN;
 		BEGIN
 			REPEAT
 				INC(count);
 			UNTIL (count = LEN(table)) OR (table[count].value # NIL);
-			IF count = LEN(table) THEN 
+			IF count = LEN(table) THEN
 				RETURN FALSE
 			END;
 			key := table[count].key;
 			value := table[count].value;
 			RETURN TRUE;
 		END GetNext;
-		
-		
+
+
 	END IntIterator;
 
 	HashTableInt* = OBJECT
@@ -717,7 +717,7 @@ TYPE
 			NEW(iterator, table);
 			RETURN iterator;
 		END GetIterator;
-		
+
 	END HashTableInt;
 
 	HashEntrySegmentedName = RECORD
@@ -1727,13 +1727,13 @@ VAR
 	PROCEDURE AppendPosition*(VAR msg: ARRAY OF CHAR; pos: Position);
 	BEGIN
 		IF pos.line >= 0 THEN
-			Strings.Append(msg, " in line "); 
-			Strings.AppendInt(msg, pos.line); 
-			Strings.Append(msg, ", col "); 
+			Strings.Append(msg, " in line ");
+			Strings.AppendInt(msg, pos.line);
+			Strings.Append(msg, ", col ");
 			Strings.AppendInt(msg, pos.start- pos.linepos);
 		END;
 	END AppendPosition;
-	
+
 	PROCEDURE MakeMessage(pos: Position; code: ErrorCode; CONST msg: ARRAY OF CHAR; VAR message: ARRAY OF CHAR);
 	BEGIN
 		MakeDetailedMessage(pos, code, msg, NIL, message);
@@ -1778,8 +1778,8 @@ VAR
 	BEGIN
 		ErrorC(diagnostics, source, pos, InvalidCode, msg);
 	END Error;
-	
-	
+
+
 
 	PROCEDURE Warning*(diagnostics: Diagnostics.Diagnostics; CONST source: ARRAY OF CHAR; pos: Position; CONST msg: ARRAY OF CHAR);
 	VAR message: ARRAY 256 OF CHAR;
@@ -1930,7 +1930,7 @@ VAR
 		END;
 		END;
 	END RemoveSuffix;
-	
+
 	PROCEDURE GetSuffix*(CONST name: SegmentedName; VAR string: ARRAY OF CHAR);
 	VAR i,pos,pos0: LONGINT;
 	BEGIN
@@ -1948,7 +1948,7 @@ VAR
 			END;
 			IF pos # 0 THEN (* no dot in name or name starts with dot *)
 				pos0 := 0;
-				REPEAT 
+				REPEAT
 					INC(pos); (* start with character after "." *)
 					string[pos0] := string[pos];
 					INC(pos0);
@@ -2126,14 +2126,14 @@ VAR
 		ELSE NEW(diagnostics,w); RETURN diagnostics
 		END;
 	END GetDiagnostics;
-	
+
 	PROCEDURE GetDefaultDiagnostics*(): Diagnostics.Diagnostics;
 	VAR w: Streams.Writer;
 	BEGIN
 		NEW(w, KernelLog.Send,128);
 		RETURN GetDiagnostics(w);
 	END GetDefaultDiagnostics;
-	
+
 
 	PROCEDURE InitWindowWriter;
 	VAR install: PROCEDURE;
@@ -2161,7 +2161,7 @@ VAR
 			Strings.Insert(by, in, pos);
 		END;
 	END Replace;
-	
+
 	OPERATOR "="*(CONST left: ARRAY OF CHAR; right: String): BOOLEAN;
 	BEGIN
 		RETURN right = StringPool.GetIndex1(left);

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません