Explorar o código

Unified whitespace

git-svn-id: https://svn-dept.inf.ethz.ch/svn/lecturers/a2/trunk@8732 8c9fc860-2736-0410-a75d-ab315db34111
negelef %!s(int64=6) %!d(string=hai) anos
pai
achega
72406ae9e0
Modificáronse 53 ficheiros con 904 adicións e 1571 borrados
  1. 1 3
      source/FoxA2Interface.Mod
  2. 6 26
      source/FoxAMD64Assembler.Mod
  3. 17 31
      source/FoxAMD64InstructionSet.Mod
  4. 79 92
      source/FoxAMDBackend.Mod
  5. 0 2
      source/FoxARMAssembler.Mod
  6. 76 92
      source/FoxARMBackend.Mod
  7. 129 137
      source/FoxARMInstructionSet.Mod
  8. 55 72
      source/FoxActiveCells.Mod
  9. 101 128
      source/FoxArrayBase.Mod
  10. 38 42
      source/FoxAssembler.Mod
  11. 1 4
      source/FoxBackend.Mod
  12. 20 28
      source/FoxBasic.Mod
  13. 22 30
      source/FoxBinaryCode.Mod
  14. 0 3
      source/FoxCSharpParser.Mod
  15. 1 1
      source/FoxCSharpScanner.Mod
  16. 3 12
      source/FoxCodeGenerators.Mod
  17. 3 10
      source/FoxDisassembler.Mod
  18. 1 16
      source/FoxDocumentationBackend.Mod
  19. 7 10
      source/FoxDocumentationHtml.Mod
  20. 1 2
      source/FoxDocumentationParser.Mod
  21. 0 3
      source/FoxDocumentationScanner.Mod
  22. 1 8
      source/FoxDocumentationTree.Mod
  23. 16 23
      source/FoxFingerprinter.Mod
  24. 1 1
      source/FoxFormats.Mod
  25. 6 12
      source/FoxGenericObjectFile.Mod
  26. 0 15
      source/FoxGlobal.Mod
  27. 0 3
      source/FoxInterfaceComparison.Mod
  28. 0 7
      source/FoxIntermediateAssembler.Mod
  29. 51 166
      source/FoxIntermediateBackend.Mod
  30. 6 20
      source/FoxIntermediateCode.Mod
  31. 4 23
      source/FoxIntermediateLinker.Mod
  32. 0 2
      source/FoxIntermediateObjectFile.Mod
  33. 1 2
      source/FoxIntermediateParser.Mod
  34. 3 14
      source/FoxInterpreter.Mod
  35. 2 3
      source/FoxInterpreterBackend.Mod
  36. 5 22
      source/FoxInterpreterSymbols.Mod
  37. 10 17
      source/FoxMinosObjectFile.Mod
  38. 0 2
      source/FoxOberonFrontend.Mod
  39. 31 37
      source/FoxParser.Mod
  40. 9 17
      source/FoxPrintout.Mod
  41. 1 4
      source/FoxProfiler.Mod
  42. 3 22
      source/FoxProgTools.Mod
  43. 29 37
      source/FoxScanner.Mod
  44. 2 5
      source/FoxSections.Mod
  45. 47 120
      source/FoxSemanticChecker.Mod
  46. 28 66
      source/FoxSyntaxTree.Mod
  47. 1 9
      source/FoxTRMAssembler.Mod
  48. 53 75
      source/FoxTRMBackend.Mod
  49. 23 52
      source/FoxTRMInstructionSet.Mod
  50. 0 26
      source/FoxTRMTools.Mod
  51. 2 3
      source/FoxTest.Mod
  52. 0 4
      source/FoxTextualSymbolFile.Mod
  53. 8 10
      source/FoxTranspilerBackend.Mod

+ 1 - 3
source/FoxA2Interface.Mod

@@ -101,7 +101,6 @@ TYPE
 
 	END StreamDiagnostics;
 
-
 	PROCEDURE Print (w: Streams.Writer; CONST source : ARRAY OF CHAR; position: Streams.Position; type: WORD; CONST message: ARRAY OF CHAR);
 	VAR attributes: Texts.Attributes;
 	BEGIN
@@ -160,5 +159,4 @@ TYPE
 
 END FoxA2Interface.
 
-FSTools.DeleteFiles FoxA2Interface.Obw ~~
-
+FSTools.DeleteFiles FoxA2Interface.Obw ~

+ 6 - 26
source/FoxAMD64Assembler.Mod

@@ -48,7 +48,6 @@ CONST
 	segFS = 4;
 	segGS = 5;
 
-
 	(* sizes *)
 	bitsDefault* = 0;
 	bits8* = 1;
@@ -91,7 +90,6 @@ CONST
 	pntr1616*= InstructionSet.pntr1616;
 	pntr1632*=InstructionSet.pntr1632;
 
-
 	(* scanner codes *)
 	TAB = 09X;
 	LF = 0AX;
@@ -285,7 +283,6 @@ TYPE
 			code.fixupList.AddFixup(fixup);
 		END AddFixup;
 
-
 		PROCEDURE EmitInstruction (mnem: LONGINT; VAR operands: ARRAY OF Operand; lastPass: BOOLEAN): BOOLEAN;
 		VAR instr, i, oppos, op: LONGINT;
 			val: LONGINT;
@@ -409,7 +406,6 @@ TYPE
 				RETURN (c1 = CHR(opCode)) & ((c2 = 0F2X) OR (c2 = 0F3X) ) ;
 			END IsPreREXPrefix;
 
-
 		BEGIN
 			IF (dump # NIL) & (lastPass) THEN
 				pc0 := code.pc;
@@ -516,7 +512,7 @@ TYPE
 								(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;
@@ -562,7 +558,6 @@ TYPE
 			IF InstructionSet.optPREP IN bitwidthOptions THEN code.PutByte (InstructionSet.prfREP) END;
 			IF InstructionSet.optPREPN IN bitwidthOptions THEN code.PutByte (InstructionSet.prfREPNE) END;
 
-
 			op := 0;
 
 			oppos := 0;
@@ -582,7 +577,6 @@ TYPE
 				code.PutByte (byte);
 			END;
 
-
 			WHILE (oppos < LEN(opcode)) & (opcode[oppos] # CHR(none)) DO
 
 				IF opcode[oppos] = CHR(opCode) THEN
@@ -703,7 +697,7 @@ TYPE
 									END;
 								*)
 								IF lastPass & (operands[addressOperand].symbol.name # "") THEN
-									 AddFixup(BinaryCode.Absolute,4,code.pc,operands[addressOperand].symbol, operands[addressOperand].symbolOffset,operands[addressOperand].displacement)
+									AddFixup(BinaryCode.Absolute,4,code.pc,operands[addressOperand].symbol, operands[addressOperand].symbolOffset,operands[addressOperand].displacement)
 								END;
 								code.PutDWord (operands[addressOperand].displacement);
 							ELSE
@@ -949,7 +943,7 @@ TYPE
 							IF (free[i]) & InstructionSet.IsImmediate64(InstructionSet.instructions[instr].operands[i])  THEN
 								operands[i].pc := code.pc;
 								IF lastPass & (operands[i].symbol.name # "") THEN
-									 AddFixup(BinaryCode.Absolute,8,code.pc,operands[i].symbol,operands[i].symbolOffset,operands[i].displacement)
+									AddFixup(BinaryCode.Absolute,8,code.pc,operands[i].symbol,operands[i].symbolOffset,operands[i].displacement)
 								END;
 								code.PutQWord (operands[i].val);
 								free[i] := FALSE; i:= maxNumberOperands;
@@ -979,7 +973,7 @@ TYPE
 									code.PutWord (operands[i].displacement);
 								ELSE
 									IF lastPass & (operands[i].symbol.name # "") THEN
-										 AddFixup(BinaryCode.Absolute,4,code.pc,operands[i].symbol,operands[i].symbolOffset,operands[i].displacement)
+										AddFixup(BinaryCode.Absolute,4,code.pc,operands[i].symbol,operands[i].symbolOffset,operands[i].displacement)
 									END;
 									code.PutDWord (operands[i].displacement);
 								END;
@@ -1175,7 +1169,6 @@ TYPE
 			Error(message);
 		END ErrorSS;
 
-
 		PROCEDURE Assemble* (reader: Streams.Reader;  orgPos: Basic.Position; scope: SyntaxTree.Scope; in: IntermediateCode.Section; out: IntermediateCode.Section; module: Sections.Module; exported, inlined: BOOLEAN;
 			map: RegisterMap
 		);
@@ -1277,7 +1270,6 @@ TYPE
 				SkipBlanks;
 				errPos := position;
 
-
 				CASE char OF
 				'A' .. 'Z', 'a' .. 'z', '_' :
 					GetIdentifier;
@@ -1367,7 +1359,6 @@ TYPE
 				END;
 			END Ensure;
 
-
 			PROCEDURE GetCPU (cumulateOptions: BOOLEAN): BOOLEAN;
 			VAR i: LONGINT;
 			BEGIN
@@ -1391,7 +1382,6 @@ TYPE
 
 			END GetCPU;
 
-
 			PROCEDURE Factor (VAR x: HUGEINT; critical: BOOLEAN; VAR type: SHORTINT): BOOLEAN;
 			VAR label: NamedLabel; l: LONGINT;
 			BEGIN
@@ -1518,7 +1508,6 @@ TYPE
 				END;
 			END Align;
 
-
 			PROCEDURE PutData (size: Size): BOOLEAN;
 			VAR i: SIZE; x: HUGEINT; type:SHORTINT; ofs: Operand;
 			BEGIN
@@ -1665,7 +1654,6 @@ TYPE
 				END;
 			END GetValue;
 
-
 			PROCEDURE GetMemFixup (CONST ident: ARRAY OF CHAR; VAR operand: Operand);
 			VAR scopeSymbol:SyntaxTree.Symbol;
 			BEGIN
@@ -1728,7 +1716,6 @@ TYPE
 			PROCEDURE AdaptOperandSizes(VAR operands: ARRAY OF Operand);
 			VAR i: LONGINT;
 
-
 				PROCEDURE OffsetSize(val: HUGEINT): SHORTINT;
 				BEGIN
 					DEC(val,emitter.code.pc);
@@ -1902,7 +1889,6 @@ TYPE
 							operands[opCount] := mem;
 							INC (opCount);
 
-
 							IF ~Ensure (symRBraket, 556) THEN
 								RETURN FALSE;
 							END;
@@ -1914,7 +1900,6 @@ TYPE
 								GetOffsetFixup (idents, offset);
 							END;
 
-
 							IF offset.symbol.name = "" THEN (* nothing could be fixuped, must be a number / constant *)
 								type := offset.type; currentFixup := ""; currentLabel := NIL;
 								IF ~Expression (offset.val, FALSE,type) THEN
@@ -2243,11 +2228,11 @@ TYPE
 	END IsRegisterOperand;
 
 	PROCEDURE IsMemoryOperand*(CONST op: Operand): BOOLEAN;
-	BEGIN 	RETURN op.type = mem
+	BEGIN RETURN op.type = mem
 	END IsMemoryOperand;
 
 	PROCEDURE IsImmediateOperand*(CONST op: Operand): BOOLEAN;
-	BEGIN 	RETURN op.type = imm
+	BEGIN RETURN op.type = imm
 	END IsImmediateOperand;
 
 	PROCEDURE DumpType*(w: Streams.Writer; type: LONGINT);
@@ -2323,7 +2308,6 @@ TYPE
 			HALT(100)
 		END;
 
-
 	END DumpOperand;
 
 	PROCEDURE DumpInstruction(w: Streams.Writer; mnemonic: LONGINT; CONST operands: ARRAY OF Operand);
@@ -2542,7 +2526,6 @@ TYPE
 	BEGIN RETURN SYSTEM.VAL (INTEGER, value) = value
 	END ValueInWordRange;
 
-
 	PROCEDURE InitOperand*(VAR operand: Operand);
 	BEGIN
 		operand.type := none;
@@ -2560,7 +2543,6 @@ TYPE
 		operand.offset := 0;
 	END InitOperand;
 
-
 	PROCEDURE InitRegister* (VAR operand: Operand; register: Register);
 	BEGIN
 		InitOperand(operand);
@@ -2758,7 +2740,6 @@ TYPE
 		RETURN FALSE
 	END SameOperand;
 
-
 	PROCEDURE Test*(context: Commands.Context);
 	VAR assembly: Emitter;
 		(*errorHandler: ErrorHandler; *)
@@ -2792,4 +2773,3 @@ TYPE
 	END FoxAMD64Assembler.
 
 OCAMD64Assembler.Test ~
-

+ 17 - 31
source/FoxAMD64InstructionSet.Mod

@@ -92,41 +92,40 @@ CONST
 	optPREP* = 9;		(* a repeat prefix must preceed the instruction *)
 	optPREPN* = 10;	(* a repeat prefix must preceed the instruction *)
 
-
 	(*
 		FoxProgTools.Enum -l=1 -e
 		(** operand types, numbers assigned to the types do not have a special meaning **)
 		(* register classes first *)
-		 reg8 reg16 reg32 reg64 CRn DRn segReg mmx xmm ymm sti
-		 (* other classes *)
-		 mem imm ioffset pntr1616 pntr1632
+		reg8 reg16 reg32 reg64 CRn DRn segReg mmx xmm ymm sti
+		(* other classes *)
+		mem imm ioffset pntr1616 pntr1632
 		(* special registers *)
-		 AL  AX  CL  CR8   CS   DS  DX  EAX  ECX  ES  FS  GS  RAX  SS rAX st0
-		 (* immediates and memory locations *)
-		 imm16  imm32  imm64  imm8
-		 uimm16  uimm32  uimm8
-		 simm16  simm32  simm8
+		AL  AX  CL  CR8   CS   DS  DX  EAX  ECX  ES  FS  GS  RAX  SS rAX st0
+		(* immediates and memory locations *)
+		imm16  imm32  imm64  imm8
+		uimm16  uimm32  uimm8
+		simm16  simm32  simm8
 		mem256
- 		mem128  mem16  mem32  mem64  mem8
-		 moffset16  moffset32  moffset64  moffset8
-		 rel16off  rel32off  rel8off
+		mem128  mem16  mem32  mem64  mem8
+		moffset16  moffset32  moffset64  moffset8
+		rel16off  rel32off  rel8off
 		(* ambivalent operand types *)
-		 reg3264
-		 regmem16  regmem32  regmem64  regmem8 reg32mem16
-		 mmxmem32  mmxmem64
-		 xmmmem256 xmmmem128  xmmmem32  xmmmem64
+		reg3264
+		regmem16  regmem32  regmem64  regmem8 reg32mem16
+		mmxmem32  mmxmem64
+		xmmmem256 xmmmem128  xmmmem32  xmmmem64
 		xmmmem8
 		xmmmem16
 		ymmmem128
 		ymmmem256
 		(* miscellaneous *)
-		 one three
+		one three
 		vm32x
 		vm32y
 		vm64x
 		vm64y
 		m2z;
-		 ~
+		~
 	*)
 	(** operand types, numbers assigned to the types do not have a special meaning **)
 	(* register classes first *)
@@ -230,7 +229,6 @@ CONST
 	prfREPNE* = 0F2H;
 	prfREPNZ* = 0F2H;
 
-
 	(* registers
 		FoxProgTools.Enum -e -l=8 -s=0
 		(** 8 bit general purpose registers **)
@@ -297,7 +295,6 @@ CONST
 		18			BH
 		19			DH
 
-
 		*)
 
 	(** register indices, the order is arbitrary and has no meaning for instruction encoding,
@@ -1343,7 +1340,6 @@ VAR
 	opVZEROALL*,
 	opVZEROUPPER*
 
-
 	: LONGINT
 
 	(*
@@ -1413,7 +1409,6 @@ VAR
 	cpus-: ARRAY maxCPUs OF CPUType;
 	cpuCount: LONGINT;
 
-
 	(* perform a binary search for the index of the specified mnemonic *)
 	PROCEDURE FindMnemonic* (CONST mnem: ARRAY OF CHAR): LONGINT;
 	VAR l, r, m: LONGINT;
@@ -1919,12 +1914,9 @@ VAR
 			INC(numberInstructions);
 		END AddInstructionV;
 
-
 		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
@@ -1947,14 +1939,12 @@ VAR
 			INC(numberInstructions);
 		END AddInstruction;
 
-
 	(* the following has partially been generated with
 		FoxProgTools.ParseAMDInstructionSet FoxInstructionSetAMD64TabSeperated.txt ~
 
 		Do not change or re-order. The alphabetical order is of importance
 	*)
 
-
 	BEGIN
 		numberMnemonics := 0;
 		numberInstructions := 0;
@@ -2970,7 +2960,6 @@ VAR
 		AddMnemonic(opXORPD, "XORPD");
 		AddMnemonic(opXORPS, "XORPS");
 
-
 		AddInstruction(opAAA, "", "37", {optNot64}, {cpu8086});
 		AddInstruction(opAAD, "", "D50A", {optNot64}, {cpu8086});
 		AddInstruction(opAAD, "", "D5ib", {optNot64}, {cpu8086});
@@ -4346,7 +4335,6 @@ VAR
 		AddInstruction(opXORPD, "xmm1,xmm2/mem128", "0F57/r", {optPOP}, {cpuSSE2});
 		AddInstruction(opXORPS, "xmm1,xmm2/mem128", "0F57/r", {}, {cpuSSE});
 
-
 		AddInstructionV(opVAESKEYGENASSIST,"xmm1,xmm2/mem128,imm8","C4 RXB.00011 X.src.0.01 DF /r ib");
 		AddInstructionV(opVPMADCSWD,"xmm1,xmm2,xmm3/mem128,xmm4","8F RXB.08 0.src1.0.00 B6 /r ib");
 		AddInstructionV(opVADDPD,"xmm1,xmm2,xmm3/mem128","C4 RXB.00001 X.src.0.01 58 /r");
@@ -5414,7 +5402,6 @@ VAR
 		END;
 	END Trace;
 
-
 BEGIN
 	InitInstructions;
 	InitRegisters;
@@ -5474,4 +5461,3 @@ System.Free FoxAMD64InstructionSet ~
 	END;
 
 	**)
-

+ 79 - 92
source/FoxAMDBackend.Mod

@@ -14,21 +14,21 @@ CONST
 
 	RAX=InstructionSet.regRAX; RCX=InstructionSet.regRCX; RDX=InstructionSet.regRDX; RBX=InstructionSet.regRBX;
 	RSP=InstructionSet.regRSP; RBP=InstructionSet.regRBP; RSI=InstructionSet.regRSI; RDI=InstructionSet.regRDI;
-	R8=InstructionSet.regR8; 	R9=InstructionSet.regR9; 	R10=InstructionSet.regR10; 	R11=InstructionSet.regR11;
-	R12=InstructionSet.regR12; 	R13=InstructionSet.regR13; 	R14=InstructionSet.regR14; 	R15=InstructionSet.regR15;
+	R8=InstructionSet.regR8; R9=InstructionSet.regR9; R10=InstructionSet.regR10; R11=InstructionSet.regR11;
+	R12=InstructionSet.regR12; R13=InstructionSet.regR13; R14=InstructionSet.regR14; R15=InstructionSet.regR15;
 	EAX=InstructionSet.regEAX; ECX=InstructionSet.regECX; EDX=InstructionSet.regEDX; EBX=InstructionSet.regEBX;
 	ESP=InstructionSet.regESP; EBP=InstructionSet.regEBP; ESI=InstructionSet.regESI; EDI=InstructionSet.regEDI;
-	R8D=InstructionSet.regR8D; 	R9D=InstructionSet.regR9D; 	R10D=InstructionSet.regR10D; 	R11D=InstructionSet.regR11D;
-	R12D=InstructionSet.regR12D; 	R13D=InstructionSet.regR13D; 	R14D=InstructionSet.regR14D; 	R15D=InstructionSet.regR15D;
-	AX=InstructionSet.regAX;	CX=InstructionSet.regCX;	DX=InstructionSet.regDX;	BX=InstructionSet.regBX;
+	R8D=InstructionSet.regR8D; R9D=InstructionSet.regR9D; R10D=InstructionSet.regR10D; R11D=InstructionSet.regR11D;
+	R12D=InstructionSet.regR12D; R13D=InstructionSet.regR13D; R14D=InstructionSet.regR14D; R15D=InstructionSet.regR15D;
+	AX=InstructionSet.regAX; CX=InstructionSet.regCX; DX=InstructionSet.regDX; BX=InstructionSet.regBX;
 	SI=InstructionSet.regSI; DI=InstructionSet.regDI; BP=InstructionSet.regBP; SP=InstructionSet.regSP;
-	R8W=InstructionSet.regR8W; 	R9W=InstructionSet.regR9W; 	R10W=InstructionSet.regR10W; 	R11W=InstructionSet.regR11W;
-	R12W=InstructionSet.regR12W; 	R13W=InstructionSet.regR13W; 	R14W=InstructionSet.regR14W; 	R15W=InstructionSet.regR15W;
-	AL=InstructionSet.regAL;	CL=InstructionSet.regCL;	DL=InstructionSet.regDL;	BL=InstructionSet.regBL;	SIL=InstructionSet.regSIL;
+	R8W=InstructionSet.regR8W; R9W=InstructionSet.regR9W; R10W=InstructionSet.regR10W; R11W=InstructionSet.regR11W;
+	R12W=InstructionSet.regR12W; R13W=InstructionSet.regR13W; R14W=InstructionSet.regR14W; R15W=InstructionSet.regR15W;
+	AL=InstructionSet.regAL; CL=InstructionSet.regCL; DL=InstructionSet.regDL; BL=InstructionSet.regBL; SIL=InstructionSet.regSIL;
 	DIL=InstructionSet.regDIL; BPL=InstructionSet.regBPL; SPL=InstructionSet.regSPL;
-	R8B=InstructionSet.regR8B; 	R9B=InstructionSet.regR9B; 	R10B=InstructionSet.regR10B; 	R11B=InstructionSet.regR11B;
-	R12B=InstructionSet.regR12B; 	R13B=InstructionSet.regR13B; 	R14B=InstructionSet.regR14B; 	R15B=InstructionSet.regR15B;
-	AH=InstructionSet.regAH;	CH=InstructionSet.regCH;	DH=InstructionSet.regDH;	BH=InstructionSet.regBH;
+	R8B=InstructionSet.regR8B; R9B=InstructionSet.regR9B; R10B=InstructionSet.regR10B; R11B=InstructionSet.regR11B;
+	R12B=InstructionSet.regR12B; R13B=InstructionSet.regR13B; R14B=InstructionSet.regR14B; R15B=InstructionSet.regR15B;
+	AH=InstructionSet.regAH; CH=InstructionSet.regCH; DH=InstructionSet.regDH; BH=InstructionSet.regBH;
 	ST0=InstructionSet.regST0;
 	XMM0 = InstructionSet.regXMM0;
 	XMM7 = InstructionSet.regXMM7;
@@ -41,12 +41,12 @@ CONST
 
 VAR registerOperands: ARRAY InstructionSet.numberRegisters OF Assembler.Operand;
 	usePool: BOOLEAN;
-	 opEAX, opECX, opEDX, opEBX, opESP, opEBP,
-	 opESI, opEDI, opAX, opCX, opDX, opBX, opSI, opDI, opAL, opCL, opDL, opBL, opAH, opCH, opDH, opBH,opST0
-	 , opRSP, opRBP: Assembler.Operand;
+	opEAX, opECX, opEDX, opEBX, opESP, opEBP,
+	opESI, opEDI, opAX, opCX, opDX, opBX, opSI, opDI, opAL, opCL, opDL, opBL, opAH, opCH, opDH, opBH,opST0,
+	opRSP, opRBP: Assembler.Operand;
 
-	 unusable,split,blocked,free: CodeGenerators.Ticket;
-	 traceStackSize: LONGINT;
+	unusable,split,blocked,free: CodeGenerators.Ticket;
+	traceStackSize: LONGINT;
 
 TYPE
 
@@ -275,7 +275,7 @@ TYPE
 					(* ST7 unusable as it is overwritten during arithmetic instructions *)
 				ELSE
 					i := GetHint(XMM0, XMM7);
-					IF i = none THEN 	i := Get(XMM7, XMM0) END
+					IF i = none THEN i := Get(XMM7, XMM0) END
 				END;
 			END;
 			hint := none; (* reset *)
@@ -429,7 +429,6 @@ TYPE
 				RETURN res
 			END GetGPHint;
 
-
 			PROCEDURE Get(from,to: LONGINT): LONGINT;
 			VAR i: LONGINT;
 			BEGIN
@@ -531,7 +530,7 @@ TYPE
 		sp=0>	FP0 - reg0								FP1 - reg0						sp=0>	FP0 - reg0
 				FP1 - reg1								FP2 - reg1								FP1 - reg1
 				FP2 - reg2								FP3 - reg2								FP2 - reg2
-				FP3 - reg3	 = load op1 =>			FP4 - reg3		= op =>				FP3 - reg3
+				FP3 - reg3	= load op1 =>			FP4 - reg3		= op =>				FP3 - reg3
 				FP4 - reg4								FP5 - reg4								FP4 - reg4
 				FP5 - reg5								FP6 - reg5								FP5 - reg5
 				FP6 - reg6								FP7 - reg6								FP6 - reg6
@@ -896,7 +895,6 @@ TYPE
 				RETURN (value <= MAX(SIGNED32)) & (value >= MIN(SIGNED32));
 			END IsSignedImm32;
 
-
 		BEGIN
 			ASSERT(virtual.mode = IntermediateCode.ModeImmediate);
 			GetPartType(virtual.type,part,type);
@@ -1029,7 +1027,6 @@ TYPE
 			END;
 		END GetRegister;
 
-
 		(* make physical operand from virtual operand, if ticket given then write result into phyiscal register represented by ticket *)
 		PROCEDURE MakeOperand(CONST vop: IntermediateCode.Operand; part: LONGINT; VAR op: Assembler.Operand; ticket: Ticket);
 		VAR tmp: Assembler.Operand;
@@ -1724,7 +1721,6 @@ TYPE
 					Assembler.InitImm(imm, 0 ,0);
 					emitter.Emit2(InstructionSet.opSBB, temp4, imm);
 
-
 					IF dtype.sizeInBits # destType.sizeInBits THEN
 						index := temp4.register;
 						CASE destType.sizeInBits OF (* choose low part accordingly *)
@@ -2318,24 +2314,24 @@ TYPE
 				11 mod 3 = 2 (=11-9)
 
 			for negative a there are two definitions for mod possible:
-				(i) 	mathematical definition with
+				(i) mathematical definition with
 					a mod b >= 0:
 					a mod b = min{ c >=0: c = a-i*b, integer i} >= 0
 					this corresponds with rounding down
 					a div b = Entier(a/b) <= a/b
-		 		(ii) symmetric definition with
-		 			(-a) mod' b = -(a mod' b) and
-		 			(-a) div' b = -(a div' b)
-		 			corresponding with rounding to zero
-		 			a div' b = RoundToZero(a/b)
-
-		 	Examples
-		 		(i) -11 div 3 = -4  (3*(-4) = -12)
-		 			-11 mod 3 = 1 (=-11-(-12))
-		 		(ii) -11 div' 3 = -(11 div 3) = -3 (3*(-3)= -9)
-		 			-11 mod' 3 = -2 (=-11-(-9))
-
-		 	The behaviour for negative b can, in the symmetrical case, be deduced as
+				(ii) symmetric definition with
+					(-a) mod' b = -(a mod' b) and
+					(-a) div' b = -(a div' b)
+					corresponding with rounding to zero
+					a div' b = RoundToZero(a/b)
+
+			Examples
+				(i) -11 div 3 = -4  (3*(-4) = -12)
+					-11 mod 3 = 1 (=-11-(-12))
+				(ii) -11 div' 3 = -(11 div 3) = -3 (3*(-3)= -9)
+					-11 mod' 3 = -2 (=-11-(-9))
+
+			The behaviour for negative b can, in the symmetrical case, be deduced as
 				(ii)	symmetric definition
 					a div' (-b) = (-a) div' b = -(a div' b)
 					a mod' (-b) = a- a div' (-b) * (-b) = a mod' b
@@ -2364,8 +2360,6 @@ TYPE
 
 			*)
 
-
-
 			(*
 				AX / regMem8 = AL (remainder AH)
 				DX:AX / regmem16 = AX (remainder DX)
@@ -2514,7 +2508,6 @@ TYPE
 				shift := opCL;
 			END;
 
-
 			IF ~IsComplex(instruction.op1) THEN
 				Move(dest,op2,PhysicalOperandType(dest));
 				emitter.Emit2 (op, dest,shift);
@@ -2607,7 +2600,6 @@ TYPE
 				rd := TemporaryTicket(IntermediateCode.GeneralPurposeRegister, type);
 				TicketToOperand(rd,op3);
 
-
 				Move(op3, op2, type);
 				Move(op1, op3, type);
 			ELSE
@@ -2711,7 +2703,6 @@ TYPE
 			END;
 		END EmitCopy;
 
-
 		PROCEDURE EmitFill(CONST instruction: IntermediateCode.Instruction; down: BOOLEAN);
 		VAR reg,sizeInBits,i: LONGINT;val, value, size, dest: Assembler.Operand;
 			op: LONGINT;
@@ -2874,7 +2865,6 @@ TYPE
 				emitter.Emit2(InstructionSet.opCMP,left,right);
 			END Cmp;
 
-
 		BEGIN
 			IF (instruction.op1.symbol.name = in.name) & (instruction.op1.symbolOffset = inPC +1) THEN (* jump to next instruction can be ignored *)
 				IF dump # NIL THEN dump.String("jump to next instruction ignored"); dump.Ln END;
@@ -3106,7 +3096,6 @@ TYPE
 			FinishOp(instruction.op1, Low, op, ticket);
 		END EmitNegXMM;
 
-
 		PROCEDURE EmitAbs(CONST instruction: IntermediateCode.Instruction);
 		VAR op1,op2: Assembler.Operand; source,imm: Assembler.Operand; eax: Ticket;
 		BEGIN
@@ -3421,8 +3410,8 @@ TYPE
 			procedure: SyntaxTree.Procedure;
 			i, j, initialSectionCount: LONGINT;
 
-		 	(* recompute fixup positions and assign binary sections *)
-		 	PROCEDURE PatchFixups(section: BinaryCode.Section);
+			(* recompute fixup positions and assign binary sections *)
+			PROCEDURE PatchFixups(section: BinaryCode.Section);
 			VAR resolved: BinaryCode.Section; fixup: BinaryCode.Fixup; displacement,symbolOffset: LONGINT; in: IntermediateCode.Section;
 				symbol: Sections.Section;
 			BEGIN
@@ -3448,69 +3437,69 @@ TYPE
 			END PatchFixups;
 
 		BEGIN
-		 	cg.SetModule(module);
+			cg.SetModule(module);
 
-		 	FOR i := 0 TO module.allSections.Length() - 1 DO
-			 	in := module.allSections.GetSection(i);
-		 		IF in.type = Sections.InlineCodeSection THEN
-		 			name := in.name;
-			 		out := ResolvedSection(in(IntermediateCode.Section));
-			 		cg.Section(in(IntermediateCode.Section),out);
-			 		procedure := in.symbol(SyntaxTree.Procedure);
-			 		IF procedure.procedureScope.body.code # NIL THEN
-				 		procedure.procedureScope.body.code.SetBinaryCode(out.os.bits);
-				 	END;
-			 	END
-		 	END;
+			FOR i := 0 TO module.allSections.Length() - 1 DO
+				in := module.allSections.GetSection(i);
+				IF in.type = Sections.InlineCodeSection THEN
+					name := in.name;
+					out := ResolvedSection(in(IntermediateCode.Section));
+					cg.Section(in(IntermediateCode.Section),out);
+					procedure := in.symbol(SyntaxTree.Procedure);
+					IF procedure.procedureScope.body.code # NIL THEN
+						procedure.procedureScope.body.code.SetBinaryCode(out.os.bits);
+					END;
+				END
+			END;
 
 			initialSectionCount := 0;
-		 	REPEAT
-		 		j := initialSectionCount;
-		 	 	initialSectionCount := module.allSections.Length() ;
-
-			 	FOR i := j TO initialSectionCount - 1 DO
-			 		in := module.allSections.GetSection(i);
-			 		IF (in.type # Sections.InlineCodeSection) & (in(IntermediateCode.Section).resolved = NIL) THEN
-			 			name := in.name;
-				 		out := ResolvedSection(in(IntermediateCode.Section));
-				 		cg.Section(in(IntermediateCode.Section),out);
-				 		IF out.os.type = Sections.VarSection THEN
-				 			IF out.pc = 1 THEN out.SetAlignment(FALSE,1)
-				 			ELSIF out.pc = 2 THEN out.SetAlignment(FALSE,2)
-				 			ELSIF (out.pc > 4) & (bits > 32) THEN out.SetAlignment(FALSE,8)
-				 			ELSIF (out.pc > 2) THEN out.SetAlignment(FALSE,4)
-				 			END;
-				 		ELSIF out.os.type = Sections.ConstSection THEN
-				 			out.SetAlignment(FALSE,bits DIV 8);
-				 		END;
-			 		END
-			 	END
+			REPEAT
+				j := initialSectionCount;
+				initialSectionCount := module.allSections.Length() ;
+
+				FOR i := j TO initialSectionCount - 1 DO
+					in := module.allSections.GetSection(i);
+					IF (in.type # Sections.InlineCodeSection) & (in(IntermediateCode.Section).resolved = NIL) THEN
+						name := in.name;
+						out := ResolvedSection(in(IntermediateCode.Section));
+						cg.Section(in(IntermediateCode.Section),out);
+						IF out.os.type = Sections.VarSection THEN
+							IF out.pc = 1 THEN out.SetAlignment(FALSE,1)
+							ELSIF out.pc = 2 THEN out.SetAlignment(FALSE,2)
+							ELSIF (out.pc > 4) & (bits > 32) THEN out.SetAlignment(FALSE,8)
+							ELSIF (out.pc > 2) THEN out.SetAlignment(FALSE,4)
+							END;
+						ELSIF out.os.type = Sections.ConstSection THEN
+							out.SetAlignment(FALSE,bits DIV 8);
+						END;
+					END
+				END
 			UNTIL initialSectionCount = module.allSections.Length(); (* process remaining sections that have been added during traversal of sections *)
 
 			(*
 			FOR i := 0 TO module.allSections.Length() - 1 DO
 				in := module.allSections.GetSection(i);
 				IF in.kind = Sections.CaseTableKind THEN
-			 		IF in(IntermediateCode.Section).resolved = NIL THEN
-				 		out := ResolvedSection(in(IntermediateCode.Section));
-				 		cg.Section(in(IntermediateCode.Section),out);
-				 	END
-				 END
-		 	END;
+					IF in(IntermediateCode.Section).resolved = NIL THEN
+						out := ResolvedSection(in(IntermediateCode.Section));
+						cg.Section(in(IntermediateCode.Section),out);
+					END
+				END
+			END;
 			*)
 
 			FOR i := 0 TO module.allSections.Length() - 1 DO
 				in := module.allSections.GetSection(i);
-		 		PatchFixups(in(IntermediateCode.Section).resolved)
-		 	END;
+				PatchFixups(in(IntermediateCode.Section).resolved)
+			END;
 
 			(*
 			FOR i := 0 TO module.allSections.Length() - 1 DO
 				in := module.allSections.GetSection(i);
 				IF in.kind = Sections.CaseTableKind THEN
-			 		PatchFixups(in(IntermediateCode.Section).resolved)
-			 	END
-		 	END;
+					PatchFixups(in(IntermediateCode.Section).resolved)
+				END
+			END;
 			*)
 
 			IF cg.error THEN Error("",Basic.invalidPosition, Streams.Invalid,"") END;
@@ -3598,7 +3587,6 @@ TYPE
 			RETURN b
 		END CanPassInRegister;
 
-
 		PROCEDURE GetDescription*(VAR instructionSet: ARRAY OF CHAR);
 		BEGIN instructionSet := "AMD";
 		END GetDescription;
@@ -3724,5 +3712,4 @@ BEGIN
 	usePool := Machine.NumberOfProcessors()>1;
 END FoxAMDBackend.
 
-
 System.FreeDownTo FoxAMDBackend ~

+ 0 - 2
source/FoxARMAssembler.Mod

@@ -52,7 +52,6 @@ TYPE
 			RETURN FALSE;
 		END GetRegisterList;
 
-
 		(** parse a special register name, along with fields **)
 		PROCEDURE GetSpecialRegisterWithFields(VAR registerNumber: LONGINT; VAR fields: SET): BOOLEAN;
 		VAR
@@ -377,7 +376,6 @@ TYPE
 					D.String("    flags="); D.Set(flags); D.Ln;
 				END;*)
 
-
 				FOR i := 0 TO InstructionSet.MaxOperands - 1 DO
 					InstructionSet.InitOperand(operands[i])
 				END;

+ 76 - 92
source/FoxARMBackend.Mod

@@ -136,7 +136,6 @@ TYPE
 			HALT(100);
 		END Emit;
 
-
 		PROCEDURE AddCitation(pc: LONGINT; bits: LONGINT; shift: LONGINT);
 		VAR
 			citation: Citation;
@@ -548,8 +547,6 @@ TYPE
 
 		inStackAllocation: BOOLEAN;
 
-
-
 		PROCEDURE & InitGeneratorARM(CONST builtinsModuleName: SyntaxTree.IdentifierString; diagnostics: Diagnostics.Diagnostics; backend: BackendARM);
 		VAR
 			physicalRegisters: PhysicalRegisters;
@@ -580,7 +577,6 @@ TYPE
 
 			NEW(listOfReferences);
 
-
 		END InitGeneratorARM;
 
 		(*------------------- overwritten methods ----------------------*)
@@ -748,7 +744,6 @@ TYPE
 			(* emit the instruction *)
 			InstructionSet.Emit(opCode, condition, flags, operands, out);
 
-
 		END Emit;
 
 		(** emit an ARM instruction with no operand **)
@@ -1398,7 +1393,6 @@ TYPE
 			RETURN irOperand.type.form = IntermediateCode.Float
 		END IsFloat;
 
-
 		(** whether an IR operand hold am integer value **)
 		PROCEDURE IsInteger(CONST irOperand: IntermediateCode.Operand): BOOLEAN;
 		BEGIN RETURN irOperand.type.form IN IntermediateCode.Integer
@@ -1580,8 +1574,8 @@ TYPE
 		END EmitFinalFixupBlock;
 
 		(* if needed, emit fixup block for all used symbol references
-		 - the fixup block is skipped by a branch instruction
-		 - afterwards, the list of references is cleared
+			- the fixup block is skipped by a branch instruction
+			- afterwards, the list of references is cleared
 		*)
 		PROCEDURE EmitFixupBlockIfNeeded;
 		BEGIN
@@ -1927,7 +1921,6 @@ TYPE
 			IF (op.symbol.name # "") & (op.resolved = NIL) THEN op.resolved := module.allSections.FindByName(op.symbol.name) END
 		END Resolve;
 
-
 		(* call <address>, <parSize> *)
 		PROCEDURE EmitCall(VAR irInstruction: IntermediateCode.Instruction);
 		VAR
@@ -2217,7 +2210,6 @@ TYPE
 				RETURN;
 			END;
 
-
 			IF IsSinglePrecisionFloat(irInstruction.op1) THEN
 				ASSERT(backend.useFPU32);
 				PrepareDoubleSourceOp(irInstruction, Low, destination[Low], left[Low], right[Low]);
@@ -2265,7 +2257,6 @@ TYPE
 				RETURN;
 			END;
 
-
 			IF IsSinglePrecisionFloat(irInstruction.op1) THEN
 				ASSERT(backend.useFPU32);
 				PrepareDoubleSourceOp(irInstruction, Low, destination, left, right);
@@ -2281,16 +2272,16 @@ TYPE
 				PrepareDoubleSourceOp(irInstruction, Low, destination, left, right);
 				(* left and right operands to double *)
 				float := GetFreeRegister(IntermediateCode.FloatType(32));
-		 		Emit2(opFMSR, float, left);
+				Emit2(opFMSR, float, left);
 				leftd := GetFreeRegister(IntermediateCode.FloatType(64));
-	 			IF irInstruction.op1.type.form = IntermediateCode.UnsignedInteger THEN
+				IF irInstruction.op1.type.form = IntermediateCode.UnsignedInteger THEN
 					Emit2(opFUITOD, leftd, float)
 				ELSE
 					Emit2(opFSITOD,leftd, float)
 				END;
-		 		Emit2(opFMSR, float,right);
+				Emit2(opFMSR, float,right);
 				rightd := GetFreeRegister(IntermediateCode.FloatType(64));
-	 			IF irInstruction.op1.type.form = IntermediateCode.UnsignedInteger THEN
+				IF irInstruction.op1.type.form = IntermediateCode.UnsignedInteger THEN
 					Emit2(opFUITOD, rightd, float)
 				ELSE
 					Emit2(opFSITOD,rightd, float)
@@ -2299,13 +2290,13 @@ TYPE
 				Emit3(opFDIVD, leftd, leftd, rightd);
 				(* result to destination *)
 				RoundDown(fpstatus);
-	 			IF irInstruction.op1.type.form = IntermediateCode.UnsignedInteger THEN
+				IF irInstruction.op1.type.form = IntermediateCode.UnsignedInteger THEN
 					Emit2(opFTOUID, float, leftd)
 				ELSE
 					Emit2(opFTOSID, float, leftd)
 				END;
 				ResetRounding(fpstatus);
-		 		Emit2(opFMRS, destination, float);
+				Emit2(opFMRS, destination, float);
 				WriteBack(irInstruction.op1, Low, destination)
 			ELSE
 				HALT(200)
@@ -2985,7 +2976,6 @@ TYPE
 							right[Low] := RegisterFromIrOperand(irRight, Low, emptyOperand);
 							Cmp(left[Low], right[Low], FALSE);
 
-
 						ELSE
 							HALT(100)
 						END
@@ -3097,7 +3087,6 @@ TYPE
 				failFixup.resolved := in;
 			END;
 
-
 		END EmitBr;
 
 		PROCEDURE RoundDown(VAR fpstatus: Operand);
@@ -3116,7 +3105,6 @@ TYPE
 			Emit2(InstructionSet.opVMSR, fpscr, fpstatus);
 		END ResetRounding;
 
-
 		PROCEDURE EmitConv(VAR irInstruction: IntermediateCode.Instruction);
 		VAR
 			irDestination, irSource: IntermediateCode.Operand;
@@ -3124,7 +3112,6 @@ TYPE
 			temp, fpstatus: Operand;
 			partType: IntermediateCode.Type;
 
-
 		BEGIN
 			irDestination := irInstruction.op1; irSource := irInstruction.op2;
 
@@ -3207,52 +3194,52 @@ TYPE
 				END
 			ELSIF IsSinglePrecisionFloat(irDestination) THEN
 				(* to single precision float: *)
-			 	IF IsInteger(irSource) THEN
+				IF IsInteger(irSource) THEN
 					ASSERT(~IsComplex(irSource));
-			 		(* integer to single precision float: ignore high part of source *)
-			 		temp := GetFreeRegister(IntermediateCode.FloatType(32));
-			 		Emit2(opFMSR, temp, source[Low]);
-		 			IF irSource.type.form = IntermediateCode.UnsignedInteger THEN
+					(* integer to single precision float: ignore high part of source *)
+					temp := GetFreeRegister(IntermediateCode.FloatType(32));
+					Emit2(opFMSR, temp, source[Low]);
+					IF irSource.type.form = IntermediateCode.UnsignedInteger THEN
 						(* non-complex unsigned integer to single precision float: *)
 						Emit2(opFUITOS, destination[Low], temp)
 					ELSE
 						(* non-complex signed integer to single precision float: *)
 						Emit2(opFSITOS, destination[Low], temp)
 					END
-			 	ELSIF IsSinglePrecisionFloat(irSource) THEN
-			 		(* single precision float to single precision float: *)
-			 		MovIfDifferent(destination[Low], source[Low])
-			 	ELSIF IsDoublePrecisionFloat(irSource) THEN
-			 		(* LONGREAL --> REAL *)
-			 		Emit2(opFCVTSD, destination[Low], source[Low])
-			 	ELSE
-			 		(* anything else to single precision float: *)
-			 		HALT(200)
-			 	END
+				ELSIF IsSinglePrecisionFloat(irSource) THEN
+					(* single precision float to single precision float: *)
+					MovIfDifferent(destination[Low], source[Low])
+				ELSIF IsDoublePrecisionFloat(irSource) THEN
+					(* LONGREAL --> REAL *)
+					Emit2(opFCVTSD, destination[Low], source[Low])
+				ELSE
+					(* anything else to single precision float: *)
+					HALT(200)
+				END
 			ELSIF IsDoublePrecisionFloat(irDestination) THEN
 				(* to double precision float: *)
-			 	IF IsInteger(irSource) THEN
+				IF IsInteger(irSource) THEN
 					ASSERT(~IsComplex(irSource));
-			 		(* integer to double precision float: ignore high part of source *)
-			 		temp := GetFreeRegister(IntermediateCode.FloatType(32));
-			 		Emit2(opFMSR, temp, source[Low]);
-		 			IF irSource.type.form = IntermediateCode.UnsignedInteger THEN
+					(* integer to double precision float: ignore high part of source *)
+					temp := GetFreeRegister(IntermediateCode.FloatType(32));
+					Emit2(opFMSR, temp, source[Low]);
+					IF irSource.type.form = IntermediateCode.UnsignedInteger THEN
 						(* non-complex unsigned integer to double precision float: *)
 						Emit2(opFUITOD, destination[Low], temp)
 					ELSE
 						(* non-complex signed integer to double precision float: *)
 						Emit2(opFSITOD, destination[Low], temp)
 					END
-			 	ELSIF IsSinglePrecisionFloat(irSource) THEN
-			 		(* REAL --> LONGREAL *)
-			 		Emit2(opFCVTDS, destination[Low], source[Low])
-			 	ELSIF IsDoublePrecisionFloat(irSource) THEN
-			 		(* single precision float to single precision float: *)
-			 		MovIfDifferent(destination[Low], source[Low])
-			 	ELSE
-			 		(* anything else to single precision float: *)
-			 		HALT(200)
-			 	END
+				ELSIF IsSinglePrecisionFloat(irSource) THEN
+					(* REAL --> LONGREAL *)
+					Emit2(opFCVTDS, destination[Low], source[Low])
+				ELSIF IsDoublePrecisionFloat(irSource) THEN
+					(* single precision float to single precision float: *)
+					MovIfDifferent(destination[Low], source[Low])
+				ELSE
+					(* anything else to single precision float: *)
+					HALT(200)
+				END
 			ELSE
 				(* to anything else: *)
 				HALT(200)
@@ -3634,11 +3621,8 @@ TYPE
 			procedure: SyntaxTree.Procedure;
 			i, j, initialSectionCount: LONGINT;
 
-
-
-
-		 	(* recompute fixup positions and assign binary sections *)
-		 	PROCEDURE PatchFixups(section: BinaryCode.Section);
+			(* recompute fixup positions and assign binary sections *)
+			PROCEDURE PatchFixups(section: BinaryCode.Section);
 			VAR resolved: BinaryCode.Section; fixup: BinaryCode.Fixup; displacement,symbolOffset: LONGINT; in: IntermediateCode.Section;
 				symbol: Sections.Section;
 			BEGIN
@@ -3669,8 +3653,8 @@ TYPE
 				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);
+			(* 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;
 			BEGIN
 				fixup := section.fixupList.firstFixup;
@@ -3706,45 +3690,45 @@ TYPE
 			*)
 
 		BEGIN
-		 	cg.SetModule(module);
-		 	cg.dump := dump;
+			cg.SetModule(module);
+			cg.dump := dump;
 
-		 	FOR i := 0 TO module.allSections.Length() - 1 DO
-			 	in := module.allSections.GetSection(i);
-		 		IF in.type = Sections.InlineCodeSection THEN
-		 			Basic.SegmentedNameToString(in.name, name);
-			 		out := ResolvedSection(in(IntermediateCode.Section));
-			 		cg.dump := out.comments;
-			 		cg.Section(in(IntermediateCode.Section), out);
-			 		IF in.symbol # NIL THEN
-				 		procedure := in.symbol(SyntaxTree.Procedure);
-				 		procedure.procedureScope.body.code.SetBinaryCode(out.os.bits);
-				 	END;
-			 	END
-		 	END;
+			FOR i := 0 TO module.allSections.Length() - 1 DO
+				in := module.allSections.GetSection(i);
+				IF in.type = Sections.InlineCodeSection THEN
+					Basic.SegmentedNameToString(in.name, name);
+					out := ResolvedSection(in(IntermediateCode.Section));
+					cg.dump := out.comments;
+					cg.Section(in(IntermediateCode.Section), out);
+					IF in.symbol # NIL THEN
+						procedure := in.symbol(SyntaxTree.Procedure);
+						procedure.procedureScope.body.code.SetBinaryCode(out.os.bits);
+					END;
+				END
+			END;
 
 			initialSectionCount := 0;
-		 	REPEAT
-		 		j := initialSectionCount;
-		 	 	initialSectionCount := module.allSections.Length() ;
-
-			 	FOR i := j TO initialSectionCount - 1 DO
-			 		in := module.allSections.GetSection(i);
-		 			Basic.SegmentedNameToString(in.name, name);
-
-			 		IF (in.type # Sections.InlineCodeSection) (*& (in(IntermediateCode.Section).resolved = NIL) *) THEN
-				 		out := ResolvedSection(in(IntermediateCode.Section));
-				 		cg.Section(in(IntermediateCode.Section),out);
-			 		END
-			 	END
+			REPEAT
+				j := initialSectionCount;
+				initialSectionCount := module.allSections.Length() ;
+
+				FOR i := j TO initialSectionCount - 1 DO
+					in := module.allSections.GetSection(i);
+					Basic.SegmentedNameToString(in.name, name);
+
+					IF (in.type # Sections.InlineCodeSection) (*& (in(IntermediateCode.Section).resolved = NIL) *) THEN
+						out := ResolvedSection(in(IntermediateCode.Section));
+						cg.Section(in(IntermediateCode.Section),out);
+					END
+				END
 			UNTIL initialSectionCount = module.allSections.Length(); (* process remaining sections that have been added during traversal of sections *)
 
-		 	FOR i := 0 TO module.allSections.Length() - 1 DO
-			 	in := module.allSections.GetSection(i);
-	 			Basic.SegmentedNameToString(in.name, name);
-			 	in := module.allSections.GetSection(i);
-		 		PatchFixups(in(IntermediateCode.Section).resolved)
-		 	END;
+			FOR i := 0 TO module.allSections.Length() - 1 DO
+				in := module.allSections.GetSection(i);
+				Basic.SegmentedNameToString(in.name, name);
+				in := module.allSections.GetSection(i);
+				PatchFixups(in(IntermediateCode.Section).resolved)
+			END;
 
 			IF cg.error THEN Error("", Basic.invalidPosition, Streams.Invalid,  "") END
 		END GenerateBinary;

+ 129 - 137
source/FoxARMInstructionSet.Mod

@@ -721,11 +721,10 @@ CONST
 			END;
 		END OperandMatches;
 
-
 		PROCEDURE Matches(CONST format: InstructionFormat): BOOLEAN;
 		VAR i: LONGINT;
 		BEGIN
-			IF mnemonic # format.mnemonic THEN 	RETURN FALSE END; (* different mnemonic *)
+			IF mnemonic # format.mnemonic THEN RETURN FALSE END; (* different mnemonic *)
 			IF (instruction.condition # conditionAL) & (instruction.condition # None) & ~(flagCondition IN format.flags) THEN (* not always case for encoding problems of BLX which comes in two forms *)
 				RETURN FALSE END; (* unpermitted condition *)
 			IF instruction.flags * format.flags # instruction.flags THEN
@@ -767,8 +766,6 @@ CONST
 			END
 		END;
 
-
-
 		RETURN result
 	END MakeInstruction;
 
@@ -837,7 +834,6 @@ CONST
 		RETURN rot <16
 	END EncodeImmediate;
 
-
 	PROCEDURE Encode(CONST instruction: Instruction; VAR code: LONGINT): BOOLEAN;
 	VAR
 		format: InstructionFormat; codeSet: SET; i: LONGINT; error: BOOLEAN;
@@ -964,7 +960,6 @@ CONST
 			END
 		END CheckImmediateShifts;
 
-
 		PROCEDURE EncodeOperand(operandEncoding: LONGINT; CONST operand: Operand);
 		VAR
 			imm, rot, firstRegister, num, shiftMode, shiftImmediate: LONGINT;
@@ -1223,24 +1218,24 @@ CONST
 					ELSIF (operand.register < QR0) OR (operand.register > QR15) THEN error := TRUE
 					END;
 					CASE operandEncoding OF
-						 encodingNEONQd:
-						 	NEONRegisterPos[0] := 13;
-						 	NEONRegisterPos[1] := 14;
-						 	NEONRegisterPos[2] := 15;
-						 	NEONRegisterPos[3] := 22;
+						|encodingNEONQd:
+							NEONRegisterPos[0] := 13;
+							NEONRegisterPos[1] := 14;
+							NEONRegisterPos[2] := 15;
+							NEONRegisterPos[3] := 22;
 						|encodingNEONQm:
-						 	NEONRegisterPos[0] := 1;
-						 	NEONRegisterPos[1] := 2;
-						 	NEONRegisterPos[2] := 3;
-						 	NEONRegisterPos[3] := 5;
+							NEONRegisterPos[0] := 1;
+							NEONRegisterPos[1] := 2;
+							NEONRegisterPos[2] := 3;
+							NEONRegisterPos[3] := 5;
 						|encodingNEONQn:
-						 	NEONRegisterPos[0] := 17;
-						 	NEONRegisterPos[1] := 18;
-						 	NEONRegisterPos[2] := 19;
-						 	NEONRegisterPos[3] := 7;
+							NEONRegisterPos[0] := 17;
+							NEONRegisterPos[1] := 18;
+							NEONRegisterPos[2] := 19;
+							NEONRegisterPos[3] := 7;
 					END;
-				 	NEONRegisterPos[4] := 32; (* end of encoding *)
-				 	SplittedUnsigned(operand.register - QR0, NEONRegisterPos)
+					NEONRegisterPos[4] := 32; (* end of encoding *)
+					SplittedUnsigned(operand.register - QR0, NEONRegisterPos)
 
 				|encodingNEONDd, encodingNEONDm, encodingNEONDn:
 					IF operand.mode # modeRegister THEN error := TRUE
@@ -1248,26 +1243,26 @@ CONST
 					ELSIF (operand.register < DR0) OR (operand.register > DR31) THEN error := TRUE
 					END;
 					CASE operandEncoding OF
-						 encodingNEONDd:
-						 	NEONRegisterPos[0] := 12;
-						 	NEONRegisterPos[1] := 13;
-						 	NEONRegisterPos[2] := 14;
-						 	NEONRegisterPos[3] := 15;
-						 	NEONRegisterPos[4] := 22;
+						|encodingNEONDd:
+							NEONRegisterPos[0] := 12;
+							NEONRegisterPos[1] := 13;
+							NEONRegisterPos[2] := 14;
+							NEONRegisterPos[3] := 15;
+							NEONRegisterPos[4] := 22;
 						|encodingNEONDm:
-						 	NEONRegisterPos[0] := 0;
-						 	NEONRegisterPos[1] := 1;
-						 	NEONRegisterPos[2] := 2;
-						 	NEONRegisterPos[3] := 3;
-						 	NEONRegisterPos[4] := 5;
+							NEONRegisterPos[0] := 0;
+							NEONRegisterPos[1] := 1;
+							NEONRegisterPos[2] := 2;
+							NEONRegisterPos[3] := 3;
+							NEONRegisterPos[4] := 5;
 						|encodingNEONDn:
-						 	NEONRegisterPos[0] := 16;
-						 	NEONRegisterPos[1] := 17;
-						 	NEONRegisterPos[2] := 18;
-						 	NEONRegisterPos[3] := 19;
-						 	NEONRegisterPos[4] := 7;
+							NEONRegisterPos[0] := 16;
+							NEONRegisterPos[1] := 17;
+							NEONRegisterPos[2] := 18;
+							NEONRegisterPos[3] := 19;
+							NEONRegisterPos[4] := 7;
 					END;
-				 	SplittedUnsigned(operand.register - DR0, NEONRegisterPos)
+					SplittedUnsigned(operand.register - DR0, NEONRegisterPos)
 
 				|encodingNEONSd, encodingNEONSm, encodingNEONSn:
 					IF operand.mode # modeRegister THEN error := TRUE
@@ -1275,69 +1270,69 @@ CONST
 					ELSIF (operand.register < SR0) OR (operand.register > SR31) THEN error := TRUE
 					END;
 					CASE operandEncoding OF
-						 encodingNEONSd:
-						 	NEONRegisterPos[0] := 22;
-						 	NEONRegisterPos[1] := 12;
-						 	NEONRegisterPos[2] := 13;
-						 	NEONRegisterPos[3] := 14;
-						 	NEONRegisterPos[4] := 15;
+						|encodingNEONSd:
+							NEONRegisterPos[0] := 22;
+							NEONRegisterPos[1] := 12;
+							NEONRegisterPos[2] := 13;
+							NEONRegisterPos[3] := 14;
+							NEONRegisterPos[4] := 15;
 						|encodingNEONSm:
-						 	NEONRegisterPos[0] := 5;
-						 	NEONRegisterPos[1] := 0;
-						 	NEONRegisterPos[2] := 1;
-						 	NEONRegisterPos[3] := 2;
-						 	NEONRegisterPos[4] := 3;
+							NEONRegisterPos[0] := 5;
+							NEONRegisterPos[1] := 0;
+							NEONRegisterPos[2] := 1;
+							NEONRegisterPos[3] := 2;
+							NEONRegisterPos[4] := 3;
 						|encodingNEONSn:
-						 	NEONRegisterPos[0] := 7;
-						 	NEONRegisterPos[1] := 16;
-						 	NEONRegisterPos[2] := 17;
-						 	NEONRegisterPos[3] := 18;
-						 	NEONRegisterPos[4] := 19;
+							NEONRegisterPos[0] := 7;
+							NEONRegisterPos[1] := 16;
+							NEONRegisterPos[2] := 17;
+							NEONRegisterPos[3] := 18;
+							NEONRegisterPos[4] := 19;
 					END;
-				 	SplittedUnsigned(operand.register - SR0, NEONRegisterPos)
+					SplittedUnsigned(operand.register - SR0, NEONRegisterPos)
 
 				|encodingNEONQorDd, encodingNEONQorDm, encodingNEONQorDn:
 					IF operand.mode # modeRegister THEN error := TRUE
 					ELSIF operand.shiftMode # None THEN error := TRUE
 					ELSIF (DR0 <= operand.register) & (operand.register <= DR31) THEN
 						CASE operandEncoding OF
-							 encodingNEONQorDd:
-							 	NEONRegisterPos[0] := 12;
-							 	NEONRegisterPos[1] := 13;
-							 	NEONRegisterPos[2] := 14;
-							 	NEONRegisterPos[3] := 15;
-							 	NEONRegisterPos[4] := 22;
+							|encodingNEONQorDd:
+								NEONRegisterPos[0] := 12;
+								NEONRegisterPos[1] := 13;
+								NEONRegisterPos[2] := 14;
+								NEONRegisterPos[3] := 15;
+								NEONRegisterPos[4] := 22;
 							|encodingNEONQorDm:
-							 	NEONRegisterPos[0] := 0;
-							 	NEONRegisterPos[1] := 1;
-							 	NEONRegisterPos[2] := 2;
-							 	NEONRegisterPos[3] := 3;
-							 	NEONRegisterPos[4] := 5;
+								NEONRegisterPos[0] := 0;
+								NEONRegisterPos[1] := 1;
+								NEONRegisterPos[2] := 2;
+								NEONRegisterPos[3] := 3;
+								NEONRegisterPos[4] := 5;
 							|encodingNEONQorDn:
-							 	NEONRegisterPos[0] := 16;
-							 	NEONRegisterPos[1] := 17;
-							 	NEONRegisterPos[2] := 18;
-							 	NEONRegisterPos[3] := 19;
-							 	NEONRegisterPos[4] := 7;
+								NEONRegisterPos[0] := 16;
+								NEONRegisterPos[1] := 17;
+								NEONRegisterPos[2] := 18;
+								NEONRegisterPos[3] := 19;
+								NEONRegisterPos[4] := 7;
 						END;
 						SplittedUnsigned(operand.register - DR0, NEONRegisterPos);
 					ELSIF (QR0 <= operand.register) & (operand.register <= QR15) THEN
 						CASE operandEncoding OF
-							 encodingNEONQorDd:
-							 	NEONRegisterPos[0] := 13;
-							 	NEONRegisterPos[1] := 14;
-							 	NEONRegisterPos[2] := 15;
-							 	NEONRegisterPos[3] := 22;
+							|encodingNEONQorDd:
+								NEONRegisterPos[0] := 13;
+								NEONRegisterPos[1] := 14;
+								NEONRegisterPos[2] := 15;
+								NEONRegisterPos[3] := 22;
 							|encodingNEONQorDm:
-							 	NEONRegisterPos[0] := 1;
-							 	NEONRegisterPos[1] := 2;
-							 	NEONRegisterPos[2] := 3;
-							 	NEONRegisterPos[3] := 5;
+								NEONRegisterPos[0] := 1;
+								NEONRegisterPos[1] := 2;
+								NEONRegisterPos[2] := 3;
+								NEONRegisterPos[3] := 5;
 							|encodingNEONQorDn:
-							 	NEONRegisterPos[0] := 17;
-							 	NEONRegisterPos[1] := 18;
-							 	NEONRegisterPos[2] := 19;
-							 	NEONRegisterPos[3] := 7;
+								NEONRegisterPos[0] := 17;
+								NEONRegisterPos[1] := 18;
+								NEONRegisterPos[2] := 19;
+								NEONRegisterPos[3] := 7;
 						END;
 						NEONRegisterPos[4] := 32;
 						SplittedUnsigned(operand.register - QR0, NEONRegisterPos);
@@ -1349,46 +1344,46 @@ CONST
 					ELSIF operand.shiftMode # None THEN error := TRUE
 					ELSIF (DR0 <= operand.register) & (operand.register <= DR15) THEN
 						CASE operandEncoding OF
-							 encodingNEONDorSd:
-							 	NEONRegisterPos[0] := 12;
-							 	NEONRegisterPos[1] := 13;
-							 	NEONRegisterPos[2] := 14;
-							 	NEONRegisterPos[3] := 15;
-							 	NEONRegisterPos[4] := 22;
+							|encodingNEONDorSd:
+								NEONRegisterPos[0] := 12;
+								NEONRegisterPos[1] := 13;
+								NEONRegisterPos[2] := 14;
+								NEONRegisterPos[3] := 15;
+								NEONRegisterPos[4] := 22;
 							|encodingNEONDorSm:
-							 	NEONRegisterPos[0] := 0;
-							 	NEONRegisterPos[1] := 1;
-							 	NEONRegisterPos[2] := 2;
-							 	NEONRegisterPos[3] := 3;
-							 	NEONRegisterPos[4] := 5;
+								NEONRegisterPos[0] := 0;
+								NEONRegisterPos[1] := 1;
+								NEONRegisterPos[2] := 2;
+								NEONRegisterPos[3] := 3;
+								NEONRegisterPos[4] := 5;
 							|encodingNEONDorSn:
-							 	NEONRegisterPos[0] := 16;
-							 	NEONRegisterPos[1] := 17;
-							 	NEONRegisterPos[2] := 18;
-							 	NEONRegisterPos[3] := 19;
-							 	NEONRegisterPos[4] := 7;
+								NEONRegisterPos[0] := 16;
+								NEONRegisterPos[1] := 17;
+								NEONRegisterPos[2] := 18;
+								NEONRegisterPos[3] := 19;
+								NEONRegisterPos[4] := 7;
 						END;
 						SplittedUnsigned(operand.register - DR0, NEONRegisterPos)
 					ELSIF (SR0 <= operand.register) & (operand.register <= SR31) THEN
 						CASE operandEncoding OF
-						 encodingNEONDorSd:
-						 	NEONRegisterPos[0] := 22;
-						 	NEONRegisterPos[1] := 12;
-						 	NEONRegisterPos[2] := 13;
-						 	NEONRegisterPos[3] := 14;
-						 	NEONRegisterPos[4] := 15;
+						|encodingNEONDorSd:
+							NEONRegisterPos[0] := 22;
+							NEONRegisterPos[1] := 12;
+							NEONRegisterPos[2] := 13;
+							NEONRegisterPos[3] := 14;
+							NEONRegisterPos[4] := 15;
 						|encodingNEONDorSm:
-						 	NEONRegisterPos[0] := 5;
-						 	NEONRegisterPos[1] := 0;
-						 	NEONRegisterPos[2] := 1;
-						 	NEONRegisterPos[3] := 2;
-						 	NEONRegisterPos[4] := 3;
+							NEONRegisterPos[0] := 5;
+							NEONRegisterPos[1] := 0;
+							NEONRegisterPos[2] := 1;
+							NEONRegisterPos[3] := 2;
+							NEONRegisterPos[4] := 3;
 						|encodingNEONDorSn:
-						 	NEONRegisterPos[0] := 7;
-						 	NEONRegisterPos[1] := 16;
-						 	NEONRegisterPos[2] := 17;
-						 	NEONRegisterPos[3] := 18;
-						 	NEONRegisterPos[4] := 19;
+							NEONRegisterPos[0] := 7;
+							NEONRegisterPos[1] := 16;
+							NEONRegisterPos[2] := 17;
+							NEONRegisterPos[3] := 18;
+							NEONRegisterPos[4] := 19;
 						END;
 						SplittedUnsigned(operand.register - SR0, NEONRegisterPos)
 					ELSE error := TRUE
@@ -1409,11 +1404,11 @@ CONST
 					NEONRegisterPos[2] := 14;
 					NEONRegisterPos[3] := 15;
 					NEONRegisterPos[4] := 22;
-				 	SplittedUnsigned(DR0 + firstRegister, NEONRegisterPos);
+					SplittedUnsigned(DR0 + firstRegister, NEONRegisterPos);
 					(* bits 8 to 11 specify the length of the list *)
 					CASE num OF
-						 1: 	Unsigned(7H, 8, 11)
-						|2: 	Unsigned(0AH, 8, 11)
+						|1: Unsigned(7H, 8, 11)
+						|2: Unsigned(0AH, 8, 11)
 						|3: Unsigned(6H, 8, 11)
 						|4: Unsigned(2H, 8, 11)
 					ELSE
@@ -1429,7 +1424,7 @@ CONST
 
 					CASE operand.register OF
 						(* FPSID - 0b0; FPSCR - 0b1; FPEXC - 0b1000 at bits 19:16 *)
-						 FPSCR: INCL(codeSet, 16)
+						|FPSCR: INCL(codeSet, 16)
 						|FPEXC: INCL(codeSet, 19)
 					END
 
@@ -1474,10 +1469,10 @@ CONST
 			(* Set the Q bit *)
 			FOR i := 0 TO MaxOperands - 1 DO
 				CASE format.operands[i] OF
-					 encodingNEONQorDd, encodingNEONQorDm, encodingNEONQorDn:
-					 	IF (QR0 <= instruction.operands[i].register) & (instruction.operands[i].register <= QR15) THEN
-					 		codeSet := codeSet + format.Quadword
-					 	END
+					|encodingNEONQorDd, encodingNEONQorDm, encodingNEONQorDn:
+						IF (QR0 <= instruction.operands[i].register) & (instruction.operands[i].register <= QR15) THEN
+							codeSet := codeSet + format.Quadword
+						END
 					|encodingNEONDorSd, encodingNEONDorSm, encodingNEONDorSn:
 						IF (DR0 <= instruction.operands[i].register) & (instruction.operands[i].register <= DR15) THEN
 							codeSet := codeSet + format.Quadword
@@ -1739,7 +1734,6 @@ CONST
 			RETURN TRUE
 		END DecodeOperand;
 
-
 	BEGIN
 		codeSet := NumberToSet(code);
 		IF TraceDecode THEN
@@ -1969,12 +1963,12 @@ CONST
 
 			FOR curr := len TO 0 BY -1 DO
 				ASSERT((format[curr] = " ") OR (format[curr] = "1")
-					 OR (format[curr] = "0") OR (format[curr] = "X")
-					 OR (format[curr] = "U") OR (format[curr] = "Q")
-					 OR (format[curr] = "F") OR (format[curr] = "L")
-					 OR (format[curr] = "S") OR (format[curr] = "o"));
+					OR (format[curr] = "0") OR (format[curr] = "X")
+					OR (format[curr] = "U") OR (format[curr] = "Q")
+					OR (format[curr] = "F") OR (format[curr] = "L")
+					OR (format[curr] = "S") OR (format[curr] = "o"));
 				CASE format[curr] OF
-					 " ":
+					|" ":
 					|"0": INCL(diffBits, count); INC(count)
 					|"1": INCL(setBits, count); INCL(diffBits, count); INC(count)
 					|"X": INC(count)
@@ -2210,7 +2204,6 @@ CONST
 
 		FOR i := 0 TO NumberRegisterEntries-1 DO ASSERT(registerEntries[i].name # "") END;
 
-
 		(* enter condition names (note that the preferred name, i.e. alias, is entered after the other variants) *)
 		conditionEntryCount := 0;
 		EnterCondition(conditionEQ, "EQ");
@@ -2600,11 +2593,11 @@ CONST
 		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);
-		EnterNEONInstruction(opISB, 		"1111 0101 0111 1111 1111 0000 0110 1111", {}, None, None, None, None, None, None);
-		EnterNEONInstruction(opLSL, 		"XXXX 0001 1010 0000 XXXX XXXX X000 XXXX", {flagCondition, flagS}, encodingR12, encodingR0, encodingImm7to11, None, 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);
+		EnterNEONInstruction(opISB, "1111 0101 0111 1111 1111 0000 0110 1111", {}, None, None, None, None, None, None);
+		EnterNEONInstruction(opLSL, "XXXX 0001 1010 0000 XXXX XXXX X000 XXXX", {flagCondition, flagS}, encodingR12, encodingR0, encodingImm7to11, None, None, None);
 		EnterNEONInstruction(opLSL, "XXXX 0001 1010 0000 XXXX XXXX 0001 XXXX", {flagCondition, flagS}, encodingR12, encodingR0, encodingR8, None, None, None);
 		EnterNEONInstruction(opLSR, "XXXX 0001 1010 0000 XXXX XXXX X010 XXXX", {flagCondition, flagS}, encodingR12, encodingR0, encodingImm7to11, None, None, None);
 		EnterNEONInstruction(opSEV, "XXXX 0011 0010 0000 1111 0000 0000 0100", {flagCondition}, None, None, None, None, None, None);
@@ -2926,7 +2919,6 @@ CONST
 		END;
 	END Disassemble;
 
-
 BEGIN Init;
 END FoxARMInstructionSet.
 

+ 55 - 72
source/FoxActiveCells.Mod

@@ -238,7 +238,6 @@ TYPE
 			RETURN TRUE
 		END Same;
 
-
 	END PortList;
 
 	(* devices are additional components that can be attached to processors
@@ -260,7 +259,6 @@ TYPE
 			RETURN Same^(as, flags)
 		END Same;
 
-
 		PROCEDURE &InitDevice*(CONST name: ARRAY OF CHAR; scope: Scope; adr: LONGINT);
 		BEGIN
 			InitSymbol(name,scope);
@@ -322,7 +320,6 @@ TYPE
 			RETURN TRUE
 		END Same;
 
-
 	END DeviceList;
 
 	(*
@@ -406,7 +403,6 @@ TYPE
 			RETURN TRUE
 		END Same;
 
-
 	END ModuleList;
 
 	(*
@@ -456,7 +452,6 @@ TYPE
 			parameterType := String; string := Strings.NewString(s);
 		END SetString;
 
-
 		PROCEDURE Write(w: Streams.Writer; indent: LONGINT);
 		VAR typeName: SyntaxTree.String;
 		BEGIN
@@ -591,7 +586,6 @@ TYPE
 			END;
 		END SetType;
 
-
 		PROCEDURE SetInstructionMemorySize*(value: LONGINT);
 		BEGIN instructionMemorySize := value
 		END SetInstructionMemorySize;
@@ -804,7 +798,7 @@ TYPE
 			NEW(type,name,SELF);
 			types.AddType(type);
 			symbols.AddSymbol(type);
-			 RETURN type
+			RETURN type
 		END NewType;
 
 		PROCEDURE ForEachInstanceDo*(method: InstanceMethod): BOOLEAN;
@@ -823,7 +817,6 @@ TYPE
 			RETURN TRUE
 		END ForEachInstanceDo;
 
-
 		PROCEDURE ForEachTypeDo*(method: TypeMethod): BOOLEAN; (* used for linking *)
 		VAR type: Type; i: LONGINT;
 		BEGIN
@@ -880,7 +873,6 @@ TYPE
 			RETURN TRUE (*RETURN Same^(as, flags)*)
 		END Same;
 
-
 		PROCEDURE & InitType*(CONST name: ARRAY OF CHAR; scope: Scope);
 		BEGIN
 			InitScope(name,scope,scope.specification);
@@ -925,8 +917,6 @@ TYPE
 			RETURN module;
 		END NewModule;
 
-
-
 		(*
 		PROCEDURE ThisPort(CONST name: ARRAY OF CHAR): Port;
 		VAR type: Type; port:Port; i: LONGINT;
@@ -984,11 +974,11 @@ TYPE
 			ELSE
 				msg := "could not link ";
 				Strings.Append(msg,linkRoot);
-				 FOR i := 0 TO modules.Length()-1 DO
-				 	module := modules.GetModule(i);
-				 	Strings.Append(msg," "); Strings.Append(msg,module.name);
-				 END;
-				 diagnostics.Error("",Streams.Invalid, msg);
+				FOR i := 0 TO modules.Length()-1 DO
+					module := modules.GetModule(i);
+					Strings.Append(msg," "); Strings.Append(msg,module.name);
+				END;
+				diagnostics.Error("",Streams.Invalid, msg);
 			END;
 			RETURN ~linker.error
 		END LinkType;
@@ -1137,7 +1127,6 @@ TYPE
 		widthInBits-: LONGINT;
 		index-: LONGINT; (* useful for implementations that emulate channels (simulator) *)
 
-
 		PROCEDURE Same*(as: Symbol; flags: SET): BOOLEAN;
 		BEGIN
 			IF TraceSame THEN TRACE("Channel",name) END;
@@ -1259,7 +1248,6 @@ TYPE
 			RETURN TRUE
 		END Same;
 
-
 	END ChannelList;
 
 	(*
@@ -1456,7 +1444,6 @@ TYPE
 
 	END Specification;
 
-
 	(*
 	PROCEDURE ReadHugeint(r: Streams.Reader; VAR x: HUGEINT): BOOLEAN;
 	VAR low, high: LONGINT;
@@ -1571,8 +1558,6 @@ TYPE
 		IF spec1.Same(spec2, {}) THEN context.out.String("Specifications are equal") ELSE context.out.String("specifications are not equal"); END;
 	END CompareSpecification;
 
-
-
 	(*
 	(**
 		Load an ActiveCells specification
@@ -1680,58 +1665,57 @@ TYPE
 		(* does nothing -- for compatibility with ActiveCells2 *)
 	END Clone;
 
-
 	PROCEDURE FlattenNetwork*(scope: Scope);
 	VAR instance,subInstance,newInstance: Instance; oldChannel,channel: Channel;
-		 instances: InstanceList; channels: ChannelList;
-		 i,j: LONGINT; name: SyntaxTree.String;
-		 port: Port;
-
-		 PROCEDURE FlattenPortInstance(VAR pi: PortInstance);
-		 VAR name: Name; port, prevPort: Port; instance: Instance;
-		 BEGIN
-		 	IF pi.port # NIL THEN
-			 	port := pi.port.delegate.port;
-			 	IF port # NIL THEN
-				 	instance := pi.port.delegate.instance;
-				 	ASSERT(instance # NIL);
-			 		COPY(pi.instance.name,name);
-			 		(* iteratively resolve port delegation and build local instance name *)
-			 		WHILE  port # NIL DO
-			 			prevPort := port;
-			 			ASSERT(instance # NIL);
-				 		Strings.Append(name,"."); Strings.Append(name,instance.name);
-				 		instance := port.delegate.instance;
-				 		port := port.delegate.port;
-				 	END;
-				 	port := prevPort;
-				 	instance := instances.ByName(name);
-				 	ASSERT(port # NIL);
-				 	ASSERT(instance # NIL);
-				 	pi.instance := instance;
-				 	pi.port := port;
-			 	END;
-			 END;
-		 END FlattenPortInstance;
-
-		 PROCEDURE EmbedInstance(instance: Instance; VAR subInstance: Instance): Instance;
-		 VAR name: Name; newInstance: Instance; i: LONGINT; parameter,newParameter: Parameter;
-		 BEGIN
-		 	COPY(instance.name, name); Strings.Append(name,"."); Strings.Append(name,subInstance.name);
-		 	newInstance := instances.ByName(name);
-		 	IF newInstance = NIL THEN
-		 		NEW(newInstance, name, scope, subInstance.instanceType);
-		 		FOR i := 0 TO subInstance.parameters.Length()-1 DO
-		 			parameter := subInstance.parameters.GetParameter(i);
-		 			newParameter := newInstance.AddParameter(parameter.name);
-		 			newParameter.index := parameter.index;
-		 			newParameter.parameterType := parameter.parameterType;
-		 			newParameter.integer := parameter.integer;
-		 			newParameter.boolean := parameter.boolean;
-		 		END;
-		 	END;
-		 	RETURN newInstance
-		 END EmbedInstance;
+		instances: InstanceList; channels: ChannelList;
+		i, j: LONGINT; name: SyntaxTree.String;
+		port: Port;
+
+		PROCEDURE FlattenPortInstance(VAR pi: PortInstance);
+		VAR name: Name; port, prevPort: Port; instance: Instance;
+		BEGIN
+			IF pi.port # NIL THEN
+				port := pi.port.delegate.port;
+				IF port # NIL THEN
+					instance := pi.port.delegate.instance;
+					ASSERT(instance # NIL);
+					COPY(pi.instance.name,name);
+					(* iteratively resolve port delegation and build local instance name *)
+					WHILE  port # NIL DO
+						prevPort := port;
+						ASSERT(instance # NIL);
+						Strings.Append(name,"."); Strings.Append(name,instance.name);
+						instance := port.delegate.instance;
+						port := port.delegate.port;
+					END;
+					port := prevPort;
+					instance := instances.ByName(name);
+					ASSERT(port # NIL);
+					ASSERT(instance # NIL);
+					pi.instance := instance;
+					pi.port := port;
+				END;
+			END;
+		END FlattenPortInstance;
+
+		PROCEDURE EmbedInstance(instance: Instance; VAR subInstance: Instance): Instance;
+		VAR name: Name; newInstance: Instance; i: LONGINT; parameter,newParameter: Parameter;
+		BEGIN
+			COPY(instance.name, name); Strings.Append(name,"."); Strings.Append(name,subInstance.name);
+			newInstance := instances.ByName(name);
+			IF newInstance = NIL THEN
+				NEW(newInstance, name, scope, subInstance.instanceType);
+				FOR i := 0 TO subInstance.parameters.Length()-1 DO
+					parameter := subInstance.parameters.GetParameter(i);
+					newParameter := newInstance.AddParameter(parameter.name);
+					newParameter.index := parameter.index;
+					newParameter.parameterType := parameter.parameterType;
+					newParameter.integer := parameter.integer;
+					newParameter.boolean := parameter.boolean;
+				END;
+			END;
+			RETURN newInstance
+		END EmbedInstance;
 
 	BEGIN
 		IF scope.instances.Length()=0 THEN RETURN END;
@@ -1822,7 +1806,6 @@ TYPE
 		platform.specLoader := LoadSpecificationDefault;
 	END InitMod;
 
-
 BEGIN
 	InitMod;
 	*)

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 101 - 128
source/FoxArrayBase.Mod


+ 38 - 42
source/FoxAssembler.Mod

@@ -15,7 +15,6 @@ CONST
 			- expressions with labels would not work
 			- fixup mechanism complicated and not generic
 
-
 	*)
 	MaxPasses* = 2;
 
@@ -366,7 +365,6 @@ TYPE
 			IF (symbol # NIL) THEN RETURN symbol.fingerprint.shallow END;
 		END GetFingerprint;
 
-
 		PROCEDURE NonConstantSymbol(pos: Position; symbol: SyntaxTree.Symbol; VAR result: Result): BOOLEAN;
 		VAR
 			name: Basic.SegmentedName; moduleScope: SyntaxTree.Scope; fixupSection: IntermediateCode.Section;
@@ -886,7 +884,6 @@ TYPE
 			AllSections;
 		END Text;
 
-
 	END Assembler;
 
 	PROCEDURE DumpResult*(w: Streams.Writer; result: Result);
@@ -926,7 +923,6 @@ END FoxAssembler.
 
 System.Free FoxAssembler ~
 
-
 FoxAssembler.Test
 ;---------------- intermediate code -----------------
 .module BitSets
@@ -934,34 +930,34 @@ FoxAssembler.Test
 .imports SYSTEM
 
 .const BitSets.@moduleSelf offset=0
-	 0: data u32 0
+	0: data u32 0
 
 .const BitSets.BitSet offset=0
-	 0: data u32 0
+	0: data u32 0
 
 .code BitSets.BitSet.InitBitSet offset=0
-	 0: enter  0,  0
-	 1: mov u32 r1, u32 [fp+8]
-	 2: mov s32 [r1], s32 [fp+12]
-	 3: push s32 [fp+12]
-	 4: mov u32 r2, u32 [fp+8]
-	 5: add u32 r3, u32 [r2-4], u32 -88
-	 6: push u32 r2
-	 7: call u32 [r3],  8
-	 8: leave  0
-	 9: exit  8
+	0: enter  0,  0
+	1: mov u32 r1, u32 [fp+8]
+	2: mov s32 [r1], s32 [fp+12]
+	3: push s32 [fp+12]
+	4: mov u32 r2, u32 [fp+8]
+	5: add u32 r3, u32 [r2-4], u32 -88
+	6: push u32 r2
+	7: call u32 [r3],  8
+	8: leave  0
+	9: exit  8
 
 .code BitSets.BitSet.Zero offset=0
-	 0: enter  0,  8
-	 1: mov s32 [fp-4], s32 0
-	 2: mov u32 r1, u32 [fp+8]
-	 3: mov u32 r2, u32 [r1+4]
-	 4: conv s32 r3, u32 [r2+12]
-	 5: sub s32 r3, s32 r3, s32 1
-	 6: mov s32 [fp-8], s32 r3
-	 7: brlt u32 BitSets.BitSet.Zero:21, s32 [fp-8], s32 [fp-4]
-	 8: br u32 BitSets.BitSet.Zero:9
-	 9: conv u32 r4, s32 [fp-4]
+	0: enter  0,  8
+	1: mov s32 [fp-4], s32 0
+	2: mov u32 r1, u32 [fp+8]
+	3: mov u32 r2, u32 [r1+4]
+	4: conv s32 r3, u32 [r2+12]
+	5: sub s32 r3, s32 r3, s32 1
+	6: mov s32 [fp-8], s32 r3
+	7: brlt u32 BitSets.BitSet.Zero:21, s32 [fp-8], s32 [fp-4]
+	8: br u32 BitSets.BitSet.Zero:9
+	9: conv u32 r4, s32 [fp-4]
 	10: mov u32 r5, u32 r4
 	11: mov u32 r6, u32 [fp+8]
 	12: mov u32 r7, u32 [r6+4]
@@ -977,16 +973,16 @@ FoxAssembler.Test
 	22: exit  4
 
 .code BitSets.BitSet.Resize offset=0
-	 0: enter  0,  12
-	 1: brlt u32 BitSets.BitSet.Resize:3, s32 [fp+12], s32 0
-	 2: br u32 BitSets.BitSet.Resize:4
-	 3: trap  8
-	 4: mov u32 r1, u32 [fp+8]
-	 5: mov s32 [r1], s32 [fp+12]
-	 6: sub s32 r2, s32 [fp+12], s32 1
-	 7: brlt u32 BitSets.BitSet.Resize:10, s32 r2, s32 0
-	 8: mov s32 r2, s32 r2
-	 9: br u32 BitSets.BitSet.Resize:11
+	0: enter  0,  12
+	1: brlt u32 BitSets.BitSet.Resize:3, s32 [fp+12], s32 0
+	2: br u32 BitSets.BitSet.Resize:4
+	3: trap  8
+	4: mov u32 r1, u32 [fp+8]
+	5: mov s32 [r1], s32 [fp+12]
+	6: sub s32 r2, s32 [fp+12], s32 1
+	7: brlt u32 BitSets.BitSet.Resize:10, s32 r2, s32 0
+	8: mov s32 r2, s32 r2
+	9: br u32 BitSets.BitSet.Resize:11
 	10: mov s32 r2, s32 0, s32 r2
 	11: shr s32 r2, s32 r2, s32 5
 	12: add s32 r2, s32 r2, s32 1
@@ -1068,9 +1064,9 @@ FoxAssembler.Test
 	88: exit  8
 
 .code BitSets.BitSet.GetSize offset=0
-	 0: enter  0,  0
-	 1: mov u32 r1, u32 [fp+8]
-	 2: return s32 [r1]
-	 3: leave  0
-	 4: exit  4
-	 5: trap  3
+	0: enter  0,  0
+	1: mov u32 r1, u32 [fp+8]
+	2: return s32 [r1]
+	3: leave  0
+	4: exit  4
+	5: trap  3

+ 1 - 4
source/FoxBackend.Mod

@@ -3,7 +3,6 @@ MODULE FoxBackend; (**  AUTHOR "kaeserm,fof"; PURPOSE "Oberon Compiler: Common b
 IMPORT
 	Streams, Diagnostics, Basic := FoxBasic, Global := FoxGlobal, Formats := FoxFormats, SyntaxTree := FoxSyntaxTree, SemanticChecker := FoxSemanticChecker, Options, Strings;
 
-
 TYPE
 	SectionName = ARRAY 256 OF CHAR;
 
@@ -89,8 +88,6 @@ TYPE
 			RETURN Global.DefaultSystem();
 		END GetSystem;
 
-
-
 		PROCEDURE Error*(CONST source: ARRAY OF CHAR; position: Basic.Position; errorNumber: LONGINT; CONST err: ARRAY OF CHAR);
 		BEGIN
 			IF (errorNumber # Basic.InvalidCode) OR (err # "") THEN
@@ -183,4 +180,4 @@ TYPE
 		ASSERT(b);
 	END Assert;
 
-END FoxBackend.
+END FoxBackend.

+ 20 - 28
source/FoxBasic.Mod

@@ -1,7 +1,6 @@
 MODULE FoxBasic;   (**  AUTHOR "fof"; PURPOSE "Oberon Compiler: basic helpers: strings, lists, hash tables, graphs, indented writer";  **)
 (* (c) fof ETH Zürich, 2009 *)
 
-
 IMPORT KernelLog, StringPool, Strings, Streams, Diagnostics, Files, SYSTEM, ObjectFile, Modules, D:= Debugging;
 
 CONST
@@ -469,7 +468,6 @@ TYPE
 		value: ANY;
 	END;
 
-
 	HashAnyArray = POINTER TO ARRAY OF HashEntryAny;
 	HashIntArray = POINTER TO ARRAY OF HashEntryInt;
 
@@ -605,7 +603,6 @@ TYPE
 			RETURN TRUE;
 		END GetNext;
 
-
 	END IntIterator;
 
 	HashTableInt* = OBJECT
@@ -819,7 +816,6 @@ TYPE
 
 	END HashTableSegmentedName;
 
-
 	(* Hash table supporting 2 keys *)
 	HashTable2D* = OBJECT(HashTable);
 	VAR
@@ -1183,7 +1179,7 @@ TYPE
 		END ReIndex;
 
 		(* Calculate dominance tree. Algorithm taken from:
-		    "A simple, fast dominance algorithm" (Cooper, Harvey, Kennedy) *)
+			"A simple, fast dominance algorithm" (Cooper, Harvey, Kennedy) *)
 		PROCEDURE CalculateDominance*;
 		VAR
 			doms: IndexList;
@@ -1751,21 +1747,22 @@ VAR
 	PROCEDURE ErrorC*(diagnostics: Diagnostics.Diagnostics; CONST source: ARRAY OF CHAR; pos: Position; code: ErrorCode; CONST msg: ARRAY OF CHAR);
 	VAR message: ARRAY 1024 OF CHAR; file: Files.File;
 
-	    PROCEDURE GetReader(): Streams.Reader;
-	    VAR reader := NIL: Streams.Reader; fileReader : Files.Reader;
-	    BEGIN
-            IF (pos.linepos >= 0) & ((source # "") OR (pos.reader # NIL)) THEN
-                reader := pos.reader;
-                IF reader = NIL THEN
-                    file := Files.Old(source);
-                    IF file # NIL THEN
-			NEW (fileReader, file, pos.linepos);
-                        reader := fileReader;
-                    END;
-                END;
-            END;
-            RETURN reader;
-	    END GetReader;
+		PROCEDURE GetReader(): Streams.Reader;
+		VAR reader := NIL: Streams.Reader; fileReader : Files.Reader;
+		BEGIN
+			IF (pos.linepos >= 0) & ((source # "") OR (pos.reader # NIL)) THEN
+				reader := pos.reader;
+				IF reader = NIL THEN
+					file := Files.Old(source);
+					IF file # NIL THEN
+						NEW (fileReader, file, pos.linepos);
+						reader := fileReader;
+					END;
+				END;
+			END;
+			RETURN reader;
+		END GetReader;
+
 	BEGIN
 		IF diagnostics # NIL THEN
 			MakeDetailedMessage(pos, code, msg, GetReader(), message);
@@ -1779,8 +1776,6 @@ VAR
 		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;
 	BEGIN
@@ -1957,7 +1952,6 @@ VAR
 		END;
 	END GetSuffix;
 
-
 	PROCEDURE IsPrefix*(CONST prefix, of: SegmentedName): BOOLEAN;
 	VAR prefixS, ofS: SectionName; i: LONGINT;
 	BEGIN
@@ -2134,7 +2128,6 @@ VAR
 		RETURN GetDiagnostics(w);
 	END GetDefaultDiagnostics;
 
-
 	PROCEDURE InitWindowWriter;
 	VAR install: PROCEDURE;
 	BEGIN
@@ -2147,9 +2140,9 @@ VAR
 
 	PROCEDURE InstallWriterFactory*(writer: WriterFactory; debug: DebugWriterFactory; diagnostics: DiagnosticsFactory);
 	BEGIN
-		 getWriter := writer;
-		 getDebugWriter := debug;
-		 getDiagnostics := diagnostics;
+		getWriter := writer;
+		getDebugWriter := debug;
+		getDiagnostics := diagnostics;
 	END InstallWriterFactory;
 
 	PROCEDURE Replace(VAR in: ARRAY OF CHAR; CONST this, by: ARRAY OF CHAR);
@@ -2293,5 +2286,4 @@ END FoxBasic.
 
 FoxBasic.ActivateDebug ~
 
-
 FoxBasic.Test ~

+ 22 - 30
source/FoxBinaryCode.Mod

@@ -186,7 +186,6 @@ TYPE
 		prev-: LabelList;
 	END;
 
-
 	Section* = OBJECT
 	VAR
 		os*: ObjectFile.Section;
@@ -203,7 +202,6 @@ TYPE
 			RETURN pc
 		END GetPC;
 
-
 		PROCEDURE & InitBinarySection*(type: SHORTINT; unit: Bits; CONST name:Basic.SegmentedName; dump: BOOLEAN; bigEndian: BOOLEAN);
 		BEGIN
 			ASSERT(unit > 0);
@@ -239,7 +237,6 @@ TYPE
 			pc := 0;
 		END Reset;
 
-
 		PROCEDURE AddLabel*(position: Basic.Position);
 		VAR new: LabelList;
 		BEGIN
@@ -264,7 +261,6 @@ TYPE
 			SetPC(pc + (-pc) MOD alignment)
 		END Align;
 
-
 		PROCEDURE SetFinally*(atPC: Unit);
 		BEGIN finally := atPC
 		END SetFinally;
@@ -370,7 +366,6 @@ TYPE
 			INC(pc,(8*Byte) DIV os.unit);
 		END PutQWord;
 
-
 		PROCEDURE PutReal*(f: REAL);
 		BEGIN
 			PutDWord(ConvertReal(f))
@@ -547,7 +542,6 @@ TYPE
 				END;
 			END Hex;
 
-
 			PROCEDURE DumpUnit(at: Unit);
 			VAR val: WORD; a: ARRAY 9 OF CHAR; bits: Bits;
 			BEGIN
@@ -632,17 +626,17 @@ TYPE
 	VAR result: LONGINT; VAR exponent, i: INTEGER;
 	BEGIN
 		(*! NaN code missing, we need an extra - machine specific - functionality for that  / cf. Streams.NaNCode *)
-	    IF value = 0 THEN RETURN 0 END;
-	    result := 0; exponent := 0;
-	    IF value < 0 THEN value := -value; result := ASH (1, Exponent) END;
-	    WHILE value < 1 DO value := value * 2; DEC (exponent) END;
-	    WHILE value >= 2 DO value := value / 2; INC (exponent) END;
-	    value := value - 1; INC (result, ASH (1, Exponent - 1) - 1 + exponent);
-	    FOR i := 0 TO Significant - 1 DO
-	        value := value * 2; INC (result, result);
-	        IF value >= 1 THEN value := value - 1; INC (result) END;
-	    END;
-	    RETURN result;
+		IF value = 0 THEN RETURN 0 END;
+		result := 0; exponent := 0;
+		IF value < 0 THEN value := -value; result := ASH (1, Exponent) END;
+		WHILE value < 1 DO value := value * 2; DEC (exponent) END;
+		WHILE value >= 2 DO value := value / 2; INC (exponent) END;
+		value := value - 1; INC (result, ASH (1, Exponent - 1) - 1 + exponent);
+		FOR i := 0 TO Significant - 1 DO
+			value := value * 2; INC (result, result);
+			IF value >= 1 THEN value := value - 1; INC (result) END;
+		END;
+		RETURN result;
 	END ConvertReal;
 
 	PROCEDURE ConvertLongreal*(value: LONGREAL): HUGEINT;
@@ -650,17 +644,17 @@ TYPE
 	VAR result: HUGEINT; VAR exponent, i: INTEGER;
 	BEGIN
 		(*! NaN code missing, we need an extra - machine specific - functionality for that  / cf. Streams.NaNCode *)
-	    IF value = 0 THEN RETURN 0 END;
-	    result := 0; exponent := 0;
-	    IF value < 0 THEN value := -value; result := ASH (1, Exponent) END;
-	    WHILE value < 1 DO value := value * 2; DEC (exponent) END;
-	    WHILE value >= 2 DO value := value / 2; INC (exponent) END;
-	    value := value - 1; INC (result, ASH (1, Exponent - 1) - 1 + exponent);
-	    FOR i := 0 TO Significant - 1 DO
-	        value := value * 2; INC (result, result);
-	        IF value >= 1 THEN value := value - 1; INC (result) END;
-	    END;
-	    RETURN result;
+		IF value = 0 THEN RETURN 0 END;
+		result := 0; exponent := 0;
+		IF value < 0 THEN value := -value; result := ASH (1, Exponent) END;
+		WHILE value < 1 DO value := value * 2; DEC (exponent) END;
+		WHILE value >= 2 DO value := value / 2; INC (exponent) END;
+		value := value - 1; INC (result, ASH (1, Exponent - 1) - 1 + exponent);
+		FOR i := 0 TO Significant - 1 DO
+			value := value * 2; INC (result, result);
+			IF value >= 1 THEN value := value - 1; INC (result) END;
+		END;
+		RETURN result;
 	END ConvertLongreal;
 
 	PROCEDURE ConvertToReal*(x: LONGINT): REAL;
@@ -731,7 +725,6 @@ TYPE
 		NEW(binarySection,type,unit,name,dump,bigEndian); RETURN binarySection
 	END NewBinarySection;
 
-
 END FoxBinaryCode.
 
 FoxBinaryCode.TestFixup
@@ -779,4 +772,3 @@ FoxBinaryCode.TestFixup
 		data2.Dump(D.Log); D.Ln;
 	END TestFixup;
 	*)
-

+ 0 - 3
source/FoxCSharpParser.Mod

@@ -14,8 +14,6 @@ CONST
 
     LynxCase = FoxScanner.Lowercase;
 
-
-
 TYPE
 	Position*= Scanner.Position;
 
@@ -1681,7 +1679,6 @@ KernelLog.Ln();
             switch-block:
                 '{' [switch-sections] '}'
 
-
             switch-sections:
                 switch-section
                 switch-sections switch-section

+ 1 - 1
source/FoxCSharpScanner.Mod

@@ -160,7 +160,7 @@ TYPE
         the last read input from the scanner to the parser
     **)
     Symbol* = RECORD
-    	position*: Position;
+        position*: Position;
         token*: Token;
         identifier*: IdentifierType;
         identifierString*: IdentifierString;

+ 3 - 12
source/FoxCodeGenerators.Mod

@@ -145,7 +145,6 @@ TYPE
 			error := TRUE;
 		END Error;
 
-
 		(* generic *)
 		PROCEDURE Section*(in: IntermediateCode.Section; out: BinaryCode.Section);
 		VAR pc: LONGINT; name: Basic.SectionName; instruction: IntermediateCode.Instruction;
@@ -302,7 +301,6 @@ TYPE
 
 			BEGIN
 
-
 				first := NIL;
 				FOR pc := 0 TO in.pc-1 DO
 					IF OptimizeRegisterTransfer IN optimize THEN
@@ -329,7 +327,6 @@ TYPE
 				Use(instruction.op3);
 			END DumpInstruction;
 
-
 			PROCEDURE Emulate(VAR x: IntermediateCode.Instruction; CONST moduleName,procedureName: SyntaxTree.IdentifierString);
 			VAR
 				parSize: LONGINT; sectionName: Basic.SegmentedName; source: Sections.Section; op: IntermediateCode.Operand;
@@ -376,7 +373,7 @@ TYPE
 				hasDestination := (IntermediateCode.Op1IsDestination IN IntermediateCode.instructionFormat[x.opcode].flags);
 				ASSERT(x.op1.mode # IntermediateCode.Undefined);
 
-				(* 	add import to import list -- raw insert, no check.
+				(*	add import to import list -- raw insert, no check.
 					checks will be performed by loader or linker -- we assume that a low-level runtime system programmer knows what he is doing
 				*)
 				SaveRegisters;
@@ -445,7 +442,6 @@ TYPE
 				END;
 			END SetLiveness;
 
-
 		BEGIN
 			inEmulation := FALSE;
 			Basic.SegmentedNameToString(in.name, name);
@@ -512,7 +508,6 @@ TYPE
 
 		(* ---------------------- generically available code emission ------------------------- *)
 
-
 		PROCEDURE GetDataSection*(): IntermediateCode.Section;
 		VAR name: Basic.SegmentedName; section: IntermediateCode.Section;
 		BEGIN
@@ -570,16 +565,14 @@ TYPE
 
 	(* ----------------------- ticket based register allocation ------------------------------------- *)
 
-
 		(* register mapping scheme
-			virtual register number	--> register mapping   = 		part(0)		-->	ticket	<-->	physical register
+			virtual register number	--> register mapping   =		part(0)		-->	ticket	<-->	physical register
 																											spill offset
 
 																	part(n)		-->	ticket	<-->	physical register
 																											spill offset
 		*)
 
-
 	Ticket*=POINTER TO RECORD
 		next-: Ticket;
 		type-: IntermediateCode.Type;
@@ -755,7 +748,6 @@ TYPE
 		PROCEDURE &InitPhysicalRegisters;
 		END InitPhysicalRegisters;
 
-
 		PROCEDURE Allocate*(index: LONGINT; virtualRegister: Ticket);
 		END Allocate;
 
@@ -788,10 +780,9 @@ TYPE
 		BEGIN
 		END NumberRegisters;
 
-
 	END PhysicalRegisters;
 
-	CONST 	MaxSpilledRegisters=64;
+	CONST MaxSpilledRegisters=64;
 
 	TYPE
 	SpillStack*=OBJECT

+ 3 - 10
source/FoxDisassembler.Mod

@@ -2,7 +2,6 @@ MODULE FoxDisassembler; (** AUTHOR ""; PURPOSE ""; *)
 
 IMPORT Streams, ObjectFile, Scanner := FoxScanner, Basic := FoxBasic, BitSets, D := Debugging, Files, Commands;
 
-
 CONST Trace = FALSE;
 TYPE
 	Block*= POINTER TO RECORD (ObjectFile.Section)
@@ -228,7 +227,6 @@ TYPE
 			dataDisplacement := data;
 		END SetDisplacements;
 
-
 	END Disassembler;
 
 	PROCEDURE FindPC*(context: Commands.Context);
@@ -256,18 +254,14 @@ TYPE
 		END;
 	END FindPC;
 
-
-
-
-
 	(*
 	PROCEDURE Test*(context: Commands.Context);
 	VAR filename: Files.FileName; name: ObjectFile.SectionName; block: Block;
 	BEGIN
 		IF context.arg.GetString(filename) THEN
-		file := Files.Old(filename);
-		IF file = NIL THEN (* error *) HALT(100) END;
-		 block := ParseLogFile(filename);
+			file := Files.Old(filename);
+			IF file = NIL THEN (* error *) HALT(100) END;
+			block := ParseLogFile(filename);
 			WHILE block # NIL DO
 				Basic.SegmentedNameToString(block.identifier.name, name);
 				context.out.String(name); context.out.String(" at "); context.out.Int(block.alignment,1); context.out.Ln;
@@ -281,4 +275,3 @@ END FoxDisassembler.
 
 System.FreeDownTo FoxDisassembler ~
 FoxDisassembler.Test ins.log ~
-

+ 1 - 16
source/FoxDocumentationBackend.Mod

@@ -131,8 +131,6 @@ The following describes how a documentation is generated from a module:
 
 **)
 
-
-
 IMPORT Basic := FoxBasic, SyntaxTree := FoxSyntaxTree, Global := FoxGlobal, Scanner := FoxScanner, Backend := FoxBackend, Formats := FoxFormats,
 		Options, Streams, Strings, SymbolFileFormat := FoxTextualSymbolFile, Diagnostics,
 		DocumentationTree := FoxDocumentationTree, DocumentationPrinter := FoxDocumentationPrinter, DocumentationHtml := FoxDocumentationHtml, DocumentationParser := FoxDocumentationParser, DocumentationScanner := FoxDocumentationScanner,
@@ -778,7 +776,6 @@ TYPE
 			RETURN FALSE
 		END NeedsSection;
 
-
 		PROCEDURE ExtractParameters(x: SyntaxTree.ProcedureType; doc: DocumentationTree.Document; VAR parameters: DocumentationTree.Document);
 		VAR par: SyntaxTree.Parameter; paragraph,heading: DocumentationTree.Paragraph; i: LONGINT; element: DocumentationTree.TextElement;
 			string: DocumentationTree.String; id: SyntaxTree.Identifier; done: BOOLEAN;
@@ -818,7 +815,6 @@ TYPE
 			END;
 		END ExtractParameters;
 
-
 		PROCEDURE WriteSymbolSection(x: SyntaxTree.Symbol);
 		VAR section: DocumentationTree.Section; paragraph: DocumentationTree.Paragraph; commentDoc: DocumentationTree.Document;
 			parameters: DocumentationTree.Document;
@@ -828,7 +824,6 @@ TYPE
 
 				parameterDocument := NIL;
 
-
 				IF x.comment # NIL THEN
 					commentDoc := DocumentationTree.NewDocument();
 					ParseComments(commentDoc,x.comment, NIL,x);
@@ -1008,7 +1003,6 @@ TYPE
 			current.text.WriteWhitespace
 		END Whitespace;
 
-
 		PROCEDURE VisitOperator*(x: SyntaxTree.Operator);
 		BEGIN VisitProcedure(x);
 		END VisitOperator;
@@ -1088,7 +1082,6 @@ TYPE
 
 			paragraph: DocumentationTree.Paragraph;
 
-
 		BEGIN
 			prevScope := current.scope;
 			current.scope := x;
@@ -1098,7 +1091,6 @@ TYPE
 			paragraph := paragraphs.AppendNew(ParagraphType.Table);
 			current.text := paragraph.text;
 
-
 			short := TRUE;
 
 			IF x IS SyntaxTree.ModuleScope THEN
@@ -1516,8 +1508,6 @@ TYPE
 		text.WriteLabel(label);
 	END WriteSymbolLabel;
 
-
-
 	PROCEDURE WriteReferenceInScope*(text: DocumentationTree.Text; symbol: SyntaxTree.Symbol; inScope: SyntaxTree.Scope);
 	VAR n: SyntaxTree.IdentifierString; td: SyntaxTree.TypeDeclaration; name: Basic.SectionName; write: BOOLEAN;
 		PROCEDURE Scope(scope: SyntaxTree.Scope);
@@ -1589,7 +1579,7 @@ TYPE
 	BEGIN
 		description := document.description;
 		FOR i := document.sections.Length()-1 TO 0 BY -1 DO
-		 section := document.sections.GetSection(i);
+			section := document.sections.GetSection(i);
 			IF (section.label # NIL) THEN
 				IF section.label^= "author" THEN
 					par := description.AppendNew(ParagraphType.Heading);
@@ -1781,15 +1771,12 @@ TYPE
 
 	END MergeSectionDocument;
 
-
 	PROCEDURE Get*(): Backend.Backend;
 	VAR documentationBackend: DocumentationBackend;
 	BEGIN
 		NEW(documentationBackend); RETURN documentationBackend;
 	END Get;
 
-
-
 END FoxDocumentationBackend.
 
 ~~
@@ -1816,12 +1803,10 @@ The following is a bulleted list
 	\* Bullet1
 	\* Bullet2
 
-
 	This is  a normal text with *
 
 There may be references like this: [[Get|FoxDocumentationBackend.Get]]
 
-
 *)
 
 System.Free FoxDocumentationHtml FoxDocumentationBackend FoxDocumentationParser FoxDocumentationPrinter FoxDocumentationTree FoxDocumentationScanner ~

+ 7 - 10
source/FoxDocumentationHtml.Mod

@@ -168,7 +168,7 @@ TYPE
 			|ElementType.Link:
 				writer.String('<a href="'); writer.String("#"); WriteString(writer,textElement.string);  writer.String('">');
 				IF textElement.text.Length()#0 THEN
-					 Text(textElement.text);
+					Text(textElement.text);
 				ELSE WriteString( writer, textElement.string);
 				END;
 				writer.String("</a>");
@@ -179,7 +179,6 @@ TYPE
 			END;
 		END TextElement;
 
-
 		PROCEDURE Text*(text: Tree.Text);
 		VAR element: Tree.TextElement; i: LONGINT;
 		BEGIN
@@ -201,25 +200,25 @@ TYPE
 				normal {
 				font-family: Helvetica, Sans-Serif;
 				}
-			  .bold {
+			.bold {
 				font-family: Helvetica, Sans-Serif;
 				}
-			  H1 {
+			H1 {
 				color: #550088
 				}
-			  H2 {
+			H2 {
 				font-family: Helvetica, Sans-Serif;
 				color: #550088
 				}
-			  H3 {
+			H3 {
 				font-family: Helvetica, Sans-Serif;
 				color: #550088
 				}
-			  H4 {
+			H4 {
 				font-family: Helvetica, Sans-Serif;
 				color: #550088
 				}
-			  A {
+			A {
 				color: #550088
 				}
 				</style>
@@ -240,5 +239,3 @@ TYPE
 	END Printer;
 
 END FoxDocumentationHtml.
-
-

+ 1 - 2
source/FoxDocumentationParser.Mod

@@ -51,7 +51,7 @@
 	Target        = word.
 
 	URL           = "[[" url "]]" |
-	                "[[" url "|" {TextElement} "]]".
+			"[[" url "|" {TextElement} "]]".
 
 	Label         = "<<" Target ">>".
 
@@ -309,5 +309,4 @@ CONST Trace = FALSE;
 
 		END Parser;
 
-
 END FoxDocumentationParser.

+ 0 - 3
source/FoxDocumentationScanner.Mod

@@ -2,7 +2,6 @@ MODULE FoxDocumentationScanner; (** AUTHOR ""; PURPOSE ""; *)
 
 IMPORT Streams, Diagnostics, D := Debugging;
 
-
 CONST
 	(* scanner constants *)
 	EOT* = 0X; LF* = 0AX; CR* = 0DX;
@@ -194,7 +193,6 @@ TYPE
 				RETURN ~IsWhitespace(prev,TRUE) & IsWhitespace(Peek(),TRUE)
 			END IsRight;
 
-
 		BEGIN
 			symbol.stringLength := 0;
 			symbol.string := NIL;
@@ -212,7 +210,6 @@ TYPE
 				RETURN
 			END;
 
-
 			CASE ch OF  (* ch > " " *)
 			EOT: symbol.token := Token.EndOfText
 			| CR: symbol.token := Token.NewLine; GetNextCharacter; IF ch = LF THEN GetNextCharacter END;

+ 1 - 8
source/FoxDocumentationTree.Mod

@@ -21,7 +21,6 @@ MODULE FoxDocumentationTree;
 		of the documentation rules and how they are parsed.
 **)
 
-
 IMPORT Basic := FoxBasic, Scanner := FoxDocumentationScanner, Strings;
 
 TYPE
@@ -59,7 +58,6 @@ TYPE
 
 	END TextElement;
 
-
 	(**
 		Comment of Text
 		@docuEBNF EBNF
@@ -105,7 +103,6 @@ TYPE
 			e := AppendNew(ElementType.Whitespace);
 		END WriteWhitespace;
 
-
 		PROCEDURE WriteLink*(CONST name, label: ARRAY OF CHAR);
 		VAR e: TextElement;
 		BEGIN
@@ -181,13 +178,11 @@ TYPE
 		BEGIN SELF.level := level
 		END SetLevel;
 
-
 	END Paragraph;
 
-
 	(**
 		@docuEBNF
-		 {{{ Paragraphs = {Paragraph}. }}}
+		{{{ Paragraphs = {Paragraph}. }}}
 	*)
 	Paragraphs*=OBJECT (Basic.List)
 
@@ -294,7 +289,6 @@ TYPE
 
 	END Sections;
 
-
 	(** a document provides the documentation of a module in a structured way *)
 	(**
 		@docuEBNF
@@ -349,7 +343,6 @@ TYPE
 		BEGIN NEW(documents,4)
 		END InitDocumentation;
 
-
 	END Documentation;
 
 	PROCEDURE NewText*(): Text;

+ 16 - 23
source/FoxFingerprinter.Mod

@@ -15,7 +15,7 @@ IMPORT SyntaxTree := FoxSyntaxTree, Basic := FoxBasic, SYSTEM, Global := FoxGlob
 	Value(fp)                  = fp <*> fpTrue | fp <*> fpFalse | fp <*> integer  | fp <*> intlow <*> inthigh | fp -> Name
 	FP(Type)                   = FP(BasicType) | FP(RecordType) | FP(PointerType)
 
-                           	 	| FP(ArrayType) | FP(MathArrayType) | FP(ProcedurType)
+                           		| FP(ArrayType) | FP(MathArrayType) | FP(ProcedurType)
 
 	FP(BasicType)              = fpTypeChar8 | fpTypeChar16 | fpTypeChar32
 	                            | fpTypeShortint | fpTypeInteger | fpTypeLongint | fpTypeHugeint
@@ -59,7 +59,6 @@ IMPORT SyntaxTree := FoxSyntaxTree, Basic := FoxBasic, SYSTEM, Global := FoxGlob
 	                            <*> FP(parameterType) [-> Name(parameterName)]  }
 **)
 
-
 CONST
 	(*Fingerprints/Obj Modes*)
 	fpModeVar=1;
@@ -387,7 +386,6 @@ TYPE
 			deep := SELF.deep;
 			IF Trace THEN TraceEnter("MathArrayType") END;
 
-
 			IF ~fingerprint.shallowAvailable THEN
 				fingerprint.shallowAvailable := TRUE; (* the fingerprinting may return to itself => avoid circles *)
 				SELF.deep := FALSE;
@@ -431,16 +429,16 @@ TYPE
 		VAR  typeDeclaration: SyntaxTree.TypeDeclaration;
 		BEGIN
 			IF (x.scope # NIL) THEN
-				 (* only executed for imported types, reason:
-				 	modification of a type name would result in modified fingerprint leading to modified fingerprints of using structures such as
-				 	in the following example:
-				 	TYPE A=ARRAY 32 OF CHAR;
-				 	PROCEDURE P*(a:A);
-				 	...
-				 	END P;
-				 	IF name of A was changed, P would get a new fingerprint.
-				 	Better: fingerprint of P only depends in type of A but not on its declared name.
-				 *)
+				(* only executed for imported types, reason:
+					modification of a type name would result in modified fingerprint leading to modified fingerprints of using structures such as
+					in the following example:
+					TYPE A=ARRAY 32 OF CHAR;
+					PROCEDURE P*(a:A);
+					...
+					END P;
+					IF name of A was changed, P would get a new fingerprint.
+					Better: fingerprint of P only depends in type of A but not on its declared name.
+				*)
 				IF Trace THEN
 					TraceIndent;
 					D.Str("TypeName  ");
@@ -510,7 +508,6 @@ TYPE
 				SELF.deep := deep;
 			END;
 
-
 			IF Trace THEN TraceExit("PointerType",fingerprint) END;
 
 			SELF.fingerprint := fingerprint;
@@ -885,10 +882,10 @@ TYPE
 			DEC(level);
 		END FPType;
 
-		(* 	Signature(f)  = f <*> FP(returnType)
-	                      { <*> (fpModeVarParameter | fpModeConstParameter | fpModePar)
-	                      <*> FP(parameterType) [-> Name(parameterName)]  }
-		 *)
+		(*	Signature(f)  = f <*> FP(returnType)
+			{ <*> (fpModeVarParameter | fpModeConstParameter | fpModePar)
+			<*> FP(parameterType) [-> Name(parameterName)]  }
+		*)
 		PROCEDURE FPSignature(VAR fp: Basic.Fingerprint; t: SyntaxTree.ProcedureType; isOperator: BOOLEAN);
 		VAR par,self: SyntaxTree.Parameter; deep: BOOLEAN;
 
@@ -1082,7 +1079,6 @@ TYPE
 			VisitVariable(x);
 		END VisitProperty;
 
-
 		(*
 			FP(ParameterDeclaration)    = 0 <*> fpModePar -> Name -> Visibility <*> FP(Type).
 		*)
@@ -1113,7 +1109,7 @@ TYPE
 
 		(*
 		FP(ProcedureDeclaration)   = 0 <*> fpModeInlineProcedure -> Name -> Visibility <*> FP(Type) -> Code.
-		                            | 0 <*> fpModeExportedProcedure -> Name -> Visibility <*> FP(Type)
+						| 0 <*> fpModeExportedProcedure -> Name -> Visibility <*> FP(Type)
 		*)
 		PROCEDURE VisitProcedure*(x: SyntaxTree.Procedure);
 		VAR fp: Basic.Fingerprint; access: SET; fingerprint: SyntaxTree.Fingerprint; deep: BOOLEAN; code: SyntaxTree.Code; i: LONGINT;
@@ -1267,7 +1263,6 @@ TYPE
 			D.Str(" "); D.Hex(fingerprint.public,0);
 		END TraceFP;
 
-
 		(* returns the finger print (object) of a type *)
 		PROCEDURE TypeFP*(this: SyntaxTree.Type): SyntaxTree.Fingerprint;
 		VAR deep: BOOLEAN;
@@ -1306,7 +1301,6 @@ TYPE
 
 	END Fingerprinter;
 
-
 	(** ---------- Fingerprinting primitives -------------- *)
 	PROCEDURE IsOberonProcedure(type: SyntaxTree.ProcedureType): BOOLEAN;
 	BEGIN
@@ -1363,5 +1357,4 @@ TYPE
 		w.Ln;
 	END DumpFingerprint;
 
-
 END FoxFingerprinter.

+ 1 - 1
source/FoxFormats.Mod

@@ -180,4 +180,4 @@ TYPE
 		ASSERT(b);
 	END Assert;
 
-END FoxFormats.
+END FoxFormats.

+ 6 - 12
source/FoxGenericObjectFile.Mod

@@ -38,7 +38,6 @@ TYPE ObjectFileFormat* = OBJECT (Formats.ObjectFileFormat)
 			Init; SetExtension(ObjectFile.DefaultExtension);
 		END InitObjectFileFormat;
 
-
 		PROCEDURE Export* (module: Formats.GeneratedModule; symbolFileFormat: Formats.SymbolFileFormat): BOOLEAN;
 		VAR fileName: Files.FileName; file: Files.File; writer: Files.Writer; fingerprinter: Fingerprinter.Fingerprinter; poolMap: ObjectFile.PoolMap;
 
@@ -167,7 +166,6 @@ TYPE ObjectFileFormat* = OBJECT (Formats.ObjectFileFormat)
 					END;
 				END;
 
-
 				IF codeSection # NIL THEN
 					UpdateAliases (codeSection, fingerprinter);
 					irSection := IntermediateCode.NewSection(sections, SHORTINT(codeSection.os.type), codeSection.os.identifier.name, NIL, FALSE);
@@ -340,8 +338,6 @@ TYPE ObjectFileFormat* = OBJECT (Formats.ObjectFileFormat)
 		BEGIN RETURN SymbolFileFormat.Get();
 		END DefaultSymbolFileFormat;
 
-
-
 	END ObjectFileFormat;
 
 	PROCEDURE GetFingerprint (section: Sections.Section; fingerprinter: Fingerprinter.Fingerprinter): ObjectFile.Fingerprint;
@@ -382,7 +378,6 @@ TYPE ObjectFileFormat* = OBJECT (Formats.ObjectFileFormat)
 		END;
 	END CheckAlias;
 
-
 	PROCEDURE CopyFixups(sections: Sections.SectionList; from, to: BinaryCode.Section; offset: LONGINT);
 	VAR fixup: BinaryCode.Fixup; i, index, fixups: SIZE; fixupList: ObjectFile.Fixups;
 		aliasSymbol: ObjectFile.Identifier; aliasOffset: LONGINT;
@@ -628,12 +623,12 @@ TYPE ObjectFileFormat* = OBJECT (Formats.ObjectFileFormat)
 		is: IntermediateCode.Section;
 		sectionList: Sections.SectionList;
 		section: ObjectFile.Section;
-		 i: LONGINT;
-		 dest: Files.FileName;
-		 writer: Files.Writer;
-		 name: ObjectFile.SegmentedName;
-		 version: WORD;
-		 offers, requires: ObjectFile.NameList;
+		i: LONGINT;
+		dest: Files.FileName;
+		writer: Files.Writer;
+		name: ObjectFile.SegmentedName;
+		version: WORD;
+		offers, requires: ObjectFile.NameList;
 	BEGIN
 		NEW(sectionList);
 		IF context.arg.GetString(dest) THEN
@@ -672,7 +667,6 @@ TYPE ObjectFileFormat* = OBJECT (Formats.ObjectFileFormat)
 		END;
 	END MakeLibrary;
 
-
 	PROCEDURE Statistics*;
 	VAR iterator: Basic.IntIterator; stat: SectionStat; index: StringPool.Index; any: ANY;
 	BEGIN

+ 0 - 15
source/FoxGlobal.Mod

@@ -215,7 +215,6 @@ TYPE
 		min, max: LONGINT; (* alignments in bits *)
 	END;
 
-
 	PassInRegisterProc = PROCEDURE {DELEGATE} (type: SyntaxTree.Type): BOOLEAN;
 
 	System*= OBJECT
@@ -248,7 +247,6 @@ TYPE
 		addressType-, sizeType-, shortintType-, integerType-, longintType-, hugeintType-, wordType-, longWordType-, wordSetType-, characterType-, characterType8-, characterType16-, characterType32-, setType-, booleanType-, anyType-,byteType-,
 		realType-, longrealType-, complexType-, longcomplexType-, objectType-, nilType-, rangeType-, lenType-: SyntaxTree.Type;
 
-
 		CanPassInRegister-: PassInRegisterProc;
 		cellsAreObjects-: BOOLEAN;
 		platformCallingConvention-: SyntaxTree.CallingConvention;
@@ -280,7 +278,6 @@ TYPE
 			platformCallingConvention := SyntaxTree.UndefinedCallingConvention;
 		END InitSystem;
 
-
 		PROCEDURE SetPlatformCallingConvention*(callingConvention: SyntaxTree.CallingConvention);
 		BEGIN
 			platformCallingConvention := callingConvention;
@@ -290,13 +287,11 @@ TYPE
 			cellsAreObjects := c;
 		END SetCellsAreObjects;
 
-
 		PROCEDURE SetRegisterPassCallback*(canPassInRegister: PassInRegisterProc);
 		BEGIN
 			CanPassInRegister := canPassInRegister;
 		END SetRegisterPassCallback;
 
-
 		PROCEDURE AddCapability*(name: SyntaxTree.Identifier);
 		VAR symbol: SyntaxTree.Symbol;
 		BEGIN
@@ -437,7 +432,6 @@ TYPE
 
 		END GenerateCellOffsets;
 
-
 		PROCEDURE GenerateVariableOffsets*(scope: SyntaxTree.Scope): BOOLEAN;
 		VAR variable: SyntaxTree.Variable; offset,size: LONGINT; alignment: LONGINT;
 		BEGIN
@@ -529,7 +523,6 @@ TYPE
 			RETURN TRUE
 		END GenerateParameterOffsets;
 
-
 		PROCEDURE SizeOf*(type: SyntaxTree.Type): LONGINT;
 		VAR size: LONGINT; base: SyntaxTree.Type;
 		BEGIN
@@ -934,7 +927,6 @@ TYPE
 		NewBuiltin(IncMul,"INCMUL",system.globalScope,TRUE);
 		NewBuiltin(DecMul,"DECMUL",system.globalScope,TRUE);
 
-
 		(*!
 
        (* Following is LYNX version: *)
@@ -943,7 +935,6 @@ TYPE
             system.characterType := Character16;
         END;
 
-
         (* LYNX builtin types *)
         DeclareLynxType(system.characterType, LynxChar, system.globalScope);
         DeclareLynxType(system.shortintType, LynxSbyte, system.globalScope);
@@ -1054,7 +1045,6 @@ TYPE
 		RETURN value;
 	END AlignedSizeOf;
 
-
 	(* returns if a module is the system module *)
 	PROCEDURE IsSystemModule*(module: SyntaxTree.Module): BOOLEAN;
 	BEGIN RETURN (module.name=systemName) OR (module.name=SystemName)
@@ -1325,7 +1315,6 @@ TYPE
 		RETURN symbol;
 	END FindSymbol;
 
-
 	PROCEDURE GetSymbolNameInScope*(symbol: SyntaxTree.Symbol; inScope: SyntaxTree.Scope; VAR name: ARRAY OF CHAR);
 	VAR n: SyntaxTree.IdentifierString; td: SyntaxTree.TypeDeclaration;
 		PROCEDURE Scope(scope: SyntaxTree.Scope);
@@ -1400,13 +1389,11 @@ TYPE
 		Basic.SuffixSegmentedName(pooledName, symbol.name);
 	END GetSymbolSegmentedNameInScope;
 
-
 	PROCEDURE GetSymbolSegmentedName*(symbol: SyntaxTree.Symbol; VAR pooledName: Basic.SegmentedName);
 	BEGIN
 		GetSymbolSegmentedNameInScope(symbol,NIL,pooledName);
 	END GetSymbolSegmentedName;
 
-
 	PROCEDURE Level*(t: SyntaxTree.Type): LONGINT;
 	VAR level: LONGINT;
 	BEGIN
@@ -1654,7 +1641,6 @@ TYPE
 		RETURN -1
 	END GetSymbol;
 
-
 	PROCEDURE InitIdentifiers;
 	VAR i: LONGINT;
 
@@ -1717,7 +1703,6 @@ TYPE
 		NewBuiltinIdentifier(IncMul,"INCMUL");
 		NewBuiltinIdentifier(DecMul,"DECMUL");
 
-
 		(* TODO: check if ok. The operators defined in FoxArrayBase require the following identifiers *)
 		(* TODO: ".*+" should preferably be added as a new token in the scanner *)
 		identifiers[Scanner.Lowercase, Scanner.Becomes] := SyntaxTree.NewIdentifier(":=");

+ 0 - 3
source/FoxInterfaceComparison.Mod

@@ -78,7 +78,6 @@ CONST
 		RETURN symbol
 	END NextSymbol;
 
-
 	PROCEDURE CompareScopes(new,old: SyntaxTree.Scope);
 	VAR newSymbol, oldSymbol: SyntaxTree.Symbol;
 		newName, oldName: SyntaxTree.IdentifierString;
@@ -157,6 +156,4 @@ CONST
 		END;
 	END CompareThis;
 
-
-
 END FoxInterfaceComparison.

+ 0 - 7
source/FoxIntermediateAssembler.Mod

@@ -99,13 +99,6 @@ TYPE
 
 	END Assembler;
 
-
-
 END FoxIntermediateAssembler.
 
 System.Free FoxInlineAssembler FoxInlineInstructionSet ~
-
-
-
-
-

+ 51 - 166
source/FoxIntermediateBackend.Mod

@@ -82,8 +82,6 @@ CONST
 			StackLimitOffset* = BaseObjectTypeSize + 3;
 			QuantumOffset = BaseObjectTypeSize + 4;
 
-
-
 		(* flags for optimizations with small matricies and vectors (Alexey Morozov) *)
 		SmallMatrixFlag = 3; (* flag for identification of a small matrix *)
 		SmallVectorFlag = 3; (* flag for identification of a small vector *)
@@ -111,7 +109,6 @@ CONST
 		SysvABI = {SyntaxTree.CCallingConvention};
 		SysvABIorWINAPI = {SyntaxTree.CCallingConvention, SyntaxTree.WinAPICallingConvention};
 
-
 TYPE
 	Position=SyntaxTree.Position;
 	SupportedInstructionProcedure* = PROCEDURE {DELEGATE} (CONST instr: IntermediateCode.Instruction; VAR moduleName,procedureName: ARRAY OF CHAR): BOOLEAN;
@@ -131,7 +128,6 @@ TYPE
 		availability: WORD; (* index *)
 	END;
 
-
 	Fixup= POINTER TO RECORD
 		pc: LONGINT;
 		nextFixup: Fixup;
@@ -168,7 +164,6 @@ TYPE
 
 	END Label;
 
-
 	ConditionalBranch = PROCEDURE {DELEGATE}(label: Label; op1,op2: IntermediateCode.Operand);
 
 	DeclarationVisitor =OBJECT
@@ -313,7 +308,6 @@ TYPE
 					lastUpdated := offset + ToMemoryUnits(system, op.type.sizeInBits);
 			END SingleInitialize;
 
-
 			PROCEDURE Initialize(type: SyntaxTree.Type; initializer: SyntaxTree.Expression; offset:LONGINT);
 			VAR op: Operand; baseType: SyntaxTree.Type; variable: SyntaxTree.Variable; i: LONGINT; size:LONGINT;
 			BEGIN
@@ -371,7 +365,6 @@ TYPE
 				END;
 			END Initialize;
 
-
 		BEGIN
 			IF x.externalName # NIL THEN RETURN END;
 			IF (currentScope IS SyntaxTree.ModuleScope) OR (currentScope IS SyntaxTree.CellScope) & ~backend.cellsAreObjects THEN
@@ -457,7 +450,6 @@ TYPE
 			END;
 		END Constant;
 
-
 		PROCEDURE Scope(x: SyntaxTree.Scope);
 		VAR procedure: SyntaxTree.Procedure;
 			constant: SyntaxTree.Constant;
@@ -471,7 +463,6 @@ TYPE
 			currentScope := x;
 			(* constants treated in implementation visitor  *)
 
-
 			WITH x: SyntaxTree.CellScope DO
 				cell := x.ownerCell;
 				parameter := cell.firstParameter;
@@ -884,8 +875,6 @@ TYPE
 			currentScope := prevScope;
 		END Procedure;
 
-
-
 		PROCEDURE AddBodyCallStub(bodyProcedure: SyntaxTree.Procedure); (* code that is only necessary for static linkers *)
 		VAR procedure: SyntaxTree.Procedure; procedureScope: SyntaxTree.ProcedureScope; name: Basic.SegmentedName;
 			ir: IntermediateCode.Section; op: IntermediateCode.Operand;
@@ -929,8 +918,6 @@ TYPE
 			ir.Emit(Mov(Basic.invalidPosition,implementationVisitor.sp,op));
 		END AddStackAllocation;
 
-
-
 		(** entry function to visit a complete module *)
 		PROCEDURE Module(x: SyntaxTree.Module; module: Sections.Module);
 		VAR
@@ -972,7 +959,6 @@ TYPE
 				RETURN FALSE
 			END ScopeNeedsInitialization;
 
-
 		BEGIN
 			ASSERT(x # NIL); ASSERT(module # NIL);
 			SELF.module := module;
@@ -1147,7 +1133,6 @@ TYPE
 			nameIndex := 0;
 		END Clear;
 
-
 		PROCEDURE GetUID(): SyntaxTree.Identifier;
 		VAR string: SyntaxTree.IdentifierString ;
 		BEGIN
@@ -1232,9 +1217,6 @@ TYPE
 			RETURN NIL
 		END GetFreeVariable;
 
-
-
-
 	END Variables;
 
 	SymbolMap = POINTER TO RECORD
@@ -1270,7 +1252,6 @@ TYPE
 
 	END SymbolMapper;
 
-
 	ImplementationVisitor =OBJECT(SyntaxTree.Visitor)
 	VAR
 		system: Global.System;
@@ -1305,8 +1286,6 @@ TYPE
 		registerUsageCount: RegisterUsageCount;
 		usedRegisters: RegisterEntry;
 
-
-
 		(* useful operands and types *)
 		nil,one,fp,sp,ap,lr,true,false: IntermediateCode.Operand;
 		bool,addressType,setType, sizeType, lenType, byteType: IntermediateCode.Type;
@@ -1466,7 +1445,6 @@ TYPE
 			Strings.Append(string, "]");
 		END GetFingerprintString;
 
-
 		(** get the name for the code section that represens a certain symbol
 		(essentially the same as Global.GetSymbolName, apart from operators) **)
 		PROCEDURE GetCodeSectionNameForSymbol(symbol: SyntaxTree.Symbol; VAR name: Basic.SegmentedName);
@@ -1480,7 +1458,6 @@ TYPE
 			END
 		END GetCodeSectionNameForSymbol;
 
-
 		PROCEDURE TraceEnter(CONST s: ARRAY OF CHAR);
 		BEGIN
 			IF dump # NIL THEN
@@ -1495,7 +1472,6 @@ TYPE
 			END;
 		END TraceExit;
 
-
 		PROCEDURE Emit(instruction: IntermediateCode.Instruction);
 		VAR moduleName, procedureName: SyntaxTree.IdentifierString;
 
@@ -2704,7 +2680,6 @@ TYPE
 			END;
 		END CheckRegistersFree;
 
-
 		(* Reuse2: reuse src1 or src2 for ongoing computation if src1 or src2, respectively, is a register.
 			Otherwise allocate a new register.
 			Does NOT necessarily keep the content of src1 or src2 in result! *)
@@ -2780,7 +2755,6 @@ TYPE
 			END
 		END TransferToRegister;
 
-
 		(** labels and branches **)
 		PROCEDURE NewLabel(): Label;
 		VAR label: Label;
@@ -3048,7 +3022,6 @@ TYPE
 					RETURN dim;
 			END Dimension;
 
-
 		BEGIN
 			(*static math array not providing pointers anyway *)
 			variable := GetTemporaryVariable(x.type, FALSE, FALSE (* untraced *));
@@ -3110,8 +3083,6 @@ TYPE
 			IF Trace THEN TraceExit("VisitUnaryExpression") END;
 		END VisitUnaryExpression;
 
-
-
 				(* test if e is of type type, side effect: result of evaluation of e stays in the operand *)
 		PROCEDURE TypeTest(tag: IntermediateCode.Operand; type: SyntaxTree.Type; label: Label; reason: BOOLEAN; withPart: BOOLEAN);
 		VAR left,right: IntermediateCode.Operand; level,offset: LONGINT; repeatL,skip: Label; originalType: SyntaxTree.Type;
@@ -3138,12 +3109,12 @@ TYPE
 				right := TypeDescriptorAdr(type);
 
 				IF backend.cooperative THEN
-		 			repeatL := NewLabel();
-		 			IF (originalType IS SyntaxTree.PointerType) & ~type(SyntaxTree.RecordType).isObject THEN
+					repeatL := NewLabel();
+					IF (originalType IS SyntaxTree.PointerType) & ~type(SyntaxTree.RecordType).isObject THEN
 						Emit(Mov(position,left,IntermediateCode.Memory(addressType,left,ToMemoryUnits(system,addressType.sizeInBits))));
 					END;
-		 			SetLabel(repeatL);
-		 			IF reason THEN
+					SetLabel(repeatL);
+					IF reason THEN
 						BreqL(label,left,right);
 					ELSE
 						skip := NewLabel();
@@ -3313,7 +3284,6 @@ TYPE
 				Emit(Push(Basic.invalidPosition, lr));
 			END;
 
-
 			variable := recordType.recordScope.firstVariable;
 			WHILE variable # NIL DO
 				IF variable.NeedsTrace() THEN
@@ -3686,7 +3656,6 @@ TYPE
 			END;
 		END CallResetProcedure;
 
-
 		PROCEDURE ResetVariables (scope: SyntaxTree.ProcedureScope);
 		VAR variable: SyntaxTree.Variable; parameter: SyntaxTree.Parameter; previousScope: SyntaxTree.Scope; prevOffset: SIZE; pc: LONGINT;
 
@@ -3806,11 +3775,9 @@ TYPE
 
 			END Reset;
 
-
 		PROCEDURE ResetVariables2 (scope: SyntaxTree.ProcedureScope; refer: BOOLEAN);
 		VAR variable: SyntaxTree.Variable; parameter: SyntaxTree.Parameter; previousScope: SyntaxTree.Scope;   pc: LONGINT; prevOffset: SIZE;
 
-
 		BEGIN
 			previousScope := currentScope;
 			currentScope := scope;
@@ -3873,8 +3840,6 @@ TYPE
 			ELSE
 				import := moduleScope.ImportByModuleName(SyntaxTree.NewIdentifier(moduleName),SyntaxTree.NewIdentifier("A2"));
 
-
-
 				IF import = NIL THEN
 					import := SyntaxTree.NewImport(Basic.invalidPosition,SyntaxTree.NewIdentifier(moduleName),SyntaxTree.NewIdentifier(moduleName),FALSE);
 
@@ -4035,7 +4000,6 @@ TYPE
 			RETURN GetDynamicSize(e.type, tag);
 		END GetArrayOfBytesSize;
 
-
 		(*
 		to find imported symbol. not needed ?
 		PROCEDURE SymbolByName(CONST moduleName, symbolName: ARRAY OF CHAR): SyntaxTree.Symbol;
@@ -4099,7 +4063,6 @@ TYPE
 			RETURN symbol
 		END GetTypeDescriptor;
 
-
 		(* Call a runtime procedure.  If numberParameters >= 0 then the procedure may be called without module import. Otherwise the signature has to be inferred from the import. *)
 		PROCEDURE CallThisChecked(position: Position; CONST moduleName, procedureName: ARRAY OF CHAR; numberParameters: LONGINT; checkNumParameters: BOOLEAN);
 		VAR procedure: SyntaxTree.Procedure; result: Operand; reg: IntermediateCode.Operand; source: IntermediateCode.Section;
@@ -4595,7 +4558,6 @@ TYPE
 
 			END CountIndices;
 
-
 		BEGIN
 			ASSERT(tagsAvailable);
 
@@ -5357,7 +5319,7 @@ TYPE
 					arrayDestinationTag := sp;
 
 					(* case 1b
-						 P(...,A[a..b,c..d],...): push: push array range descriptor to stack
+						P(...,A[a..b,c..d],...): push: push array range descriptor to stack
 					*)
 					IF expression IS SyntaxTree.IndexDesignator THEN
 						ReuseCopy(arrayDestinationTag,arrayDestinationTag);
@@ -5459,7 +5421,7 @@ TYPE
 				ELSIF (parameter.type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Open) & (parameter.kind = SyntaxTree.VarParameter) THEN
 					dim := SemanticChecker.Dimension(parameter.type.resolved,{SyntaxTree.Open});
 					(* case 2b
-						 P(...,A[a..b,c..d],...) pre: emit range and push array range descriptor, memorize stack position
+						P(...,A[a..b,c..d],...) pre: emit range and push array range descriptor, memorize stack position
 							push: push reference to pushed array descriptor
 							post: remove array descriptor.
 					*)
@@ -5476,7 +5438,7 @@ TYPE
 						Pass((operand.tag));
 						NeedDescriptor := FALSE;
 					(* case 2a
-						 P(...,A,...)
+						P(...,A,...)
 						push: push reference to array descriptor on stack
 					*)
 					ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Open THEN
@@ -5514,7 +5476,7 @@ TYPE
 							Pass((arrayDestinationTag));
 						END;
 					(* case 2d
-						 P(...,T,...) push: emit dimension check, push T
+						P(...,T,...) push: emit dimension check, push T
 					*)
 					ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN
 						Designate(expression,operand);
@@ -5522,7 +5484,7 @@ TYPE
 						DimensionCheck(operand.tag, IntermediateCode.Immediate(sizeType,dim),BreqL);
 						Pass((operand.tag));
 					(* case 2f
-						 P(...,S,...) pre: allocate array descriptor on stack and memorize stack position
+						P(...,S,...) pre: allocate array descriptor on stack and memorize stack position
 							push: push reference to pushed array descriptor
 							post: remove array descriptor
 					*)
@@ -5585,7 +5547,7 @@ TYPE
 				ELSIF (parameter.type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor) & (parameter.kind IN {SyntaxTree.ConstParameter,SyntaxTree.ValueParameter}) THEN
 					dim := SemanticChecker.Dimension(type,{SyntaxTree.Open,SyntaxTree.Static});
 					(* case 3b
-						 P(...,A[a..b,c..d],...)
+						P(...,A[a..b,c..d],...)
 					*)
 					IF (expression IS SyntaxTree.IndexDesignator) & (type.resolved(SyntaxTree.MathArrayType).form # SyntaxTree.Static) THEN
 						IF type(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN (* indexer of form a[e,....,?] *)
@@ -5644,16 +5606,16 @@ TYPE
 					(* case 3d
 						P(...,T,...)
 						case 3e
-						 P(...,PT(...),...)
+						P(...,PT(...),...)
 					*)
 					ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor THEN
 						Designate(expression,operand);
 						Dereference(operand,type.resolved,FALSE);
 						Pass((operand.tag));
 					(* case 3f
-						 P(...,S,...)
-						 case 3g
-						 P(...,PS(...),...)
+						P(...,S,...)
+						case 3g
+						P(...,PS(...),...)
 					*)
 					ELSIF type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Static THEN
 						descriptorType := GetMathArrayDescriptorType(dim);
@@ -5998,7 +5960,6 @@ TYPE
 				ReleaseIntermediateOperand(result.op);
 			END;
 
-
 		END VisitStatementDesignator;
 
 		PROCEDURE InlineProcedureCall(x: SyntaxTree.ProcedureCallDesignator): BOOLEAN;
@@ -6046,9 +6007,6 @@ TYPE
 				RETURN variableDesignator
 			END GetTemp;
 
-
-
-
 		BEGIN
 			resultDesignator := procedureResultDesignator; procedureResultDesignator := NIL;
 			wasInline := currentIsInline;
@@ -6227,7 +6185,7 @@ TYPE
 						IF left IS SyntaxTree.DereferenceDesignator THEN (* dereference, if required *)
 							left := left(SyntaxTree.Designator).left;
 						END;
-	 					expression := checker.NewObjectOperatorCall(Basic.invalidPosition, left, 0, actualParameter.parameters, tempVariableDesignator);
+						expression := checker.NewObjectOperatorCall(Basic.invalidPosition, left, 0, actualParameter.parameters, tempVariableDesignator);
 						currentWriteBackCall.call := expression(SyntaxTree.ProcedureCallDesignator);
 					END;
 					actualParameter := tempVariableDesignator;
@@ -6248,7 +6206,6 @@ TYPE
 				END;
 			END;
 
-
 			resultDesignator := procedureResultDesignator; procedureResultDesignator := NIL;
 			procedureType := x.left.type.resolved(SyntaxTree.ProcedureType);
 			callingConvention := procedureType.callingConvention;
@@ -6313,7 +6270,7 @@ TYPE
 				IntermediateCode.InitImmediate(mask,addressType,-alignment);
 				Emit(And(position,sp, sp, mask));
 				Emit(Add(position, sp, sp, IntermediateCode.Immediate(addressType, gap)));
-			 	Emit(Push(position,reg));
+				Emit(Push(position,reg));
 				ReleaseIntermediateOperand(reg);
 			END;
 
@@ -6387,15 +6344,15 @@ TYPE
 					Designate(d,returnValue);
 					returnTypeSize := system.SizeOf(procedureType.returnType.resolved);
 					size := IntermediateCode.Immediate(addressType,ToMemoryUnits(system,returnTypeSize));
-			 		Emit(Push(position,size));
-			 		Emit(Push(position,returnValue.op));
-			 		ReleaseOperand(returnValue);
+					Emit(Push(position,size));
+					Emit(Push(position,returnValue.op));
+					ReleaseOperand(returnValue);
 				ELSE*)
 					PushParameter(d,procedureType.returnParameter,callingConvention, FALSE, dummy,-1)
 					(*
-		 		END;
-		 		*)
-		 	END;
+				END;
+				*)
+			END;
 
 			IF callingConvention # SyntaxTree.OberonCallingConvention THEN
 				parameterRegisters := 0;
@@ -6462,7 +6419,6 @@ TYPE
 				parametersSize := ParametersSize(system,procedureType, FALSE);
 			END;
 
-
 			IF isCallOfDynamicOperator & hasDynamicOperands THEN
 			(*
 				dynamic operator overloading:
@@ -6548,7 +6504,6 @@ TYPE
 				END
 			END;
 
-
 			ReleaseParameterRegisters();
 
 			IF ~(symbol IS SyntaxTree.Procedure) & backend.trackLeave & ~isUnchecked & (callingConvention IN {SyntaxTree.WinAPICallingConvention, SyntaxTree.CCallingConvention}) THEN
@@ -6619,7 +6574,6 @@ TYPE
 				Emit(Pop(position, ap));
 			END;
 
-
 			IF firstWriteBackCall # NIL THEN
 				SaveRegisters(); ReleaseUsedRegisters(saved2);
 				(* perform all write-back calls in the list *)
@@ -6692,7 +6646,6 @@ TYPE
 				RETURN delegatePointerType
 			END GetDelegateType;
 
-
 			PROCEDURE GetBackendType(x: SyntaxTree.Type; VAR offset: LONGINT; VAR name: Basic.SegmentedName): SyntaxTree.Symbol;
 			(* create anonymous type declaration for types that need a type descriptor but have been declared anonymously
 				such as in VAR a: RECORD ... END;
@@ -6761,7 +6714,6 @@ TYPE
 			make memory should be used when tag is used, not earlier
 			*)
 
-
 			RETURN res
 		END TypeDescriptorAdr;
 
@@ -6901,7 +6853,6 @@ TYPE
 				rightType := NIL
 			END;
 
-
 			(* determine operator kind *)
 			IF IsStrictlyPointerToRecord(leftType) THEN
 				kind := {LhsIsPointer}
@@ -7085,7 +7036,6 @@ TYPE
 				END;
 			END StringOperand;
 
-
 			PROCEDURE Ln;
 			BEGIN
 				IF GetProcedure("Ln") THEN
@@ -7093,7 +7043,6 @@ TYPE
 				END;
 			END Ln;
 
-
 		BEGIN
 			IF backend.traceModuleName = "" THEN RETURN END;
 			IF AddImport(backend.traceModuleName,traceModule,TRUE) THEN
@@ -7169,7 +7118,6 @@ TYPE
 			END;
 		END SystemTrace;
 
-
 		PROCEDURE InitFields(type: SyntaxTree.Type; CONST adr: IntermediateCode.Operand; offset: LONGINT);
 		VAR baseType: SyntaxTree.Type; imm,mem: IntermediateCode.Operand; dim,size: LONGINT;
 			variable: SyntaxTree.Variable; i: LONGINT; initializerOp: Operand;
@@ -7520,8 +7468,6 @@ TYPE
 			END;
 		END MathArrayLenOrIncr;
 
-
-
 		PROCEDURE ArrayLen(type: SyntaxTree.ArrayType; VAR operand: Operand; VAR dim: IntermediateCode.Operand; VAR result: Operand );
 		VAR val: LONGINT; res,res2: IntermediateCode.Operand; end,next: Label; t: SyntaxTree.Type; imm: IntermediateCode.Operand; hasDynamicPart: BOOLEAN;
 			offset: LONGINT;
@@ -7615,7 +7561,6 @@ TYPE
 			variable.SetAccess(SyntaxTree.Hidden);
 			variable.SetUntraced(untraced);
 
-
 			IF v = NIL THEN
 				temporaries.AddVariable(variable);
 
@@ -7669,7 +7614,6 @@ TYPE
 				recordScope.AddVariable(variable);
 			END AddVariable;
 
-
 		BEGIN
 			name := "@ArrayDescriptor";
 			Basic.AppendNumber(name,dimensions);
@@ -7750,10 +7694,9 @@ TYPE
 			ReleaseOperand(op);
 		END PushConstInteger;
 
-
 		PROCEDURE OpenInitializer(symbol: SyntaxTree.Symbol; scope: SyntaxTree.Scope): IntermediateCode.Section;
 		VAR name: Basic.SegmentedName; procedure: SyntaxTree.Procedure; procedureScope: SyntaxTree.ProcedureScope;
-		 section: IntermediateCode.Section;
+			section: IntermediateCode.Section;
 		BEGIN
 			procedureScope := SyntaxTree.NewProcedureScope(scope);
 			Global.GetSymbolSegmentedName(symbol, name);
@@ -7934,8 +7877,6 @@ TYPE
 
 		END AddPorts;
 
-
-
 		PROCEDURE AddProperty(cellType: SyntaxTree.CellType; cell: SyntaxTree.Symbol; property: SyntaxTree.Property; value: SyntaxTree.Expression);
 		VAR name: ARRAY 256 OF CHAR; op: Operand;  left, d: SyntaxTree.Designator;
 		BEGIN
@@ -8084,7 +8025,6 @@ TYPE
 			END;
 		END AddPortProperties;
 
-
 		PROCEDURE PushPort(p: SyntaxTree.Expression);
 		VAR op: Operand;
 		BEGIN
@@ -8125,7 +8065,7 @@ TYPE
 				x := x(SyntaxTree.Designator).left;
 			END;
 			RETURN x # NIL;
-			 *)
+			*)
 		END OnHeap;
 
 		PROCEDURE VisitBuiltinCallDesignator*(x: SyntaxTree.BuiltinCallDesignator);
@@ -8207,7 +8147,6 @@ TYPE
 				END;
 			END CallBodies;
 
-
 			PROCEDURE PushTD(type: SyntaxTree.Type);
 			VAR op: IntermediateCode.Operand;
 			BEGIN
@@ -8222,7 +8161,6 @@ TYPE
 				END
 			END PushTD;
 
-
 		BEGIN
 			IF Trace THEN TraceEnter("VisitBuiltinCallDesignator") END;
 
@@ -8640,7 +8578,6 @@ TYPE
 						(* call bodies *)
 						CallBodies(pointer,type);
 
-
 						SetLabel(exit);
 						needsTrace := p0.NeedsTrace();
 						IF needsTrace THEN ModifyAssignments(true) END;
@@ -8761,16 +8698,16 @@ TYPE
 					type := type(SyntaxTree.PointerType).pointerBase.resolved;
 					IF ~backend.cooperative THEN  (* simpler version *)
 						(*
-						 	push len0
-						 	push len1
-						 	push len2
-						 	push len_size
-						 	push len_adr
+							push len0
+							push len1
+							push len2
+							push len_size
+							push len_adr
 
 							push tag
-						 	push static elements
-						 	push element size
-						 	push adr
+							push static elements
+							push element size
+							push adr
 						*)
 
 						dim := 0;
@@ -8796,7 +8733,6 @@ TYPE
 
 						openDim := dim;
 
-
 						staticLength := 1;
 						IF type IS SyntaxTree.ArrayType THEN
 							WHILE (type IS SyntaxTree.ArrayType) DO (* static array *)
@@ -8814,7 +8750,6 @@ TYPE
 						staticLength := ToMemoryUnits(system,system.AlignedSizeOf(type));
 						Emit(Push(position, IntermediateCode.Immediate(sizeType, staticLength))); (* element size *)
 
-
 						Designate(p0,l);
 						Emit(Push(position,l.op)); (* address *)
 						ReleaseOperand(l);
@@ -9071,15 +9006,15 @@ TYPE
 						*)
 					ELSE
 						(*
-						 	push len0
-						 	push len1
-						 	push len2
-
-						 	push size
-						 	push len_adr
-						 	push element_size
-						 	push tag
-						 	push adr
+							push len0
+							push len1
+							push len2
+
+							push size
+							push len_adr
+							push element_size
+							push tag
+							push adr
 						*)
 
 						dim := 0;
@@ -9090,7 +9025,6 @@ TYPE
 							isTensor := FALSE;
 						END;
 
-
 						FOR i := x.parameters.Length()-1 TO firstPar BY -1 DO
 							IF ~isTensor THEN
 								type := type(SyntaxTree.MathArrayType).arrayBase.resolved;
@@ -9121,7 +9055,6 @@ TYPE
 							baseType := SemanticChecker.ArrayBase(type,openDim);
 						END;
 
-
 						staticLength := ToMemoryUnits(system,system.AlignedSizeOf(baseType));
 						Emit(Push(position, IntermediateCode.Immediate(sizeType, staticLength)));
 
@@ -9193,14 +9126,12 @@ TYPE
 					(* allocate *)
 					CallThis(position,"ActiveCellsRuntime","Allocate",7);
 
-
 					Symbol(temporaryVariable,l); (*Designate(temporaryVariable,l)*)
 					(* l.op contains address of pointer to record *)
 					ToMemory(l.op,addressType,0);
 					(* l.op contains value  of pointer to record *)
 					InitFields(baseType, l.op,0);
 
-
 					(* add capabilities *)
 					modifier := p0(SyntaxTree.Designator).modifiers;
 
@@ -9219,7 +9150,6 @@ TYPE
 					*)
 					AddModifiers(baseType(SyntaxTree.CellType), temporaryVariable, modifier);
 
-
 					Symbol(temporaryVariable,l); (*Designate(temporaryVariable,l)*)
 					(* l.op contains address of pointer to record *)
 					ToMemory(l.op,addressType,0);
@@ -9228,7 +9158,6 @@ TYPE
 					ReleaseOperand(l);
 					CallThis(position,"ActiveCellsRuntime","FinishedProperties",1);
 
-
 					prevScope := currentScope;
 					init := OpenInitializer(temporaryVariable, baseType(SyntaxTree.CellType).cellScope);
 					previous := section;
@@ -9630,7 +9559,6 @@ TYPE
 					Emit(Push(position,s2.op));
 				END;
 
-
 				(*
 				Emit(Push(position,IntermediateCode.Immediate(addressType,size)));
 				*)
@@ -10637,7 +10565,6 @@ TYPE
 			RETURN i;
 		END GetAvailability;
 
-
 		PROCEDURE VisitVariable*(x: SyntaxTree.Variable);
 		VAR symbol: Sections.Section;  type: SyntaxTree.Type; recordType: SyntaxTree.RecordType; name: Basic.SegmentedName; temp: IntermediateCode.Operand; reg: LONGINT;
 		BEGIN
@@ -10964,7 +10891,6 @@ TYPE
 			VExpression(x.expression);
 		END VisitAlias;
 
-
 		(** statements *)
 
 		PROCEDURE VisitProcedureCallStatement*(x: SyntaxTree.ProcedureCallStatement);
@@ -11435,7 +11361,6 @@ TYPE
 			END;
 		END VisitCommunicationStatement;
 
-
 		PROCEDURE VisitIfStatement*(x: SyntaxTree.IfStatement);
 		VAR end: Label; i,elsifs: LONGINT; elsif: SyntaxTree.IfPart; escape: BOOLEAN;
 
@@ -11643,7 +11568,6 @@ TYPE
 			IF Trace THEN TraceExit("VisitCaseStatement") END;
 		END VisitCaseStatement;
 
-
 		PROCEDURE VisitWhileStatement*(x: SyntaxTree.WhileStatement);
 		VAR startL,falseL: Label;
 		BEGIN
@@ -11688,7 +11612,6 @@ TYPE
 			temporaryVariableDesignator := SyntaxTree.NewSymbolDesignator(Basic.invalidPosition, NIL, temporaryVariable);
 			temporaryVariableDesignator.SetType(x.variable.type.resolved);
 
-
 			Assign(temporaryVariableDesignator,x.to);
 			IF x.by = NIL THEN by := 1 ELSE by := x.by.resolved(SyntaxTree.IntegerValue).value END;
 			IF by > 0 THEN
@@ -12236,7 +12159,6 @@ TYPE
 			RETURN ProcedureParametersSize(system, procedure);
 		END ProcParametersSize;
 
-
 		PROCEDURE ParameterCopies(x: SyntaxTree.ProcedureType);
 		VAR parameter: SyntaxTree.Parameter; type, base: SyntaxTree.Type;
 			op: Operand; temp,size,par,dst, length,null: IntermediateCode.Operand;
@@ -12349,7 +12271,6 @@ TYPE
 			END;
 		END GetFingerprint;
 
-
 		PROCEDURE Body(x: SyntaxTree.Body; scope: SyntaxTree.Scope; ir: IntermediateCode.Section; moduleBody: BOOLEAN);
 		VAR prevScope: SyntaxTree.Scope; procedureType: SyntaxTree.ProcedureType; procedure: SyntaxTree.Procedure;
 			cellScope: SyntaxTree.CellScope; op: Operand; string: SyntaxTree.IdentifierString;
@@ -12371,7 +12292,6 @@ TYPE
 				dump := NIL;
 			END;
 
-
 			prevScope := currentScope;
 			currentScope := scope;
 
@@ -12409,7 +12329,6 @@ TYPE
 
 				InitVariables(scope);
 
-
 				IF backend.preciseGC & (x.code = NIL) & (~procedureType.noPAF) & ~procedure.isEntry & ~procedure.isExit THEN
 					GetCodeSectionNameForSymbol(procedure, name);
 					Basic.SuffixSegmentedName (name, Basic.MakeString ("@Descriptor"));
@@ -12464,12 +12383,12 @@ TYPE
 		declarationVisitor: DeclarationVisitor;
 		module: Sections.Module;
 		moduleName: ARRAY 128 OF CHAR;
- 		moduleNamePool: Basic.HashTableInt;
- 		moduleNamePoolSection: IntermediateCode.Section;
- 		modulePointerSection: IntermediateCode.Section;
- 		modulePointerSizePC: LONGINT;
- 		modulePointerSectionOffset: LONGINT;
- 		modulePointers: LONGINT;
+		moduleNamePool: Basic.HashTableInt;
+		moduleNamePoolSection: IntermediateCode.Section;
+		modulePointerSection: IntermediateCode.Section;
+		modulePointerSizePC: LONGINT;
+		modulePointerSectionOffset: LONGINT;
+		modulePointers: LONGINT;
 
 		simple: BOOLEAN; (* simple = no module loading, no reflection *)
 
@@ -12484,7 +12403,6 @@ TYPE
 	CONST
 		EmptyBlockOffset = 2;
 
-
 		PROCEDURE &InitMetaDataGenerator(implementationVisitor: ImplementationVisitor; declarationVisitor: DeclarationVisitor; simple: BOOLEAN);
 		BEGIN
 			IF implementationVisitor.backend.cooperative THEN
@@ -12634,7 +12552,6 @@ TYPE
 			section.Emit(Data(Basic.invalidPosition,op));
 		END Size;
 
-
 		PROCEDURE Set(section: IntermediateCode.Section; value: Basic.Set);
 		VAR op: IntermediateCode.Operand;
 		BEGIN
@@ -12714,7 +12631,6 @@ TYPE
 			String(section, s);
 		END String0;
 
-
 		PROCEDURE NamedSymbol(section: IntermediateCode.Section; name: Basic.SegmentedName; symbol: SyntaxTree.Symbol; virtualOffset, realOffset: LONGINT);
 		VAR op: IntermediateCode.Operand;
 		BEGIN
@@ -12731,7 +12647,6 @@ TYPE
 			section.EmitAt(pc, Data(Basic.invalidPosition,op));
 		END NamedSymbolAt;
 
-
 		PROCEDURE Symbol(section: IntermediateCode.Section; symbol: Sections.Section; virtualOffset, realOffset: LONGINT);
 		BEGIN
 			IF symbol= NIL THEN
@@ -12911,8 +12826,6 @@ TYPE
 			RETURN section
 		END NamedBlock;
 
-
-
 		PROCEDURE Block(CONST mName, typeName, suffix: ARRAY OF CHAR; VAR offset: LONGINT): IntermediateCode.Section;
 		VAR name: ARRAY 128 OF CHAR; pooledName: Basic.SegmentedName;
 		BEGIN
@@ -13082,7 +12995,6 @@ TYPE
 				scopes[0].section := source;
 				scopes[0].arraySizePC := MIN(LONGINT);
 
-
 				FOR s := 0 TO LEN(sections)-1 DO
 					symbol := sections[s];
 					IF (symbol # NIL) & (implementationVisitor.backend.cooperative) & (symbol.symbol = NIL) OR (symbol.symbol # NIL) & (symbol.type # Sections.InitCodeSection) & (symbol.type # Sections.EntryCodeSection) & (symbol.type # Sections.ExitCodeSection) & (symbol.type # Sections.InlineCodeSection) THEN
@@ -13175,7 +13087,6 @@ TYPE
 			Export(sectionArray^);
 		END ExportDesc;
 
-
 		PROCEDURE ExceptionArray(source: IntermediateCode.Section);
 		VAR
 			p: Sections.Section; finallyPC, sizePC, size, i: LONGINT;
@@ -13277,7 +13188,7 @@ TYPE
 				sfScopeBegin = 0F0X;
 				sfScopeEnd = 0F1X;
 				sfProcedure = 0F2X;
-				sfVariable = 	0F3X;
+				sfVariable = 0F3X;
 				sfTypeDeclaration = 0F4X;
 				sfModule = 0FFX;
 
@@ -13287,7 +13198,6 @@ TYPE
 				sizePC, startPC, lastOffset: LONGINT;
 				indirectTypes: Basic.HashTable;
 
-
 				PROCEDURE CurrentIndex(): LONGINT;
 				VAR i: LONGINT;
 				BEGIN
@@ -13783,8 +13693,6 @@ TYPE
 					Char(section, sfScopeEnd); (* scope ends *)
 				END NScope;
 
-
-
 			BEGIN
 				NEW(indirectTypes, 32);
 				ArrayBlock(section,sizePC,"", FALSE);
@@ -14056,7 +13964,6 @@ TYPE
 			PatchArray(section, sizePC, numberProcs);
 		END ProcedureDescriptorArray;
 
-
 		(*
 			Module* = OBJECT (Heaps.RootObject)	(* cf. Linker0 & Heaps.WriteType *)
 			VAR
@@ -14333,7 +14240,6 @@ TYPE
 			END;
 		END PatchCRC;
 
-
 		PROCEDURE PointerArray(source: IntermediateCode.Section; scope: SyntaxTree.Scope; VAR numberPointers: LONGINT);
 		VAR variable: SyntaxTree.Variable; pc: LONGINT; symbol: Sections.Section; parameter: SyntaxTree.Parameter; parametersSize: LONGINT;
 		BEGIN
@@ -14611,7 +14517,6 @@ TYPE
 							source.SetExported(IsExported(td));
 						END;
 
-
 						Info(source, "parent");
 						IF baseRecord # NIL THEN
 							Global.GetSymbolSegmentedName(baseTD,name);
@@ -14661,7 +14566,7 @@ TYPE
 										---
 										TypeDesc = TypeInfoAdr
 										---
-						td adr ---> 	rec size
+						td adr ---> rec size
 										----
 										pointer offsets
 										----
@@ -14755,7 +14660,6 @@ TYPE
 
 	END MetaDataGenerator;
 
-
 	IntermediateBackend*= OBJECT (IntermediateCode.IntermediateBackend)
 	VAR
 		trace-: BOOLEAN;
@@ -14773,8 +14677,6 @@ TYPE
 		preciseGC, trackLeave, writeBarriers: BOOLEAN;
 		experiment: BOOLEAN;
 
-
-
 		PROCEDURE &InitIntermediateBackend*;
 		BEGIN
 			simpleMetaData := FALSE;
@@ -14927,25 +14829,18 @@ TYPE
 		BEGIN RETURN SymbolFileFormat.Get()
 		END DefaultSymbolFileFormat;
 
-
-
 	END IntermediateBackend;
 
-
 	(* ----------------------------------- register allocation ------------------------------------- *)
 
-
 		(* register mapping scheme
-			virtual register number	--> register mapping   = 		part(0)		-->	ticket	<-->	physical register
+			virtual register number	--> register mapping   =		part(0)		-->	ticket	<-->	physical register
 																											spill offset
 
 																	part(n)		-->	ticket	<-->	physical register
 																											spill offset
 		*)
 
-
-
-
 	VAR int8-, int16-, int32-, int64-, uint8-, uint16-, uint32-, uint64-, float32-, float64-: IntermediateCode.Type;
 		emptyOperand: IntermediateCode.Operand;
 		systemCalls: ARRAY NumberSystemCalls OF SyntaxTree.Symbol;
@@ -14981,7 +14876,6 @@ TYPE
 		statCoopTraceModule)
 	END Statistics;
 
-
 	PROCEDURE GCD(a,b: LONGINT): LONGINT;
 	VAR h: LONGINT;
 	BEGIN
@@ -15272,7 +15166,6 @@ TYPE
 		RETURN (type IS SyntaxTree.ArrayType) & (type(SyntaxTree.ArrayType).form = SyntaxTree.SemiDynamic);
 	END IsSemiDynamicArray;
 
-
 	PROCEDURE IsStaticArray(type: SyntaxTree.Type): BOOLEAN;
 	BEGIN
 		IF type = NIL THEN RETURN FALSE END;
@@ -15401,7 +15294,6 @@ TYPE
 			parSize := parSize + (-parSize) MOD system.addressSize;
 		END;
 
-
 		parameter :=procedureType.lastParameter;
 		WHILE (parameter # NIL) DO
 			IF procedureType.callingConvention IN SysvABIorWINAPI THEN
@@ -15413,7 +15305,6 @@ TYPE
 			parameter := parameter.prevParameter;
 		END;
 
-
 		IF procedureType.selfParameter # NIL THEN
 			parameter := procedureType.selfParameter;
 			INC(parSize,system.SizeOfParameter(parameter));
@@ -15486,7 +15377,6 @@ TYPE
 		RETURN instruction
 	END Conv;
 
-
 	PROCEDURE Call*(position: Basic.Position;op: IntermediateCode.Operand; parSize: LONGINT): IntermediateCode.Instruction;
 	VAR instruction: IntermediateCode.Instruction;
 	BEGIN
@@ -15520,7 +15410,7 @@ TYPE
 	END Result;
 
 	PROCEDURE Trap(position: Basic.Position;nr: LONGINT): IntermediateCode.Instruction;
- 	VAR op1: IntermediateCode.Operand;
+	VAR op1: IntermediateCode.Operand;
 	VAR instruction: IntermediateCode.Instruction;
 	BEGIN
 		IntermediateCode.InitNumber(op1,nr);
@@ -15733,7 +15623,6 @@ TYPE
 		RETURN instruction
 	END SpecialInstruction;
 
-
 	PROCEDURE Reserve(position: Basic.Position;units: LONGINT): IntermediateCode.Instruction;
 	VAR op1: IntermediateCode.Operand;
 	VAR instruction: IntermediateCode.Instruction;
@@ -15786,7 +15675,6 @@ TYPE
 		RETURN pc
 	END EnterImmediate;
 
-
 	PROCEDURE Init;
 	VAR i: LONGINT; name: SyntaxTree.IdentifierString;
 	BEGIN
@@ -15815,14 +15703,11 @@ TYPE
 		RETURN (symbol # NIL) & symbol.NeedsSection();
 	END IsExported;
 
-
-
 BEGIN
 	Init;
 
 END FoxIntermediateBackend.
 
-
 Compiler.Compile -p=Win32 FoxIntermediateBackend.Mod ~
 
 #	Release.Build --path="/temp/obg/" Win32 ~

+ 6 - 20
source/FoxIntermediateCode.Mod

@@ -47,7 +47,6 @@ CONST
 	GeneralPurpose*=0;
 	Parameter*=1; (* *)
 
-
 	(* special registers *)
 	None*=-1; (* no register assigned *)
 	SP*=-2; (* stack pointer *)
@@ -89,9 +88,6 @@ TYPE
 	RegisterMap*= RECORD register*: LONGINT; name*: SyntaxTree.SourceCode END;
 	BackendRules*= POINTER TO ARRAY OF RegisterMap;
 
-
-
-
 	Operand* = RECORD
 		mode-: SHORTINT; (* Undefined, ModeRegister, ModeImmediate, ModeMemory, ModeNumber or ModeString *)
 		type-: Type; (* size and form *)
@@ -136,7 +132,6 @@ TYPE
 
 	Instructions*=POINTER TO ARRAY OF Instruction;
 
-
 	(** code object *)
 	Section*= OBJECT (Sections.Section)
 	VAR
@@ -168,7 +163,6 @@ TYPE
 			exported := e
 		END SetExported;
 
-
 		PROCEDURE EnableComments*(enabled: BOOLEAN);
 		BEGIN
 			IF enabled & (comments = NIL) THEN NEW(comments, GetPC)
@@ -189,7 +183,6 @@ TYPE
 			alias := section; aliasOffset := offset;
 		END SetAlias;
 
-
 		PROCEDURE SetFinally*(atPc: LONGINT);
 		BEGIN finally := atPc
 		END SetFinally;
@@ -379,7 +372,6 @@ TYPE
 			END;
 		END WriteRaw;
 
-
 	END Section;
 
 	IntermediateBackend*= OBJECT (Backend.Backend)
@@ -399,7 +391,6 @@ TYPE
 
 	END IntermediateBackend;
 
-
 	VAR
 		instructionFormat-: ARRAY NofOpcodes OF InstructionFormat;
 		int8-, int16-, int32-, int64-, uint8-, uint16-, uint32-, uint64-, float32-, float64-, undef-: Type;
@@ -432,7 +423,6 @@ TYPE
 		IF result # NIL THEN
 			section := result(Section);
 
-
 			(*
 			t0 := result.type;
 			IF t0 # type THEN
@@ -602,12 +592,12 @@ TYPE
 						newln := FALSE;
 					END;
 					IF (ch = '"') OR (ch = '\') THEN
-					 	w.Char( '\' );
-					 	w.Char(ch);
+						w.Char( '\' );
+						w.Char(ch);
 					ELSE
-					 	w.Char(ch);
-					 END
-				 END;
+						w.Char(ch);
+					END
+				END;
 				INC(i);
 				ch := str[i];
 			END;
@@ -758,7 +748,6 @@ TYPE
 		IF instr.opcode = special THEN w.RawLInt(instr.subtype) END;
 	END WriteRawInstruction;
 
-
 	PROCEDURE DumpInstruction*(w: Streams.Writer; CONST instr: Instruction);
 	BEGIN
 		w.String(instructionFormat[instr.opcode].name);
@@ -881,7 +870,6 @@ TYPE
 		Assert(op2.symbol.name[0] # 0, "not intialized operand 2");
 		Assert(op3.symbol.name[0] # 0, "not intialized operand 3");
 
-
 		instr.opcode := opcode;
 		instr.op1 := op1;
 		instr.op2 := op2;
@@ -909,7 +897,6 @@ TYPE
 		instr.subtype := subType
 	END SetSubType;
 
-
 	PROCEDURE InitOperand*(VAR op: Operand);
 	BEGIN
 		op.mode := Undefined;
@@ -1021,7 +1008,6 @@ TYPE
 		END;
 	END IsConstantInteger;
 
-
 	PROCEDURE InitImmediate*(VAR op: Operand; type: Type; value: HUGEINT);
 	BEGIN
 		Assert(type.form IN Integer,"operand type does not match value type");
@@ -1289,7 +1275,7 @@ TYPE
 		ELSIF type IS SyntaxTree.CellType THEN
 			RETURN GetType(system, system.addressType);
 		ELSE
- 			HALT(100);
+			HALT(100);
 		END;
 	END GetType;
 

+ 4 - 23
source/FoxIntermediateLinker.Mod

@@ -42,7 +42,6 @@ TYPE
 			backend := defaultBackend;
 			defaultBackend.GetDescription(platformName);
 
-
 			NEW(allSections);
 			NEW(importList, 128);
 			NEW(loadedModules, 128);
@@ -83,7 +82,6 @@ TYPE
 			END
 		END EmitAt;
 
-
 		PROCEDURE PatchIntegerValue*(CONST sectionName: ARRAY OF CHAR; index: LONGINT; value: HUGEINT; type: SyntaxTree.Type): BOOLEAN;
 		VAR instruction: IntermediateCode.Instruction; section: Sections.Section; op1: IntermediateCode.Operand;
 			pooledName: Basic.SegmentedName; itype: IntermediateCode.Type;
@@ -142,7 +140,6 @@ TYPE
 			RETURN TRUE;
 		END PatchStringValue;
 
-
 		PROCEDURE LoadModule*(CONST moduleFileName: ARRAY OF CHAR; recursive: BOOLEAN): BOOLEAN;
 		VAR
 			filename, moduleName: SyntaxTree.IdentifierString;
@@ -659,7 +656,6 @@ TYPE
 			UNTIL ~Conflict(binaryModule(Sections.Module),sizes^) OR (count > 10) ;
 			ASSERT(count <=10);
 
-
 			IF binaryModule = NIL THEN
 				Basic.Error(diagnostics, desiredName,Basic.invalidPosition, "the specified backend cannot process intermediate code");
 				result := FALSE
@@ -751,7 +747,6 @@ TYPE
 			END;
 		END Generate;
 
-
 		(*PROCEDURE LinkInstance(CONST typeName, instanceName: ARRAY OF CHAR): BOOLEAN;
 		VAR
 			codeFileName, dataFileName: Files.FileName;
@@ -895,7 +890,6 @@ TYPE
 					specification.log.String("generated code file: ");specification.log.String(codeFileName); specification.log.Ln;
 					specification.log.String("generated data file: ");specification.log.String(dataFileName); specification.log.Ln;
 
-
 				END;
 			ELSE
 				msg := "could not link ";
@@ -934,7 +928,6 @@ TYPE
 			objectFileFormat.GetOptions(options);
 		END GetOptions;
 
-
 	END SpecificationLinker;
 
 	PROCEDURE Get*(): Backend.Backend;
@@ -993,8 +986,6 @@ TYPE
 		END;
 	END CopySections;
 
-
-
 (*
 	PROCEDURE LinkActiveCells*(activeCellsSpecification: ActiveCells.Specification; backend: Backend.Backend; objectFileFormat: Formats.ObjectFileFormat): BOOLEAN;
 	TYPE
@@ -1149,7 +1140,6 @@ TYPE
 						specification.log.String("generated code file: ");specification.log.String(codeFileName); specification.log.Ln;
 						specification.log.String("generated data file: ");specification.log.String(dataFileName); specification.log.Ln;
 
-
 					END;
 				ELSE
 					msg := "could not link ";
@@ -1244,7 +1234,7 @@ TYPE
 			NEW(assemblinker, diagnostics, defaultBackend);
 		END;
 		WHILE Basic.GetStringParameter(input,filename) & ~error DO
-			IF targetFile = "" THEN NEW(assemblinker, diagnostics, defaultBackend) 	END;
+			IF targetFile = "" THEN NEW(assemblinker, diagnostics, defaultBackend) END;
 			IF assemblinker.LoadModule(filename, FALSE) THEN
 				assemblinker.MarkReachabilityOfAll(TRUE);
 				FileNameToModuleName(filename, moduleName);
@@ -1261,7 +1251,7 @@ TYPE
 		END;
 		IF ~error & (targetFile # "") THEN
 			assemblinker.PrearrangeReachableDataSections;
-			IF 	assemblinker.GenerateObjectFile(objectFileFormat, context.out, targetFile)
+			IF assemblinker.GenerateObjectFile(objectFileFormat, context.out, targetFile)
 			THEN
 				Basic.Information(diagnostics, targetFile, Basic.invalidPosition, "generated.")
 			ELSE error := FALSE
@@ -1292,7 +1282,6 @@ TYPE
 
 				system := backend.GetSystem();
 
-
 				IF (instructionMemorySize > 0) & (instructionMemorySize < code.SizeInBits() DIV system.codeUnit) THEN
 					Basic.Error(diagnostics, instanceName, Basic.invalidPosition, "specified instruction memory size too small");
 					error := TRUE;
@@ -1314,8 +1303,6 @@ TYPE
 					StaticLinker.WriteOutputFile (code, codeFileName, linker, StaticLinker.WriteTRMCodeFile);
 					StaticLinker.WriteOutputFile (data, dataFileName, linker, StaticLinker.WriteTRMDataFile);
 
-
-
 					IF linkerLog # NIL THEN linkerLog.Update; Files.Register(logFile) END;
 					IF log # NIL THEN
 						log.String(instanceName);
@@ -1329,7 +1316,6 @@ TYPE
 						log.String("generated code file: ");log.String(codeFileName); log.Ln;
 						log.String("generated data file: ");log.String(dataFileName); log.Ln;
 
-
 					END;
 				ELSE
 					msg := "could not link ";
@@ -1340,9 +1326,6 @@ TYPE
 
 	END WriteCodeAndDataFiles;
 
-
-
-
 	(* to link active cells
 		- load all intermediate code files and collect all sections in one object
 		- for each cell instance
@@ -1355,7 +1338,6 @@ TYPE
 		- ir code / data units depend on section type, do not necessarily have to be stored
 	*)
 
-
 	PROCEDURE Test*(context: Commands.Context);
 	VAR
 		input: Streams.Reader;
@@ -1456,7 +1438,7 @@ TYPE
 		*)
 		(*
 		WHILE Basic.GetStringParameter(input,filename) & ~error DO
-			IF targetFile = "" THEN NEW(assemblinker, diagnostics, defaultBackend, "") 	END;
+			IF targetFile = "" THEN NEW(assemblinker, diagnostics, defaultBackend, "") END;
 			IF assemblinker.LoadModule(filename, FALSE) THEN
 				assemblinker.MarkReachabilityOfAll(TRUE);
 				FileNameToModuleName(filename, moduleName);
@@ -1475,8 +1457,7 @@ TYPE
 		(*
 		IF ~error & (targetFile # "") THEN
 			assemblinker.PrearrangeReachableDataSections;
-			IF 	assemblinker.GenerateObjectFile(objectFileFormat, context.out, targetFile)
-			THEN
+			IF assemblinker.GenerateObjectFile(objectFileFormat, context.out, targetFile) THEN
 				Basic.Information(diagnostics, targetFile, Streams.Invalid, "generated.")
 			ELSE error := FALSE
 			END;

+ 0 - 2
source/FoxIntermediateObjectFile.Mod

@@ -505,7 +505,6 @@ TYPE ObjectFileFormat* = OBJECT (Formats.ObjectFileFormat)
 		END;
 	END WriteHeader;
 
-
 	(* test code to display --not public *)
 	PROCEDURE Show*(context: Commands.Context);
 	VAR
@@ -548,4 +547,3 @@ FoxIntermediateObjectFile.Show Builtins  ~
 			writer.Update;
 			Files.Register(file);
 			*)
-

+ 1 - 2
source/FoxIntermediateParser.Mod

@@ -426,7 +426,7 @@ TYPE
 				(* total size of the section in units *)
 				ELSIF ThisIdentifier("size") & ExpectSymbol(Scanner.Equal) THEN
 					IF ExpectIntegerWithSign(integer) THEN
-						 (* nothing to do (this property is ignored, since the size is calculated from the actual content) *)
+						(* nothing to do (this property is ignored, since the size is calculated from the actual content) *)
 					ELSE
 						Error(positionOfProperty, "invalid size")
 					END
@@ -620,5 +620,4 @@ TYPE
 		END;
 	END ParseFile;
 
-
 END FoxIntermediateParser.

+ 3 - 14
source/FoxInterpreter.Mod

@@ -7,7 +7,6 @@ CONST
 	EnableTrace = FALSE;
 	MaxIndex = 8;
 
-
 TYPE
 	Result*= InterpreterSymbols.Result;
 	Value*=InterpreterSymbols.Value;
@@ -96,7 +95,6 @@ TYPE
 			RETURN print;
 		END Print;
 
-
 	END Parser;
 
 	Interpreter* = OBJECT (SyntaxTree.Visitor)
@@ -111,7 +109,6 @@ TYPE
 		diagnostics: Diagnostics.Diagnostics;
 		context-: Commands.Context;
 
-
 		PROCEDURE & Init*(scope: Scope; diagnostics: Diagnostics.Diagnostics; context: Commands.Context);
 		BEGIN
 			IF scope = NIL THEN scope := global END;
@@ -400,10 +397,8 @@ TYPE
 				item.in := NIL;
 			END;
 
-
 		END VisitQualifiedType;
 
-
 		(*
 		PROCEDURE FindInScope(scope: Scope; symbol: StringPool.Index): Value;
 		VAR item: Value;
@@ -460,7 +455,7 @@ TYPE
 
 		PROCEDURE VisitIdentifierDesignator*(x: SyntaxTree.IdentifierDesignator);
 		VAR moduleName: Modules.Name; msg: ARRAY 128 OF CHAR; res: WORD;
-			 builtin : Builtin; anyValue: Any;
+			builtin : Builtin; anyValue: Any;
 		BEGIN
 			ASSERT(x.left = NIL);
 			item.name := x.identifier;
@@ -504,7 +499,6 @@ TYPE
 			END;
 		END VisitSelectorDesignator;
 
-
 		PROCEDURE VisitParameterDesignator*(x: SyntaxTree.ParameterDesignator);
 		VAR e: SyntaxTree.Expression; proc: InterpreterSymbols.ProcedureResult; i: LONGINT;
 			adr: ADDRESS; adrValue: Value; any: InterpreterSymbols.AnyValue;
@@ -650,7 +644,6 @@ TYPE
 			RETURN NIL;
 		END FindType;
 
-
 		PROCEDURE VisitBuiltinCallDesignator*(x: SyntaxTree.BuiltinCallDesignator);
 		VAR p,p0,p1,p2: SyntaxTree.Expression;
 			type,t0,t1,t2: SyntaxTree.Type;
@@ -901,7 +894,7 @@ TYPE
 			END CreateContext;
 
 			PROCEDURE IsDelimiter(ch : CHAR) : BOOLEAN;
-			CONST 	CR = 0DX;  LF = 0AX;  TAB = 9X;
+			CONST CR = 0DX;  LF = 0AX;  TAB = 9X;
 			BEGIN
 				RETURN (ch = " ") OR (ch = CR) OR (ch = LF) OR (ch = TAB) OR (ch = ";") OR (ch = 0X);
 			END IsDelimiter;
@@ -1012,10 +1005,9 @@ TYPE
 		PROCEDURE Evaluate(x: SyntaxTree.Expression): Value;
 		VAR w: Value;
 		BEGIN
-			 IF GetValue(x, w) THEN RETURN w ELSE RETURN NIL END;
+			IF GetValue(x, w) THEN RETURN w ELSE RETURN NIL END;
 		END Evaluate;
 
-
 		PROCEDURE GetInteger(x: SyntaxTree.Expression; VAR i: Integer): BOOLEAN;
 		VAR v: Value;
 		BEGIN
@@ -1347,7 +1339,6 @@ VAR d: RECORD e: LONGINT END;
 
 	END TestO;
 
-
 BEGIN
 	InitGlobalScope;
 	c := 10;
@@ -1422,8 +1413,6 @@ FoxInterpreter.Statements
 	o := Test.TestO();
 	~
 
-
-
 FoxInterpreter.Statements
 	s := {0..10, 15};
 	a := 10;

+ 2 - 3
source/FoxInterpreterBackend.Mod

@@ -187,7 +187,6 @@ TYPE
 			END;
 		END Resolve;
 
-
 		PROCEDURE Designate (VAR operand: Intermediate.Operand): Address;
 		VAR address: Address;
 		BEGIN
@@ -259,7 +258,7 @@ TYPE
 				Execute (pc.section.instructions[pc.index], pc);
 				IF pc.index >= pc.section.pc THEN
 					IF sp # StackSize THEN Error ("missing return"); END;
-					 pc.section := NIL;
+					pc.section := NIL;
 				END;
 			END;
 		END Run;
@@ -385,7 +384,7 @@ TYPE
 
 		PROCEDURE ProcessSyntaxTreeModule *(x: SyntaxTree.Module): Formats.GeneratedModule;
 		VAR module: Sections.Module; section: Sections.Section; interpreter: Interpreter;
- 		BEGIN
+		BEGIN
 			module := GenerateIntermediate (x, SupportedInstruction, SupportedImmediate);
 			NEW (heap); NEW (interpreter, SELF, SHORT (SHORT (addressSize)),module);
 			Traverse (module.allSections, interpreter.AllocateSection);

+ 5 - 22
source/FoxInterpreterSymbols.Mod

@@ -5,7 +5,6 @@ IMPORT Strings, Basic := FoxBasic, StringPool, Streams, Commands, PersistentObje
 CONST
 	TAB = 09X;
 
-
 TYPE
 
 	Item*= PersistentObjects.Object;
@@ -87,8 +86,7 @@ TYPE
 		RETURN 0;
 	END SymbolAddress;
 
-
-	TYPE
+TYPE
 
 	Result*= OBJECT (Item)
 
@@ -119,7 +117,6 @@ TYPE
 
 	END Result;
 
-
 	SymbolResult*=OBJECT(Result)
 	VAR name: ARRAY 32 OF CHAR;
 
@@ -186,7 +183,6 @@ TYPE
 				RETURN NIL;
 		END Find;
 
-
 	END ModuleResult;
 
 	Callstack = OBJECT
@@ -273,7 +269,6 @@ TYPE
 			p.a := a;
 		END PushA;
 
-
 		PROCEDURE PushSz(s: SIZE);
 		VAR p: POINTER {UNSAFE,UNTRACED} TO RECORD s: SIZE END;
 		BEGIN
@@ -453,8 +448,8 @@ TYPE
 						CASE type OF
 							Reflection.sfTypeCHAR .. Reflection.sfTypeSIZE, Reflection.sfTypePointerToRecord, Reflection.sfTypePointerToArray:
 							(*! check type ! *)
-							 stack.PushA(o.Address());
-							 RETURN TRUE;
+							stack.PushA(o.Address());
+							RETURN TRUE;
 						ELSE
 							RETURN FALSE
 						END;
@@ -526,7 +521,6 @@ TYPE
 			RETURN FALSE;
 		END PushTyped;
 
-
 		PROCEDURE Push*(o: Result): BOOLEAN;
 		VAR
 			s: SHORTINT; i: INTEGER; l: LONGINT; h: HUGEINT;
@@ -575,8 +569,8 @@ TYPE
 					NEW(int, stack.CallH(address));
 					RETURN int;
 			|Reflection.sfTypeREAL:
-				 NEW(real, stack.CallR(address));
-				 RETURN real
+				NEW(real, stack.CallR(address));
+				RETURN real
 			|Reflection.sfTypeLONGREAL:
 				NEW(real, stack.CallX(address));
 				RETURN real;
@@ -733,7 +727,6 @@ TYPE
 
 	END FieldResult;
 
-
 	(* traverse types and supertypes for first occurence of symbol name *)
 	PROCEDURE FindInType(scope: Result; address: ADDRESS; type: ADDRESS; CONST name: ARRAY OF CHAR): Result;
 	VAR tag: ADDRESS; typeInfo: Modules.TypeDesc; i, num: LONGINT;
@@ -764,7 +757,6 @@ TYPE
 		RETURN NIL;
 	END FindInType;
 
-
 	PROCEDURE FindConstructor(scope: Result; type: ADDRESS): ProcedureResult;
 	VAR tag: ADDRESS; typeInfo: Modules.TypeDesc; i, num: LONGINT;
 			proc: ProcedureResult; f: FieldResult;
@@ -871,7 +863,6 @@ TYPE
 
 	END Value;
 
-
 	CONST StrValue="value";
 	TYPE
 
@@ -969,7 +960,6 @@ TYPE
 			RETURN ADDRESSOF(value)
 		END Address;
 
-
 	END AddressValue;
 
 	IntegerValue*=OBJECT(Value)
@@ -1090,7 +1080,6 @@ TYPE
 			x := value; RETURN TRUE;
 		END GetBoolean;
 
-
 		PROCEDURE WriteValue*(w: Streams.Writer);
 		BEGIN IF value THEN w.String("TRUE") ELSE w.String("FALSE") END
 		END WriteValue;
@@ -1138,7 +1127,6 @@ TYPE
 
 	END StringValue;
 
-
 	SetValue*=OBJECT(Value)
 	VAR value*: SET;
 
@@ -1211,7 +1199,6 @@ TYPE
 			x := value; RETURN TRUE;
 		END GetRange;
 
-
 		PROCEDURE WriteValue*(w: Streams.Writer);
 		BEGIN
 			w.Int(FIRST(value),0); w.String(" .. "); w.Int(LAST(value),0); IF STEP(value) # 1 THEN w.String(" BY "); w.Int(STEP(value),0) END;
@@ -1356,7 +1343,6 @@ TYPE
 			w.String("] ");
 		END WriteValue;
 
-
 	END MathArrayValue;
 
 	(* object value represented as ANY wrapped in Value ? *)
@@ -1422,7 +1408,6 @@ TYPE
 			RETURN symbols.Get(index)(Symbol).item
 		END GetItem;
 
-
 		(* Enter a symbol with its name *)
 		PROCEDURE Enter1*(item: Item; name: StringPool.Index);
 		VAR any: ANY; symbol: Symbol;
@@ -1512,7 +1497,6 @@ TYPE
 
 	END Scope;
 
-
 	PROCEDURE Indent(w: Streams.Writer; level: LONGINT);
 	BEGIN
 		WHILE level> 0 DO w.Char(TAB); DEC(level) END;
@@ -1539,7 +1523,6 @@ TYPE
 		c.GetObject(o); IF o = NIL THEN RETURN NIL ELSE RETURN o(Value) END;
 	END ContentGetValue;
 
-
 	PROCEDURE NewIntegerValue(value: HUGEINT): IntegerValue;
 	VAR obj: IntegerValue;
 	BEGIN

+ 10 - 17
source/FoxMinosObjectFile.Mod

@@ -3,14 +3,11 @@ MODULE FoxMinosObjectFile; (** AUTHOR "fof"; PURPOSE "Oberon Compiler Minos Obje
 IMPORT
 	Scanner := FoxScanner, Basic := FoxBasic, SyntaxTree := FoxSyntaxTree, Global := FoxGlobal, SemanticChecker := FoxSemanticChecker, Fingerprinter := FoxFingerprinter, Sections := FoxSections,
 	Streams, D := Debugging, Files, SYSTEM,Strings, BinaryCode := FoxBinaryCode, KernelLog, Diagnostics, SymbolFileFormat := FoxTextualSymbolFile, Options,
-	Formats := FoxFormats, IntermediateCode := FoxIntermediateCode, Machine
-	;
-
+	Formats := FoxFormats, IntermediateCode := FoxIntermediateCode, Machine;
 
 CONST
 	Trace=FALSE;
 
-
 TYPE Name=ARRAY 256 OF CHAR;
 	ByteArray = POINTER TO ARRAY OF CHAR;
 
@@ -187,14 +184,11 @@ TYPE
 			END;
 		END FirstOffsets;
 
-
 		(* note: if 'caseSections' is TRUE, only case table sections are processed, otherwise only regular sections (imported symbol/system call sections are never processed) *)
 		PROCEDURE SetOffsets(sectionList: Sections.SectionList);
 		VAR
 			section: Sections.Section;
 			i: LONGINT;
-
-
 		BEGIN
 			FOR i := 0 TO sectionList.Length() - 1 DO
 				section := sectionList.GetSection(i);
@@ -209,12 +203,12 @@ TYPE
 				IF section.symbol = module.module.moduleScope.bodyProcedure THEN
 				ELSIF symbolName = "@moduleSelf" THEN
 				ELSIF section.type = Sections.ConstSection THEN
-					 IF binarySection.os.alignment # 0 THEN
-					 	INC(codeSize,(-codeSize) MOD binarySection.os.alignment);
-					 END;
-					  section.SetOffset(codeSize); INC(codeSize,binarySection.pc); (* global constants: in code *)
-					  Basic.Align(codeSize, 4); (* word alignment *)
-						(*ReportSection(section)*)
+					IF binarySection.os.alignment # 0 THEN
+						INC(codeSize,(-codeSize) MOD binarySection.os.alignment);
+					END;
+					section.SetOffset(codeSize); INC(codeSize,binarySection.pc); (* global constants: in code *)
+					Basic.Align(codeSize, 4); (* word alignment *)
+					(*ReportSection(section)*)
 				ELSIF (section.type = Sections.CodeSection) OR (section.type = Sections.BodyCodeSection) THEN
 					(*IF section.symbol = module.module.moduleScope.bodyProcedure THEN
 						bodyOffset := codeSize
@@ -223,10 +217,10 @@ TYPE
 					section.SetOffset(codeSize); INC(codeSize, binarySection.pc);
 					Basic.Align(codeSize, 4); (* word alignment *)
 					(*ReportSection(section)*)
- 				ELSIF section.type = Sections.VarSection THEN
+				ELSIF section.type = Sections.VarSection THEN
 					INC(varSize, binarySection.pc);
 					IF binarySection.os.alignment # 0 THEN
-					 	INC(varSize,(-varSize) MOD binarySection.os.alignment);
+						INC(varSize,(-varSize) MOD binarySection.os.alignment);
 					END;
 					section.SetOffset(-varSize); (* global variables: negative offset *)
 					(*ReportSection(section)*)
@@ -278,7 +272,6 @@ TYPE
 				RETURN (type.declaredType.resolved IS SyntaxTree.RecordType)
 			END TypeNeedsSection;
 
-
 		BEGIN
 			numberEntries := 0;
 			symbol := moduleScope.firstSymbol;
@@ -380,7 +373,7 @@ TYPE
 								patchOffset := (fixup.resolved.offset + fixup.displacement);
 								IF (patchOffset DIV 4 >= 8000H) OR (patchOffset DIV 4< -8000H)
 									OR (patchOffset MOD 4 # 0)
-								 THEN
+								THEN
 									msg := "fixup problem: ";
 									Basic.SegmentedNameToString(fixup.symbol.name, name);
 									Strings.Append(msg, name);

+ 0 - 2
source/FoxOberonFrontend.Mod

@@ -28,7 +28,6 @@ TYPE
 			RETURN parser.error;
 		END Error;
 
-
 		PROCEDURE Done*(): BOOLEAN;
 		BEGIN
 			RETURN ~parser.NextModule()
@@ -43,5 +42,4 @@ TYPE
 		RETURN frontend;
 	END Get;
 
-
 END FoxOberonFrontend.

+ 31 - 37
source/FoxParser.Mod

@@ -18,12 +18,12 @@ CONST
 		Import     = Identifier [':=' Identifier] ['in' Identifier].
 
 		DeclarationSequence  =  {
-							 'const' [ConstDeclaration] {';' [ConstDeclaration]}
+							'const' [ConstDeclaration] {';' [ConstDeclaration]}
 							|'type'  [TypeDeclaration] {';' [TypeDeclaration]}
-						 	|'var'   [VariableDeclaration] {';' [VariableDeclaration]}
-						 	| ProcedureDeclaration
-						 	| OperatorDeclaration
-						 	| ';'
+							|'var'   [VariableDeclaration] {';' [VariableDeclaration]}
+							| ProcedureDeclaration
+							| OperatorDeclaration
+							| ';'
 							}
 
 	Declaration = IdentifierDefinition '=' Expression.
@@ -83,7 +83,7 @@ CONST
 	StatementSequence = Statement {';' Statement}.
 
 	Statement =
- 				[
+				[
 					Designator [':=' Expression |'!' Expression | '?' Expression | '<<' Expresssion | '>>' Expression]
 					| 'if' Expression 'then' StatementSequence
 						{'elsif' Expression 'then' StatementSequence}
@@ -92,13 +92,13 @@ CONST
 					| 'with' Identifier ':' QualifiedIdentifier 'do' StatementSequence
 						{['|' Identifier ':'] QualifiedIdentifier 'do' StatementSequence}
 						[else StatementSequence]
-						 'end'
+						'end'
 					| 'case' Expression 'of' ['|'] Case {'|' Case} ['else' StatementSequence] 'end'
 					| 'while' Expression 'do' StatementSequence 'end'
 					| 'repeat' StatementSequence 'until' Expression
 					| 'for' Identifier ':=' Expression 'to' Expression ['by' Expression] 'do'
 						StatementSequence 'end'
- 					| 'loop' StatementSequence 'end'
+					| 'loop' StatementSequence 'end'
 					| 'exit'
 					| 'return' [Expression]
 					| 'await' Expression
@@ -132,7 +132,7 @@ CONST
 	Set = '{' [ RangeExpression {',' RangeExpression} ] '}'.
 
 	Designator  = ('self' | 'result' | Identifier)
-		      						{'.' Identifier  | '[' IndexList ']' | '(' [ExpressionList] ')' | '^'} [Flags].
+							{'.' Identifier  | '[' IndexList ']' | '(' [ExpressionList] ')' | '^'} [Flags].
 
 	RangeExpression = SimpleExpression | [SimpleExpression] '..' [SimpleExpression] ['by' SimpleExpression] | '*'.
 
@@ -254,13 +254,11 @@ TYPE
 			error := FALSE;
 		END Reset;
 
-
 		PROCEDURE SetLax*;
 		BEGIN
 			Lax := TRUE;
 		END SetLax;
 
-
 		(** output error message and / or given code *)
 		PROCEDURE Error(position: Position; code: LONGINT; CONST message: ARRAY OF CHAR);
 		BEGIN
@@ -604,7 +602,7 @@ TYPE
 				IF ~Optional( Scanner.Period )THEN
 					suffix := prefix;  prefix := SyntaxTree.invalidIdentifier;   (* empty *)
 				ELSE
-					 suffix := Identifier(position1);
+					suffix := Identifier(position1);
 				END;
 				qualifiedIdentifier := SyntaxTree.NewQualifiedIdentifier( position0, prefix,suffix);
 			ELSE
@@ -765,7 +763,7 @@ TYPE
 		END RangeExpression;
 
 		(** Designator  = ('self' | 'result' | Identifier)
-		                  {'.' Identifier  | '[' IndexList ']' | '(' [ExpressionList] ')' | '^'} [Flags].
+			{'.' Identifier  | '[' IndexList ']' | '(' [ExpressionList] ')' | '^'} [Flags].
 		**)
 		PROCEDURE Designator( ): SyntaxTree.Designator;
 		VAR
@@ -890,9 +888,9 @@ TYPE
 		END MathArray;
 
 		(** Factor = Number | Character | String | 'nil' | 'imag' | 'true' | 'false' | Set
-			 			  | '(' Expression ')' | '~' Factor | Factor '`' | Designator | MathArray.
-			 			  | 'SIZE' 'OF' Designator | 'ADDRESS' 'OF' Designator | 'ALIAS' OF Expression
-			 			  **)
+						| '(' Expression ')' | '~' Factor | Factor '`' | Designator | MathArray.
+						| 'SIZE' 'OF' Designator | 'ADDRESS' 'OF' Designator | 'ALIAS' OF Expression
+						**)
 		PROCEDURE Factor( ): SyntaxTree.Expression;
 		VAR factor: SyntaxTree.Expression; position: Position; operator: LONGINT;
 		BEGIN
@@ -993,7 +991,7 @@ TYPE
 		END Factor;
 
 		(** Term = Factor {MulOp Factor}.
-		   MulOp = '*' | '**' | '.*' | '+*' | '/' | '\' | './' | 'div' | 'mod' | '&'.
+			MulOp = '*' | '**' | '.*' | '+*' | '/' | '\' | './' | 'div' | 'mod' | '&'.
 		**)
 		PROCEDURE Term( ): SyntaxTree.Expression;
 		VAR term, factor: SyntaxTree.Expression;  operator: LONGINT; position: Position;
@@ -1040,9 +1038,9 @@ TYPE
 		(**
 			Expression           = RangeExpression [RelationOp RangeExpression].
 			RelationOp           = '=' | '.=' | '#' | '.#'
-			                     | '<' | '.<' | '<=' | '.<=' | '>' | '.>' | '>=' | '.>='
-			                     | '??' | '!!' | '<<?' | '>>?'
-			                     | 'in' | 'is'
+						| '<' | '.<' | '<=' | '.<=' | '>' | '.>' | '>=' | '.>='
+						| '??' | '!!' | '<<?' | '>>?'
+						| 'in' | 'is'
 		**)
 		PROCEDURE Expression*( ): SyntaxTree.Expression;
 		VAR expression, rightExpression: SyntaxTree.Expression;  operator: LONGINT;  position: Position;
@@ -1085,7 +1083,6 @@ TYPE
 			IF Trace THEN E( "Case" ) END;
 		END Case;
 
-
 		(**		Statement =
                      [
                      Designator [':=' Expression |'!' Expression | '?' Expression | '<<' Expresssion | '>>' Expression]
@@ -1095,7 +1092,7 @@ TYPE
                         'end'
                      | 'with' Identifier ':' QualifiedIdentifier 'do' StatementSequence
                          {'|' [Identifier ':'] QualifiedIdentifier 'do' StatementSequence}
-                				[else StatementSequence]
+                         [else StatementSequence]
                          'end'
                      | 'case' Expression 'of' ['|'] Case {'|' Case} ['else' StatementSequence] 'end'
                      | 'while' Expression 'do' StatementSequence 'end'
@@ -1433,7 +1430,7 @@ TYPE
 		END Code;
 
 		(** Body = 'begin' [Flags] StatementSequence ['finally' StatementSequence]
-		         			| 'code' Code. **)
+						| 'code' Code. **)
 		PROCEDURE Body( scope: SyntaxTree.ProcedureScope ): SyntaxTree.Body;
 		VAR body: SyntaxTree.Body; code: SyntaxTree.Code; position: Position;  previousScope: SyntaxTree.Scope;
 		BEGIN
@@ -1516,7 +1513,7 @@ TYPE
 			(* generic empty OBJECT type *)
 			IF Peek(Scanner.Semicolon) OR Peek(Scanner.RightParenthesis) THEN
 				Scanner.GetKeyword(scanner.case,Scanner.Object,identifier);
-	      		qualifiedIdentifier := SyntaxTree.NewQualifiedIdentifier(position,SyntaxTree.invalidIdentifier,identifier);
+				qualifiedIdentifier := SyntaxTree.NewQualifiedIdentifier(position,SyntaxTree.invalidIdentifier,identifier);
 				type := SyntaxTree.NewQualifiedType( position, parentScope, qualifiedIdentifier );
 				RETURN type
 			END;
@@ -1593,14 +1590,12 @@ TYPE
 				cellType.SetModifiers(modifiers);
 			END;
 
-
 			IF Optional( Scanner.LeftParenthesis ) THEN
 				PortList(cellType,cellScope);
 			END;
 
 			IF Optional( Scanner.Semicolon ) THEN END;
 
-
 			WHILE Optional(Scanner.Import) DO ImportList(cellScope) END;
 			DeclarationSequence( cellScope);
 			IF Peek(Scanner.Begin) OR Peek(Scanner.Code) THEN
@@ -1617,7 +1612,7 @@ TYPE
 
 		(** PointerType = 'pointer' [Flags] 'to' Type. **)
 		PROCEDURE PointerType( position: Position; parentScope: SyntaxTree.Scope ): SyntaxTree.PointerType;
-		VAR pointerType: SyntaxTree.PointerType;  base: SyntaxTree.Type; 	modifiers: SyntaxTree.Modifier;
+		VAR pointerType: SyntaxTree.PointerType; base: SyntaxTree.Type; modifiers: SyntaxTree.Modifier;
 		BEGIN
 			IF Trace THEN S( "PointerType" ) END;
 			(* pointer token already consumed *)
@@ -1683,7 +1678,7 @@ TYPE
 
 		(** ArrayType     = 'array' 'of' Type | 'array' Expression {',' Expression} 'of' Type
 													| 'array' '[' MathArraySize {',' MathArraySize} ']' ['of' Type].
-	  		 MathArraySize = Expression | '*' | '?'.
+			MathArraySize = Expression | '*' | '?'.
 		**)
 		PROCEDURE ArrayType(position: Position;   parentScope: SyntaxTree.Scope ): SyntaxTree.Type;
 		VAR
@@ -2044,7 +2039,7 @@ TYPE
 		END CommentWithPart;
 
 		(** ProcedureDeclaration = 'procedure' ['^'|'&'|'~'|'-'|Flags ['-']] IdentifierDefinition [FormalParameters]';'
-			                       DeclarationSequence  [Body] 'end' Identifier.
+					DeclarationSequence  [Body] 'end' Identifier.
 			Forward declarations ignored.
 		**)
 		PROCEDURE ProcedureDeclaration( parentScope: SyntaxTree.Scope);
@@ -2148,7 +2143,7 @@ TYPE
 		END ProcedureDeclaration;
 
 		(** OperatorDeclaration  = 'operator' [Flags] ['-'] String ['*'|'-'] FormalParameters ';'
-			                       DeclarationSequence [Body] 'end' String.
+					DeclarationSequence [Body] 'end' String.
 		**)
 		PROCEDURE OperatorDeclaration(parentScope: SyntaxTree.Scope );
 		VAR
@@ -2189,7 +2184,6 @@ TYPE
 			ELSE access := SyntaxTree.Internal;
 			END;
 
-
 			procedureScope := SyntaxTree.NewProcedureScope(parentScope);
 			operator := SyntaxTree.NewOperator( token.position, SyntaxTree.NewIdentifier(string^), procedureScope);
 			CommentSymbol(operator);
@@ -2297,12 +2291,12 @@ TYPE
 		END ConstDeclaration;
 
 		(** DeclarationSequence  =  { 'const' [ConstDeclaration] {';' [ConstDeclaration]}
-			                         |'type'  [TypeDeclaration] {';' [TypeDeclaration]}
-			                         |'var'   [VariableDeclaration] {';' [VariableDeclaration]}
-			                         | ProcedureDeclaration
-			                         | OperatorDeclaration
-			                         | ';'
-			                        }
+						|'type'  [TypeDeclaration] {';' [TypeDeclaration]}
+						|'var'   [VariableDeclaration] {';' [VariableDeclaration]}
+						| ProcedureDeclaration
+						| OperatorDeclaration
+						| ';'
+					}
 		**)
 		PROCEDURE DeclarationSequence( parentScope: SyntaxTree.Scope);
 		VAR previousScope: SyntaxTree.Scope;

+ 9 - 17
source/FoxPrintout.Mod

@@ -225,7 +225,6 @@ TYPE
 			VisitBasicType(x);
 		END VisitAnyType;
 
-
 		PROCEDURE VisitMathArrayType*(x: SyntaxTree.MathArrayType);
 		BEGIN
 			Keyword("ARRAY " );
@@ -279,7 +278,6 @@ TYPE
 			FlagEnd(first);
 		END ObjectFlags;
 
-
 		PROCEDURE VisitPointerType*(x: SyntaxTree.PointerType);
 		VAR pointerBase: SyntaxTree.Type;
 		BEGIN
@@ -398,14 +396,12 @@ TYPE
 			IF ~first THEN w.String("} ") END;
 		END FlagEnd;
 
-
 		PROCEDURE Value(identifier: SyntaxTree.Identifier; value: HUGEINT; VAR first: BOOLEAN);
 		BEGIN
 			Flag(identifier,first);
 			w.String("("); w.Int(value,1); w.String(")");
 		END Value;
 
-
 		PROCEDURE VisitProcedureType*(x: SyntaxTree.ProcedureType);
 		VAR first: BOOLEAN;
 		BEGIN
@@ -588,8 +584,8 @@ TYPE
 		PROCEDURE VisitBracketDesignator*(x: SyntaxTree.BracketDesignator);
 		BEGIN
 			Expression(x.left);
-		 	IF info THEN AlertString("(*<BracketDesignator>*)") END;
-		 	w.String("["); ExpressionList(x.parameters); w.String("]");
+			IF info THEN AlertString("(*<BracketDesignator>*)") END;
+			w.String("["); ExpressionList(x.parameters); w.String("]");
 		END VisitBracketDesignator;
 
 		PROCEDURE VisitParameterDesignator*(x: SyntaxTree.ParameterDesignator);
@@ -738,7 +734,6 @@ TYPE
 			VisitStatementBlock(x.block);
 		END VisitInlineCallDesignator;
 
-
 		PROCEDURE VisitStatementDesignator*(x: SyntaxTree.StatementDesignator);
 		BEGIN
 			Indent; Keyword("STATEMENT-DESIGNATOR ");
@@ -749,7 +744,6 @@ TYPE
 			Indent; Statement(x.statement);
 		END VisitStatementDesignator;
 
-
 		PROCEDURE VisitBuiltinCallDesignator*(x: SyntaxTree.BuiltinCallDesignator);
 		BEGIN
 			IF x.left # NIL THEN
@@ -1178,7 +1172,6 @@ TYPE
 			w.String( ")" );
 		END ParameterList;
 
-
 		PROCEDURE Access(access: SET);
 		BEGIN
 			IF SyntaxTree.PublicWrite IN access THEN w.String(" PublicWrite") END;
@@ -1297,7 +1290,6 @@ TYPE
 				type := x.type(SyntaxTree.ProcedureType);
 				PrintSymbol(x);
 
-
 				ParameterList(type.firstParameter);
 				IF type.returnType # NIL THEN
 					w.String( ": " );
@@ -1322,7 +1314,7 @@ TYPE
 						IF mode >= SymbolFile THEN
 							ProcedureScope(x.procedureScope);
 						END;
-						Indent;  Keyword("END " );  	w.String( '"' );  Identifier(x.name);  w.String( '"' );
+						Indent; Keyword("END " ); w.String( '"' ); Identifier(x.name); w.String( '"' );
 					END;
 				END;
 			END
@@ -1522,14 +1514,14 @@ TYPE
 			Expression(x.left);
 			identifier := Global.GetIdentifier(x.op,case);
 			w.String(" "); Identifier(identifier); w.String(" ");
-			 Expression(x.right);
+			Expression(x.right);
 		END VisitCommunicationStatement;
 
 		PROCEDURE IfPart(x: SyntaxTree.IfPart);
 		BEGIN
 			IF DebugPosition THEN TRACE(x.position.start, x.position.end, x.end.start, x.end.end) END;
 			Comments(x.comment, x, FALSE);
-	 		Keyword("IF " );
+			Keyword("IF " );
 			Expression(x.condition);
 			Keyword(" THEN " );
 			Comments(x.comment,x,TRUE);
@@ -1683,7 +1675,9 @@ TYPE
 		END VisitExitableBlock;
 
 		PROCEDURE VisitExitStatement*(x: SyntaxTree.ExitStatement);
-		BEGIN 	Keyword("EXIT" ) END VisitExitStatement;
+		BEGIN
+			Keyword("EXIT" );
+		END VisitExitStatement;
 
 		PROCEDURE VisitReturnStatement*(x: SyntaxTree.ReturnStatement);
 		BEGIN
@@ -1892,7 +1886,6 @@ TYPE
 
 	END Printer;
 
-
 (* debugging helper *)
 VAR
 	debug: Printer;
@@ -1903,7 +1896,6 @@ VAR
 		NEW(p,w,mode,info); RETURN p
 	END NewPrinter;
 
-
 	PROCEDURE Info*(CONST info: ARRAY OF CHAR; a: ANY);
 	VAR symbol: SyntaxTree.Symbol; scope: SyntaxTree.Scope;
 	BEGIN
@@ -1934,7 +1926,7 @@ VAR
 		ELSIF a IS SyntaxTree.Scope THEN
 			scope := a(SyntaxTree.Scope);
 			WHILE(scope # NIL) DO
-				D.Ln; 		D.Str("      ");
+				D.Ln; D.Str("      ");
 				IF scope IS SyntaxTree.ModuleScope THEN D.Str("ModuleScope: ")
 				ELSIF scope IS SyntaxTree.ProcedureScope THEN D.Str("ProcedureScope: ");
 				ELSIF scope IS SyntaxTree.RecordScope THEN D.Str("RecordScope: ");

+ 1 - 4
source/FoxProfiler.Mod

@@ -89,7 +89,6 @@ TYPE
 	END;
 	HashIntArray = ARRAY 2*MaxProcesses OF HashEntryInt;
 
-
 VAR
 	(* modules *)
 	modules:Modules;
@@ -185,7 +184,7 @@ VAR
 	VAR time: HUGEINT; p: Process;
 	BEGIN
 		time:= GetTimer();
-		IF TraceEnter THEN log.String("Enter procedure: "); log.Int(moduleId,1); log.String(", "); log.Int(procedureId,1); log.Ln; log.Update 	END;
+		IF TraceEnter THEN log.String("Enter procedure: "); log.Int(moduleId,1); log.String(", "); log.Int(procedureId,1); log.Ln; log.Update END;
 		p := GetProcess();
 		p.Enter(moduleId,procedureId,time);
 	END EnterProcedure;
@@ -338,7 +337,6 @@ VAR
 		END;
 		log.Update;
 
-
 		FOR k := 0 TO numberProcesses-1 DO
 			IF processes[k].stackPosition # 0 THEN
 				log.String("warning: process "); log.Int(k,1); log.String(" still running with a stack of "); log.Int(processes[k].stackPosition,1); log.Ln;
@@ -365,7 +363,6 @@ VAR
 		ExitProcedure(0,0);
 	END CalibrateProc;
 
-
 	PROCEDURE Calibrate;
 	VAR cal: LONGINT; i: SIZE; process: Process;
 	BEGIN

+ 3 - 22
source/FoxProgTools.Mod

@@ -44,7 +44,7 @@ TYPE
 		PROCEDURE DumpNames(w: Streams.Writer);
 		VAR
 			i: LONGINT;
-			name: 	ARRAY 256 OF CHAR;
+			name: ARRAY 256 OF CHAR;
 		BEGIN
 			w.Int(Length(), 0); w.String(" names:"); w.Ln;
 			FOR i := 0 TO Length() - 1 DO
@@ -392,7 +392,6 @@ TYPE
 				END;
 			END Comment;
 
-
 		BEGIN
 			ch := context.arg.Get();
 			SkipBlanks;  i := 0;
@@ -416,7 +415,6 @@ TYPE
 			RETURN (i>0);
 		END GetNextSymbol;
 
-
 	BEGIN
 		NEW(options);
 		options.Add("e", "export", Options.Flag);
@@ -508,10 +506,6 @@ TYPE
 
 		END Replacer;
 
-
-
-
-
 	VAR fileName,instr: ARRAY 256 OF CHAR; w: Streams.Writer; reader: Files.Reader; file: Files.File; ch: CHAR;
 		line: ARRAY 1024 OF CHAR;
 
@@ -522,14 +516,11 @@ TYPE
 		cpuoptionReplacer: Replacer;
 		bitwidthReplacer: Replacer;
 
-
-
 		numberMnemonics: LONGINT;
 		numberInstructions : LONGINT;
 		maxMnemonicNameLength: LONGINT;
 		maxOpcodeLength: LONGINT;
 
-
 		PROCEDURE Priority(i: Instruction): LONGINT;
 		VAR prio: LONGINT;
 
@@ -587,7 +578,7 @@ TYPE
 		PROCEDURE GetLine(VAR line: ARRAY OF CHAR);
 		VAR i : LONGINT;
 		BEGIN
-			 i := 0;
+			i := 0;
 			WHILE(ch # CR) & (ch # LF) & (ch # 0X) DO
 				line[i] := ch; INC(i);
 				GetCh();
@@ -645,7 +636,6 @@ TYPE
 				END;
 			END Follows;
 
-
 			PROCEDURE OpCode(CONST code: ARRAY OF CHAR);
 			VAR ch: CHAR; i: LONGINT;
 				op: ARRAY 3 OF CHAR;
@@ -669,7 +659,6 @@ TYPE
 					END;
 				END Hex;
 
-
 			BEGIN
 				error := FALSE;
 				ModRM := "";
@@ -816,7 +805,6 @@ TYPE
 				w.String("}");
 			END Options;
 
-
 		PROCEDURE ParseLine(CONST  line: ARRAY OF CHAR);
 		VAR ch: CHAR; i : LONGINT;
 
@@ -826,16 +814,13 @@ TYPE
 				len := 0;
 				ch:= line[i]; INC(i);
 				WHILE(ch # TAB) & (ch # LF) & (ch # 0X) DO
-					WHILE(ch = " ") DO 	ch:= line[i]; INC(i); END;
+					WHILE (ch = " ") DO ch:= line[i]; INC(i); END;
 					sym[len] := ch; INC(len);
 					ch:= line[i]; INC(i);
 				END;
 				sym[len] := 0X;
 			END NextSym;
 
-
-
-
 		BEGIN
 			i := 0; ch := line[0];
 			IF (ch = '"') OR (ch = ";") THEN (* comment line skipped *)
@@ -880,7 +865,6 @@ TYPE
 				END;
 			END;
 
-
 		END ParseLine;
 
 	BEGIN
@@ -990,7 +974,6 @@ TYPE
 			mnemonic := firstMnemonic;
 			maxOpcodeLength:= 0;
 
-
 			WHILE(mnemonic # NIL) DO
 				(*
 				IF Strings.Length(mnemonic.name)+1 > maxMnemonicNameLength THEN maxMnemonicNameLength := Strings.Length(mnemonic.name)+1 END;
@@ -1080,7 +1063,6 @@ TYPE
 				mnemonic := mnemonic.next;
 			END;
 
-
 			w.Char(09X); w.String("numberMnemonics = "); w.Int(numberMnemonics,1); w.String(";"); w.Ln;
 			w.Char(09X); w.String("numberInstructions = "); w.Int(numberInstructions,1); w.String(";");w.Ln;
 			w.Char(09X); w.String("maxMnemonicNameLength ="); w.Int(maxMnemonicNameLength,1); w.String(";"); w.Ln;
@@ -1112,7 +1094,6 @@ FoxProgTools.Enum --incremental a b c d e ~
 FoxProgTools.Enum --start=10 a b c  d e ~
 FoxProgTools.Enum --start=10 --hex  a b c  d e ~
 
-
 FoxProgTools.ParseAMDInstructionSet FoxInstructionSetAMD64TabSeperated.txt ~
 
 FoxProgTools.ParseARMInstructionSet OC/FoxInstructionSetARM.txt ~

+ 29 - 37
source/FoxScanner.Mod

@@ -30,19 +30,19 @@ CONST
 	note: order of symbols is important for the parser, do not modify without looking it up
 
 	FoxProgTools.Enum --export --linefeed=6
-    	None
+	None
 	(* RelationOps: Equal ... Is *)
-    	Equal DotEqual Unequal DotUnequal
-    	Less DotLess  LessEqual DotLessEqual Greater DotGreater GreaterEqual DotGreaterEqual
-    	LessLessQ GreaterGreaterQ Questionmarks ExclamationMarks
-    	In Is
-    	(* MulOps: Times ... And *)
-    	Times TimesTimes DotTimes PlusTimes Slash Backslash DotSlash Div Mod And
-    	(* AddOps: Or ... Minus *)
-    	Or Plus Minus
-    	(* Prefix Unary Operators Plus ... Not *)
+	Equal DotEqual Unequal DotUnequal
+	Less DotLess  LessEqual DotLessEqual Greater DotGreater GreaterEqual DotGreaterEqual
+	LessLessQ GreaterGreaterQ Questionmarks ExclamationMarks
+	In Is
+	(* MulOps: Times ... And *)
+	Times TimesTimes DotTimes PlusTimes Slash Backslash DotSlash Div Mod And
+	(* AddOps: Or ... Minus *)
+	Or Plus Minus
+	(* Prefix Unary Operators Plus ... Not *)
 		Not
-    	(* expressions may start with Plus ... Identifier *)
+	(* expressions may start with Plus ... Identifier *)
 		LeftParenthesis LeftBracket LeftBrace Number Character String Nil Imag True False Self Result New Identifier
 		(* statementy may start with Self ... Begin *)
 		If Case While Repeat For Loop With Exit Await Return Ignore Begin
@@ -107,7 +107,6 @@ CONST
 	Lowercase*=1;
 	Unknown*=2;
 
-
 TYPE
 	(* keywords  book keeping *)
 	Keyword* = ARRAY 32 OF CHAR;
@@ -256,14 +255,13 @@ TYPE
 			RETURN new
 		END GetStringCopy;
 
-
 	END StringMaker;
 
 	(** scanner reflects the following EBNF
-		Token 				= String | Symbol | Number | Keyword | Identifier.
-		Symbol 				=  | '#' | '&' | '(' ['*' any '*' ')'] | ')' | '*'['*'] | '+'['*'] | ',' | '-' | '.' [ '.' | '*' | '/' | '=' | '#' | '>'['='] | '<' ['=']
-											  | '/' | ':' ['='] | ';'  | '<' ['=' | '<' ['?'] ] | '=' | '>' [ '=' | '>' ['?']]
-											  | '[' | ']' | '^' | '{' | '|' | '}' | '~' | '\' |  '`' |  '?' ['?'] | '!' ['!']
+		Token				= String | Symbol | Number | Keyword | Identifier.
+		Symbol				=  | '#' | '&' | '(' ['*' any '*' ')'] | ')' | '*'['*'] | '+'['*'] | ',' | '-' | '.' [ '.' | '*' | '/' | '=' | '#' | '>'['='] | '<' ['=']
+											| '/' | ':' ['='] | ';'  | '<' ['=' | '<' ['?'] ] | '=' | '>' [ '=' | '>' ['?']]
+											| '[' | ']' | '^' | '{' | '|' | '}' | '~' | '\' |  '`' |  '?' ['?'] | '!' ['!']
 		Identifier			= Letter {Letter | Digit | '_'}.
 		Letter					= 'A' | 'B' | .. | 'Z' | 'a' | 'b' | .. | 'z'.
 		Digit						= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' .
@@ -316,8 +314,8 @@ TYPE
 			firstIdentifier := TRUE;
 			SELF.position := pos;
 			DEC(position.start, 1); (* one token lookahead *)
-			IF reader = NIL THEN ch := EOT ELSE 	GetNextCharacter END;
-			IF Trace THEN D.Str( "New scanner  " );   D.Ln;  END;
+			IF reader = NIL THEN ch := EOT ELSE GetNextCharacter END;
+			IF Trace THEN D.Str( "New scanner  " ); D.Ln; END;
 			IF source = "" THEN SELF.position.reader := reader END;
 			useLineNumbers := FALSE;
 		END InitializeScanner;
@@ -516,7 +514,6 @@ TYPE
 			token.string := stringMaker.GetStringCopy(token.stringLength);
 		END GetEscapedString;
 
-
 		(** get a string starting at current position
 			string = {'"' {Character} '"'} | {"'" {Character} "'"}.
 		**)
@@ -643,7 +640,6 @@ TYPE
 				RETURN (ch >= "0") & (ch <= "1")
 			END IsBinaryDigit;
 
-
 		BEGIN  (* ("0" <= ch) & (ch <= "9") *)
 			result := Number;
 			i := 0;  m := 0;  n := 0;  d := 0;  si := 0;  long := FALSE;
@@ -913,9 +909,9 @@ TYPE
 			| ',':     s := Comma;  GetNextCharacter
 			| '-':    s := Minus;  GetNextCharacter
 			| '.':     GetNextCharacter;
-					IF ch = '.' THEN GetNextCharacter;  s := Upto;
-					ELSIF ch = '*' THEN GetNextCharacter;  s := DotTimes;
-					ELSIF ch = '/' THEN 	GetNextCharacter;  s := DotSlash;
+					IF ch = '.' THEN GetNextCharacter; s := Upto;
+					ELSIF ch = '*' THEN GetNextCharacter; s := DotTimes;
+					ELSIF ch = '/' THEN GetNextCharacter; s := DotSlash;
 					ELSIF ch='=' THEN GetNextCharacter; s := DotEqual;
 					ELSIF ch='#' THEN GetNextCharacter; s := DotUnequal;
 					ELSIF ch='>' THEN GetNextCharacter;
@@ -966,8 +962,8 @@ TYPE
 						s := String;
 						GetEscapedString(token);
 					END;
-			| '`':	s := Transpose; GetNextCharacter
-			| '?': 	s := Questionmark; GetNextCharacter; IF ch = '?' THEN s := Questionmarks; GetNextCharacter END;
+			| '`':     s := Transpose; GetNextCharacter
+			| '?':     s := Questionmark; GetNextCharacter; IF ch = '?' THEN s := Questionmarks; GetNextCharacter END;
 			| '!':     s := ExclamationMark; GetNextCharacter; IF ch = '!' THEN s := ExclamationMarks; GetNextCharacter END;
 			| Ellipsis:
 					s := Upto;  GetNextCharacter
@@ -1018,13 +1014,13 @@ TYPE
 	END;
 
 	(** assembler scanner reflects the following EBNF
-		Token 			= String | Symbol | Number | Identifier.
-		Symbol 			= '\' | '#' | '(' ['*' any '*' ')'] | ')' | CR [LF] | LF | '*' | '+' | ',' | '-' | '~' | '.' | '/' | '%' | ':' | ';' | '=' | '[' | ']' | '{' | '}' | '!' | '^' | '$'['$'].
+		Token			= String | Symbol | Number | Identifier.
+		Symbol			= '\' | '#' | '(' ['*' any '*' ')'] | ')' | CR [LF] | LF | '*' | '+' | ',' | '-' | '~' | '.' | '/' | '%' | ':' | ';' | '=' | '[' | ']' | '{' | '}' | '!' | '^' | '$'['$'].
 		String				= '"' {Character} '"' | "'" {Character} "'".
 		Identifier		= '@' | Letter {'@' | '.' | Letter | Digit | '_'} .
-		Letter 				= 'A' | 'B' | .. |  'Z' | 'a' | 'b' |  .. | 'z' .
-		Digit 				= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'.
-		BinaryDigit 	= '0' | '1' .
+		Letter				= 'A' | 'B' | .. |  'Z' | 'a' | 'b' |  .. | 'z' .
+		Digit				= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'.
+		BinaryDigit	= '0' | '1' .
 		Number			= Integer | Real.
 		Character		= Digit [HexDigit] 'X'.
 		Integer			=  Digit {Digit} | Digit {HexDigit} 'H' | '0x' {HexDigit} | '0b' {BinaryDigit}.
@@ -1057,7 +1053,6 @@ TYPE
 			position := context.position;
 		END SetContext;
 
-
 		PROCEDURE SkipToEndOfLine*;
 		BEGIN
 			WHILE (ch # EOT) & (ch # CR) & (ch # LF) DO
@@ -1111,7 +1106,7 @@ TYPE
 				SkipBlanks;
 				token.position := position;
 				CASE ch OF  (* ch > ' ' *)
-				| EOT: 	s := EndOfText;
+				| EOT:	s := EndOfText;
 				| DoubleQuote:
 						s := String; GetString(token, TRUE, FALSE, TRUE);
 				| SingleQuote:
@@ -1164,13 +1159,11 @@ TYPE
 
 	END AssemblerScanner;
 
-
 	VAR
 		reservedCharacter: ARRAY 256 OF BOOLEAN;
 		symbols-: ARRAY EndOfText+1 OF Keyword;
 		keywordsLower, keywordsUpper: KeywordTable;
 
-
 	(** return a new scanner on a stream, error output via diagnostics  **)
 	PROCEDURE NewScanner*( CONST source: ARRAY OF CHAR; reader: Streams.Reader; position: LONGINT; diagnostics: Diagnostics.Diagnostics ): Scanner;
 	VAR s: Scanner; pos: Position;
@@ -1527,7 +1520,7 @@ TYPE
 		Basic.SetErrorMessage(Character,"missing character");
 		Basic.SetErrorMessage(Identifier,"missing identifier");
 		Basic.SetErrorMessage(EndOfText,"unexpected token before end");
-	  END InitKeywords;
+	END InitKeywords;
 
 	(** debugging / reporting **)
 	PROCEDURE ReportKeywords*(context: Commands.Context);
@@ -1548,7 +1541,6 @@ TYPE
 		END;
 	END ReportKeywords;
 
-
 	(*
 	PROCEDURE TestScanner*(context: Commands.Context);
 	VAR filename: ARRAY 256 OF CHAR; reader: Streams.Reader; scanner: Scanner;token: Token;

+ 2 - 5
source/FoxSections.Mod

@@ -189,8 +189,8 @@ TYPE
 				IF (ch = 0DX) OR (ch = 0AX) THEN newln := TRUE
 				ELSE
 					IF newln THEN w.Ln; w.String(LineCommentStart); newln := FALSE;  END;
-				 	w.Char(ch);
-				 END;
+					w.Char(ch);
+				END;
 				INC(i); ch := str[i];
 			END;
 			IF w IS Basic.Writer THEN w(Basic.Writer).EndComment; w(Basic.Writer).DecIndent;END;
@@ -360,11 +360,8 @@ TYPE
 			END;
 		END WriteRaw;
 
-
 	END SectionList;
 
-
-
 	NameEntry = POINTER TO RECORD
 		name: SyntaxTree.IdentifierString;
 	END;

+ 47 - 120
source/FoxSemanticChecker.Mod

@@ -90,9 +90,8 @@ TYPE
 		backendName-: ARRAY 32 OF CHAR;
 		inConversion: LONGINT;
 
-
 		(* temporary variables for the visitors
-		    they replace variables on a stack during use of the visitor pattern and may only be
+			they replace variables on a stack during use of the visitor pattern and may only be
 			- set in AcceptXXX procedures
 			- set and read in ResolveXXX procedures
 		*)
@@ -173,7 +172,6 @@ TYPE
 			Basic.Information(diagnostics, currentScope.ownerModule.sourceName, position, msg);
 		END InfoSS;
 
-
 		(*** symbol lookup ***)
 
 		(** find a symbol in the current scope, traverse to outer scope if traverse=true and no symbol found yet
@@ -494,14 +492,13 @@ TYPE
 			pointed to by a pointer to record. The following diagram shows the possible cases for records and pointer to records.
 
 			(1) Rec = RECORD ... END;					Ptr		<--->		Rec
-				Ptr = POINTER TO Rec;						^				 |
-																|				 |
+				Ptr = POINTER TO Rec;						^				|
+																|				|
 															TypeDesc			TypeDesc
 
-
 			(2)	Obj = POINTER TO RECORD .. END;		Obj		<--->		Record
 																^				/
-																|			   /
+																|			/
 															TypeDesc	<-- /
 		*)
 
@@ -520,7 +517,6 @@ TYPE
 			typeDeclaration.SetScope(currentScope);
 		END AnonymousTypeDeclaration;
 
-
 		(**
 			deferred pointer type resolving
 			- resolve base type
@@ -769,7 +765,6 @@ TYPE
 			END;
 		END CheckModifiers;
 
-
 		(**
 			resolve procedure type
 			- enter procedure to list of deferred fixes (to avoid infinite loops in the declaration phase)
@@ -832,7 +827,6 @@ TYPE
 				END;
 			END IsPointerToRecord;
 
-
 		BEGIN
 			hasPointers := FALSE;
 
@@ -1009,7 +1003,6 @@ TYPE
 			ELSE numberMethods := recordBase.recordScope.numberMethods
 			END;
 
-
 			modifier := x.modifiers;
 			(*IF ~x.isCellNet THEN*)
 				IF HasValue(modifier,Global.NameDataMemorySize,position,value) THEN END;
@@ -1114,7 +1107,6 @@ TYPE
 			END;
 		END ResolveCellType;
 
-
 		(** Check if a node has already been resolved. If not then mark as currently being resolved.
 			If node is currently being resolved then emit a cyclic definition error.
 			Return TRUE only if node is fully resolved.
@@ -1159,7 +1151,6 @@ TYPE
 			END;
 		END ResolveType;
 
-
 		(** resolve all pending types (late resolving).
 			- type fixes are resolved at the end of the declaration phase
 			- type fixes may imply new type fixes that are also entered at the end of the list
@@ -1203,7 +1194,6 @@ TYPE
 			RETURN result
 		END RegularType;
 
-
 		(** returns signature compatibility of procedure types this and to
 			- if not compatible then error is reported
 			- compatibility means type equality
@@ -1582,7 +1572,6 @@ TYPE
 				RETURN ResolveType(arrayType);
 			END RecursivelySetType;
 
-
 		BEGIN
 			type := NIL;
 			RecursivelyFindType(x);
@@ -1720,7 +1709,7 @@ TYPE
 							determined via the type descriptor, implement that ? *)
 						Error(left.position,"is not a type symbol");
 					END
-				 (* ALIAS OF *)
+				(* ALIAS OF *)
 				|Scanner.Alias:
 					type := left.type.resolved;
 					IF ~(type IS SyntaxTree.MathArrayType) THEN
@@ -1773,7 +1762,6 @@ TYPE
 				END;
 			END RecursivelyConvert;
 
-
 			PROCEDURE RecursivelySetType(x: SyntaxTree.MathArrayExpression): SyntaxTree.Type;
 			VAR numberElements,i,size,gsize: LONGINT; baseType: SyntaxTree.Type;expression: SyntaxTree.Expression;
 				arrayType: SyntaxTree.MathArrayType;
@@ -2362,12 +2350,12 @@ TYPE
 
 				Times, Plus, Minus		numeric		numeric		numeric
 											set				set				set
-				Slash 						numeric		numeric		real	/complex
+				Slash						numeric		numeric		real	/complex
 											set				set				set
 				Div , Mod					integer			integer			integer
 				And, Or					bool			bool			bool
-				Equal, Unequal 			basic			basic			bool
-											pointer 		pointer 		bool
+				Equal, Unequal			basic			basic			bool
+											pointer		pointer			bool
 											object			object			bool
 											record			record			bool
 											string			string			bool
@@ -2379,10 +2367,10 @@ TYPE
 
 				In							integer			set				bool
 				Is							pointer			type			bool
-				 							object			type			bool
-				 							record			type			bool
+											object			type			bool
+											record			type			bool
 
-				 Upto: special abbreviation for a..b
+				Upto: special abbreviation for a..b
 			*)
 
 			ELSIF (left.type = NIL) THEN
@@ -2486,7 +2474,7 @@ TYPE
 					Error(binaryExpression.position,"operator not defined 5");
 				END;
 				IF (operator = Scanner.Equal) OR (operator=Scanner.Unequal)
-					OR 	(operator = Scanner.Less) OR (operator = Scanner.LessEqual)
+					OR (operator = Scanner.Less) OR (operator = Scanner.LessEqual)
 					OR (operator = Scanner.Greater) OR (operator = Scanner.GreaterEqual) THEN
 					type := system.booleanType;
 				ELSE
@@ -2773,7 +2761,7 @@ TYPE
 		END ResolveBinaryExpression;
 
 		(** resolve a range expression of the from <<first .. last BY step>>
-		    - depending on the context different things are checked:
+			- depending on the context different things are checked:
 				ArrayIndex:
 					- components must be integers
 					- replace missing lower bound with 0
@@ -2790,7 +2778,7 @@ TYPE
 					- must have lower and upper bound present
 					- components are made compatible
 					- must not have step size
-		    - if error: return invalidExpression
+			- if error: return invalidExpression
 		**)
 		PROCEDURE ResolveRangeExpression(x: SyntaxTree.RangeExpression): SyntaxTree.Expression;
 		VAR
@@ -2934,15 +2922,14 @@ TYPE
 			ELSIF resolved IS SyntaxTree.Designator THEN
 				result := resolved(SyntaxTree.Designator);
 			ELSE
-				 Error(d.position,"is no designator ! ");
-				 result := SyntaxTree.invalidDesignator;
+				Error(d.position,"is no designator ! ");
+				result := SyntaxTree.invalidDesignator;
 			END;
 
 			(* result.type might be nil.  *)
 			RETURN result
 		END ResolveDesignator;
 
-
 		(**
 			self designator generated in this module
 			nothing to be resolved
@@ -3000,7 +2987,6 @@ TYPE
 			RETURN x;
 		END ResolveResultDesignator;
 
-
 		(**
 			return symbol designator as an expression
 			- if symbol is a constant then return the constant value expression
@@ -3059,7 +3045,6 @@ TYPE
 				assignable := assignable & (SyntaxTree.InternalWrite IN symbol.access);
 			END;
 
-
 			assignable := assignable & ((symbol IS SyntaxTree.Variable) OR (symbol IS SyntaxTree.Parameter)
 				& (symbol(SyntaxTree.Parameter).kind # SyntaxTree.ConstParameter) & ~(symbol(SyntaxTree.Parameter).ownerType IS SyntaxTree.CellType));
 
@@ -3112,7 +3097,6 @@ TYPE
 			END;
 		END ResolveIdentifierDesignator;
 
-
 		(** check and resolve a selector designator of the form left.designator
 			- if left is a pointer type then do auto dereferenciation
 			- left denotes a search scope:
@@ -3214,7 +3198,7 @@ TYPE
 			NIL						z					z
 			ARRAY [x, y]			z					ARRAY [x, y] OF z
 			ARRAY [x, y]			ARRAY [z]			ARRAY [x, y, z]
-			ARRAY [x, y]	 		ARRAY [*]			ARRAY [*, *, *]
+			ARRAY [x, y]			ARRAY [*]			ARRAY [*, *, *]
 		*)
 		PROCEDURE SetIndexBaseType(indexDesignator: SyntaxTree.IndexDesignator; newBaseType: SyntaxTree.Type);
 		VAR
@@ -3386,7 +3370,6 @@ TYPE
 			PROCEDURE FindOperator(recordType: SyntaxTree.RecordType; identifier: SyntaxTree.Identifier; actualParameters: SyntaxTree.ExpressionList): SyntaxTree.Operator;
 			VAR bestOperator: SyntaxTree.Operator; bestDistance: LONGINT; numberParameters: LONGINT; procedureType: SyntaxTree.ProcedureType;
 
-
 				PROCEDURE FindInScope(scope: SyntaxTree.RecordScope; access: SET);
 				VAR operator: SyntaxTree.Operator; distance,i: LONGINT;
 				CONST trace = FALSE;
@@ -3529,9 +3512,6 @@ TYPE
 				END
 			END FinalizeIndexDesignator;
 
-
-
-
 		BEGIN
 			IF Trace THEN D.Str("ResolveBracketDesignator"); D.Ln; END;
 
@@ -3639,7 +3619,6 @@ TYPE
 			RETURN result;
 		END ResolveBracketDesignator;
 
-
 		(** check and resolve expression list
 			- resolve each expression in an expression list
 			- returns true if and only if all statements could have successfully been resolved
@@ -3890,8 +3869,6 @@ TYPE
 
 			END;
 
-
-
 			IF result = SyntaxTree.invalidDesignator THEN
 			ELSIF (left IS SyntaxTree.SymbolDesignator) & (left(SyntaxTree.SymbolDesignator).symbol IS SyntaxTree.Procedure) THEN
 				procedure := left(SyntaxTree.SymbolDesignator).symbol(SyntaxTree.Procedure);
@@ -3931,7 +3908,7 @@ TYPE
 					END;
 					formalParameter := formalParameter.nextParameter;
 					INC(i);
- 				END;
+				END;
 			(*IF ~tooComplex & (procedureType.returnType # NIL) THEN
 				IF resultDesignator # NIL THEN
 					returnDesignator := resultDesignator
@@ -3957,8 +3934,6 @@ TYPE
 			RETURN result
 		END NewProcedureCallDesignator;
 
-
-
 		(**
 			builtin call designator generated in ResolveParameterDesignator
 			-> nothing to be resolved
@@ -4003,7 +3978,6 @@ TYPE
 			RETURN result
 		END CheckBasicType;
 
-
 		(**
 			if expression x is of number type then return true else report error and return false
 		**)
@@ -4119,7 +4093,6 @@ TYPE
 			RETURN result
 		END CheckRealType;
 
-
 		(**
 			if expression x is of range type then return true else report error and return false
 		**)
@@ -4265,7 +4238,6 @@ TYPE
 			RETURN result;
 		END CheckEnumerationValue;
 
-
 		PROCEDURE CheckCharacterValue(x: SyntaxTree.Expression; VAR value: CHAR): BOOLEAN;
 		VAR result: BOOLEAN;
 		BEGIN
@@ -4301,7 +4273,6 @@ TYPE
 			RETURN result;
 		END CheckPositiveIntegerValue;
 
-
 		PROCEDURE CheckPortType(x: SyntaxTree.Expression; VAR portType: SyntaxTree.PortType): BOOLEAN;
 		VAR type: SyntaxTree.Type; result: BOOLEAN;
 		BEGIN
@@ -4382,8 +4353,6 @@ TYPE
 				END;
 			END CheckModifiers;
 
-
-
 		BEGIN
 			type := NIL; result := NIL;
 			type0 := NIL; type1 := NIL; type2 := NIL;
@@ -4443,7 +4412,7 @@ TYPE
 						IF (numberActualParameters > 1) & CheckIntegerValue(parameter1,i1) THEN
 							(* modified: any integer parameter value is allowed, it is in the responsibility of the programmer to adhere to
 								rules imposed by the architecture / current runtime
-							 *)
+							*)
 						END;
 					END;
 				(* ---- COPY ----- *)
@@ -4493,7 +4462,7 @@ TYPE
 					IF CheckPositiveIntegerValue(parameter0,i0,FALSE) THEN
 						(* modified: any integer parameter value is allowed, it is in the responsibility of the programmer to adhere to
 							rules imposed by the architecture / current runtime
-						 *)
+						*)
 					END;
 				(* ---- WAIT ----- *)
 				ELSIF cooperative & (id = Global.Wait) & CheckArity(1,1) THEN
@@ -4731,7 +4700,7 @@ TYPE
 						END;
 
 						(*!compatibility with release, remove when resolved
-						    critical in release : SHORT(ASH(..))), ASH(ORD(..))
+							critical in release : SHORT(ASH(..))), ASH(ORD(..))
 						*)
 						parameter1 := NewConversion(parameter1.position,parameter1,system.longintType,NIL);
 						parameter0 := NewConversion(parameter0.position,parameter0,type,NIL);
@@ -4984,7 +4953,7 @@ TYPE
 						parameter0 := NewConversion(parameter0.position, parameter0, system.characterType,NIL);
 						actualParameters.SetExpression(0,parameter0);
 						(* IF CheckCharacterType(parameter0) THEN*)
-						 IF IsCharacterValue(parameter0,c)THEN
+						IF IsCharacterValue(parameter0,c)THEN
 							result.SetResolved(Global.NewIntegerValue(system,position,ORD(c)));
 							type := Global.GetSignedIntegerType(system,ORD(c));
 						END;
@@ -5025,7 +4994,7 @@ TYPE
 						ELSIF type.sizeInBits = 128 THEN type := Global.Complex64
 						END;
 					ELSE
-						 Error(parameter0.position,"short not applicable")
+						Error(parameter0.position,"short not applicable")
 					END;
 					IF (parameter0.resolved # NIL) THEN
 						parameter0 := ConvertValue(parameter0.position,parameter0.resolved,type);
@@ -5068,7 +5037,7 @@ TYPE
 						ELSIF type.sizeInBits = 64 THEN type := Global.Complex128
 						END;
 					ELSE
-						 Error(parameter0.position,"long not applicable")
+						Error(parameter0.position,"long not applicable")
 					END;
 					IF (parameter0.resolved # NIL) THEN
 						parameter0 := ConvertValue(parameter0.position,parameter0.resolved,type);
@@ -5180,10 +5149,10 @@ TYPE
 					END;
 				(* ---- LSH, LSL, ROT, ROR ----- *)
 				ELSIF ((id = Global.Lsh) OR (id = Global.Rot) OR (id= Global.Ror)) & CheckArity(2,2) THEN
-				 	type := type0;
+					type := type0;
 
-				 	parameter1 := NewConversion(parameter1.position,parameter1,system.longintType,NIL);
-				 	actualParameters.SetExpression(1, parameter1);
+					parameter1 := NewConversion(parameter1.position,parameter1,system.longintType,NIL);
+					actualParameters.SetExpression(1, parameter1);
 
 					IF IsIntegerValue(parameter0,i0) & IsIntegerValue(parameter1,i1) THEN
 						IF id = Global.Lsh THEN
@@ -5202,7 +5171,7 @@ TYPE
 							result := SyntaxTree.invalidExpression;
 							Error(parameter0.position,"is no basic type");
 						ELSE
-							 IF (parameter1.resolved # NIL) THEN
+							IF (parameter1.resolved # NIL) THEN
 								parameter0 := ConvertValue(parameter1.position,parameter1.resolved,type);
 								IF parameter0 IS SyntaxTree.Value THEN
 									result.SetResolved(parameter0(SyntaxTree.Value));
@@ -5309,7 +5278,6 @@ TYPE
 						type := system.lenType;
 					END;
 
-
 				(* ---- SUM ----- *)
 				ELSIF (id = Global.Sum) & CheckArity(1,2) THEN (* can only be found by overloading *)
 					Error(position, "sum operator not applicable");
@@ -5411,7 +5379,7 @@ TYPE
 					END;
 				(* ------- CONNECT -------*)
 				ELSIF (id = Global.Connect) & (CheckArity(2,3)) THEN
-					(*IF 	~(currentIsCellNet) THEN
+					(*IF ~(currentIsCellNet) THEN
 						Error(position, "connection outside activeCells body block");
 					END;*)
 
@@ -5433,7 +5401,7 @@ TYPE
 				(* ---------- DELEGATE --------*)
 				ELSIF (id = Global.Delegate) & (CheckArity(2,2)) THEN
 					(*
-					IF 	~(currentIsCellNet) THEN
+					IF ~(currentIsCellNet) THEN
 						Error(position, "connection delegation outside activeCells body block");
 					END;
 					*)
@@ -5615,8 +5583,8 @@ TYPE
 		END ResolveParameterDesignator;
 
 		(** check dereference designator left^
-			 - check if left is pointer type or left is object type
-			 - return new dereference designator with type = left.baseType.type (if appropriate)
+			- check if left is pointer type or left is object type
+			- return new dereference designator with type = left.baseType.type (if appropriate)
 			with error handling
 			returns invalidDesignator = invalidExpression if error
 		**)
@@ -5739,7 +5707,7 @@ TYPE
 			END;
 			result := x;
 			WITH x:
-			  SyntaxTree.ResultDesignator DO result := ResolveResultDesignator(x)
+			| SyntaxTree.ResultDesignator DO result := ResolveResultDesignator(x)
 			| SyntaxTree.SelfDesignator DO result := ResolveSelfDesignator(x)
 			| SyntaxTree.TypeGuardDesignator DO result := x;
 			| SyntaxTree.SymbolDesignator DO result := x;
@@ -5894,8 +5862,7 @@ TYPE
 
 		PROCEDURE ResolveSymbol*(x: SyntaxTree.Symbol);
 		BEGIN
-			WITH
-			  x:
+			WITH x:
 			| SyntaxTree.TypeDeclaration DO ResolveTypeDeclaration(x)
 			| SyntaxTree.Constant DO ResolveConstant(x)
 			| SyntaxTree.Parameter DO ResolveParameter(x)
@@ -5948,12 +5915,11 @@ TYPE
 			RETURN result
 		END SymbolNeedsResolution;
 
-
 		(** check and resolve a type declaration symbol = Type
 			- set type to declaration type
 				-> the type of a type declaration is NOT the declared type but the "declaration" type.
-				     This is so because the type declaration itself does not have a type but it only stands for a type.
-				     In the implementation of the compiler this made a lot much easier.
+					This is so because the type declaration itself does not have a type but it only stands for a type.
+					In the implementation of the compiler this made a lot much easier.
 			- resolve and set declared type
 			- check symbol
 		**)
@@ -6045,7 +6011,6 @@ TYPE
 			END;
 		END AdaptStackAlignment;
 
-
 		(** check and resolve a variable / field
 			- check and set type
 			- negative check on open array type
@@ -6119,7 +6084,6 @@ TYPE
 			END;
 		END ResolveVariable;
 
-
 		(** check and resolve a (procedure) parameter
 			- check and set type
 			- check symbol
@@ -6257,7 +6221,6 @@ TYPE
 				procedureType.SetUntracedReturn(HasFlag(modifiers, Global.NameUntraced, position));
 				CheckModifiers(modifiers, TRUE);
 
-
 				procedure.SetState(SyntaxTree.Resolved);
 
 				FixProcedureType(procedureType);
@@ -6569,8 +6532,6 @@ TYPE
 			END
 		END ResolveOperator;
 
-
-
 		PROCEDURE AddImport*(module: SyntaxTree.Module; x: SyntaxTree.Import): BOOLEAN;
 		VAR prevScope: SyntaxTree.Scope; prevDiagnostics: Diagnostics.Diagnostics;
 		BEGIN
@@ -6589,7 +6550,6 @@ TYPE
 			IF error THEN error := FALSE; RETURN FALSE ELSE RETURN TRUE END;
 		END AddImport;
 
-
 		(** check and resolve import
 			- check for name = SYSTEM
 			- check for forbidden self import
@@ -6983,14 +6943,13 @@ TYPE
 
 		END WithPart;
 
-
 		(** check and resolve with statement WITH variable: type DO ... END;
 			- check type and variable
 			- check that variable type is type extension of type
 			- check that variable is a variable
 			- enter new with scope and enter guardedVariable with same name and reference to variable
 			- create if statement:
-				WITH variable: type DO ... END; 	--> IF ~(variable IS type) THEN HALT(withTrap) ELSE ... END;
+				WITH variable: type DO ... END; --> IF ~(variable IS type) THEN HALT(withTrap) ELSE ... END;
 		**)
 		PROCEDURE ResolveWithStatement(withStatement: SyntaxTree.WithStatement): SyntaxTree.Statement;
 		VAR i,j: LONGINT; prevScope: SyntaxTree.Scope; variable: SyntaxTree.Designator;
@@ -7000,7 +6959,6 @@ TYPE
 			variable := ResolveDesignator(withStatement.variable);
 			withStatement.SetVariable(variable);
 
-
 			FOR i := 0 TO withStatement.WithParts()-1 DO
 				WithPart(withStatement.GetWithPart(i),variable);
 			END;
@@ -7111,7 +7069,6 @@ TYPE
 			StatementSequence(casePart.statements);
 		END CasePart;
 
-
 		(** check and resolve case statement CASE variable OF ... END;
 			- check variable
 			- check case parts
@@ -7184,8 +7141,7 @@ TYPE
 			repeatStatement.SetCondition(ResolveCondition(repeatStatement.condition));
 			StatementSequence(repeatStatement.statements);
 			RETURN repeatStatement;
-		 END ResolveRepeatStatement;
-
+		END ResolveRepeatStatement;
 
 		PROCEDURE GetGuard(symbol: SyntaxTree.Symbol; VAR type: SyntaxTree.Type): BOOLEAN;
 		VAR withEntry: WithEntry;
@@ -7248,7 +7204,6 @@ TYPE
 				expression := Global.NewIntegerValue(system,Basic.invalidPosition,1);
 			END;
 
-
 			IF expression = SyntaxTree.invalidExpression THEN
 			ELSIF  ~CompatibleTo(system,expression.type.resolved,designator.type.resolved) THEN
 				Error(expression.position,"step value of incompatible type");
@@ -7278,7 +7233,6 @@ TYPE
 			RETURN exitableBlock;
 		END ResolveExitableBlock;
 
-
 		(** check and resolve exit statement EXIT
 			- check that exit is within LOOP statement block
 		**)
@@ -7293,7 +7247,7 @@ TYPE
 				Error(exitStatement.position,"exit statement not within loop statement");
 			END;
 			RETURN exitStatement;
-		 END ResolveExitStatement;
+		END ResolveExitStatement;
 
 		(** check and resolve return statement RETURN [expression]
 			- check expression (if any)
@@ -7349,7 +7303,7 @@ TYPE
 				END;
 			END;
 			RETURN returnStatement;
-		 END ResolveReturnStatement;
+		END ResolveReturnStatement;
 
 		(** check and resolve await statement AWAIT(condition: Expression)
 			- check await condition
@@ -7413,7 +7367,6 @@ TYPE
 			END;
 		END ResolveCode;
 
-
 		(** check and set flags of a statement block
 			- check for multiply occurence of a flag
 			- check and set priority only in bodies
@@ -7435,7 +7388,6 @@ TYPE
 				END;
 			END SetProtectedRecord;
 
-
 		BEGIN
 			flags := {};
 			IF (block IS SyntaxTree.Body) & (currentIsBodyProcedure) & ((currentScope.outerScope = NIL) OR ~(currentScope.outerScope IS SyntaxTree.ModuleScope)) THEN
@@ -7546,7 +7498,7 @@ TYPE
 		(** check and resolve body
 			- check flags (active, priority, safe)
 			- check body and finally part
-		 **)
+		**)
 		PROCEDURE Body(body: SyntaxTree.Body);
 		BEGIN
 			ResolveStatementBlock(body);
@@ -7588,13 +7540,11 @@ TYPE
 			END;
 		END Register;
 
-
-
 		(**
 			implementation: check and resolve an implementation part
 		**)
 		(*!	can in principle be done in parallel on different checkers: implementations do only depend on declarations)
-		 move implementation checker to a separate object ? *)
+			move implementation checker to a separate object ? *)
 		PROCEDURE Implementation(scope: SyntaxTree.Scope);
 		VAR prevScope: SyntaxTree.Scope; procedure: SyntaxTree.Procedure; prevIsRealtime, prevIsBodyProcedure, prevIsCellNet: BOOLEAN;
 			procedureType: SyntaxTree.ProcedureType;
@@ -7741,7 +7691,6 @@ TYPE
 				END;
 			END DeclareCell;
 
-
 		BEGIN
 			prevError := error;
 			prevPhase := phase;
@@ -7864,8 +7813,6 @@ TYPE
 				symbol := symbol.nextSymbol;
 			END;
 
-
-
 			IF (scope IS SyntaxTree.ProcedureScope) & scope(SyntaxTree.ProcedureScope).ownerProcedure.type.isRealtime THEN
 				symbol := scope.firstSymbol;
 				WHILE symbol # NIL DO
@@ -7971,9 +7918,9 @@ TYPE
 							thisOperator := thisOperator.nextOperator
 						END
 					END
-			 	END;
-			 	thatOperator := thatOperator.nextOperator
-			 END
+				END;
+				thatOperator := thatOperator.nextOperator
+			END
 		END CheckInterOperatorConformity;
 
 		(** check module:
@@ -8030,7 +7977,6 @@ TYPE
 			currentScope := prevScope;
 		END Module;
 
-
 	END Checker;
 
 	Warnings*=OBJECT
@@ -8141,8 +8087,8 @@ TYPE
 			(scope IS SyntaxTree.ModuleScope)
 			& (scope(SyntaxTree.ModuleScope).ownerModule.isCellNet)
 			OR
-			 (scope # NIL) & (scope IS SyntaxTree.CellScope)
-			 & (scope(SyntaxTree.CellScope).ownerCell.isCellNet)
+			(scope # NIL) & (scope IS SyntaxTree.CellScope)
+			& (scope(SyntaxTree.CellScope).ownerCell.isCellNet)
 	END IsCellNetScope;
 
 	PROCEDURE IsCellScope(scope: SyntaxTree.Scope): BOOLEAN;
@@ -8150,14 +8096,12 @@ TYPE
 		RETURN (scope # NIL) & (scope IS SyntaxTree.CellScope) & ~(scope(SyntaxTree.CellScope).ownerCell.isCellNet)
 	END IsCellScope;
 
-
 	PROCEDURE InCellNetScope(scope: SyntaxTree.Scope): BOOLEAN;
 	BEGIN
 		WHILE (scope # NIL) & ~IsCellScope(scope) & ~IsCellNetScope(scope) DO scope := scope.outerScope END;
 		RETURN (scope # NIL) & IsCellNetScope(scope)
 	END InCellNetScope;
 
-
 	PROCEDURE ToMemoryUnits(system: Global.System; size: LONGINT): LONGINT;
 	BEGIN
 		ASSERT(size MOD system.dataUnit = 0);
@@ -8338,7 +8282,6 @@ TYPE
 		END;
 	END StaticArrayCompatible;
 
-
 	PROCEDURE OpenArrayCompatible(formalType: SyntaxTree.ArrayType; actualType: SyntaxTree.Type): BOOLEAN;
 	VAR arrayBase: SyntaxTree.Type; result: BOOLEAN;
 
@@ -8419,8 +8362,6 @@ TYPE
 		RETURN result
 	END MathArrayCompatible;
 
-
-
 	(**
 		Math Array Type distance for assignments / parameter passings of the form
 		from -> to
@@ -8547,8 +8488,6 @@ TYPE
 			WHILE (formalParameter # NIL) & (result # Infinity) DO
 				actualParameter := actualParameters.GetExpression(i);
 
-
-
 				ASSERT(formalParameter.type # NIL);
 				IF (actualParameter.type = NIL) THEN distance := Infinity
 				ELSE
@@ -8721,7 +8660,6 @@ TYPE
 		RETURN (type # NIL) & ((type.resolved IS SyntaxTree.IntegerType) & (type.resolved(SyntaxTree.IntegerType).sizeInBits <= addressWidth) OR (type.resolved IS SyntaxTree.SizeType))
 	END IsSizeType;
 
-
 	PROCEDURE IsSignedIntegerType*(type: SyntaxTree.Type): BOOLEAN;
 	BEGIN
 		RETURN (type # NIL) & (type IS SyntaxTree.IntegerType) & type(SyntaxTree.IntegerType).signed
@@ -8756,7 +8694,6 @@ TYPE
 		RETURN result
 	END IsEnumerationValue;
 
-
 	PROCEDURE IsRealValue(x: SyntaxTree.Expression; VAR value: LONGREAL): BOOLEAN;
 	VAR result: BOOLEAN;
 	BEGIN
@@ -8868,7 +8805,6 @@ TYPE
 		RETURN FALSE;
 	END IsOpenArray;
 
-
 	PROCEDURE IsStaticArray*(type: SyntaxTree.Type; VAR base: SyntaxTree.Type; VAR dim :LONGINT): BOOLEAN;
 	BEGIN
 		type := type.resolved;
@@ -8949,7 +8885,6 @@ TYPE
 		RETURN result
 	END IsUnsafePointer;
 
-
 	PROCEDURE IsDisposable*(type: SyntaxTree.Type): BOOLEAN;
 	BEGIN
 		RETURN (type # NIL) & (type.resolved IS SyntaxTree.PointerType) & (type.resolved(SyntaxTree.PointerType).isDisposable)
@@ -9013,7 +8948,6 @@ TYPE
 		RETURN (type IS SyntaxTree.EnumerationType)
 	END IsEnumerationType;
 
-
 	(** cf. section "Type extension (base type)" in the language report **)
 	PROCEDURE IsTypeExtension(base,extension: SyntaxTree.Type): BOOLEAN;
 	VAR result: BOOLEAN;
@@ -9075,7 +9009,6 @@ TYPE
 		END
 	END IsCallable;
 
-
 	(** compute and return the distance of two record types
 		returns the number of extension levels of from to to, returns infinite if to is not an extension of from
 	**)
@@ -9163,7 +9096,6 @@ TYPE
 		END;
 	END IsIndexOperator;
 
-
 	PROCEDURE IsUnextensibleRecord(d: SyntaxTree.Expression): BOOLEAN;
 	BEGIN
 		RETURN (d.type.resolved IS SyntaxTree.RecordType) &
@@ -9318,7 +9250,6 @@ TYPE
 	BEGIN RETURN (type # NIL) & (type.resolved IS SyntaxTree.ComplexType);
 	END IsComplexType;
 
-
 	PROCEDURE IsStaticRange(x: SyntaxTree.Expression; VAR firstValue, lastValue, stepValue: Basic.Integer): BOOLEAN;
 	VAR
 		result: BOOLEAN;
@@ -9341,7 +9272,6 @@ TYPE
 	BEGIN RETURN (type.resolved IS SyntaxTree.MathArrayType) & (type.resolved(SyntaxTree.MathArrayType).form = SyntaxTree.Tensor)
 	END IsTensor;
 
-
 	PROCEDURE IsStaticMathArray*(type: SyntaxTree.Type; VAR length: LONGINT; VAR baseType: SyntaxTree.Type): BOOLEAN;
 	BEGIN
 		IF (type IS SyntaxTree.MathArrayType) & (type(SyntaxTree.MathArrayType).form = SyntaxTree.Static) THEN
@@ -9353,13 +9283,11 @@ TYPE
 		END;
 	END IsStaticMathArray;
 
-
 	PROCEDURE SymbolHasAddress*(symbol: SyntaxTree.Symbol): BOOLEAN;
 	BEGIN
 		RETURN (symbol IS SyntaxTree.Variable) OR (symbol IS SyntaxTree.Parameter) OR (symbol IS SyntaxTree.Procedure)
 	END SymbolHasAddress;
 
-
 	PROCEDURE HasAddress*(expression: SyntaxTree.Expression): BOOLEAN;
 	BEGIN
 		RETURN
@@ -9419,7 +9347,6 @@ TYPE
 		RETURN (procedureType # NIL) & (procedureType.callingConvention=SyntaxTree.OberonCallingConvention) & ReturnedAsParameter(procedureType.returnType);
 	END StructuredReturnType;
 
-
 END FoxSemanticChecker.
 
 System.FreeDownTo FoxSemanticChecker ~

+ 28 - 66
source/FoxSyntaxTree.Mod

@@ -40,7 +40,7 @@ CONST
 
 	(** parameter forms *)
 	ValueParameter* = 0;  VarParameter* = 1;  ConstParameter* = 2;
-	InPort*=3; 	OutPort*=4;
+	InPort*=3; OutPort*=4;
 
 	(** array forms *)
 	Static*=1; (* ARRAY x OF .. / ARRAY [x] OF ... *)
@@ -237,7 +237,6 @@ TYPE
 		PROCEDURE VisitInlineCallDesignator*(x: InlineCallDesignator);
 		BEGIN HALT(100) (* abstract *) END VisitInlineCallDesignator;
 
-
 		PROCEDURE VisitStatementDesignator*(x: StatementDesignator);
 		BEGIN HALT(100) (* abstract *) END VisitStatementDesignator;
 
@@ -296,7 +295,7 @@ TYPE
 		PROCEDURE VExpression*(x: Expression);
 		BEGIN
 			WITH x:
-			  ResultDesignator DO VisitResultDesignator(x)
+			| ResultDesignator DO VisitResultDesignator(x)
 			| SelfDesignator DO VisitSelfDesignator(x)
 			| SupercallDesignator DO VisitSupercallDesignator(x)
 			| DereferenceDesignator DO VisitDereferenceDesignator(x)
@@ -375,8 +374,8 @@ TYPE
 
 		PROCEDURE VSymbol*(x: Symbol);
 		BEGIN
-			WITH
-			  x: Module DO VisitModule(x)
+			WITH x:
+			| Module DO VisitModule(x)
 			| TypeDeclaration DO VisitTypeDeclaration(x)
 			| Constant DO VisitConstant(x)
 			| Parameter DO VisitParameter(x)
@@ -503,7 +502,6 @@ TYPE
 			Basic.SuffixSegmentedName(name, suffix)
 		END GetName;
 
-
 	END QualifiedIdentifier;
 
 	(**** types ****)
@@ -803,7 +801,6 @@ TYPE
 
 	END SizeType;
 
-
 	(** <<BOOLEAN>>
 		boolean type
 	**)
@@ -825,7 +822,6 @@ TYPE
 
 	END BooleanType;
 
-
 	(** <<SET>>
 		set type
 	**)
@@ -1025,7 +1021,6 @@ TYPE
 			RETURN (resolved # NIL) & (resolved.IsRecordType());
 		END IsRecordType;
 
-
 	END QualifiedType;
 
 	(** string literal type **)
@@ -1131,7 +1126,6 @@ TYPE
 			form := f;
 		END SetForm;
 
-
 		PROCEDURE SetLength*(length: Expression);
 		BEGIN
 			SELF.length := length;
@@ -1728,7 +1722,6 @@ TYPE
 
 	END CellType;
 
-
 	(** <<procedureType = PROCEDURE [{DELEGATE}] (firstParameter .. lastParameter): returnType>>
 		also used as type for procedures
 	**)
@@ -1887,7 +1880,6 @@ TYPE
 
 		END SameSignature;
 
-
 		PROCEDURE SameType*(this: Type): BOOLEAN;
 		BEGIN
 			RETURN SameSignature(this)
@@ -1923,7 +1915,6 @@ TYPE
 			resolved-: Value;
 			isHidden-: BOOLEAN;
 
-
 		PROCEDURE End*( position: Position);
 		BEGIN SELF.end := position;
 		END End;
@@ -1940,7 +1931,6 @@ TYPE
 		BEGIN isHidden := hidden
 		END SetHidden;
 
-
 		PROCEDURE SetType*(type: Type);
 		BEGIN
 			SELF.type := type;
@@ -2107,7 +2097,7 @@ TYPE
 	END BinaryExpression;
 
 	(** expression that denotes a range
-	    <<[first] '..' [last] ['by' step] | '*' >>
+		<<[first] '..' [last] ['by' step] | '*' >>
 	**)
 	RangeExpression* = OBJECT (Expression)
 	VAR
@@ -2222,7 +2212,6 @@ TYPE
 			relatedRhs := expression;
 		END SetRelatedRhs;
 
-
 		PROCEDURE Clone(): Expression;
 		VAR clone: Designator;
 		BEGIN
@@ -2230,10 +2219,8 @@ TYPE
 			NEW(clone, position); RETURN clone
 		END Clone;
 
-
 	END Designator;
 
-
 	(*** first phase (parse time) designators ***)
 
 	(** <<identifier>>
@@ -2272,7 +2259,6 @@ TYPE
 
 	END SelectorDesignator;
 
-
 	(** <<left(arg1, arg2, ...)>>
 		may designate a function call or a type guard
 	**)
@@ -2292,7 +2278,6 @@ TYPE
 
 	END ParameterDesignator;
 
-
 	(** <<left^>>
 		may designate a pointer dereference or a method supercall
 	**)
@@ -2571,7 +2556,6 @@ TYPE
 		BEGIN RETURN type.NeedsTrace();
 		END NeedsTrace;
 
-
 	END SelfDesignator;
 
 	(** <<RESULT>> **)
@@ -2906,7 +2890,6 @@ TYPE
 
 		comment-: Comment;
 
-
 		PROCEDURE & InitSymbol(position: Position; name:Identifier);
 		BEGIN
 			SELF.position := position; state := Undefined;
@@ -2997,7 +2980,6 @@ TYPE
 			RETURN access * Public # {};
 		END NeedsSection;
 
-
 	END Symbol;
 
 	(**
@@ -3040,7 +3022,6 @@ TYPE
 
 	END TypeDeclaration;
 
-
 	(** <<CONST name = value >>
 		Constant declaration symbol. Represents a constant being defined in the form CONST name  =  value
 		The type of the constant is stored in the type field and is resolved by the semantic checker.
@@ -3198,7 +3179,6 @@ TYPE
 		nextProperty-, prevProperty-: Property;
 		value-: Expression;
 
-
 		PROCEDURE & InitProperty(position: Position;  name: Identifier);
 		BEGIN
 			InitSymbol( position, name );
@@ -3227,7 +3207,6 @@ TYPE
 
 	END Alias;
 
-
 	(** Procedure declaration symbol. Represents a procedure being defined in the form PROCEDURE name(parameters): returnType;
 		Note that the type of a procedure is a ProcedureType (and not the return type of the procedure).
 		Parameters, local variables, constants and type declarations are stored in the procedureScope field.
@@ -3322,7 +3301,6 @@ TYPE
 
 	END Procedure;
 
-
 	(** Builtin symbol stands for a builtin procedure. Is resolved by the semantic checker. **)
 	Builtin* = OBJECT (Symbol)
 	VAR
@@ -3511,7 +3489,6 @@ TYPE
 			end := pos;
 		END End;
 
-
 	END Statement;
 
 	(** << call(...) >> **)
@@ -3607,42 +3584,41 @@ TYPE
 
 	END Part;
 
-
 	(** << ... condition THEN statements ... >> **)
 	IfPart*= OBJECT (Part)
 	VAR
 		condition-: Expression;
-	 	statements-: StatementSequence;
+		statements-: StatementSequence;
 
-	 	comment-: Comment;
+		comment-: Comment;
 
-	 	PROCEDURE & InitIfPart;
-	 	BEGIN
-	 		InitPart;
-	 		statements := NIL; condition := NIL; comment := NIL;
-	 	END InitIfPart;
+		PROCEDURE & InitIfPart;
+		BEGIN
+			InitPart;
+			statements := NIL; condition := NIL; comment := NIL;
+		END InitIfPart;
 
-	 	PROCEDURE SetCondition*(condition: Expression);
-	 	BEGIN SELF.condition := condition
-	 	END SetCondition;
+		PROCEDURE SetCondition*(condition: Expression);
+		BEGIN SELF.condition := condition
+		END SetCondition;
 
-	 	PROCEDURE SetStatements*(statements: StatementSequence);
-	 	BEGIN SELF.statements := statements
-	 	END SetStatements;
+		PROCEDURE SetStatements*(statements: StatementSequence);
+		BEGIN SELF.statements := statements
+		END SetStatements;
 
-	 	PROCEDURE SetComment*(comment: Comment);
-	 	BEGIN SELF.comment := comment
-	 	END SetComment;
+		PROCEDURE SetComment*(comment: Comment);
+		BEGIN SELF.comment := comment
+		END SetComment;
 
-	 	PROCEDURE Clone(): IfPart;
-	 	VAR copy: IfPart;
-	 	BEGIN
-	 		NEW(copy); copy.condition := CloneExpression(condition);
-	 		copy.statements := CloneStatementSequence(statements);
+		PROCEDURE Clone(): IfPart;
+		VAR copy: IfPart;
+		BEGIN
+			NEW(copy); copy.condition := CloneExpression(condition);
+			copy.statements := CloneStatementSequence(statements);
 			RETURN copy
-	 	END Clone;
+		END Clone;
 
-	 END IfPart;
+	END IfPart;
 
 	(** << IF ifPart {ELSIF elsifParts} ELSE elseParts >> **)
 	IfStatement* = OBJECT (Statement)
@@ -3823,7 +3799,6 @@ TYPE
 			RETURN copy
 		END Clone;
 
-
 	END CasePart;
 
 	(** << CASE varaible OF caseParts ELSE elsePart >> **)
@@ -4103,7 +4078,6 @@ TYPE
 			RETURN copy
 		END Clone;
 
-
 	END AwaitStatement;
 
 	(* << Identifier ( Expression) >> *)
@@ -4289,7 +4263,6 @@ TYPE
 
 	END Comment;
 
-
 	(**** building blocks ****)
 
 	Scope*=OBJECT
@@ -4308,7 +4281,6 @@ TYPE
 
 		ownerModule-: Module;
 
-
 		PROCEDURE & InitScope(outer: Scope);
 		BEGIN
 			firstSymbol := NIL; numberSymbols := 0;
@@ -4743,7 +4715,6 @@ TYPE
 			bodyProcedure := NIL;
 		END Clear;
 
-
 		PROCEDURE SetOwnerCell*(owner: CellType);
 		BEGIN
 			ownerCell := owner
@@ -4817,7 +4788,6 @@ TYPE
 
 	END CellScope;
 
-
 	(**
 		<<
 		IMPORT firstImport .. lastImport;
@@ -4955,10 +4925,8 @@ TYPE
 			END;
 		END RemoveImporters;
 
-
 	END ModuleScope;
 
-
 	(* << MODULE name ['in' context] moduleScope name '.' >>  *)
 	Module* = OBJECT (Symbol)
 		VAR
@@ -4992,7 +4960,6 @@ TYPE
 			SELF.case := case
 		END SetCase;
 
-
 		PROCEDURE SetCellNet*(isCellNet: BOOLEAN);
 		BEGIN SELF.isCellNet := isCellNet
 		END SetCellNet;
@@ -5013,7 +4980,6 @@ TYPE
 		BEGIN SELF.modifiers := modifiers
 		END SetModifiers;
 
-
 		PROCEDURE AddScope*(c: Scope);
 		BEGIN
 			IF lastScope= NIL THEN firstScope := c ELSE lastScope.nextScope := c END;
@@ -5374,7 +5340,6 @@ VAR
 		NEW( property, position, name);  RETURN property;
 	END NewProperty;
 
-
 	PROCEDURE NewExpressionList*(): ExpressionList;
 	VAR expressionList: ExpressionList;
 	BEGIN
@@ -5661,7 +5626,6 @@ VAR
 		NEW( statementDesignator, position, s); RETURN statementDesignator
 	END NewStatementDesignator;
 
-
 	PROCEDURE NewBody*( position: Position ; scope: ProcedureScope): Body;
 	VAR body: Body;
 	BEGIN
@@ -5832,8 +5796,6 @@ VAR
 
 	END Init;
 
-
 BEGIN
 	Init;
 END FoxSyntaxTree.
-

+ 1 - 9
source/FoxTRMAssembler.Mod

@@ -11,7 +11,7 @@ TYPE
 TYPE
 	Assembler*= OBJECT (FoxAssembler.Assembler)
 	VAR capabilities-: SET;
-		  instructionSet: InstructionSet.InstructionSet;
+		instructionSet: InstructionSet.InstructionSet;
 
 		PROCEDURE &Init2*(diagnostics: Diagnostics.Diagnostics; capabilities: SET; instructionSet: InstructionSet.InstructionSet);
 		BEGIN
@@ -111,14 +111,6 @@ TYPE
 		END GetRegister;
 	END Assembler;
 
-
-
-
 END FoxTRMAssembler.
 
 System.Free FoxTRMAssembler FoxTRMInstructionSet ~
-
-
-
-
-

+ 53 - 75
source/FoxTRMBackend.Mod

@@ -313,8 +313,6 @@ TYPE
 
 		BEGIN
 
-
-
 			physicalRegisters(PhysicalRegisters).SupportFP(FPSupported);
 			supportFP := FPSupported;
 			tickets.Init;
@@ -432,7 +430,7 @@ TYPE
 					| IntermediateCode.mul:
 						IF (Global.NoMulCapability IN backend.capabilities) THEN  (*mul forbidden*)
 							IF IntermediateCode.IsConstantInteger(instr.op3,value) & IntermediateBackend.PowerOf2(value,exp) THEN RETURN TRUE
-							ELSE procedureName:="MulL"; RETURN FALSE	 END;
+							ELSE procedureName:="MulL"; RETURN FALSE END;
 						ELSE
 							RETURN TRUE;
 						END
@@ -722,7 +720,6 @@ TYPE
 			END;
 		END PostGenerate;
 
-
 		PROCEDURE TicketToOperand(ticket:Ticket; VAR op: InstructionSet.Operand);
 		BEGIN
 			ASSERT(ticket # NIL);
@@ -767,9 +764,9 @@ TYPE
 				stack layout:
 				p1
 				...
-				pm	 													(parameters pushed by caller)
-				LR   													(explicitly pushed by frontend because hasLinkRegister = TRUE)
-				prev FP <-- FP = logicalFP 	(explicitly pushed by frontend)
+				pm														(parameters pushed by caller)
+				LR													(explicitly pushed by frontend because hasLinkRegister = TRUE)
+				prev FP <-- FP = logicalFP	(explicitly pushed by frontend)
 				v1
 				...
 				vn
@@ -898,7 +895,6 @@ TYPE
 			END;
 		END Resolve;
 
-
 		PROCEDURE EmitCall(VAR instruction: IntermediateCode.Instruction);
 		VAR op: InstructionSet.Operand; section: IntermediateCode.Section; code: BinaryCode.Section; symbol: ObjectFile.Identifier;
 			fixup, newFixup: BinaryCode.Fixup; pc: LONGINT; regOp: Operand; offset,reloffset: LONGINT;
@@ -1178,9 +1174,8 @@ TYPE
 			RETURN FALSE
 		END UnsignedImmediate;
 
-
 		PROCEDURE HardwareIntegerRegister(index: LONGINT; sizeInBits: LONGINT): LONGINT;
-		BEGIN 	RETURN index
+		BEGIN RETURN index
 		END HardwareIntegerRegister;
 
 		PROCEDURE HardwareFloatRegister(index: LONGINT; sizeInBits: LONGINT): LONGINT;
@@ -1255,7 +1250,6 @@ TYPE
 				MovIfDifferent(tmp, physical);
 				physical := tmp;
 
-
 				IF (offset >= 0) & (offset < ASH(1,instructionSet.ImmediateFixupBits)) THEN
 					instructionSet.InitImmediate(imm, 0, offset);
 					Emit2(opADD,physical,imm);
@@ -1282,7 +1276,6 @@ TYPE
 			IF ~IsSameRegister(a,b) THEN Emit2(opMOV, a, b) END;
 		END MovIfDifferent;
 
-
 		PROCEDURE AcquireDestinationRegister(CONST vop: IntermediateCode.Operand; part: LONGINT; VAR op: Operand);
 		VAR  type: IntermediateCode.Type;
 		BEGIN
@@ -1327,7 +1320,6 @@ TYPE
 			END;
 		END PrepareOp3;
 
-
 		PROCEDURE PrepareFOp3(CONST instruction: IntermediateCode.Instruction; VAR dest, left, right: Assembler.Operand);
 		VAR vop1,vop2, vop3: IntermediateCode.Operand; op2: InstructionSet.Operand;
 			opx: Operand;
@@ -1414,7 +1406,6 @@ TYPE
 			FinishOp(instruction.op1,Low,destLow, leftLow);
 		END EmitFAdd;
 
-
 		PROCEDURE EmitSub(VAR instruction: IntermediateCode.Instruction);
 		VAR destLow, destHigh, leftLow, rightLow, leftHigh, rightHigh: Operand; negateLow, negateHigh: BOOLEAN; fixup: BinaryCode.Fixup;
 		BEGIN
@@ -1450,7 +1441,6 @@ TYPE
 			FinishOp(instruction.op1,Low,destLow, leftLow);
 		END EmitFSub;
 
-
 		PROCEDURE EmitMul(VAR instruction: IntermediateCode.Instruction);
 		VAR negate: BOOLEAN;
 			op1Low, op2Low, op3Low, op1High, op2High, op3High, destLow, destHigh: Operand;
@@ -1542,7 +1532,6 @@ TYPE
 				END;
 		END EmitAnd;
 
-
 		PROCEDURE EmitOr(VAR instruction: IntermediateCode.Instruction; part: LONGINT);
 		VAR left, right, dest: Operand; negate: BOOLEAN;
 		BEGIN
@@ -1847,7 +1836,7 @@ TYPE
 								MOV LR, Rx ; restore LR
 								ADD Ry, offset
 								BR R2
-							 *)
+							*)
 							ticket1 := TemporaryTicket(IntermediateCode.GeneralPurposeRegister,IntermediateCode.int32);
 							ticket2 := TemporaryTicket(IntermediateCode.GeneralPurposeRegister,IntermediateCode.int32);
 							TicketToOperand(ticket1,oldLR);
@@ -2031,7 +2020,6 @@ TYPE
 						Emit1(hiFail, target);
 					END;
 
-
 					(*ReleaseHint(op2.register);
 					ReleaseHint(op3.register);*)
 				END;
@@ -2206,8 +2194,6 @@ TYPE
 
 	END System;
 
-
-
 	BackendTRM = OBJECT (IntermediateBackend.IntermediateBackend)
 	VAR
 		cg: CodeGeneratorTRM;
@@ -2230,7 +2216,6 @@ TYPE
 		BEGIN
 			Initialize^(diagnostics, log, flags, checker, system); (*goes up the inheritance hierarchy all the way to Backend.Mod*)
 
-
 			NEW(cg, builtinsModuleName, diagnostics, SELF,myInstructionSet);
 			cg.patchSpartan6 := patchSpartan6;
 			recentInstructionWidth := Sections.UnknownSize;
@@ -2289,9 +2274,8 @@ TYPE
 				END;
 			END Resolve;
 
-
-		 	(* recompute fixup positions and assign binary sections *)
-		 	PROCEDURE PatchFixups(section: BinaryCode.Section);
+			(* recompute fixup positions and assign binary sections *)
+			PROCEDURE PatchFixups(section: BinaryCode.Section);
 			VAR resolved: BinaryCode.Section; fixup: BinaryCode.Fixup; symbolOffset: LONGINT; in: IntermediateCode.Section;
 			BEGIN
 				fixup := section.fixupList.firstFixup;
@@ -2311,59 +2295,57 @@ TYPE
 			END PatchFixups;
 
 		BEGIN
-		 	cg.SetModule(module);
-		 	cg.dump := dump;
-
-		 	FOR i := 0 TO module.allSections.Length() - 1 DO
-			 	in := module.allSections.GetSection(i);
-			 	in(IntermediateCode.Section).EnableComments(trace);
-		 		IF in.type = Sections.InlineCodeSection THEN
-		 			Basic.SegmentedNameToString(in.name, name);
-			 		out := ResolvedSection(in(IntermediateCode.Section));
-			 		cg.dump := out.comments;
-		 			SetInstructionWidth(out.os.unit);
-			 		cg.Section(in(IntermediateCode.Section), out);  (*compilation*)
-			 		IF in.symbol # NIL THEN
-				 		procedure := in.symbol(SyntaxTree.Procedure);
-				 		procedure.procedureScope.body.code.SetBinaryCode(out.os.bits);
-				 	END;
-			 	END
-		 	END;
+			cg.SetModule(module);
+			cg.dump := dump;
+
+			FOR i := 0 TO module.allSections.Length() - 1 DO
+				in := module.allSections.GetSection(i);
+				in(IntermediateCode.Section).EnableComments(trace);
+				IF in.type = Sections.InlineCodeSection THEN
+					Basic.SegmentedNameToString(in.name, name);
+					out := ResolvedSection(in(IntermediateCode.Section));
+					cg.dump := out.comments;
+					SetInstructionWidth(out.os.unit);
+					cg.Section(in(IntermediateCode.Section), out);  (*compilation*)
+					IF in.symbol # NIL THEN
+						procedure := in.symbol(SyntaxTree.Procedure);
+						procedure.procedureScope.body.code.SetBinaryCode(out.os.bits);
+					END;
+				END
+			END;
 
 			initialSectionCount := 0;
-		 	REPEAT
-		 		j := initialSectionCount;
-		 	 	initialSectionCount := module.allSections.Length() ;
-
-			 	FOR i := j TO initialSectionCount - 1 DO
-			 		in := module.allSections.GetSection(i);
-			 		IF (in.type # Sections.InlineCodeSection) (*& (in(IntermediateCode.Section).resolved = NIL) *) THEN
-				 		out := ResolvedSection(in(IntermediateCode.Section));
-			 			SetInstructionWidth(out.os.unit);
-				 		cg.Section(in(IntermediateCode.Section),out);
-			 		END
-			 	END
+			REPEAT
+				j := initialSectionCount;
+				initialSectionCount := module.allSections.Length() ;
+
+				FOR i := j TO initialSectionCount - 1 DO
+					in := module.allSections.GetSection(i);
+					IF (in.type # Sections.InlineCodeSection) (*& (in(IntermediateCode.Section).resolved = NIL) *) THEN
+						out := ResolvedSection(in(IntermediateCode.Section));
+						SetInstructionWidth(out.os.unit);
+						cg.Section(in(IntermediateCode.Section),out);
+					END
+				END
 			UNTIL initialSectionCount = module.allSections.Length(); (* process remaining sections that have been added during traversal of sections *)
 
 			(*
-		 	FOR i := 0 TO module.allSections.Length() - 1 DO
-			 	in := module.allSections.GetSection(i);
-			 	IF ~in.IsExternal() THEN
-			 		IF in.type # Sections.InlineCodeSection THEN
-				 		Basic.SegmentedNameToString(in.name, name);
-				 		out := ResolvedSection(in(IntermediateCode.Section));
-				 		cg.Section(in(IntermediateCode.Section), out);
-			 		END
-			 	END;
-		 	END;
+			FOR i := 0 TO module.allSections.Length() - 1 DO
+				in := module.allSections.GetSection(i);
+				IF ~in.IsExternal() THEN
+					IF in.type # Sections.InlineCodeSection THEN
+						Basic.SegmentedNameToString(in.name, name);
+						out := ResolvedSection(in(IntermediateCode.Section));
+						cg.Section(in(IntermediateCode.Section), out);
+					END
+				END;
+			END;
 			*)
 
-
-
-		 	FOR i := 0 TO module.allSections.Length() - 1 DO
-			 	in := module.allSections.GetSection(i);
-		 		PatchFixups(in(IntermediateCode.Section).resolved)
-		 	END;
+			FOR i := 0 TO module.allSections.Length() - 1 DO
+				in := module.allSections.GetSection(i);
+				PatchFixups(in(IntermediateCode.Section).resolved)
+			END;
 
 			IF cg.error THEN Error("", Basic.invalidPosition, Streams.Invalid,  "") END;
 		END GenerateBinary;
@@ -2480,7 +2462,7 @@ TYPE
 		BEGIN
 
 			(*VAR and CONST sections go to the data memory, only code sections go to code memory
-			    Note that data memory has 32 bit words while code has standard 18.
+				Note that data memory has 32 bit words while code has standard 18.
 			*)
 			IF in.bitsPerUnit # Sections.UnknownSize THEN
 				unit :=  in.bitsPerUnit;
@@ -2525,9 +2507,6 @@ TYPE
 		HALT(100);
 	END Halt;
 
-
-
-
 	PROCEDURE Init;
 	BEGIN
 		NEW(defaultInstructionSet,18); (*TODO: maybe it's better to have all these init functions outside of instruction set object?*)
@@ -2544,5 +2523,4 @@ BEGIN
 	Init;
 END FoxTRMBackend.
 
-
 System.FreeDownTo FoxTRMBackend  ~

+ 23 - 52
source/FoxTRMInstructionSet.Mod

@@ -8,7 +8,7 @@ CONST
 	maxMnemonicNameLength=8;
 	maxNumberInstructions=100;
 
-	(* 	mnemonics , unsorted
+	(*	mnemonics , unsorted
 		FoxProgTools.Enum -e -l=8
 		opMOV opNOT
 		opADD opFADD
@@ -22,7 +22,6 @@ CONST
 		~
 	*)
 
-
 	(*Variable instruction width related. All other bitcaounts derived.*)
 	(*instructionW=24;*) (*Number of bits an instruction word holds. default 18*)
 	regselW=3; (*number of bits to select a register. default 3*)
@@ -36,7 +35,7 @@ CONST
 	opBLT*= 32; opBGT*= 33; opBLE*= 34; opBT*= 35; opBF*= 36; opBZS*= 37; opBZC*= 38; opBCS*= 39;
 	opBCC*= 40; opBNS*= 41; opBNC*= 42; opBVS*= 43; opBVC*= 44; opHADD*= 45; opFHADD*= 46; numberMnemonics*= 47;
 
-	(* 	operand format types *)
+	(*	operand format types *)
 	None*=-1; (* no operand *)
 	Rd=0; (* destination register,  encoded at bits 11..13  *)
 	Rs=1; (* source register,  encoded at bits 0..2 *)
@@ -48,11 +47,6 @@ CONST
 	MemRegImm7=7; (* memory operand of the form  [reg +imm] with 7 bit immediate, encoded at reg = 0..2, imm= 3..9  *)
 	VRd0=8; (* vector register, being restricted to register number 0 *)
 
-
-
-
-
-
 	ZeroRegister* = 7;
 
 	(* operand types *)
@@ -107,7 +101,6 @@ TYPE
 		op1-, op2-: Operand;
 	END;
 
-
 	InstructionSet *=OBJECT
 		VAR mnemonics-: ARRAY numberMnemonics OF Mnemonic;
 		mnemonicsSorted-: ARRAY numberMnemonics OF NumberedName;
@@ -121,7 +114,6 @@ TYPE
 		ImmediateFixupBits-: LONGINT;
 		MemoryOffsetFixupBits-: LONGINT;
 
-
 		PROCEDURE & InitInstructionSet * (instructionWidth: LONGINT);
 		BEGIN
 			ASSERT(instructionWidth>0);
@@ -530,7 +522,6 @@ TYPE
 			mnemonics[alias].firstInstructionFormat := mnemonics[number].firstInstructionFormat;
 		END AddAlias;
 
-
 		PROCEDURE EndMnemonic;
 		BEGIN
 			mnemonics[curMnemonic].lastInstructionFormat := numberInstructionFormats-1;
@@ -593,7 +584,6 @@ TYPE
 			oooo ddd 1 xxxxxxxsss
 		*)
 
-
 		isimmP:=instructionW-1-opcodeW-regselW; (*18bit inW=> bit 10. If this bit is NOT set, there is an immediate.*)
 		isfloatP:=isimmP-2; (*18 bit insW => bit 8*)
 		isvecP:=isimmP-1; (*18 bit insW=> bit 9*)
@@ -625,8 +615,8 @@ TYPE
 		currOpCode:=makeOpcode(1);
 		AddMnemonic(opNOT, "NOT");
 		AddInstruction(currOpCode,						{isimmP}+opcodeP, Rd, Imm10,{});
-		AddInstruction({isimmP}+currOpCode, 			capabilityP+opcodeP, Rd, Rs,{});
-		AddInstruction({isimmP,isfloatP}+currOpCode, 	capabilityP+opcodeP, VRd, VRs,{Global.VectorCapability});
+		AddInstruction({isimmP}+currOpCode,			capabilityP+opcodeP, Rd, Rs,{});
+		AddInstruction({isimmP,isfloatP}+currOpCode,	capabilityP+opcodeP, VRd, VRs,{Global.VectorCapability});
 		EndMnemonic;
 
 		(* ADD: oooo = 0010 *)
@@ -733,7 +723,7 @@ TYPE
 		EndMnemonic;
 
 		(* BLR: oooo = 1011 *)
-		(* BLR Rd, Rs 	<--> 	Rd := PC+1; PC := Rs *)
+		(* BLR Rd, Rs <--> Rd := PC+1; PC := Rs *)
 		AddMnemonic(opBLR, "BLR");
 		AddInstruction(currOpCode+{isSpecialBR,isSpecialBR-1}, brModesP+opcodeP, Rd, Rs,{});
 		EndMnemonic;
@@ -779,29 +769,29 @@ TYPE
 			1111	FALSE	Never	BF
 		*)
 		currOpCode:=makeOpcode(14);
-		AddMnemonic(opBEQ, "BEQ"); 	AddInstruction(currOpCode+makeCondition(0), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
-		AddMnemonic(opBNE, "BNE"); 	AddInstruction(currOpCode+makeCondition(1), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBEQ, "BEQ");	AddInstruction(currOpCode+makeCondition(0), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBNE, "BNE");	AddInstruction(currOpCode+makeCondition(1), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
 
-		AddMnemonic(opBAE, "BAE");  	AddInstruction(currOpCode+makeCondition(2), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
-		AddMnemonic(opBB, "BB");      	AddInstruction(currOpCode+makeCondition(3), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBAE, "BAE");	AddInstruction(currOpCode+makeCondition(2), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBB, "BB");	AddInstruction(currOpCode+makeCondition(3), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
 
-		AddMnemonic(opBN, "BN");     	AddInstruction(currOpCode+makeCondition(4), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
-		AddMnemonic(opBNN, "BNN"); 	AddInstruction(currOpCode+makeCondition(5), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBN, "BN");	AddInstruction(currOpCode+makeCondition(4), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBNN, "BNN");	AddInstruction(currOpCode+makeCondition(5), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
 
-		AddMnemonic(opBO, "BO");     	AddInstruction(currOpCode+makeCondition(6), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
-		AddMnemonic(opBNO, "BNO"); 	AddInstruction(currOpCode+makeCondition(7), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBO, "BO");	AddInstruction(currOpCode+makeCondition(6), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBNO, "BNO");	AddInstruction(currOpCode+makeCondition(7), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
 
-		AddMnemonic(opBA, "BA"); 		AddInstruction(currOpCode+makeCondition(8), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
-		AddMnemonic(opBBE, "BBE"); 	AddInstruction(currOpCode+makeCondition(9), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBA, "BA");		AddInstruction(currOpCode+makeCondition(8), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBBE, "BBE");	AddInstruction(currOpCode+makeCondition(9), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
 
-		AddMnemonic(opBGE, "BGE"); 	AddInstruction(currOpCode+makeCondition(10), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
-		AddMnemonic(opBLT, "BLT"); 	AddInstruction(currOpCode+makeCondition(11), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBGE, "BGE");	AddInstruction(currOpCode+makeCondition(10), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBLT, "BLT");	AddInstruction(currOpCode+makeCondition(11), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
 
-		AddMnemonic(opBGT, "BGT"); 	AddInstruction(currOpCode+makeCondition(12), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
-		AddMnemonic(opBLE, "BLE"); 	AddInstruction(currOpCode+makeCondition(13), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBGT, "BGT");	AddInstruction(currOpCode+makeCondition(12), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBLE, "BLE");	AddInstruction(currOpCode+makeCondition(13), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
 
-		AddMnemonic(opBT, "BT"); 		AddInstruction(currOpCode+makeCondition(14), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
-		AddMnemonic(opBF, "BF"); 		AddInstruction(currOpCode+makeCondition(15), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBT, "BT");		AddInstruction(currOpCode+makeCondition(14), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
+		AddMnemonic(opBF, "BF");		AddInstruction(currOpCode+makeCondition(15), opcodeP+brCondP, SignedImm10, None,{}); EndMnemonic;
 
 		Inverse(opBEQ, opBNE);
 		Inverse(opBAE, opBB);
@@ -821,19 +811,14 @@ TYPE
 		AddAlias(opBVS,opBO,"BVS");
 		AddAlias(opBVC,opBNO,"BVC");
 
-
-
 		(* BL: 1111 nnnnnnnnnnnnnn *)
 		currOpCode:=makeOpcode(15);
 		AddMnemonic(opBL, "BL");
 		AddInstruction(currOpCode, opcodeP, Imm14, None,{});
 		EndMnemonic;
 
-
-
 		SortMnemonics(0, numberMnemonics-1);
 
-
 		IF checkMnemonic THEN CheckMnemonics END;
 	END InitInstructions;
 
@@ -933,7 +918,6 @@ TYPE
 			DumpOperand(w, op);
 		END DumpOp;
 
-
 	BEGIN
 		IF instruction.format = None THEN
 			w.String(" no format")
@@ -964,8 +948,8 @@ TYPE
 			CASE type OF
 				|Rd: context.out.String("Rd")
 				|Rs: context.out.String("Rs")
-			     |Imm10: context.out.String("imm10");
-			     |SignedImm10: context.out.String("SignedImm10");
+				|Imm10: context.out.String("imm10");
+				|SignedImm10: context.out.String("SignedImm10");
 				|Imm14: context.out.String("imm14");
 				|MemRegImm7: context.out.String("MemRegImm7");
 			ELSE
@@ -1003,11 +987,8 @@ TYPE
 		END;
 	END DumpInstructionFormats;
 
-
-
 	END InstructionSet;
 
-
 	PROCEDURE Hex(ch: CHAR): LONGINT;
 	BEGIN
 		IF (ch <= 'F') & (ch >= 'A') THEN RETURN ORD(ch)-ORD('A')+10
@@ -1026,8 +1007,6 @@ TYPE
 		NEW(r, file, 0);
 		NEW(bitSet,0);
 
-
-
 		WHILE r.Available()>0 DO
 			r.Ln(line);
 			val:=0;
@@ -1126,7 +1105,6 @@ TYPE
 		END;
 	END Disassemble;
 
-
 VAR
 	decodeInstance: InstructionSet;
 BEGIN
@@ -1137,13 +1115,6 @@ System.FreeDownTo FoxTRMInstructionSet ~
 FoxTRMInstructionSet.DumpInstructionFormats -s ~
 FoxTRMInstructionSet.Test ~
 
-
-
-
-
-
-
 FoxTRMInstructionSet.Disassemble disastest.mem ~
 
 FoxTRMInstructionSet.Disassemble ins.mem ~
-

+ 0 - 26
source/FoxTRMTools.Mod

@@ -170,7 +170,6 @@ IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, BitSets,Ob
 		RETURN TRUE
 	END SplitColumns;
 
-
 	PROCEDURE DoSplitFiles*(CONST source, dest, extension: ARRAY OF CHAR; blocks, blockSize: LONGINT; verbose,strided,patchSpartan6: BOOLEAN; diagnostics: Diagnostics.Diagnostics): BOOLEAN;
 	VAR line: LONGINT; fileName: Files.FileName; oldFile: Files.File;
 		newFiles: POINTER TO ARRAY OF Files.File;
@@ -187,8 +186,6 @@ IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, BitSets,Ob
 			Files.JoinExtension(fileName,extension,fileName);
 		END GetFileName;
 
-
-
 	BEGIN
 
 		TRACE(source);
@@ -245,7 +242,6 @@ IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, BitSets,Ob
 		RETURN TRUE
 	END DoSplitFiles;
 
-
 	PROCEDURE SplitFiles* (context: Commands.Context);
 	VAR options: Options.Options;
 		sourceName, name, extension: Files.FileName;
@@ -305,7 +301,6 @@ IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, BitSets,Ob
 		END;
 	END SplitColumnsCmd;
 
-
 	PROCEDURE CompareFiles*(context: Commands.Context);
 	VAR f1,f2,f3: Files.File; name1, name2, matrixname: Files.FileName; r1, r2: Files.Reader;  x,y: ARRAY 32 OF CHAR; i: LONGINT; line1: LONGINT;
 		matrix: ARRAY 16 OF ARRAY 16 OF LONGINT; j: LONGINT; p1, p2: LONGINT; writer: Files.Writer;
@@ -340,7 +335,6 @@ IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, BitSets,Ob
 				END;
 				INC(line1);
 
-
 				(*
 				IF (line1 MOD 512 = 480)  THEN
 					context.out.Int(line1,1); context.out.String(":");
@@ -385,7 +379,6 @@ IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, BitSets,Ob
 				*)
 			END;
 
-
 			FOR i := 0 TO 15 DO
 			FOR j := 0 TO 15 DO
 				writer.Int(matrix[i,j],1); writer.String(" ");
@@ -456,7 +449,6 @@ IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, BitSets,Ob
 	END DeleteFiles;
 	*)
 
-
 END FoxTRMTools.
 
 FoxTRMTools.Test ~
@@ -475,7 +467,6 @@ oc/TRM.Runtime.Mod
 oc/TRM.TestNet.Mdf
 ~
 
-
 FoxAVSP6LX75T.ReadSpecification TestNet ~
 
 FoxTRMTools.BuildHardware -p="AVSP6LX75T" -f="TestNet" ~
@@ -490,7 +481,6 @@ PET.Open data.mem ~
 PET.Open data0.mem ~
 PET.Open data1.mem ~
 
-
 FoxTRMTools.GenerateTestFile test.code ~
 FoxTRMTools.GenerateTestFile --value=010H test.code ~
 FoxTRMTools.GenerateTestFile --random test.code ~
@@ -502,8 +492,6 @@ PET.Open -e test.code test2.code ~
 
 FoxTRMTools.CompareFiles test.code test2.code matrix.txt ~
 
-
-
 UARTPC.Open 6 ~
 
 System.DoCommands
@@ -516,7 +504,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -525,7 +512,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -534,7 +520,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -543,7 +528,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -552,7 +536,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -561,7 +544,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -570,7 +552,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -579,7 +560,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -588,7 +568,6 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 FoxTRMTools.GenerateTestFile --random --size=4096 TestBRAM0con0code.mem ~
 FoxTRMTools.SplitFiles  --blockSize=512 --blocks=8 --patchSpartan6 TestBRAM0con0code.mem ~
 WinApplications.Run "testbram.bat" ~
@@ -597,13 +576,9 @@ FoxTRMTools.GenerateTestFile --sourceFile=bram.dat test.code ~
 PET.Open -e TestBRAM0con0code.mem test.code ~
 FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
-
 System.Show "DONE!" ~
 ~
 
-
-
-
 System.DoCommands
 
 FoxTRMTools.GenerateTestFile --random --size=512 TestBRAM0con0code.mem ~
@@ -616,7 +591,6 @@ FoxTRMTools.CompareFiles TestBRAM0con0code.mem test.code bram.mtx~
 
 ~
 
-
 M = {};
 
 file =fopen('bram.mtx')

+ 2 - 3
source/FoxTest.Mod

@@ -213,7 +213,6 @@ TYPE
 		RETURN reader
 	END GetTextReader;
 
-
 PROCEDURE RunTests(
 	text : Texts.Text;
 	CONST source: ARRAY OF CHAR;
@@ -249,11 +248,11 @@ END FoxTest.
 
 System.Free FoxTest TestSuite Versioning ~
 
-	FoxTest.Compile 	Oberon.Execution.Test Oberon.Execution.AMD64TestDiff ~
+	FoxTest.Compile	Oberon.Execution.Test Oberon.Execution.AMD64TestDiff ~
 
 	FoxTest.Compile	Oberon.Compilation.Test Oberon.Compilation.AMD64TestDiff ~
 
-	FoxTest.Compile 	MathVectors.Test MathVectors.Test.Diff ~
+	FoxTest.Compile	MathVectors.Test MathVectors.Test.Diff ~
 
 	FoxTest.Compile
 		--verbose

+ 0 - 4
source/FoxTextualSymbolFile.Mod

@@ -97,8 +97,4 @@ TYPE
 		NEW(symbolFile); RETURN symbolFile
 	END Get;
 
-
-
 END FoxTextualSymbolFile.
-
-

+ 8 - 10
source/FoxTranspilerBackend.Mod

@@ -477,7 +477,7 @@ TYPE
 
 			PrintIndent;
 			IF ~pragma THEN writer.String("/*") END;
- 			i := 0; len := LEN (comment);
+			i := 0; len := LEN (comment);
 			LOOP
 				ch := comment[i]; INC (i);
 				IF (i = len) OR (ch = 0X) THEN EXIT END;
@@ -629,21 +629,21 @@ TYPE
 				IF first THEN first := FALSE ELSE writer.Char (Comma); writer.Char (Space); END;
 				PrintArgument (arguments.GetExpression (index), parameter, FALSE);
 				INC (index); DEC (count); parameter := parameter.nextParameter;
- 			END;
+			END;
 			WHILE (outerScope # NIL) & (outerScope IS SyntaxTree.ProcedureScope) DO
- 				parameter := outerScope(SyntaxTree.ProcedureScope).ownerProcedure.type(SyntaxTree.ProcedureType).firstParameter;
- 				WHILE parameter # NIL DO
+				parameter := outerScope(SyntaxTree.ProcedureScope).ownerProcedure.type(SyntaxTree.ProcedureType).firstParameter;
+				WHILE parameter # NIL DO
 					IF first THEN first := FALSE ELSE writer.Char (Comma); writer.Char (Space); END;
 					PrintArgument (NIL, parameter, outerScope = currentProcedureScope);
 					parameter := parameter.nextParameter;
 				END;
-  				variable := outerScope.firstVariable;
- 				WHILE variable # NIL DO
+				variable := outerScope.firstVariable;
+				WHILE variable # NIL DO
 					IF first THEN first := FALSE ELSE writer.Char (Comma); writer.Char (Space); END;
 					PrintArgument (NIL, variable, outerScope = currentProcedureScope);
 					variable := variable.nextVariable;
 				END;
- 				outerScope := outerScope.outerScope;
+				outerScope := outerScope.outerScope;
 			END;
 			RETURN first;
 		END PrintArguments;
@@ -1278,7 +1278,7 @@ TYPE
 			| Scanner.Minus: IF expression.type.resolved IS SyntaxTree.SetType THEN writer.Char ('~') ELSE writer.Char ('-') END;
 			| Scanner.Not: writer.Char ('!');
 			END;
-			 PrintExpression (expression.left);
+			PrintExpression (expression.left);
 		END VisitUnaryExpression;
 
 		PROCEDURE VisitTypeGuardDesignator* (expression: SyntaxTree.TypeGuardDesignator);
@@ -1662,5 +1662,3 @@ TextCompiler.CompileSelection -b=Transpiler --defineMain  ~
 
 FoxTest.Compile --options="-PC -G=Transpiler" --command="WinApplications.Run --hide cl /c Test.c" Oberon.Temp.Test Oberon.Temp.TranspilerTestDiff ~
 FoxTest.Compile --options="--defineMain -PC -G=Transpiler" --command="WinApplications.Run --hide cl Test.c;WinApplications.Run --hide Test.exe" Oberon.Temp.Test Oberon.Temp.TranspilerTestDiff ~
-
-

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio