Bläddra i källkod

Removed Strings.Min/Max and used MIN/MAX instead

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8507 8c9fc860-2736-0410-a75d-ab315db34111
negelef 6 år sedan
förälder
incheckning
7da0e9b20f
62 ändrade filer med 278 tillägg och 288 borttagningar
  1. 3 3
      source/CDRecord.Mod
  2. 5 5
      source/ContextualDependency.Mod
  3. 23 23
      source/DTPText.Mod
  4. 11 11
      source/DTPView.Mod
  5. 1 1
      source/ExerciseGroups.Mod
  6. 5 5
      source/FATFiles.Mod
  7. 4 4
      source/FractalDemo.Mod
  8. 3 3
      source/ICMP.Mod
  9. 1 1
      source/IP.Mod
  10. 4 4
      source/IPv6.Mod
  11. 3 3
      source/InitNetwork.Mod
  12. 12 12
      source/MakeIsoImages.Mod
  13. 6 6
      source/PET.Mod
  14. 10 10
      source/ReleaseVisualizer.Mod
  15. 1 1
      source/Repositories.Mod
  16. 1 11
      source/Strings.Mod
  17. 8 8
      source/TCP.Mod
  18. 6 6
      source/TFPET.Mod
  19. 2 2
      source/TextCompiler.Mod
  20. 16 16
      source/UnicodeBidirectionality.Mod
  21. 2 2
      source/VNCServer.Mod
  22. 1 1
      source/WMArabicIME.Mod
  23. 2 2
      source/WMArmenianIME.Mod
  24. 8 8
      source/WMBuilder.Mod
  25. 2 2
      source/WMCalendar.Mod
  26. 2 2
      source/WMClock.Mod
  27. 2 2
      source/WMComponents.Mod
  28. 2 2
      source/WMDefaultWindows.Mod
  29. 2 2
      source/WMDesktopIcons.Mod
  30. 2 2
      source/WMDiagramComponents.Mod
  31. 6 6
      source/WMDiff.Mod
  32. 3 3
      source/WMEditors.Mod
  33. 1 1
      source/WMEthiopicIME.Mod
  34. 4 4
      source/WMGraphicUtilities.Mod
  35. 1 1
      source/WMGraphics.Mod
  36. 14 14
      source/WMGrids.Mod
  37. 1 1
      source/WMHebrewIME.Mod
  38. 2 2
      source/WMMenus.Mod
  39. 2 2
      source/WMMixer.Mod
  40. 2 2
      source/WMNavigator.Mod
  41. 1 1
      source/WMOverlay.Mod
  42. 1 1
      source/WMPopups.Mod
  43. 2 2
      source/WMProcessInfo.Mod
  44. 1 1
      source/WMProperties.Mod
  45. 1 1
      source/WMRussianIME.Mod
  46. 5 5
      source/WMScreenShot.Mod
  47. 1 1
      source/WMScribble.Mod
  48. 10 10
      source/WMScrollableComponents.Mod
  49. 2 2
      source/WMSearchComponents.Mod
  50. 1 1
      source/WMShapes.Mod
  51. 1 1
      source/WMSlideshow.Mod
  52. 4 4
      source/WMStandardComponents.Mod
  53. 4 4
      source/WMStringGrids.Mod
  54. 1 1
      source/WMTCPTracker.Mod
  55. 15 15
      source/WMTextStyleTool.Mod
  56. 4 4
      source/WMTextTool.Mod
  57. 30 30
      source/WMTextView.Mod
  58. 2 2
      source/WMTrees.Mod
  59. 1 1
      source/WMUkrainianIME.Mod
  60. 1 1
      source/Windows.WMTCPTracker.Mod
  61. 1 1
      source/XML.Mod
  62. 3 3
      source/YMF754.Mod

+ 3 - 3
source/CDRecord.Mod

@@ -1010,7 +1010,7 @@ TYPE
 			INC(bytesRead, amount);
 			IF (amount < track.bytespt) THEN
 				r := NIL;
-				rem := Strings.Min(track.bytespt-amount, track.size  - bytesRead);
+				rem := MIN(track.bytespt-amount, track.size  - bytesRead);
 				Utils.ClearBuffer(buffer^, amount, rem);
 				INC(amount, rem); INC(bytesRead, rem);
 			END;
@@ -1109,7 +1109,7 @@ TYPE
 				r.Bytes(rBuffer.buf^, 0, track.bytespt, amount);
 				INC(bytesRead, amount);
 				IF amount < track.bytespt THEN
-					rem := Strings.Min(track.bytespt-amount, track.size - bytesRead);
+					rem := MIN(track.bytespt-amount, track.size - bytesRead);
 					Utils.ClearBuffer(rBuffer.buf^, amount, rem);
 					INC(amount, rem); INC(bytesRead, rem);
 				END;
@@ -1119,7 +1119,7 @@ TYPE
 
 			WHILE bytesRead < track.size DO
 				rBuffer := WaitBufferAvailable(FALSE);
-				amount := Strings.Min(track.bytespt, track.size  - bytesRead);
+				amount := MIN(track.bytespt, track.size  - bytesRead);
 				Utils.ClearBuffer(rBuffer.buf^, 0, amount);
 				rBuffer.len := amount;
 				INC(bytesRead, amount);

+ 5 - 5
source/ContextualDependency.Mod

@@ -251,7 +251,7 @@ TYPE
 
 				(* if rotations need to be done thisNode's depth is passed back *)
 				ELSE
-					IF Strings.Max(leftDepth,rightDepth) = leftDepth THEN
+					IF MAX(leftDepth,rightDepth) = leftDepth THEN
 						RETURN leftDepth + 1;
 					ELSE
 						RETURN rightDepth + 1;
@@ -274,8 +274,8 @@ TYPE
 			thisNode.leftNode.rightNode := thisNode;
 			thisNode := thisNode.leftNode;
 			thisNode.rightNode.leftNode := tempNode;
-			thisNode.rightNode.depth := Strings.Max(GetNodeDepth(thisNode.rightNode.leftNode),GetNodeDepth(thisNode.rightNode.rightNode)) + 1;
-			thisNode.depth := Strings.Max(thisNode.leftNode.depth,thisNode.rightNode.depth) + 1;
+			thisNode.rightNode.depth := MAX(GetNodeDepth(thisNode.rightNode.leftNode),GetNodeDepth(thisNode.rightNode.rightNode)) + 1;
+			thisNode.depth := MAX(thisNode.leftNode.depth,thisNode.rightNode.depth) + 1;
 		END RotateRight;
 
 		(* Rotate the current tree to the left *)
@@ -287,8 +287,8 @@ TYPE
 			thisNode.rightNode.leftNode := thisNode;
 			thisNode := thisNode.rightNode;
 			thisNode.leftNode.rightNode := tempNode;
-			thisNode.leftNode.depth := Strings.Max(GetNodeDepth(thisNode.leftNode.leftNode),GetNodeDepth(thisNode.leftNode.rightNode)) + 1;
-			thisNode.depth := Strings.Max(thisNode.leftNode.depth,thisNode.rightNode.depth) + 1;
+			thisNode.leftNode.depth := MAX(GetNodeDepth(thisNode.leftNode.leftNode),GetNodeDepth(thisNode.leftNode.rightNode)) + 1;
+			thisNode.depth := MAX(thisNode.leftNode.depth,thisNode.rightNode.depth) + 1;
 		END RotateLeft;
 
 		(* Auxiliary procedure that returns the node's depth while checking for the node's existence *)

+ 23 - 23
source/DTPText.Mod

@@ -747,12 +747,12 @@ TYPE
 				IF (sender # NIL) & (sender IS Highlight) THEN
 					hl := sender(Highlight);
 					IF (hl.oldFrom # hl.from.GetPosition()) & (hl.oldTo # hl.to.GetPosition()) THEN (* both changed *)
-						min := Strings.Min(
-										Strings.Min(hl.oldFrom, hl.from.GetPosition()),
-										Strings.Min(hl.oldTo, hl.to.GetPosition()));
-						max := Strings.Max(
-										Strings.Max(hl.oldFrom, hl.from.GetPosition()),
-										Strings.Max(hl.oldTo, hl.to.GetPosition()));
+						min := MIN(
+										MIN(hl.oldFrom, hl.from.GetPosition()),
+										MIN(hl.oldTo, hl.to.GetPosition()));
+						max := MAX(
+										MAX(hl.oldFrom, hl.from.GetPosition()),
+										MAX(hl.oldTo, hl.to.GetPosition()));
 						InvalidateRange(min, max)
 					ELSIF hl.oldTo # hl.to.GetPosition() THEN (* to changed *)
 						InvalidateRange(hl.oldTo, hl.to.GetPosition())
@@ -877,7 +877,7 @@ TYPE
 			l := layout.FindLineNrByPos(cursor.GetPosition());
 			IF (l < firstLineI) THEN
 				(* move the cursor down by 3 lines to get more context *)
-				l := Strings.Max(0, l - 3);
+				l := MAX(0, l - 3);
 				firstLine.Set(l);
 			ELSIF (l < layout.GetNofLines()) THEN
 				ty := bordersI.t; i := firstLineI;
@@ -888,7 +888,7 @@ TYPE
 				END;
 				ty := ty + layout.lines[i].height;
 				IF ty >= bounds.GetHeight() - bordersI.b THEN
-					l := Strings.Max(0, l - 3);
+					l := MAX(0, l - 3);
 					firstLine.Set(l)
 				END
 			END;
@@ -1009,7 +1009,7 @@ TYPE
 				IF layout.lines[i].firstInParagraph THEN ypos := ypos + layout.lines[i].spaceBefore; END;
 				IF (i>0) & layout.lines[i-1].lastInParagraph THEN ypos := ypos + layout.lines[i-1].spaceAfter; END;
 			END;
-			RETURN Strings.Max(i -1, 0)
+			RETURN MAX(i -1, 0)
 		END FindLineByY;
 
 		PROCEDURE ViewToTextPos*(x, y: LONGINT; VAR pos : LONGINT);
@@ -1018,10 +1018,10 @@ TYPE
 		BEGIN
 			text.AcquireRead;
 			pos := -1;
-			x := Strings.Max(0, Strings.Min(x, bounds.GetWidth()));
-			y := Strings.Max(0, Strings.Min(y, bounds.GetHeight()));
+			x := MAX(0, MIN(x, bounds.GetWidth()));
+			y := MAX(0, MIN(y, bounds.GetHeight()));
 
-			l := FindLineByY(firstLineI, Strings.Min(Strings.Max(y, bordersI.t), bounds.GetHeight() - bordersI.b));
+			l := FindLineByY(firstLineI, MIN(MAX(y, bordersI.t), bounds.GetHeight() - bordersI.b));
 			(* KernelLog.String("Line: "); KernelLog.Int(l, 0); KernelLog.Ln; *)
 
 			x := x - bordersI.l; (* + leftShiftI; *)
@@ -1767,8 +1767,8 @@ TYPE
 				text.AcquireWrite;
 				IF Texts.GetLastSelection(selectionText, from, to) THEN
 					selectionText.AcquireWrite;
-					a := Strings.Min(from.GetPosition(), to.GetPosition());
-					b := Strings.Max(from.GetPosition(), to.GetPosition());
+					a := MIN(from.GetPosition(), to.GetPosition());
+					b := MAX(from.GetPosition(), to.GetPosition());
 
 					ViewToTextPos(x, y, pos);
 					utilreader.SetPosition(pos);
@@ -2113,7 +2113,7 @@ TYPE
 					pos := cursor.GetPosition();
 					lineStart := TextUtilities.FindPosLineStart(utilreader, pos);
 					nofWhitespace := TextUtilities.CountWhitespace(utilreader, lineStart);
-					nofWhitespace := Strings.Min(nofWhitespace, pos - lineStart);
+					nofWhitespace := MIN(nofWhitespace, pos - lineStart);
 					InsertChar(Texts.NewLineChar);
 					IF nofWhitespace > 0 THEN
 						text.CopyFromText(text, lineStart, nofWhitespace, pos + 1)
@@ -2171,7 +2171,7 @@ TYPE
 			cl := layout.FindLineNrByPos(pos);
 			IF cl > 0 THEN
 				DEC(cl);
-				cursor.SetPosition(layout.GetLineStartPos(cl) + Strings.Min(layout.GetLineLength(cl) - 1, lineEnter));
+				cursor.SetPosition(layout.GetLineStartPos(cl) + MIN(layout.GetLineLength(cl) - 1, lineEnter));
 				IF cl < firstLineI THEN firstLine.Set(cl) END
 			END;
 			IF select THEN KeyUpdateSelection(cursor.GetPosition()) END;
@@ -2189,7 +2189,7 @@ TYPE
 			cl := layout.FindLineNrByPos(pos);
 			IF cl < layout.GetNofLines() - 1 THEN
 				INC(cl);
-				cursor.SetPosition(layout.GetLineStartPos(cl) + Strings.Min(layout.GetLineLength(cl) - 1, lineEnter));
+				cursor.SetPosition(layout.GetLineStartPos(cl) + MIN(layout.GetLineLength(cl) - 1, lineEnter));
 				IF cl > FindLineByY(firstLineI, bounds.GetHeight() - bordersI.b) THEN firstLine.Set(firstLineI + 1 ) END
 			END;
 			IF select THEN KeyUpdateSelection(cursor.GetPosition()) END;
@@ -2289,8 +2289,8 @@ TYPE
 					1, TRUE, LONGINT(0808080FFH), WMGraphics.ModeCopy)
 			END;
 			text.AcquireRead;
-			la := FindLineByY(firstLineI, Strings.Max(cliprect.t, bordersI.t));
-			lb := FindLineByY(firstLineI, Strings.Min(cliprect.b, bounds.GetHeight() - bordersI.b));
+			la := FindLineByY(firstLineI, MAX(cliprect.t, bordersI.t));
+			lb := FindLineByY(firstLineI, MIN(cliprect.b, bounds.GetHeight() - bordersI.b));
 			(* KernelLog.String("FrameHeight: "); KernelLog.Int(h, 0); KernelLog.Ln; *)
 			(* KernelLog.String("bounds Height: "); KernelLog.Int(bounds.GetHeight(), 0); KernelLog.Ln; *)
 
@@ -3181,8 +3181,8 @@ TYPE
 					attr.fontInfo.fontcache := NIL;
 
 					text.AcquireWrite;
-					a := Strings.Min(from.GetPosition(), to.GetPosition());
-					b := Strings.Max(from.GetPosition(), to.GetPosition());
+					a := MIN(from.GetPosition(), to.GetPosition());
+					b := MAX(from.GetPosition(), to.GetPosition());
 					NEW(utilreader, text);
 					utilreader.SetPosition(a);
 					utilreader.ReadCh(ch);
@@ -3236,8 +3236,8 @@ TYPE
 					attr.fontInfo.fontcache := NIL;
 
 					text.AcquireWrite;
-					a := Strings.Min(from.GetPosition(), to.GetPosition());
-					b := Strings.Max(from.GetPosition(), to.GetPosition());
+					a := MIN(from.GetPosition(), to.GetPosition());
+					b := MAX(from.GetPosition(), to.GetPosition());
 					NEW(utilreader, text);
 					utilreader.SetPosition(a);
 					utilreader.ReadCh(ch);

+ 11 - 11
source/DTPView.Mod

@@ -623,7 +623,7 @@ TYPE
 								cframe.SetPosition(fx, fy);
 							END;
 							x1 := ENTIER(fx*zoomFactor)-dx+docOriginX; y1 := ENTIER(fy*zoomFactor)-dy+docOriginY;
-							InvalidateRect(WMRectangles.MakeRect(Strings.Min(x1, oldx1)+dx-10, Strings.Min(oldy1, y1)+dy-10, ENTIER(cframe.GetWidth()*zoomFactor)+Strings.Max(x1, oldx1)+dx+10, ENTIER(cframe.GetHeight()*zoomFactor)+Strings.Max(y1, oldy1)+dy+10));
+							InvalidateRect(WMRectangles.MakeRect(MIN(x1, oldx1)+dx-10, MIN(oldy1, y1)+dy-10, ENTIER(cframe.GetWidth()*zoomFactor)+MAX(x1, oldx1)+dx+10, ENTIER(cframe.GetHeight()*zoomFactor)+MAX(y1, oldy1)+dy+10));
 						ELSIF resize THEN										(* resize frame *)
 							quality := FALSE;
 							xs := ENTIER(cframe.GetX()*zoomFactor)+docOriginX;
@@ -663,21 +663,21 @@ TYPE
 									ELSE cguide.SetPosition((y-docOriginY)/zoomFactor); END;
 								END;
 								oldy1 := gy; gy := y;
-								InvalidateRect(WMRectangles.MakeRect(0, Strings.Min(oldy1, gy)-10, ENTIER(document.GetPageWidth()*zoomFactor)+docOriginX, Strings.Max(oldy1, gy)+10));
+								InvalidateRect(WMRectangles.MakeRect(0, MIN(oldy1, gy)-10, ENTIER(document.GetPageWidth()*zoomFactor)+docOriginX, MAX(oldy1, gy)+10));
 							ELSE
 								IF WillSnap((x-docOriginX)/zoomFactor, 0, (x-docOriginX)/zoomFactor,1, snapLeft, snapTop, snapRight, snapBottom, tx, ty) THEN
 									IF snapLeft THEN cguide.SetPosition(tx);		(* snap guide *)
 									ELSE cguide.SetPosition((x-docOriginX)/zoomFactor); END;
 								END;
 								oldx1 := gx; gx := x;
-								InvalidateRect(WMRectangles.MakeRect(Strings.Min(oldx1, gx)-10, 0, Strings.Max(oldx1, gx)+10, ENTIER(document.GetPageHeight()*zoomFactor)+docOriginX));
+								InvalidateRect(WMRectangles.MakeRect(MIN(oldx1, gx)-10, 0, MAX(oldx1, gx)+10, ENTIER(document.GetPageHeight()*zoomFactor)+docOriginX));
 							END;
 						ELSIF addguide THEN									(* create new guide object *)
 							oldx1 := gx; gx := x;
 							IF res2 = 0 THEN										(* Horizontal guide *)
-								InvalidateRect(WMRectangles.MakeRect(0, Strings.Min(oldy1, gy)-10, ENTIER(document.GetPageWidth()*zoomFactor)+docOriginX, Strings.Max(oldy1, gy)+10));
+								InvalidateRect(WMRectangles.MakeRect(0, MIN(oldy1, gy)-10, ENTIER(document.GetPageWidth()*zoomFactor)+docOriginX, MAX(oldy1, gy)+10));
 							ELSE												(* Vertical guide *)
-								InvalidateRect(WMRectangles.MakeRect(Strings.Min(oldx1, gx)-10, 0, Strings.Max(oldx1, gx)+10, ENTIER(document.GetPageHeight()*zoomFactor)+docOriginX));
+								InvalidateRect(WMRectangles.MakeRect(MIN(oldx1, gx)-10, 0, MAX(oldx1, gx)+10, ENTIER(document.GetPageHeight()*zoomFactor)+docOriginX));
 							END;
 						ELSE
 						END;
@@ -746,7 +746,7 @@ TYPE
 					ELSE												(* plugin selected *)
 						IF down THEN
 							IF addobject THEN							(* on create new content object *)
-								InvalidateRect(WMRectangles.MakeRect(Strings.Min(vx0, vx1)-10, Strings.Min(vy0, vy1)-10, Strings.Max(vx0, vx1)+10, Strings.Max(vy0, vy1)+10));
+								InvalidateRect(WMRectangles.MakeRect(MIN(vx0, vx1)-10, MIN(vy0, vy1)-10, MAX(vx0, vx1)+10, MAX(vy0, vy1)+10));
 							ELSE
 								IF  (cframe # NIL) & WMRectangles.PointInRect(x, y, WMRectangles.MakeRect(ENTIER(cframe.GetX()*zoomFactor)+docOriginX, ENTIER(cframe.GetY()*zoomFactor)+docOriginY, ENTIER((cframe.GetX()+cframe.GetWidth())*zoomFactor)+docOriginX, ENTIER((cframe.GetY()+cframe.GetHeight())*zoomFactor)+docOriginY)) THEN
 									ccontent := cframe.GetContent();
@@ -828,10 +828,10 @@ TYPE
 						ELSE											(* dragged *)
 							IF addobject THEN
 								IF (cpage # NIL) THEN					(* create frame *)
-(*									fx := (Strings.Min(x0,x1)-docOriginX)/zoomFactor;
-									fy := (Strings.Min(y0,y1)-docOriginY)/zoomFactor;
-									fw := (Strings.Max(x0,x1)-Strings.Min(x0,x1))/zoomFactor;
-									fh := (Strings.Max(y0,y1)-Strings.Min(y0,y1))/zoomFactor;
+(*									fx := (MIN(x0,x1)-docOriginX)/zoomFactor;
+									fy := (MIN(y0,y1)-docOriginY)/zoomFactor;
+									fw := (MAX(x0,x1)-MIN(x0,x1))/zoomFactor;
+									fh := (MAX(y0,y1)-MIN(y0,y1))/zoomFactor;
 *)
 									fx := (x0-docOriginX)/zoomFactor;
 									fy := (y0-docOriginY)/zoomFactor;
@@ -877,7 +877,7 @@ TYPE
 										activeContent.Hide;
 									END;
 									content.Show(propsX, propsY); activeFrame := cframe;
-									InvalidateRect(WMRectangles.MakeRect(Strings.Min(x0, x1)-5, Strings.Min(y0, y1)-5, Strings.Max(x0, x1)+5, Strings.Max(y0, y1)+5));
+									InvalidateRect(WMRectangles.MakeRect(MIN(x0, x1)-5, MIN(y0, y1)-5, MAX(x0, x1)+5, MAX(y0, y1)+5));
 								END;
 							ELSE										(* forward click to plugin *)
 								IF (cframe # NIL) & WMRectangles.PointInRect(x, y, WMRectangles.MakeRect(ENTIER(cframe.GetX()*zoomFactor)+docOriginX, ENTIER(cframe.GetY()*zoomFactor)+docOriginY, ENTIER((cframe.GetX()+cframe.GetWidth())*zoomFactor)+docOriginX, ENTIER((cframe.GetY()+cframe.GetHeight())*zoomFactor)+docOriginY)) THEN

+ 1 - 1
source/ExerciseGroups.Mod

@@ -1446,7 +1446,7 @@ TYPE
 				ELSE
 					WebStd.AppendXMLContent(td, WebStd.CreateXMLText(" "))
 				END;
-				FOR i := 0 TO Strings.Min(person.grades.GetCount(), nofCols)-1 DO
+				FOR i := 0 TO MIN(person.grades.GetCount(), nofCols)-1 DO
 					number := person.grades.GetItem(i);
 					tr.AddContent(GetInputField(i, number))
 				END;

+ 5 - 5
source/FATFiles.Mod

@@ -794,7 +794,7 @@ TYPE
 				WHILE (len > 0) & (Pos(r) < size) DO
 					IF (buffer.pos # r.apos) THEN ReadBuffer(buffer, r.apos) END;
 					src := ADDRESSOF(buffer.data[r.bpos]);
-					m := Strings.Min(Strings.Min(size - Pos(r), clusterSize - r.bpos), len);
+					m := MIN(MIN(size - Pos(r), clusterSize - r.bpos), len);
 					SYSTEM.MOVE(src, ADDRESSOF(x[ofs]), m);
 					INC(ofs, m); DEC(len, m);
 					INC(r.bpos, m); ASSERT(r.bpos <= clusterSize);
@@ -839,7 +839,7 @@ TYPE
 				WHILE (len > 0) DO
 					IF (buffer.pos # r.apos) THEN ReadBuffer(buffer, r.apos) END;
 					dst := ADDRESSOF(buffer.data[r.bpos]);
-					m := Strings.Min(clusterSize-r.bpos, len);
+					m := MIN(clusterSize-r.bpos, len);
 					SYSTEM.MOVE(ADDRESSOF(x[ofs]), dst, m);
 					WriteBuffer(buffer);
 					INC(ofs, m); DEC(len, m);
@@ -1011,7 +1011,7 @@ TYPE
 					name[pos] := PathDelimiter; INC(pos)
 				END
 			END;
-			name[Strings.Min(LEN(name)-1, pos)] := 0X
+			name[MIN(LEN(name)-1, pos)] := 0X
 		END GetFullName;
 
 	END File;
@@ -1225,7 +1225,7 @@ TYPE
 					END
 				END
 			UNTIL (data[0] = deLast) OR r.eof OR ~cont;
-			IF (firstFreePos = MAX(LONGINT)) THEN firstFreePos := Strings.Max(Pos(r)-32, 0) END;
+			IF (firstFreePos = MAX(LONGINT)) THEN firstFreePos := MAX(Pos(r)-32, 0) END;
 			ASSERT(firstFreePos MOD 32 = 0)
 		END EnumerateX;
 
@@ -1655,7 +1655,7 @@ TYPE
 			IF (pos < LEN(name)-1) THEN
 				name[pos] := PathDelimiter; INC(pos)
 			END;
-			name[Strings.Min(LEN(name)-1, pos)] := 0X
+			name[MIN(LEN(name)-1, pos)] := 0X
 		END GetFullName;
 	END RootDirectory;
 

+ 4 - 4
source/FractalDemo.Mod

@@ -269,10 +269,10 @@ TYPE
 			IF selecting THEN
 				WMGraphicUtilities.RectGlassShade(canvas,
 					WMRectangles.MakeRect(
-						Strings.Min(x0, x1),
-						Strings.Min(y0, y1),
-						Strings.Max(x1, x0),
-						Strings.Max(y1, y0)), 5, FALSE)
+						MIN(x0, x1),
+						MIN(y0, y1),
+						MAX(x1, x0),
+						MAX(y1, y0)), 5, FALSE)
 			END;
 			IF recalcNeeded THEN
 				canvas.SetColor(LONGINT(0FFFF00FFH));

+ 3 - 3
source/ICMP.Mod

@@ -23,7 +23,7 @@ MODULE ICMP; (** AUTHOR "mvt"; PURPOSE "ICMP protocol"; *)
 	o Always access fields as 8-, 16- or 32-bit values and use DIV, MOD, ASH, ODD for bit access.
 *)
 
-IMPORT SYSTEM, Machine, Modules, KernelLog, IP, IPv6, Network, Strings;
+IMPORT SYSTEM, Machine, Modules, KernelLog, IP, IPv6, Network;
 
 CONST
 	(* DEBUG *)
@@ -578,7 +578,7 @@ BEGIN
 	Network.Put4(teData, 0, 0); (* Unused *)
 
 	(* add portion of discarded packet *)
-	teDataLen := Strings.Min(TimeExcHdrLen + 1280 - IPv6.MaxIPHdrLen - ICMPHdrLen, TimeExcHdrLen + discardedPacket.len);
+	teDataLen := MIN(TimeExcHdrLen + 1280 - IPv6.MaxIPHdrLen - ICMPHdrLen, TimeExcHdrLen + discardedPacket.len);
 	FOR i := TimeExcHdrLen TO teDataLen - 1 DO
 		teData[i] := discardedPacket.data[i - TimeExcHdrLen];
 	END;
@@ -599,7 +599,7 @@ BEGIN
 	Network.Put4(ppData, 0, probPointer);
 
 	(* add portion of discarded packet *)
-	ppDataLen := Strings.Min(ParamExcHdrLen + 1280 - IPv6.MaxIPHdrLen - ICMPHdrLen, ParamExcHdrLen + discardedPacket.len);
+	ppDataLen := MIN(ParamExcHdrLen + 1280 - IPv6.MaxIPHdrLen - ICMPHdrLen, ParamExcHdrLen + discardedPacket.len);
 	FOR i := ParamExcHdrLen TO ppDataLen - 1 DO
 		ppData[i] := discardedPacket.data[i - ParamExcHdrLen];
 	END;

+ 1 - 1
source/IP.Mod

@@ -1678,7 +1678,7 @@ BEGIN
 	IF all THEN
 		length := LEN(buffer) -1;
 	ELSE
-		length := Strings.Min(LEN(buffer) - 1, 256);
+		length := MIN(LEN(buffer) - 1, 256);
 	END;
 
 	FOR i := 0 TO length DO

+ 4 - 4
source/IPv6.Mod

@@ -1678,8 +1678,8 @@ TYPE
 
 			(* Get Path Maximum transmission unit *)
 			pmtu := destCache.GetPMTU(destAdr);
-			pmtu := Strings.Min(pmtu, linkMTU);
-			pmtu := Strings.Min(pmtu, dev.mtu);
+			pmtu := MIN(pmtu, linkMTU);
+			pmtu := MIN(pmtu, dev.mtu);
 
 			IF h3len+h4len+dlen > pmtu THEN
 				(* fragment packet *)
@@ -2235,8 +2235,8 @@ TYPE
 							END;
 							hasMTUOption := TRUE;
 							icmpMTUOption(buffer, mtu);
-							mtu := Strings.Min(mtu, linkMTU);
-							mtu := Strings.Min(mtu, dev.mtu);
+							mtu := MIN(mtu, linkMTU);
+							mtu := MIN(mtu, dev.mtu);
 
 						|IP.ICMPAdvIntOptionType:
 							(* Check length field *)

+ 3 - 3
source/InitNetwork.Mod

@@ -496,7 +496,7 @@ VAR
 
 				(* DNS *)
 				dnsElems := GetSettings(intElem, "DNS");
-				FOR i := 0 TO Strings.Min(dnsElems.GetNumberOfElements(), DNSMod.MaxNofServer) - 1 DO
+				FOR i := 0 TO MIN(dnsElems.GetNumberOfElements(), DNSMod.MaxNofServer) - 1 DO
 					p := dnsElems.GetElement(i);
 					elem := p(XML.Element);
 					attribute := elem.GetAttribute("value");
@@ -562,7 +562,7 @@ VAR
 
 				(* DNS *)
 				dnsElems := GetSettings(intElem, "DNS");
-				FOR i := 0 TO Strings.Min(dnsElems.GetNumberOfElements(), DNSMod.MaxNofServer) - 1 DO
+				FOR i := 0 TO MIN(dnsElems.GetNumberOfElements(), DNSMod.MaxNofServer) - 1 DO
 					p := dnsElems.GetElement(i);
 					elem := p(XML.Element);
 					attribute := elem.GetAttribute("value");
@@ -794,7 +794,7 @@ BEGIN
 
 					(* DNS *)
 					dnsElems := GetSettings(elem, "DNS");
-					FOR i := 0 TO Strings.Min(dnsElems.GetNumberOfElements(), DNSMod.MaxNofServer) - 1 DO
+					FOR i := 0 TO MIN(dnsElems.GetNumberOfElements(), DNSMod.MaxNofServer) - 1 DO
 						p := dnsElems.GetElement(i);
 						elem := p(XML.Element);
 						attribute := elem.GetAttribute("value");

+ 12 - 12
source/MakeIsoImages.Mod

@@ -457,13 +457,13 @@ TYPE
 			IF type = Joliet THEN
 				COPY(root.name^, name);
 				ReplaceNonJolietChars(name);
-				len := Strings.Min(UTF8Strings.Length(name), 32 DIV 2);
+				len := MIN(UTF8Strings.Length(name), 32 DIV 2);
 				UTF8Strings.Extract(name, 0, len, shortname);
 			ELSE
 				count := UTF8Strings.UTF8toASCII(root.name^, CHR(95), name);
 				Strings.UpperCase(name);
 				ReplaceNonDChars(name);
-				len := Strings.Min(Strings.Length(name), 32);
+				len := MIN(Strings.Length(name), 32);
 				Strings.Copy(name, 0, len, shortname);
 			END;
 			root.shortname := Strings.NewString(shortname);
@@ -511,13 +511,13 @@ TYPE
 			IF (node IS File) & GetExtension(name, file, ext) THEN
 				ReplaceNonDChars(file);
 				ReplaceNonDChars(ext);
-				len := Strings.Min(Strings.Length(file), 8);
+				len := MIN(Strings.Length(file), 8);
 				Strings.Copy(file, 0, len, shortname);
 				Strings.Append(shortname, ".");
 				ext[3] := 0X;
 				Strings.Append(shortname, ext);
 			ELSE
-				len := Strings.Min(Strings.Length(name), 8);
+				len := MIN(Strings.Length(name), 8);
 				Strings.Copy(name, 0, len, shortname);
 				ReplaceNonDChars(shortname);
 			END;
@@ -536,18 +536,18 @@ TYPE
 				IF GetExtension(name, file, ext) THEN
 					ReplaceNonDChars(file);
 					ReplaceNonDChars(ext);
-					len := Strings.Min(Strings.Length(file), 30-Strings.Length(ext)-1);
+					len := MIN(Strings.Length(file), 30-Strings.Length(ext)-1);
 					Strings.Copy(file, 0, len, shortname);
 					Strings.Append(shortname, ".");
 					ext[30] := 0X;
 					Strings.Append(shortname, ext);
 				ELSE
-					len := Strings.Min(Strings.Length(name), 30);
+					len := MIN(Strings.Length(name), 30);
 					Strings.Copy(name, 0, len, shortname);
 					ReplaceNonDChars(shortname);
 				END;
 			ELSE
-				len := Strings.Min(Strings.Length(name), 31);
+				len := MIN(Strings.Length(name), 31);
 				Strings.Copy(name, 0, len, shortname);
 				ReplaceNonDChars(shortname);
 			END;
@@ -566,12 +566,12 @@ TYPE
 			COPY(node.name^, name);
 			ReplaceNonJolietChars(name);
 			IF (node IS File) & GetExtension(name, file, ext) THEN
-				len := Strings.Min(UTF8Strings.Length(file), 64 - UTF8Strings.Length(ext) -1);
+				len := MIN(UTF8Strings.Length(file), 64 - UTF8Strings.Length(ext) -1);
 				UTF8Strings.Extract(name, 0, len, shortname);
 				Strings.Append(shortname, ".");
 				Strings.Append(shortname, ext);
 			ELSE
-				len := Strings.Min(UTF8Strings.Length(name), 64);
+				len := MIN(UTF8Strings.Length(name), 64);
 				UTF8Strings.Extract(name, 0, len, shortname);
 			END;
 			RETURN len;
@@ -629,13 +629,13 @@ TYPE
 			node := dir.content;
 			WHILE node # NIL DO
 				len := UTF8Strings.Length(node.shortname^);
-				max := Strings.Max(max, len);
+				max := MAX(max, len);
 				node := node.next;
 			END;
 			cur := dir.subdir;
 			WHILE cur # NIL DO
 				len :=GetMaxPathLengthDir(cur);
-				max := Strings.Max(max, len);
+				max := MAX(max, len);
 				cur := cur.nextdir;
 			END;
 			IF dir.parent # dir THEN (* root directory *)
@@ -1557,7 +1557,7 @@ VAR
 BEGIN
 	UTF8Strings.UTF8toUnicode(src, ucs4, len);
 	DEC(len);
-	i := 0; len := Strings.Min(len, LEN(dst) DIV 2);
+	i := 0; len := MIN(len, LEN(dst) DIV 2);
 	FOR i := 0 TO len-1 DO
 		dst[2*i] := CHR(ucs4[i] DIV 100H MOD 100H);
 		dst[2*i+1] :=  CHR(ucs4[i] MOD 100H);

+ 6 - 6
source/PET.Mod

@@ -2310,8 +2310,8 @@ TYPE
 			IF currentPage = NIL THEN RETURN; END;
 			IF Texts.GetLastSelection(selectionText, from, to) THEN
 				selectionText.AcquireRead;
-				a := Strings.Min(from.GetPosition(), to.GetPosition());
-				b := Strings.Max(from.GetPosition(), to.GetPosition());
+				a := MIN(from.GetPosition(), to.GetPosition());
+				b := MAX(from.GetPosition(), to.GetPosition());
 				TextUtilities.SubTextToStr(selectionText, a, b - a, pcStr);
 				selectionText.ReleaseRead;
 				Strings.Trim(pcStr, " ");
@@ -2726,8 +2726,8 @@ VAR a, b : LONGINT; string : ARRAY 4 OF Texts.Char32;
 BEGIN
 	ASSERT((text # NIL) & (from # NIL) & (to # NIL));
 	text.AcquireWrite;
-	a := Strings.Min(from.GetPosition(), to.GetPosition());
-	b := Strings.Max(from.GetPosition(), to.GetPosition());
+	a := MIN(from.GetPosition(), to.GetPosition());
+	b := MAX(from.GetPosition(), to.GetPosition());
 	string[0] := ORD(" "); string[1] := ORD("*"); string[2] := ORD(")"); string[3] := 0;
 	text.InsertUCS32(b, string);
 	string[0] := ORD("("); string[1] := ORD("*"); string[2] := ORD(" "); string[3] := 0;
@@ -2745,8 +2745,8 @@ VAR
 	openPos, closePos, openLen, closeLen : LONGINT;
 BEGIN
 	text.AcquireWrite;
-	a := Strings.Min(from.GetPosition(), to.GetPosition());
-	b := Strings.Max(from.GetPosition(), to.GetPosition());
+	a := MIN(from.GetPosition(), to.GetPosition());
+	b := MAX(from.GetPosition(), to.GetPosition());
 
 	NEW(reader, text);
 

+ 10 - 10
source/ReleaseVisualizer.Mod

@@ -158,7 +158,7 @@ TYPE
 							imp := modules[j].imports;
 							WHILE imp # NIL DO
 								IF imp.m =  modules[i] THEN
-									l := Strings.Min(l, modules[j].level -1);
+									l := MIN(l, modules[j].level -1);
 								END;
 								imp := imp.next
 							END
@@ -675,7 +675,7 @@ TYPE
 
 	(*			i := 0; l := Strings.Length(m.purpose^);
 				WHILE i < l DO
-					Strings.Copy(m.purpose^, i, Strings.Min(25, l - i), sec);
+					Strings.Copy(m.purpose^, i, MIN(25, l - i), sec);
 					canvas.DrawString(ENTIER(r.l + fx), r.t + ENTIER(ty * fy), sec);
 					ty := ty + 15;
 					INC(i, 25)
@@ -978,7 +978,7 @@ TYPE
 				m.reference := NIL;
 				m.subsystems := {};
 				subSystems.CheckModule(m);
-				maxDepth := Strings.Max(maxDepth, ml.GetDepth(m));
+				maxDepth := MAX(maxDepth, ml.GetDepth(m));
 			END;
 			INC(maxDepth);
 
@@ -1016,7 +1016,7 @@ TYPE
 					(* calculate max length for each group *)
 					levels[i].nofGroups := 0;
 					FOR j := 0 TO 31 DO
-						ms[j] := Strings.Max(ms[j], levels[i].groupLength[j]);
+						ms[j] := MAX(ms[j], levels[i].groupLength[j]);
 						IF levels[i].groupLength[j] > 0 THEN INC(levels[i].nofGroups) END;
 					END;
 					j := 0;
@@ -1039,7 +1039,7 @@ TYPE
 				ELSE
 					totSlots := 0;
 					FOR j := 0 TO levels[i].nofGroups -1 DO
-						levels[i].groupSlots[j] := Strings.Max(1, levels[i].groupCounts[j] * (maxW DIV 2 (* spare space for leveling out *))  DIV levels[i].n);
+						levels[i].groupSlots[j] := MAX(1, levels[i].groupCounts[j] * (maxW DIV 2 (* spare space for leveling out *))  DIV levels[i].n);
 						INC(totSlots, levels[i].groupSlots[j])
 					END;
 					(* level out *)
@@ -1056,7 +1056,7 @@ TYPE
 					END;
 					(* calc yAdvance *)
 					FOR j := 0 TO levels[i].nofGroups -1 DO
-						levels[i].yAdvance := Strings.Max(levels[i].yAdvance, levels[i].groupCounts[j] DIV levels[i].groupSlots[j] + 1);
+						levels[i].yAdvance := MAX(levels[i].yAdvance, levels[i].groupCounts[j] DIV levels[i].groupSlots[j] + 1);
 					END;
 
 				END
@@ -1080,10 +1080,10 @@ TYPE
 						mb.aabb.l := (sp + gc MOD levels[i].groupSlots[g])* (BoxW + HSpace) ; mb.aabb.r := mb.aabb.l + BoxW;
 						mb.aabb.t := (y + gc DIV levels[i].groupSlots[g]) * (BoxH + VSpace); mb.aabb.b := mb.aabb.t + BoxH;
 						mb.rellayerpos := (VSpace - 5) - (j / levels[i].n) * (VSpace / 2);
-						range.l := Strings.Min(range.l, ENTIER(mb.aabb.l));
-						range.t:= Strings.Min(range.t, ENTIER(mb.aabb.t));
-						range.r := Strings.Max(range.r, ENTIER(mb.aabb.r));
-						range.b := Strings.Max(range.b, ENTIER(mb.aabb.b));
+						range.l := MIN(range.l, ENTIER(mb.aabb.l));
+						range.t:= MIN(range.t, ENTIER(mb.aabb.t));
+						range.r := MAX(range.r, ENTIER(mb.aabb.r));
+						range.b := MAX(range.b, ENTIER(mb.aabb.b));
 						IF m.file # NIL THEN COPY(m.file^, mb.name);
 						ELSE COPY(m.name, mb.name);
 						END;

+ 1 - 1
source/Repositories.Mod

@@ -807,7 +807,7 @@ TYPE
 					IF (ptr # NIL) & (ptr IS ComponentInfo) THEN
 						ptr(ComponentInfo).next := components;
 						components := ptr(ComponentInfo);
-						nextID := Strings.Max(nextID, components(ComponentInfo).id);
+						nextID := MAX(nextID, components(ComponentInfo).id);
 					END;
 				END;
 			ELSE

+ 1 - 11
source/Strings.Mod

@@ -32,7 +32,7 @@ TYPE
 		VAR newSize, i : LONGINT; n : String;
 		BEGIN
 			IF length + len + 1 >= LEN(data) THEN
-				newSize := Max(LEN(data) * 2, length + len + 1);
+				newSize := MAX(LEN(data) * 2, length + len + 1);
 				NEW(n, newSize);
 				FOR i := 0 TO length - 1 DO n[i] := data[i] END;
 				data := n;
@@ -132,16 +132,6 @@ TYPE
 	END "+"; 
 	
 	
-(** useful functions *)
-
-PROCEDURE Min*(a,b: LONGINT): LONGINT;
-BEGIN IF (a < b) THEN RETURN a ELSE RETURN b END
-END Min;
-
-PROCEDURE Max*(a,b: LONGINT): LONGINT;
-BEGIN IF (a > b) THEN RETURN a ELSE RETURN b END
-END Max;
-
 (** string handling *)
 
 (** returns the length of a string *)

+ 8 - 8
source/TCP.Mod

@@ -44,7 +44,7 @@ TCP - Transmission Control Protocol. Based on the 4.4BSD-Lite distribution descr
 
 *)
 
-IMPORT SYSTEM, Machine, KernelLog, Clock, Modules, Objects, Kernel, Commands, Network, IP, Streams, ActiveTimers, Strings;
+IMPORT SYSTEM, Machine, KernelLog, Clock, Modules, Objects, Kernel, Commands, Network, IP, Streams, ActiveTimers;
 
 CONST
 	StrongChecks = FALSE;
@@ -482,7 +482,7 @@ TYPE
 				WHILE (rcvhead # NIL) & (rcvhead # rcvreasm) & (size > 0) DO
 					IF rcvhead.nextFragment = NIL THEN
 						(* read all available data until user buffer is full *)
-						rlen := Strings.Min(rcvhead.len, size);
+						rlen := MIN(rcvhead.len, size);
 						IF SystemMove THEN
 							SYSTEM.MOVE(ADDRESSOF(rcvhead.data[rcvhead.ofs]), ADDRESSOF(data[ofs]), rlen);
 						ELSE
@@ -511,7 +511,7 @@ TYPE
 						IF rcvheadFragment = NIL THEN
 							rcvheadFragment := rcvhead;
 						END;
-						rlen := Strings.Min(rcvheadFragment.len, size);
+						rlen := MIN(rcvheadFragment.len, size);
 						IF SystemMove THEN
 							SYSTEM.MOVE(ADDRESSOF(rcvheadFragment.data[rcvheadFragment.ofs]), ADDRESSOF(data[ofs]), rlen);
 						ELSE
@@ -798,7 +798,7 @@ TYPE
 					END;
 					sndnxt := snduna; rtt := 0;
 					sndcwnd := maxseg; dupacks := 0;
-					sndssthresh := Strings.Max(Strings.Min(sndwnd, sndcwnd) DIV 2 DIV maxseg, 2) * maxseg;
+					sndssthresh := MAX(MIN(sndwnd, sndcwnd) DIV 2 DIV maxseg, 2) * maxseg;
 					IF TraceCongestion THEN
 						KernelLog.String("ST sndssthresh := "); KernelLog.Int(sndssthresh, 1); KernelLog.Ln
 					END;
@@ -1826,7 +1826,7 @@ VAR
 				|3X: (* Window Scaling *)
 					IF (optlen = 3) & (Syn IN pf) THEN
 						INCL(p.flags, RcvdScale);
-						p.requestedsscale := Strings.Min(LONG(ORD(buffer.data[i+2])), MaxWinShift);
+						p.requestedsscale := MIN(LONG(ORD(buffer.data[i+2])), MaxWinShift);
 					END;
 				|8X: (* Timestamp *)
 					IF DoRFC1323 & (optlen = 10) THEN
@@ -2025,7 +2025,7 @@ VAR
 						INC(p.dupacks);
 						IF p.dupacks = ReXmtThresh THEN
 							onxt := p.sndnxt;
-							p.sndssthresh := Strings.Max(Strings.Min(p.sndwnd, p.sndcwnd) DIV 2 DIV p.maxseg, 2) * p.maxseg;
+							p.sndssthresh := MAX(MIN(p.sndwnd, p.sndcwnd) DIV 2 DIV p.maxseg, 2) * p.maxseg;
 							IF TraceCongestion THEN
 								KernelLog.String("DA sndssthresh := "); KernelLog.Int(p.sndssthresh, 1); KernelLog.Ln
 							END;
@@ -2068,7 +2068,7 @@ VAR
 			END;
 			cw := p.sndcwnd; incr := p.maxseg;
 			IF cw > p.sndssthresh THEN incr := incr * incr DIV cw END;
-			p.sndcwnd := Strings.Min(cw + incr, ASH(MaxWin, p.sndscale));
+			p.sndcwnd := MIN(cw + incr, ASH(MaxWin, p.sndscale));
 			IF acked > p.sndcc THEN
 				DEC(p.sndwnd, p.sndcc); SbDrop(p, p.sndcc); finacked := TRUE
 			ELSE
@@ -2410,7 +2410,7 @@ BEGIN
 	END;
 
 	(* slow path *)
-	p.rcvwnd := Strings.Max(Strings.Max(p.rcvspace, 0), p.rcvadv - p.rcvnxt);
+	p.rcvwnd := MAX(MAX(p.rcvspace, 0), p.rcvadv - p.rcvnxt);
 	CASE p.state OF
 		Listen:
 			IF ProcessListen() THEN Trim1 ELSE RETURN END

+ 6 - 6
source/TFPET.Mod

@@ -2265,8 +2265,8 @@ TYPE
 			IF currentPage = NIL THEN RETURN; END;
 			IF Texts.GetLastSelection(selectionText, from, to) THEN
 				selectionText.AcquireRead;
-				a := Strings.Min(from.GetPosition(), to.GetPosition());
-				b := Strings.Max(from.GetPosition(), to.GetPosition());
+				a := MIN(from.GetPosition(), to.GetPosition());
+				b := MAX(from.GetPosition(), to.GetPosition());
 				TextUtilities.SubTextToStr(selectionText, a, b - a, pcStr);
 				selectionText.ReleaseRead;
 				Strings.Trim(pcStr, " ");
@@ -2682,8 +2682,8 @@ VAR a, b : LONGINT; string : ARRAY 4 OF Texts.Char32;
 BEGIN
 	ASSERT((text # NIL) & (from # NIL) & (to # NIL));
 	text.AcquireWrite;
-	a := Strings.Min(from.GetPosition(), to.GetPosition());
-	b := Strings.Max(from.GetPosition(), to.GetPosition());
+	a := MIN(from.GetPosition(), to.GetPosition());
+	b := MAX(from.GetPosition(), to.GetPosition());
 	string[0] := ORD(" "); string[1] := ORD("*"); string[2] := ORD(")"); string[3] := 0;
 	text.InsertUCS32(b, string);
 	string[0] := ORD("("); string[1] := ORD("*"); string[2] := ORD(" "); string[3] := 0;
@@ -2701,8 +2701,8 @@ VAR
 	openPos, closePos, openLen, closeLen : LONGINT;
 BEGIN
 	text.AcquireWrite;
-	a := Strings.Min(from.GetPosition(), to.GetPosition());
-	b := Strings.Max(from.GetPosition(), to.GetPosition());
+	a := MIN(from.GetPosition(), to.GetPosition());
+	b := MAX(from.GetPosition(), to.GetPosition());
 
 	NEW(reader, text);
 

+ 2 - 2
source/TextCompiler.Mod

@@ -35,8 +35,8 @@ CONST
 	BEGIN
 		IF Texts.GetLastSelection(selectionText, from, to) THEN
 			selectionText.AcquireRead;
-			a := Strings.Min(from.GetPosition(), to.GetPosition());
-			b := Strings.Max(from.GetPosition(), to.GetPosition());
+			a := MIN(from.GetPosition(), to.GetPosition());
+			b := MAX(from.GetPosition(), to.GetPosition());
 			size := UTF8Size(selectionText,a,b-a+1)+1;
 			NEW(pcStr,size);
 			TextUtilities.SubTextToStr(selectionText, a, b - a+1, pcStr^);

+ 16 - 16
source/UnicodeBidirectionality.Mod

@@ -180,7 +180,7 @@ TYPE
 		PROCEDURE NewTextReaderArray(VAR trArray : TextReaderArray; size : LONGINT);
 		BEGIN
 			IF trArray = NIL THEN
-				NEW(trArray,Strings.Max(initialCacheElementSize,2*size));
+				NEW(trArray,MAX(initialCacheElementSize,2*size));
 			ELSIF LEN(trArray) < size THEN
 				NEW(trArray,2*size);
 			END;
@@ -221,7 +221,7 @@ TYPE
 		PROCEDURE NewBoolArray(VAR bArray : BoolArray; size : LONGINT);
 		BEGIN
 			IF bArray = NIL THEN
-				NEW(bArray,Strings.Max(initialCacheElementSize,2*size));
+				NEW(bArray,MAX(initialCacheElementSize,2*size));
 			ELSIF LEN(bArray) < size THEN
 				NEW(bArray,2*size);
 			END;
@@ -231,7 +231,7 @@ TYPE
 		PROCEDURE NewPosArrays(VAR pArrays : PosArrays; size : LONGINT);
 		BEGIN
 			IF pArrays = NIL THEN
-				NEW(pArrays,Strings.Max(initialCacheElementSize,2*size));
+				NEW(pArrays,MAX(initialCacheElementSize,2*size));
 			ELSIF LEN(pArrays) < size THEN
 				NEW(pArrays,2*size);
 			END;
@@ -251,7 +251,7 @@ TYPE
 			(* pool is empty *)
 			IF posArrayPool.first = NIL THEN
 				NEW(pArray);
-				NEW(pArray.array,Strings.Max(initialCacheElementSize,2*size));
+				NEW(pArray.array,MAX(initialCacheElementSize,2*size));
 				pArray.size := size;
 				RETURN;
 			END;
@@ -284,7 +284,7 @@ TYPE
 
 			(* if no position array was found, resize the first one and use it *)
 			pArray := posArrayPool.first;
-			NEW(pArray.array,Strings.Max(initialCacheElementSize,2*size));
+			NEW(pArray.array,MAX(initialCacheElementSize,2*size));
 			pArray.size := size;
 			posArrayPool.first := pArray.next;
 			pArray.next := NIL;
@@ -294,7 +294,7 @@ TYPE
 		PROCEDURE NewIntegerArray(VAR iArray : IntegerArray; size : LONGINT);
 		BEGIN
 			IF iArray = NIL THEN
-				NEW(iArray,Strings.Max(initialCacheElementSize,2*size));
+				NEW(iArray,MAX(initialCacheElementSize,2*size));
 			ELSIF LEN(iArray) < size THEN
 				NEW(iArray,2*size);
 			END;
@@ -304,7 +304,7 @@ TYPE
 		PROCEDURE NewStringArray(VAR sArray : Strings.StringArray; size : LONGINT);
 		BEGIN
 			IF sArray = NIL THEN
-				NEW(sArray,Strings.Max(initialCacheElementSize,2*size));
+				NEW(sArray,MAX(initialCacheElementSize,2*size));
 			ELSIF LEN(sArray) < size THEN
 				NEW(sArray,2*size);
 			END;
@@ -314,7 +314,7 @@ TYPE
 		PROCEDURE NewCharArray(VAR cArray : CharArray; size : LONGINT);
 		BEGIN
 			IF cArray = NIL THEN
-				NEW(cArray,Strings.Max(initialCacheElementSize,2*size));
+				NEW(cArray,MAX(initialCacheElementSize,2*size));
 			ELSIF LEN(cArray) < size THEN
 				NEW(cArray,2*size);
 			END;
@@ -1223,7 +1223,7 @@ TYPE
 
 				(* W1. *)
 				IF cacheElement.characterTypes[i]^ = "NSM" THEN
-					Strings.Copy(lastCharType^,0,Strings.Min(LEN(cacheElement.characterTypes[i]),LEN(lastCharType)),cacheElement.characterTypes[i]^);
+					Strings.Copy(lastCharType^,0,MIN(LEN(cacheElement.characterTypes[i]),LEN(lastCharType)),cacheElement.characterTypes[i]^);
 				END;
 
 				(* border of two runs *)
@@ -1243,7 +1243,7 @@ TYPE
 
 				(* remember strong type for W2 *)
 				ELSIF IsStrongCharacterType(cacheElement.characterTypes[i]) & ~newLevel THEN
-					Strings.Copy(cacheElement.characterTypes[i]^,0,Strings.Min(LEN(cacheElement.characterTypes[i]),LEN(lastCharType)),lastCharType^);
+					Strings.Copy(cacheElement.characterTypes[i]^,0,MIN(LEN(cacheElement.characterTypes[i]),LEN(lastCharType)),lastCharType^);
 					lastStrongType := NeutralType;
 
 				(* W2. remember the new type for W1 *)
@@ -1256,13 +1256,13 @@ TYPE
 						END;
 					ELSE
 						charType := HL2(cacheElement,i,lastStrongType);
-						Strings.Copy(charType^,0,Strings.Min(LEN(cacheElement.characterTypes[i]),LEN(charType)),cacheElement.characterTypes[i]^);
-						Strings.Copy(charType^,0,Strings.Min(LEN(lastCharType),LEN(charType)),lastCharType^);
+						Strings.Copy(charType^,0,MIN(LEN(cacheElement.characterTypes[i]),LEN(charType)),cacheElement.characterTypes[i]^);
+						Strings.Copy(charType^,0,MIN(LEN(lastCharType),LEN(charType)),lastCharType^);
 					END;
 
 				(* remember character type for W1, exept for BN *)
 				ELSIF cacheElement.characterTypes[i]^ # "BN" THEN
-					Strings.Copy(cacheElement.characterTypes[i]^,0,Strings.Min(LEN(cacheElement.characterTypes[i]),LEN(lastCharType)),lastCharType^);
+					Strings.Copy(cacheElement.characterTypes[i]^,0,MIN(LEN(cacheElement.characterTypes[i]),LEN(lastCharType)),lastCharType^);
 				END;
 				newLevel := FALSE;
 			END;
@@ -1641,7 +1641,7 @@ TYPE
 			END;
 
 			(* the length of the text cannot be longer than the actual line *)
-			length := Strings.Min(length,cacheElement.lineLength-relStart);
+			length := MIN(length,cacheElement.lineLength-relStart);
 
 			IF CharacterDebugging THEN
 				KernelLog.Ln;
@@ -1842,7 +1842,7 @@ TYPE
 			lineCache.FindElement(pos,cacheElement);
 			IF (cacheElement = NIL) OR (cacheElement.characterEmbeddingLevels = NIL) THEN
 
-				RETURN Strings.Max(0,cacheElement.paragraphEmbeddingLevel);
+				RETURN MAX(0,cacheElement.paragraphEmbeddingLevel);
 			END;
 
 			IF cacheElement.pos + cacheElement.lineLength <= pos THEN
@@ -2157,7 +2157,7 @@ TYPE
 		(* Returns the character type of the higher of two levels *)
 		PROCEDURE GetBorderOfRunCharacterType(thisLevel, otherLevel : LONGINT; VAR result : Strings.String);
 		BEGIN
-			IF (ODD(Strings.Max(thisLevel,otherLevel))) THEN
+			IF (ODD(MAX(thisLevel,otherLevel))) THEN
 				result^ := "R";
 			ELSE
 				result^ := "L";

+ 2 - 2
source/VNCServer.Mod

@@ -461,11 +461,11 @@ TYPE
 		BEGIN
 			in.SkipBytes(3); (* padding *)
 			len := in.Net32();
-			NEW(text, Strings.Min(MaxCutSize, len + 1));
+			NEW(text, MIN(MaxCutSize, len + 1));
 			FOR i := 0 TO len - 1 DO
 				IF len < MaxCutSize - 1 THEN text[i] := in.Get() ELSE skip := in.Get() END;
 			END;
-			text[Strings.Min(MaxCutSize - 1, len)] := 0X;
+			text[MIN(MaxCutSize - 1, len)] := 0X;
 			IF vncInfo.cutl # NIL THEN vncInfo.cutl(text) END;
 		END ClientCutText;
 

+ 1 - 1
source/WMArabicIME.Mod

@@ -138,7 +138,7 @@ BEGIN
 	IF Texts.GetLastSelection(selectionText, from, to) THEN
 		selectionText.AcquireRead;
 		NEW(r, selectionText);
-		r.SetPosition(Strings.Min(from.GetPosition(), to.GetPosition()));
+		r.SetPosition(MIN(from.GetPosition(), to.GetPosition()));
 		r.ReadCh(ucs);
 		selectionText.ReleaseRead;
 		KernelLog.String("InsertChar("); KernelLog.Hex(ucs, 0); KernelLog.String("H) (**)"); KernelLog.Ln;

+ 2 - 2
source/WMArmenianIME.Mod

@@ -1,7 +1,7 @@
 MODULE WMArmenianIME; (** AUTHOR "tf"; PURPOSE "Write armenian characters"; *)
 
 IMPORT
-	Strings, WMInputMethods, Texts, KernelLog;
+	WMInputMethods, Texts, KernelLog;
 
 CONST
 	imeName* = "Armenian";
@@ -149,7 +149,7 @@ BEGIN
 	IF Texts.GetLastSelection(selectionText, from, to) THEN
 		selectionText.AcquireRead;
 		NEW(r, selectionText);
-		r.SetPosition(Strings.Min(from.GetPosition(), to.GetPosition()));
+		r.SetPosition(MIN(from.GetPosition(), to.GetPosition()));
 		r.ReadCh(ucs);
 		selectionText.ReleaseRead;
 		KernelLog.String("InsertChar("); KernelLog.Hex(ucs, 0); KernelLog.String("H) (**)"); KernelLog.Ln;

+ 8 - 8
source/WMBuilder.Mod

@@ -782,10 +782,10 @@ TYPE
 		PROCEDURE FixBounds;
 		BEGIN
 			bounds := WMRectangles.MakeRect(
-				Strings.Min(bounds.l, bounds.r),
-				Strings.Min(bounds.t, bounds.b),
-				Strings.Max(bounds.l, bounds.r),
-				Strings.Max(bounds.t, bounds.b)
+				MIN(bounds.l, bounds.r),
+				MIN(bounds.t, bounds.b),
+				MAX(bounds.l, bounds.r),
+				MAX(bounds.t, bounds.b)
 			);
 		END FixBounds;
 
@@ -1186,10 +1186,10 @@ TYPE
 					IF (rect.l # 0) OR (rect.t # 0) OR (rect.r # 0) OR (rect.b # 0) THEN
 						bounds := components[i](WMComponents.VisualComponent).bounds.Get();
 						ToEditorCoordinates(components[i](WMComponents.VisualComponent), bounds);
-						rect.l := Strings.Min(rect.l, bounds.l);
-						rect.t := Strings.Min(rect.t, bounds.t);
-						rect.r := Strings.Max(rect.r, bounds.r);
-						rect.b := Strings.Max(rect.b, bounds.b);
+						rect.l := MIN(rect.l, bounds.l);
+						rect.t := MIN(rect.t, bounds.t);
+						rect.r := MAX(rect.r, bounds.r);
+						rect.b := MAX(rect.b, bounds.b);
 					ELSE
 						rect := components[i](WMComponents.VisualComponent).bounds.Get();
 						ToEditorCoordinates(components[i](WMComponents.VisualComponent), rect);

+ 2 - 2
source/WMCalendar.Mod

@@ -560,8 +560,8 @@ TYPE
 					ELSE
 						width := GetWidth();
 						height := GetHeight();
-						width := Strings.Max(10, width + dx);
-						height := Strings.Max(10, height + dy);
+						width := MAX(10, width + dx);
+						height := MAX(10, height + dy);
 						manager.SetWindowSize(SELF, width, height);
 					END;
 				END;

+ 2 - 2
source/WMClock.Mod

@@ -146,8 +146,8 @@ TYPE
 					ELSE
 						width := GetWidth();
 						height := GetHeight();
-						width := Strings.Max(10, width + dx);
-						height := Strings.Max(10, height + dy);
+						width := MAX(10, width + dx);
+						height := MAX(10, height + dy);
 						manager.SetWindowSize(SELF, width, height);
 					END;
 				END;

+ 2 - 2
source/WMComponents.Mod

@@ -2935,8 +2935,8 @@ BEGIN
 	ASSERT(w # NIL);
 	IF Texts.GetLastSelection(text, from, to) THEN
 		text.AcquireRead;
-		a := Strings.Min(from.GetPosition(), to.GetPosition());
-		b := Strings.Max(from.GetPosition(), to.GetPosition());
+		a := MIN(from.GetPosition(), to.GetPosition());
+		b := MAX(from.GetPosition(), to.GetPosition());
 		IF (text.GetLength() > 0) THEN
 			TextUtilities.SubTextToStream(text, a, b - a + 1, w);
 		END;

+ 2 - 2
source/WMDefaultWindows.Mod

@@ -158,8 +158,8 @@ TYPE
 							draggingWidth := draggingWidth + dx;
 						END;
 
-						newWidth := Strings.Max(1, draggingWidth);
-						newHeight := Strings.Max(1, draggingHeight);
+						newWidth := MAX(1, draggingWidth);
+						newHeight := MAX(1, draggingHeight);
 
 						IF modKeys * Inputs.Alt # {} THEN
 							snapWidth := newWidth; snapHeight := newHeight;

+ 2 - 2
source/WMDesktopIcons.Mod

@@ -97,8 +97,8 @@ TYPE
 					ELSE
 						width := GetWidth();
 						height := GetHeight();
-						width := Strings.Max(10, width + dx);
-						height := Strings.Max(10, height + dy);
+						width := MAX(10, width + dx);
+						height := MAX(10, height + dy);
 						manager.SetWindowSize(SELF, width, height);
 					END;
 				END;

+ 2 - 2
source/WMDiagramComponents.Mod

@@ -403,7 +403,7 @@ TYPE
 		BEGIN
 			model.Acquire;
 			nofPoints := model.GetNofPoints();
-			nofVisible := Strings.Min(nofPoints - 1, w DIV deltaxI + 1);
+			nofVisible := MIN(nofPoints - 1, w DIV deltaxI + 1);
 
 			IF nofVisible >= 2 THEN
 				index := nofPoints - 1;
@@ -450,7 +450,7 @@ TYPE
 		BEGIN
 			model.Acquire;
 			nofPoints := model.GetNofPoints();
-			nofVisible := Strings.Min(nofPoints - 1, w DIV deltaxI + 1);
+			nofVisible := MIN(nofPoints - 1, w DIV deltaxI + 1);
 			nofStandalone := GetNumberOf(Standalone, 0, MAX(LONGINT), model.descriptor);
 
 			IF nofVisible >= 2 THEN

+ 6 - 6
source/WMDiff.Mod

@@ -203,7 +203,7 @@ TYPE
 		VAR intStr: ARRAY 32 OF CHAR; nofRows: LONGINT; diffState : DiffState; lineWidth, dy: LONGINT;
 		BEGIN
 			font.GetStringSize(string^, lineWidth, dy); INC(lineWidth,4);
-			maxLineWidth := Strings.Max(lineWidth, maxLineWidth);
+			maxLineWidth := MAX(lineWidth, maxLineWidth);
 			lineNbr.model.Acquire;
 			grid.model.Acquire;
 			nofRows := grid.model.GetNofRows();
@@ -249,7 +249,7 @@ TYPE
 		VAR intStr: ARRAY 32 OF CHAR; nofRows, lineWidth, dy: LONGINT;
 		BEGIN
 			font.GetStringSize(string^, lineWidth, dy); INC(lineWidth, 4);
-			maxLineWidth := Strings.Max(lineWidth, maxLineWidth);
+			maxLineWidth := MAX(lineWidth, maxLineWidth);
 			lineNbr.model.Acquire;
 			grid.model.Acquire;
 			nofRows := grid.model.GetNofRows();
@@ -339,8 +339,8 @@ TYPE
 			barHeight := bounds.GetHeight()- 2*ScrollbarWidth;
 			pageStart := barHeight * pageStart DIV nofRows;
 			pageSize := pageSize * barHeight DIV nofRows;
-			SELF.pageStart := Strings.Max(pageStart, 0);
-			SELF.pageSize := Strings.Min(barHeight-pageStart, Strings.Max(pageSize, 1));
+			SELF.pageStart := MAX(pageStart, 0);
+			SELF.pageSize := MIN(barHeight-pageStart, MAX(pageSize, 1));
 			Invalidate;
 		END SetPage;
 
@@ -395,7 +395,7 @@ TYPE
 						pos := ENTIER(fact * i + 0.5);
 						IF ~prev THEN rect.t := pos; rect.b := pos + 1; prev := TRUE
 						ELSE
-							rect.b := Strings.Max(rect.b, pos+1);
+							rect.b := MAX(rect.b, pos+1);
 						END;
 					ELSE
 						IF prev THEN
@@ -582,7 +582,7 @@ TYPE
 		BEGIN
 			pageSize := leftView.grid.bounds.GetHeight() DIV leftView.grid.defaultRowHeight.Get();
 			scrolly.pageSize.Set(pageSize);
-			scrolly.min.Set(0); scrolly.max.Set(Strings.Max(leftView.curLine, rightView.curLine) - pageSize);
+			scrolly.min.Set(0); scrolly.max.Set(MAX(leftView.curLine, rightView.curLine) - pageSize);
 		END SetScrollbarProperties;
 
 		PROCEDURE Update;

+ 3 - 3
source/WMEditors.Mod

@@ -1610,7 +1610,7 @@ TYPE
 
 					lineStart := TextUtilities.FindPosLineStart(utilreader, pos);
 					nofWhitespace := TextUtilities.CountWhitespace(utilreader, lineStart);
-					nofWhitespace := Strings.Min(nofWhitespace, pos - lineStart);
+					nofWhitespace := MIN(nofWhitespace, pos - lineStart);
 
 					IF (nofWhitespace > 0) THEN
 						idx := 0;
@@ -1670,8 +1670,8 @@ TYPE
 				text.AcquireWrite;
 				IF Texts.GetLastSelection(selectionText, from, to) THEN
 					selectionText.AcquireWrite;
-					a := Strings.Min(from.GetPosition(), to.GetPosition());
-					b := Strings.Max(from.GetPosition(), to.GetPosition());
+					a := MIN(from.GetPosition(), to.GetPosition());
+					b := MAX(from.GetPosition(), to.GetPosition());
 
 					tv.ViewToTextPos(x, y, pos);
 					(* get the internal position of the cursor *)

+ 1 - 1
source/WMEthiopicIME.Mod

@@ -196,7 +196,7 @@ BEGIN
 	IF Texts.GetLastSelection(selectionText, from, to) THEN
 		selectionText.AcquireRead;
 		NEW(r, selectionText);
-		r.SetPosition(Strings.Min(from.GetPosition(), to.GetPosition()));
+		r.SetPosition(MIN(from.GetPosition(), to.GetPosition()));
 		r.ReadCh(ucs);
 		selectionText.ReleaseRead;
 		KernelLog.String("SetChar("); KernelLog.Hex(ucs, 0); KernelLog.String("H; (**)"); KernelLog.Ln;

+ 4 - 4
source/WMGraphicUtilities.Mod

@@ -1,7 +1,7 @@
 MODULE WMGraphicUtilities;	(** AUTHOR "TF"; PURPOSE "Tools using WMGraphics"; *)
 
 IMPORT
-	WMGraphics, WMRectangles, Strings;
+	WMGraphics, WMRectangles;
 
 TYPE
 	EllipsePixelsFiller* = PROCEDURE(CONST canvas : WMGraphics.Canvas; rect : WMRectangles.Rectangle; dx, dy : LONGINT; lineColor, fillColor : WMGraphics.Color; mode : LONGINT);
@@ -11,9 +11,9 @@ PROCEDURE ScaleColor*(color : WMGraphics.Color; factor : LONGINT): WMGraphics.Co
 VAR r, g, b, a : LONGINT;
 BEGIN
 	WMGraphics.ColorToRGBA(color, r, g, b, a);
-	r := Strings.Min(r * factor DIV 256, 255);
-	g := Strings.Min(g * factor DIV 256, 255);
-	b := Strings.Min(b * factor DIV 256, 255);
+	r := MIN(r * factor DIV 256, 255);
+	g := MIN(g * factor DIV 256, 255);
+	b := MIN(b * factor DIV 256, 255);
 	RETURN WMGraphics.RGBAToColor(r, g, b, a)
 END ScaleColor;
 

+ 1 - 1
source/WMGraphics.Mod

@@ -121,7 +121,7 @@ TYPE
 					IF HasChar(code) THEN GetGlyphSpacings(code, g);
 					ELSE FBGetGlyphSpacings(code, g)
 					END;
-					dy := Strings.Max(dy, g.height);
+					dy := MAX(dy, g.height);
 					dx := dx + g.bearing.l + g.width + g.bearing.r
 				ELSE INC(i) (* avoid endless loop *)
 				END

+ 14 - 14
source/WMGrids.Mod

@@ -159,8 +159,8 @@ TYPE
 			defaultRowHeightC := defaultRowHeight.Get();
 			fixedColsC := fixedCols.Get();
 			fixedRowsC := fixedRows.Get();
-			tableStart.row := Strings.Max(tableStart.row, fixedRowsC);
-			tableStart.col := Strings.Max(tableStart.col, fixedColsC);
+			tableStart.row := MAX(tableStart.row, fixedRowsC);
+			tableStart.col := MAX(tableStart.col, fixedColsC);
 
 			nofRowsC := nofRows.Get();
 			nofColsC := nofCols.Get();
@@ -426,8 +426,8 @@ TYPE
 				r, clip : WMRectangles.Rectangle;
 		BEGIN
 			DrawBackground^(canvas);
-			tableStart.row := Strings.Max(tableStart.row, fixedRowsC);
-			tableStart.col := Strings.Max(tableStart.col, fixedColsC);
+			tableStart.row := MAX(tableStart.row, fixedRowsC);
+			tableStart.col := MAX(tableStart.col, fixedColsC);
 
 			canvas.GetClipRect(clip);
 			canvas.SaveState(state); (* save the current clip-state for the scrollbars *)
@@ -531,8 +531,8 @@ TYPE
 		PROCEDURE SetTopPosition*(col, row : LONGINT; updateScrollbar : BOOLEAN);
 		BEGIN
 			Acquire;
-			col := Strings.Min(Strings.Max(col, fixedColsC), nofColsC - 1);
-			row := Strings.Min(Strings.Max(row, fixedRowsC), nofRowsC - 1);
+			col := MIN(MAX(col, fixedColsC), nofColsC - 1);
+			row := MIN(MAX(row, fixedRowsC), nofRowsC - 1);
 			IF (col # tableStart.col) OR (row # tableStart.row) THEN
 				tableStart.col := col; tableStart.row := row;
 				IF pointerInside THEN FindCellXY(lastPointerX, lastPointerY, highlight.col, highlight.row) END;
@@ -557,8 +557,8 @@ TYPE
 			r := GetVisibleCellRect(col, row);
 			WHILE (r.r > w) & (cur.col < col) DO DEC(r.r, GetColWidth(cur.col)); INC(cur.col) END;
 			WHILE (r.b > h) & (cur.row < row) DO DEC(r.b, GetRowHeight(cur.row)); INC(cur.row) END;
-			cur.col := Strings.Min(cur.col, col);
-			cur.row := Strings.Min(cur.row, row);
+			cur.col := MIN(cur.col, col);
+			cur.row := MIN(cur.row, row);
 			SetTopPosition(cur.col, cur.row, TRUE)
 		END ScrollCellVisible;
 
@@ -644,8 +644,8 @@ TYPE
 		BEGIN
 			Acquire;
 			oldStart := selStart; oldEnd := selEnd;
-			selStart.col := Strings.Min(scol, ecol); selStart.row := Strings.Min(srow, erow);
-			selEnd.col := Strings.Max(scol, ecol); selEnd.row := Strings.Max(srow, erow);
+			selStart.col := MIN(scol, ecol); selStart.row := MIN(srow, erow);
+			selEnd.col := MAX(scol, ecol); selEnd.row := MAX(srow, erow);
 			IF (oldStart.col = selStart.col) & (oldStart.row= selStart.row) &
 				(oldEnd.col = selEnd.col) & (oldEnd.row= selEnd.row) THEN
 				Release;
@@ -766,15 +766,15 @@ TYPE
 		VAR col, row : LONGINT; manager : WM.WindowManager; cell, pos : LONGINT;
 		BEGIN
 			IF dragCellSpacingWidth THEN
-				x := Strings.Min(x, bounds.GetWidth());
+				x := MIN(x, bounds.GetWidth());
 				IF (colWidths # NIL) & (dragCellSpacingNr < LEN(colWidths)) THEN
-					colWidths[dragCellSpacingNr] := Strings.Max(x - dragCellSpacingPos, 1);
+					colWidths[dragCellSpacingNr] := MAX(x - dragCellSpacingPos, 1);
 					Invalidate()
 				END;
 			ELSIF dragCellSpacingHeight THEN
-				y := Strings.Min(y, bounds.GetHeight());
+				y := MIN(y, bounds.GetHeight());
 				IF (rowHeights # NIL) & (dragCellSpacingNr < LEN(rowHeights)) THEN
-					rowHeights[dragCellSpacingNr] := Strings.Max(y - dragCellSpacingPos, 1);
+					rowHeights[dragCellSpacingNr] := MAX(y - dragCellSpacingPos, 1);
 					Invalidate()
 				END;
 			ELSIF dragPossible THEN

+ 1 - 1
source/WMHebrewIME.Mod

@@ -82,7 +82,7 @@ BEGIN
 	IF Texts.GetLastSelection(selectionText, from, to) THEN
 		selectionText.AcquireRead;
 		NEW(r, selectionText);
-		r.SetPosition(Strings.Min(from.GetPosition(), to.GetPosition()));
+		r.SetPosition(MIN(from.GetPosition(), to.GetPosition()));
 		r.ReadCh(ucs);
 		selectionText.ReleaseRead;
 		KernelLog.String("InsertChar("); KernelLog.Hex(ucs, 0); KernelLog.String("H) (**)"); KernelLog.Ln;

+ 2 - 2
source/WMMenus.Mod

@@ -151,7 +151,7 @@ TYPE
 			ASSERT((menu # NIL) & (root # NIL));
 			Acquire;
 			SELF.menu := menu; SELF.root := root; hover := NIL;
-			greyBoxWidth := Strings.Max(MinImageWidth + 2 * HMenuDistance , MaxImageWidth() + 2 * HMenuDistance);
+			greyBoxWidth := MAX(MinImageWidth + 2 * HMenuDistance , MaxImageWidth() + 2 * HMenuDistance);
 			Invalidate;
 			Release
 		END SetMenu;
@@ -174,7 +174,7 @@ TYPE
 				child := menu.GetChildren(root);
 				WHILE (child # NIL) DO
 					height := height + ItemHeight(child);
-					width := Strings.Max(width, ItemWidth(child, FALSE));
+					width := MAX(width, ItemWidth(child, FALSE));
 					child := menu.GetNextSibling(child);
 				END;
 				menu.Release;

+ 2 - 2
source/WMMixer.Mod

@@ -201,7 +201,7 @@ BEGIN
 		device.GetMixerChannel(0, master)
 	END;
 	IF master # NIL THEN
-		master.SetVolume(Strings.Min(255, master.GetVolume() + 4))
+		master.SetVolume(MIN(255, master.GetVolume() + 4))
 	END;
 END MasterIncVol;
 
@@ -212,7 +212,7 @@ BEGIN
 		device.GetMixerChannel(0, master)
 	END;
 	IF master # NIL THEN
-		master.SetVolume(Strings.Max(0, master.GetVolume() - 4))
+		master.SetVolume(MAX(0, master.GetVolume() - 4))
 	END;
 END MasterDecVol;
 

+ 2 - 2
source/WMNavigator.Mod

@@ -250,9 +250,9 @@ TYPE
 								(* calculate bottom rectangle *)
 								IF wr.b < r.b THEN WMRectangles.SetRect(nr, r.l, wr.b, r.r, r.b); Draw(nr, cur.prev) END;
 								(* calculate left rectangle *)
-								IF wr.l > r.l THEN WMRectangles.SetRect(nr, r.l, Strings.Max(r.t, wr.t), wr.l, Strings.Min(r.b, wr.b)); Draw(nr, cur.prev) END;
+								IF wr.l > r.l THEN WMRectangles.SetRect(nr, r.l, MAX(r.t, wr.t), wr.l, MIN(r.b, wr.b)); Draw(nr, cur.prev) END;
 								(* calculate left rectangle *)
-								IF wr.r < r.r THEN WMRectangles.SetRect(nr, wr.r, Strings.Max(r.t, wr.t), r.r, Strings.Min(r.b, wr.b)); Draw(nr, cur.prev) END;
+								IF wr.r < r.r THEN WMRectangles.SetRect(nr, wr.r, MAX(r.t, wr.t), r.r, MIN(r.b, wr.b)); Draw(nr, cur.prev) END;
 								(* calculate overlapping *)
 								nr := r; WMRectangles.ClipRect(nr, wr);
 								IF ~WMRectangles.RectEmpty(nr) THEN InternalDraw(nr, cur) END

+ 1 - 1
source/WMOverlay.Mod

@@ -196,7 +196,7 @@ TYPE
 					ELSE
 						canvas.Line(lx, ly, x, y, color, WMGraphics.ModeCopy);
 					END;
-					Invalidate(WMRectangles.MakeRect(Strings.Min(lx, x), Strings.Min(ly, y), Strings.Max(lx, x) + 1, Strings.Max(ly, y) + 1));
+					Invalidate(WMRectangles.MakeRect(MIN(lx, x), MIN(ly, y), MAX(lx, x) + 1, MAX(ly, y) + 1));
 				END;
 			ELSIF (currentPointer # Pointer_Arrow) THEN
 				currentPointer := Pointer_Arrow;

+ 1 - 1
source/WMPopups.Mod

@@ -77,7 +77,7 @@ TYPE
 				entry := entry.next;
 			END;
 
-			width := Strings.Min(width, 1024);
+			width := MIN(width, 1024);
 
 			panel.bounds.SetExtents(width, height);
 

+ 2 - 2
source/WMProcessInfo.Mod

@@ -155,14 +155,14 @@ TYPE
 			FOR i := 0 TO 5 DO
 				GetTitleStr(i, str);
 				f.GetStringSize(str, dx, dy);
-				colWidth[i] := Strings.Max(dx + 4, 30);
+				colWidth[i] := MAX(dx + 4, 30);
 				grid.model.SetCellText(i, 0, Strings.NewString(str));
 				grid.model.SetTextAlign(i, 0, WMGraphics.AlignCenter)
 			END;
 			FOR i := 6 TO 11 - 1 DO
 				GetTitleStr(i, str);
 				f.GetStringSize(str, dx, dy);
-				colWidth[i] := Strings.Max(dx + 4, minWidth+ 40);
+				colWidth[i] := MAX(dx + 4, minWidth+ 40);
 				grid.model.SetCellText(i, 0, Strings.NewString(str));
 				grid.model.SetTextAlign(i, 0, WMGraphics.AlignCenter)
 			END;

+ 1 - 1
source/WMProperties.Mod

@@ -629,7 +629,7 @@ TYPE
 
 		PROCEDURE Validate(v : LONGINT) : LONGINT;
 		BEGIN
-			IF bounded THEN RETURN Strings.Max(min, Strings.Min(max, v))
+			IF bounded THEN RETURN MAX(min, MIN(max, v))
 			ELSE RETURN v
 			END
 		END Validate;

+ 1 - 1
source/WMRussianIME.Mod

@@ -126,7 +126,7 @@ BEGIN
 	IF Texts.GetLastSelection(selectionText, from, to) THEN
 		selectionText.AcquireRead;
 		NEW(r, selectionText);
-		r.SetPosition(Strings.Min(from.GetPosition(), to.GetPosition()));
+		r.SetPosition(MIN(from.GetPosition(), to.GetPosition()));
 		r.ReadCh(ucs);
 		selectionText.ReleaseRead;
 		KernelLog.String("InsertChar("); KernelLog.Hex(ucs, 0); KernelLog.String("H) (**)"); KernelLog.Ln;

+ 5 - 5
source/WMScreenShot.Mod

@@ -1,7 +1,7 @@
 MODULE WMScreenShot;	(** AUTHOR "TF"; PURPOSE "Screenshot utility"; *)
 
 IMPORT
-	Commands, Plugins, Raster, Strings, WMGraphics, WMRectangles,
+	Commands, Plugins, Raster, WMGraphics, WMRectangles,
 	WM := WMWindowManager;
 
 TYPE
@@ -102,9 +102,9 @@ TYPE
 						(* calculate bottom rectangle *)
 						IF wr.b < r.b THEN WMRectangles.SetRect(nr, r.l, wr.b, r.r, r.b); Draw(nr, cur.prev) END;
 						(* calculate left rectangle *)
-						IF wr.l > r.l THEN WMRectangles.SetRect(nr, r.l, Strings.Max(r.t, wr.t), wr.l, Strings.Min(r.b, wr.b)); Draw(nr, cur.prev) END;
+						IF wr.l > r.l THEN WMRectangles.SetRect(nr, r.l, MAX(r.t, wr.t), wr.l, MIN(r.b, wr.b)); Draw(nr, cur.prev) END;
 						(* calculate left rectangle *)
-						IF wr.r < r.r THEN WMRectangles.SetRect(nr, wr.r, Strings.Max(r.t, wr.t), r.r, Strings.Min(r.b, wr.b)); Draw(nr, cur.prev) END;
+						IF wr.r < r.r THEN WMRectangles.SetRect(nr, wr.r, MAX(r.t, wr.t), r.r, MIN(r.b, wr.b)); Draw(nr, cur.prev) END;
 						(* calculate overlapping *)
 						nr := r; WMRectangles.ClipRect(nr, wr);
 						IF ~WMRectangles.RectEmpty(nr) THEN InternalDraw(nr, cur) END
@@ -140,8 +140,8 @@ BEGIN
 	p := manager.viewRegistry.Get(viewportName);
 	IF p # NIL THEN viewport := p(WM.ViewPort) ELSE viewport := WM.GetDefaultView() END;
 
-	w := Strings.Max(ENTIER(viewport.range.r - viewport.range.l), 1);
-	h := Strings.Max(ENTIER(viewport.range.b - viewport.range.t), 1);
+	w := MAX(ENTIER(viewport.range.r - viewport.range.l), 1);
+	h := MAX(ENTIER(viewport.range.b - viewport.range.t), 1);
 	context.arg.SkipWhitespace;
 	IF (context.arg.Peek() >= '0') & (context.arg.Peek() <= '9') THEN context.arg.Int(w, FALSE) END;
 	context.arg.SkipWhitespace;

+ 1 - 1
source/WMScribble.Mod

@@ -21,7 +21,7 @@ TYPE
 		BEGIN
 			IF 0 IN keys THEN canvas.Line(lx, ly, x, y, WMGraphics.Blue, WMGraphics.ModeSrcOverDst);
 				Invalidate(
-					WMRectangles.MakeRect(Strings.Min(lx, x), Strings.Min(ly, y), Strings.Max(lx, x) + 1, Strings.Max(ly, y) + 1)
+					WMRectangles.MakeRect(MIN(lx, x), MIN(ly, y), MAX(lx, x) + 1, MAX(ly, y) + 1)
 				)
 			 END;
 			lx := x; ly := y

+ 10 - 10
source/WMScrollableComponents.Mod

@@ -52,8 +52,8 @@ TYPE
 				END;
 				c := GetNext(c);
 			END;
-			dx :=  Strings.Max(0, (rEnclosing.r-rEnclosing.l)-(rCopy.r-rCopy.l));
-			dy := Strings.Max(0, (rEnclosing.b-rEnclosing.t)-(rCopy.b-rCopy.t));
+			dx :=  MAX(0, (rEnclosing.r-rEnclosing.l)-(rCopy.r-rCopy.l));
+			dy := MAX(0, (rEnclosing.b-rEnclosing.t)-(rCopy.b-rCopy.t));
 			CheckLeftTop;
 			aligning := FALSE;
 			Release;
@@ -62,8 +62,8 @@ TYPE
 
 		PROCEDURE CheckLeftTop;
 		BEGIN
-			left := Strings.Min(left, dx);
-			top := Strings.Min(top, dy);
+			left := MIN(left, dx);
+			top := MIN(top, dy);
 		END CheckLeftTop;
 
 		PROCEDURE SetLeftTop(dxf, dyf: REAL);
@@ -218,11 +218,11 @@ TYPE
 					dx := tw- rw;
 					hScrollbar.visible.Set(TRUE);
 					IF rw > 0 THEN
-					nofLevels := Strings.Max(minNofLevels.Get(), nofLevelsPerPage.Get() * dx DIV rw);
+					nofLevels := MAX(minNofLevels.Get(), nofLevelsPerPage.Get() * dx DIV rw);
 					END;
 					hScrollbar.max.Set(nofLevels);
-					(* hScrollbar.pageSize.Set(Strings.Max(1, (rw * nofLevels) DIV dx)); *)
-					hScrollbar.pageSize.Set(Strings.Max(1, (rw * nofLevels) DIV th) + 1);
+					(* hScrollbar.pageSize.Set(MAX(1, (rw * nofLevels) DIV dx)); *)
+					hScrollbar.pageSize.Set(MAX(1, (rw * nofLevels) DIV th) + 1);
 					IF (sequencer # NIL) & sequencer.IsCallFromSequencer() THEN
 						hScrollbar.RecacheProperties; (* workaround because, InternalPropertyChanged is InUpdate *)
 					END;
@@ -237,11 +237,11 @@ TYPE
 					dy := th - rh;
 					vScrollbar.visible.Set(TRUE);
 					IF rh > 0 THEN
-						nofLevels := Strings.Max(minNofLevels.Get(), nofLevelsPerPage.Get() * dy DIV rh)
+						nofLevels := MAX(minNofLevels.Get(), nofLevelsPerPage.Get() * dy DIV rh)
 					END;
 					vScrollbar.max.Set(nofLevels);
-					(* vScrollbar.pageSize.Set(Strings.Max(1, (rh * nofLevels) DIV dy)); *)
-					vScrollbar.pageSize.Set(Strings.Max(1, (rh * nofLevels) DIV th) + 1);
+					(* vScrollbar.pageSize.Set(MAX(1, (rh * nofLevels) DIV dy)); *)
+					vScrollbar.pageSize.Set(MAX(1, (rh * nofLevels) DIV th) + 1);
 					vScrollbar.RecacheProperties; (* workaround because, InternalPropertyChanged is InUpdate *)
 				ELSE
 					dy := 0;

+ 2 - 2
source/WMSearchComponents.Mod

@@ -266,8 +266,8 @@ TYPE
 			searchString := "";
 			IF Texts.GetLastSelection(selectionText, from, to) THEN
 				selectionText.AcquireRead;
-				a := Strings.Min(from.GetPosition(), to.GetPosition());
-				b := Strings.Max(from.GetPosition(), to.GetPosition());
+				a := MIN(from.GetPosition(), to.GetPosition());
+				b := MAX(from.GetPosition(), to.GetPosition());
 				IF ((b - a) <= SearchStringMaxLen) THEN
 					TextUtilities.SubTextToStr(selectionText, a, b - a, searchString);
 				END;

+ 1 - 1
source/WMShapes.Mod

@@ -195,7 +195,7 @@ TYPE
 			IF (colorI # 0) THEN
 				rect := bounds.Get();
 				canvas.SetColor(colorI);
-				radius := Strings.Min((rect.r - rect.l) DIV 2, (rect.b - rect.t) DIV 2) - 1;
+				radius := MIN((rect.r - rect.l) DIV 2, (rect.b - rect.t) DIV 2) - 1;
 				WMGraphicUtilities.Circle(canvas, (rect.r - rect.l) DIV 2, (rect.b - rect.t) DIV 2, radius);
 			END;
 		END DrawBackground;

+ 1 - 1
source/WMSlideshow.Mod

@@ -551,7 +551,7 @@ TYPE  SlideshowNavigation = OBJECT(WMComponents.FormWindow);
 		END;
 		(* correct window width & height *)
 		manager := WMWindowManager.GetDefaultManager();
-		w := Strings.Max(w, 180);
+		w := MAX(w, 180);
 		manager.SetWindowSize(SELF, w, h);
 		Resized(w, h);
 		Invalidate( WMRectangles.MakeRect(0, 0, w, h) );

+ 4 - 4
source/WMStandardComponents.Mod

@@ -1747,12 +1747,12 @@ TYPE
 		BEGIN
 			width := bounds.GetWidth(); height := bounds.GetHeight();
 			tmin := min.Get(); tmax := max.Get();
-			ps := Strings.Min(tmax - tmin, pageSize.Get());
+			ps := MIN(tmax - tmin, pageSize.Get());
 			IF vertical.Get() THEN
 				IF tmax > tmin THEN
 					h := (height - 2 * width);
 					f := ps / (tmax - tmin);
-					ts := Strings.Min(h, Strings.Max(ENTIER(f * h), SELF.minTrackerSize.Get()));
+					ts := MIN(h, MAX(ENTIER(f * h), SELF.minTrackerSize.Get()));
 					tp := (pos.Get() - tmin) * (h - ts) DIV (tmax - tmin);
 				ELSE
 					ts := (height - 2 * width); tp := 0;
@@ -1766,7 +1766,7 @@ TYPE
 				IF tmax > tmin THEN
 					w := (width - 2 * height);
 					f := ps / (tmax - tmin);
-					ts := Strings.Min(w, Strings.Max(ENTIER(f * w), SELF.minTrackerSize.Get()));
+					ts := MIN(w, MAX(ENTIER(f * w), SELF.minTrackerSize.Get()));
 					tp := (pos.Get() - tmin) * (w - ts) DIV (tmax - tmin);
 				ELSE
 					ts := (width - 2 * height); tp := 0;
@@ -2255,7 +2255,7 @@ TYPE
 			IF aligning THEN EnableUpdate; Release; RETURN END;
 			aligning := TRUE;
 			tmin := min.Get(); tmax := max.Get();
-			ps := Strings.Min(tmax - tmin, pageSize.Get());
+			ps := MIN(tmax - tmin, pageSize.Get());
 			IF vertical.Get() THEN
 				IF tmax > tmin THEN
 					h := bounds.GetHeight();

+ 4 - 4
source/WMStringGrids.Mod

@@ -89,10 +89,10 @@ TYPE
 		VAR i : LONGINT; newRows : RowArray;
 		BEGIN
 			NEW(newRows, newSize);
-			FOR i := 0 TO Strings.Min(nofRows, newSize) - 1 DO
+			FOR i := 0 TO MIN(nofRows, newSize) - 1 DO
 				newRows[i] := rows[i]
 			END;
-			FOR i := Strings.Min(nofRows, newSize)  TO newSize - 1 DO
+			FOR i := MIN(nofRows, newSize)  TO newSize - 1 DO
 				NEW(newRows[i]);
 				AdjustRow(newRows[i])
 			END;
@@ -105,7 +105,7 @@ TYPE
 			IF row.cells = NIL THEN NEW(row.cells, nofCols) END;
 			IF LEN(row.cells) # nofCols THEN
 				NEW(newCells, nofCols);
-				FOR i := 0 TO Strings.Min(nofCols, LEN(row.cells)) - 1 DO
+				FOR i := 0 TO MIN(nofCols, LEN(row.cells)) - 1 DO
 					newCells[i] := row.cells[i]
 				END;
 				row.cells := newCells
@@ -170,7 +170,7 @@ TYPE
 			ASSERT(Objects.ActiveObject() = lockedBy, 3000);
 			IF (col >= 0) & (row >= 0) & (col < nofCols) & (row < nofRows) THEN
 				IF rows[row].cells[col] = NIL THEN NEW(rows[row].cells[col]) END;
-				length := Strings.Max(minBufferSize, Strings.Length(caption) + 1); (* 0X *)
+				length := MAX(minBufferSize, Strings.Length(caption) + 1); (* 0X *)
 				cell := rows[row].cells[col];
 				IF (cell.caption = NIL) OR ~(UseInternalBuffer IN cell.flags) OR (LEN(cell.caption) < length) THEN
 					NEW(cell.caption, length);

+ 1 - 1
source/WMTCPTracker.Mod

@@ -112,7 +112,7 @@ TYPE
 			FOR i := 0 TO 33 - 1 DO
 				GetTitleStr(i, str);
 				f.GetStringSize(str, dx, dy);
-				colWidth[i] := Strings.Max(dx + 4, minWidth);
+				colWidth[i] := MAX(dx + 4, minWidth);
 				grid.model.SetCellText(i, 0, Strings.NewString(str));
 				grid.model.SetTextAlign(i, 0, WMGraphics.AlignCenter);
 			END;

+ 15 - 15
source/WMTextStyleTool.Mod

@@ -248,8 +248,8 @@ TYPE
 				cStyle := data(Texts.CharacterStyle);
 				IF Texts.GetLastSelection(text, from, to) THEN
 				text.AcquireWrite;
-				a := Strings.Min(from.GetPosition(), to.GetPosition());
-				b := Strings.Max(from.GetPosition(), to.GetPosition());
+				a := MIN(from.GetPosition(), to.GetPosition());
+				b := MAX(from.GetPosition(), to.GetPosition());
 				text.SetCharacterStyle(a, b - a, cStyle);
 				text.ReleaseWrite
 				END
@@ -284,8 +284,8 @@ TYPE
 					cStyle := Texts.GetCharacterStyleByName("Highlight");
 				END;
 				text.AcquireWrite;
-				a := Strings.Min(from.GetPosition(), to.GetPosition());
-				b := Strings.Max(from.GetPosition(), to.GetPosition());
+				a := MIN(from.GetPosition(), to.GetPosition());
+				b := MAX(from.GetPosition(), to.GetPosition());
 				text.SetCharacterStyle(a, b - a, cStyle);
 				text.ReleaseWrite
 			END
@@ -302,8 +302,8 @@ TYPE
 				IF WMDialogs.QueryString("Enter Link", tempLink) = WMDialogs.ResOk THEN
 					link := Strings.NewString(tempLink);
 					text.AcquireWrite;
-					a := Strings.Min(from.GetPosition(), to.GetPosition());
-					b := Strings.Max(from.GetPosition(), to.GetPosition());
+					a := MIN(from.GetPosition(), to.GetPosition());
+					b := MAX(from.GetPosition(), to.GetPosition());
 					text.SetLink(a, b - a, link);
 					text.ReleaseWrite
 				END
@@ -321,7 +321,7 @@ TYPE
 				IF WMDialogs.QueryString("Enter Label", label) = WMDialogs.ResOk THEN
 					NEW(lp); lp.label := Strings.NewString(label);
 					text.AcquireWrite;
-					a := Strings.Min(from.GetPosition(), to.GetPosition());
+					a := MIN(from.GetPosition(), to.GetPosition());
 					text.InsertPiece(a, lp);
 					text.ReleaseWrite
 				END
@@ -460,8 +460,8 @@ TYPE
 		BEGIN
 			IF Texts.GetLastSelection(text, from, to) THEN
 				text.AcquireWrite;
-				a := Strings.Min(from.GetPosition(), to.GetPosition());
-				b := Strings.Max(from.GetPosition(), to.GetPosition());
+				a := MIN(from.GetPosition(), to.GetPosition());
+				b := MAX(from.GetPosition(), to.GetPosition());
 				NEW(utilreader, text);
 				utilreader.SetPosition(a);
 				utilreader.ReadCh(ch);
@@ -556,8 +556,8 @@ TYPE
 
 				(* Set the style *)
 				text.AcquireWrite;
-				a := Strings.Min(from.GetPosition(), to.GetPosition());
-				b := Strings.Max(from.GetPosition(), to.GetPosition());
+				a := MIN(from.GetPosition(), to.GetPosition());
+				b := MAX(from.GetPosition(), to.GetPosition());
 				text.SetCharacterStyle(a, b - a, cStyle);
 				text.ReleaseWrite
 			END
@@ -1924,8 +1924,8 @@ BEGIN
 	ASSERT(changeInfo # NIL);
 	IF Texts.GetLastSelection(text, from, to) THEN
 		text.AcquireWrite;
-		a := Strings.Min(from.GetPosition(), to.GetPosition());
-		b := Strings.Max(from.GetPosition(), to.GetPosition());
+		a := MIN(from.GetPosition(), to.GetPosition());
+		b := MAX(from.GetPosition(), to.GetPosition());
 
 		NEW(utilreader, text);
 		utilreader.SetPosition(a);
@@ -2036,8 +2036,8 @@ BEGIN
 		cStyle := Texts.GetCharacterStyleByName(cStyleStr);
 		IF cStyle # NIL THEN
 			text.AcquireWrite;
-			a := Strings.Min(from.GetPosition(), to.GetPosition());
-			b := Strings.Max(from.GetPosition(), to.GetPosition());
+			a := MIN(from.GetPosition(), to.GetPosition());
+			b := MAX(from.GetPosition(), to.GetPosition());
 			text.SetCharacterStyle(a, b - a, cStyle);
 			text.ReleaseWrite
 		END;

+ 4 - 4
source/WMTextTool.Mod

@@ -223,8 +223,8 @@ TYPE
 		BEGIN
 			IF Texts.GetLastSelection(text, from, to) THEN
 				text.AcquireWrite;
-				a := Strings.Min(from.GetPosition(), to.GetPosition());
-				b := Strings.Max(from.GetPosition(), to.GetPosition());
+				a := MIN(from.GetPosition(), to.GetPosition());
+				b := MAX(from.GetPosition(), to.GetPosition());
 				NEW(utilreader, text);
 				utilreader.SetPosition(a);
 				utilreader.ReadCh(ch);
@@ -596,8 +596,8 @@ BEGIN
 	ASSERT(changeInfo # NIL);
 	IF Texts.GetLastSelection(text, from, to) THEN
 		text.AcquireWrite;
-		a := Strings.Min(from.GetPosition(), to.GetPosition());
-		b := Strings.Max(from.GetPosition(), to.GetPosition());
+		a := MIN(from.GetPosition(), to.GetPosition());
+		b := MAX(from.GetPosition(), to.GetPosition());
 
 		NEW(utilreader, text);
 		utilreader.SetPosition(a);

+ 30 - 30
source/WMTextView.Mod

@@ -198,7 +198,7 @@ TYPE
 			WHILE pos < text.GetLength() DO
 				oldpos := pos;
 				LayoutLine(pos, lines[nofLines]); INC(textHeight, lines[nofLines].height);
-				textWidth := Strings.Max(textWidth, lines[nofLines].width);
+				textWidth := MAX(textWidth, lines[nofLines].width);
 				ASSERT(pos > oldpos);
 				IF TraceLayout IN Trace THEN KernelLog.String("Line from : "); KernelLog.Int(lines[nofLines].pos, 5); KernelLog.Ln END;
 				INC(nofLines); IF nofLines >= LEN(lines) THEN GrowLines END
@@ -231,7 +231,7 @@ TYPE
 					WHILE (pos < text.GetLength())   DO
 						DEC(textHeight, lines[l].height);
 						LayoutLine(pos, lines[l]);
-						textWidth := Strings.Max(textWidth, lines[l].width);
+						textWidth := MAX(textWidth, lines[l].width);
 						INC(textHeight, lines[nofLines].height);
 						INC(dl);
 						IF TraceLayout IN Trace THEN KernelLog.String("Line from : "); KernelLog.Int(lines[nofLines].pos, 5); KernelLog.Ln END;
@@ -246,7 +246,7 @@ TYPE
 					linesChanged := TRUE;
 					DEC(textHeight, (lines[l].height));
 					LayoutLine(pos, lines[l]);
-					textWidth := Strings.Max(textWidth, lines[l].width);
+					textWidth := MAX(textWidth, lines[l].width);
 					INC(textHeight, (lines[nofLines].height));
 					INC(dl);
 					IF TraceLayout IN Trace THEN KernelLog.String("Line from : "); KernelLog.Int(lines[nofLines].pos, 5); KernelLog.Ln END;
@@ -1235,12 +1235,12 @@ TYPE
 				IF (sender # NIL) & (sender IS Highlight) THEN
 					hl := sender(Highlight);
 					IF ((hl.oldFrom # hl.from.GetPosition()) & (hl.oldTo # hl.to.GetPosition())) OR (hl.oldColor # hl.color) THEN (* both changed *)
-						min := Strings.Min(
-										Strings.Min(hl.oldFrom, hl.from.GetPosition()),
-										Strings.Min(hl.oldTo, hl.to.GetPosition()));
-						max := Strings.Max(
-										Strings.Max(hl.oldFrom, hl.from.GetPosition()),
-										Strings.Max(hl.oldTo, hl.to.GetPosition()));
+						min := MIN(
+										MIN(hl.oldFrom, hl.from.GetPosition()),
+										MIN(hl.oldTo, hl.to.GetPosition()));
+						max := MAX(
+										MAX(hl.oldFrom, hl.from.GetPosition()),
+										MAX(hl.oldTo, hl.to.GetPosition()));
 						InvalidateRange(min, max)
 					ELSIF hl.oldTo # hl.to.GetPosition() THEN (* to changed *)
 						InvalidateRange(hl.oldTo, hl.to.GetPosition())
@@ -1393,7 +1393,7 @@ TYPE
 			l := layout.FindLineNrByPos(cursor.GetPosition());
 			IF (l < firstLineI) THEN
 				(* move the cursor down by 3 lines to get more context *)
-				l := Strings.Max(0, l - 3);
+				l := MAX(0, l - 3);
 				firstLine.Set(l);
 			ELSIF (l < layout.GetNofLines()) THEN
 				ty := bordersI.t; i := firstLineI;
@@ -1405,7 +1405,7 @@ TYPE
 				END;
 				ty := ty + layout.lines[i].height;
 				IF ty >= bounds.GetHeight() - bordersI.b THEN
-					l := Strings.Max(0, l - 3);
+					l := MAX(0, l - 3);
 					firstLine.Set(l)
 				END
 			END;
@@ -1615,7 +1615,7 @@ TYPE
 				CheckParagraphEnd(i, ypos);
 				INC(i);
 			END;
-			RETURN Strings.Max(i -1, 0)
+			RETURN MAX(i -1, 0)
 		END FindLineByY;
 
 		PROCEDURE ViewToTextPos*(x, y: LONGINT; VAR pos : LONGINT);
@@ -1627,10 +1627,10 @@ TYPE
 		BEGIN
 			text.AcquireRead;
 			pos := -1;
-			x := Strings.Max(0, Strings.Min(x, bounds.GetWidth()));
-			y := Strings.Max(0, Strings.Min(y, bounds.GetHeight()));
+			x := MAX(0, MIN(x, bounds.GetWidth()));
+			y := MAX(0, MIN(y, bounds.GetHeight()));
 
-			l := FindLineByY(firstLineI, Strings.Min(Strings.Max(y, bordersI.t), bounds.GetHeight() - bordersI.b));
+			l := FindLineByY(firstLineI, MIN(MAX(y, bordersI.t), bounds.GetHeight() - bordersI.b));
 
 			x := x - bordersI.l - x0 + leftShiftI;
 			IF x < 0 THEN x := 0 END;
@@ -1779,14 +1779,14 @@ TYPE
 				GetWidth(ch, dx);
 
 				IF (ch = Texts.ObjectChar) THEN
-					word := Strings.Max(word, dx);
+					word := MAX(word, dx);
 					cls := cls + dx;
 					cws := 0
 				ELSIF (ch = Texts.NewLineChar) THEN
-					line := Strings.Max(line, cls);
+					line := MAX(line, cls);
 					cls := 0
 				ELSIF (ch = 32) THEN
-					word := Strings.Max(word, cws);
+					word := MAX(word, cws);
 					cws := 0
 				ELSE
 					cws := cws + dx;
@@ -1794,8 +1794,8 @@ TYPE
 				END;
 
 			UNTIL utilreader.eot;
-			line := Strings.Max(line, cls);
-			word := Strings.Max(word, cws);
+			line := MAX(line, cls);
+			word := MAX(word, cws);
 			text.ReleaseRead;
 
 		END GetMinMaxWidth;
@@ -2268,8 +2268,8 @@ TYPE
 				INC(pos);
 				IF (stopPos < 0) OR (pos <= stopPos) THEN
 					IF (ch # Texts.NewLineChar) & (ch # 0) THEN
-						GetExtents(ch, dx, a, d); ascent := Strings.Max(ascent, a); descent := Strings.Max(descent, d);
-						IF ld = 0 THEN ld := ascent + descent; ELSE ld := Strings.Max(ld, ascent + descent); END; leading := Strings.Max(leading, ld);
+						GetExtents(ch, dx, a, d); ascent := MAX(ascent, a); descent := MAX(descent, d);
+						IF ld = 0 THEN ld := ascent + descent; ELSE ld := MAX(ld, ascent + descent); END; leading := MAX(leading, ld);
 						IF isMultiLineI & (wrapModeI # NoWrap) & (i > 0) & (x0 + x + dx > wrapwidth) THEN
 							eol := TRUE; DEC(pos); wrapPos := pos;
 							(* Go left for last space *)
@@ -3096,7 +3096,7 @@ TYPE
 			h := 0; w := 0;
 			FOR i := la TO lb DO
 				h := h + (layout.lines[i].height);
-				w := Strings.Max(w, layout.lines[i].width);
+				w := MAX(w, layout.lines[i].width);
 			END;
 			h := Limit(h, 20, 200);
 			w := Limit(w, 20, 400);
@@ -3350,7 +3350,7 @@ TYPE
 			IF cl > 0 THEN
 				DEC(cl);
 				lineStart := layout.GetLineStartPos(cl);
-				cPos := lineStart + Strings.Min(layout.GetLineLength(cl) - 1, lineEnter);
+				cPos := lineStart + MIN(layout.GetLineLength(cl) - 1, lineEnter);
 				cursor.SetPosition(cPos);
 				IF cl < firstLineI THEN firstLine.Set(cl) END
 			END;
@@ -3380,7 +3380,7 @@ TYPE
 			IF cl < layout.GetNofLines() - 1 THEN
 				INC(cl);
 				lineStart := layout.GetLineStartPos(cl);
-				cPos := lineStart + Strings.Min(layout.GetLineLength(cl) - 1, lineEnter);
+				cPos := lineStart + MIN(layout.GetLineLength(cl) - 1, lineEnter);
 
 				cursor.SetPosition(cPos);
 				IF cl > FindLineByY(firstLineI, bounds.GetHeight() - bordersI.b) THEN firstLine.Set(firstLineI + 1 ) END
@@ -3774,7 +3774,7 @@ TYPE
 			IF openFile THEN FindCommand(pos, start, end)
 			ELSE FindCommandRange(pos, start, end, nofLastSelections)
 			END;
-			bufSize := Strings.Max(Strings.Min((end - start) * 5 + 1 (* for UTF *), MaxCallParameterBuf), 1);
+			bufSize := MAX(MIN((end - start) * 5 + 1 (* for UTF *), MaxCallParameterBuf), 1);
 			NEW(s, bufSize);
 			paramSize := 0;
 			TextUtilities.SubTextToStrAt(text, start, end - start, paramSize, s^);
@@ -3831,8 +3831,8 @@ TYPE
 						IF Texts.GetLastSelection(selectionText, from, to) THEN
 							selectionOk := TRUE;
 							selectionText.AcquireRead;
-							a := Strings.Min(from.GetPosition(), to.GetPosition());
-							b := Strings.Max(from.GetPosition(), to.GetPosition());
+							a := MIN(from.GetPosition(), to.GetPosition());
+							b := MAX(from.GetPosition(), to.GetPosition());
 							INC(paramSize, b - a + 1);
 						END;
 					END;
@@ -3930,12 +3930,12 @@ TYPE
 			ASSERT(IsCallFromSequencer());
 			text.AcquireRead;
 			FindCommand(cursor.GetPosition(), start, end);
-			bufSize := Strings.Max(Strings.Min((end - start) * 5 + 1 (* for UTF *), 4096), 1);
+			bufSize := MAX(MIN((end - start) * 5 + 1 (* for UTF *), 4096), 1);
 			NEW(command, bufSize);
 			TextUtilities.SubTextToStr(text, start, end - start, command^);
 
 			FindCommandRange(cursor.GetPosition(), start, end, nofLastSelections);
-			bufSize := Strings.Max(Strings.Min((end - start) * 5 + 1 (* for UTF *), MaxCallParameterBuf), 1);
+			bufSize := MAX(MIN((end - start) * 5 + 1 (* for UTF *), MaxCallParameterBuf), 1);
 			NEW(s, bufSize);
 			TextUtilities.SubTextToStr(text, start, end - start, s^);
 			text.ReleaseRead;

+ 2 - 2
source/WMTrees.Mod

@@ -479,7 +479,7 @@ TYPE
 				INC(lines);
 				h := DefaultHeight; w := bounds.GetWidth();
 				IF measureNode # NIL THEN measureNode(x, w, h) END;
-				width := Strings.Max(width, w + level * indent);
+				width := MAX(width, w + level * indent);
 				INC(cury, h);
 				IF NodeExpanded IN x.state THEN
 					a := tree.GetChildren(x);
@@ -850,7 +850,7 @@ TYPE
 
 		PROCEDURE WheelMove*(dz: LONGINT); (** PROTECTED *)
 		BEGIN
-			SetFirstLine(Strings.Min(Strings.Max(firstLine + dz, 0), lines - 1), TRUE)
+			SetFirstLine(MIN(MAX(firstLine + dz, 0), lines - 1), TRUE)
 		END WheelMove;
 
 		PROCEDURE SelectNode*(node : TreeNode);

+ 1 - 1
source/WMUkrainianIME.Mod

@@ -126,7 +126,7 @@ BEGIN
 	IF Texts.GetLastSelection(selectionText, from, to) THEN
 		selectionText.AcquireRead;
 		NEW(r, selectionText);
-		r.SetPosition(Strings.Min(from.GetPosition(), to.GetPosition()));
+		r.SetPosition(MIN(from.GetPosition(), to.GetPosition()));
 		r.ReadCh(ucs);
 		selectionText.ReleaseRead;
 		KernelLog.String("InsertChar("); KernelLog.Hex(ucs, 0); KernelLog.String("H) (**)"); KernelLog.Ln;

+ 1 - 1
source/Windows.WMTCPTracker.Mod

@@ -112,7 +112,7 @@ TYPE
 			FOR i := 0 TO 33 - 1 DO
 				GetTitleStr(i, str);
 				f.GetStringSize(str, dx, dy);
-				colWidth[i] := Strings.Max(dx + 4, minWidth);
+				colWidth[i] := MAX(dx + 4, minWidth);
 				grid.model.SetCellText(i, 0, Strings.NewString(str));
 				grid.model.SetTextAlign(i, 0, WMGraphics.AlignCenter);
 			END;

+ 1 - 1
source/XML.Mod

@@ -1826,7 +1826,7 @@ BEGIN
 			END;
 		ELSIF (codeLength > 0) THEN
 			FlushEscapeBuffer;
-			len := Strings.Min(codeLength, stringLength - 1 - i);
+			len := MIN(codeLength, stringLength - 1 - i);
 			IF (len > 0) THEN
 				r.Bytes(string, i, len, actLen);
 				IF (actLen # len) THEN

+ 3 - 3
source/YMF754.Mod

@@ -793,7 +793,7 @@ TYPE
 				IF copySize < 0 THEN
 					copySize := playRecBuffSize - playRecBuffPos;
 				END;
-				copySize := Strings.Min(copySize, buffFirst.buff.len - buffFirstPos);
+				copySize := MIN(copySize, buffFirst.buff.len - buffFirstPos);
 				(* Copy *)
 				SYSTEM.MOVE(
 					ADDRESSOF(buffFirst.buff.data^) + buffFirstPos,
@@ -830,7 +830,7 @@ TYPE
 			playRecBuffPos := 0;
 			WHILE (buffFirst # NIL) & (playRecBuffPos < playRecBuffSize) DO
 				(* Calculate copy size *)
-				copySize := Strings.Min(buffFirst.buff.len, playRecBuffSize - playRecBuffPos);
+				copySize := MIN(buffFirst.buff.len, playRecBuffSize - playRecBuffPos);
 				(* Copy *)
 				SYSTEM.MOVE(
 					ADDRESSOF(buffFirst.buff.data^),
@@ -974,7 +974,7 @@ TYPE
 				IF copySize < 0 THEN
 					copySize := playRecBuffSize - playRecBuffPos;
 				END;
-				copySize := Strings.Min(copySize, buffFirst.buff.len - buffFirstPos);
+				copySize := MIN(copySize, buffFirst.buff.len - buffFirstPos);
 				(* Copy *)
 				SYSTEM.MOVE(
 					ADDRESSOF(playRecBuff^) + playRecBuffPos,