diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 364e5e74d..e64eac230 100644 --- a/Configuration/GlobalAssemblyInfo.cs +++ b/Configuration/GlobalAssemblyInfo.cs @@ -15,7 +15,7 @@ internal static class RevisionClass public const string Major = "3"; public const string Minor = "4"; public const string Build = "2"; - public const string Revision = "1978"; + public const string Revision = "1979"; public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; diff --git a/Configuration/Version.defs b/Configuration/Version.defs index bb8ff977f..1a9ed47fd 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=4 -%REVISION%=1978 %COREVERSION%=2 +%REVISION%=1979 +%MINOR%=4 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index f0284cd54..86bbba840 100644 Binary files a/Localization/DefaultLang.resources and b/Localization/DefaultLang.resources differ diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 84254dc63..bc265a836 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.4.2.1978' +!define VERSION '3.4.2.1979' diff --git a/TestSuite/CompilationSamples/DrawManField.pas b/TestSuite/CompilationSamples/DrawManField.pas index f3a698a0e..80e727e18 100644 --- a/TestSuite/CompilationSamples/DrawManField.pas +++ b/TestSuite/CompilationSamples/DrawManField.pas @@ -587,6 +587,8 @@ end; procedure buttonStartClick(o: Object; e: EventArgs); begin + if t=nil then + exit; if t.ThreadState = System.Threading.ThreadState.Suspended then begin DMField.StepFlag := False; @@ -604,6 +606,8 @@ end; procedure buttonStepClick(o: Object; e: EventArgs); begin + if t=nil then + exit; DMField.StepFlag := True; t.Resume; (GraphABCControl as Control).Focus; diff --git a/TestSuite/CompilationSamples/RobotField.pas b/TestSuite/CompilationSamples/RobotField.pas index 62460fcf5..b13931351 100644 --- a/TestSuite/CompilationSamples/RobotField.pas +++ b/TestSuite/CompilationSamples/RobotField.pas @@ -299,12 +299,12 @@ var Sz,Z,Dim: integer; begin Sz:=CellSize; Z:=max(Sz div 12,2); - if Sz>64 then Dim:=10 + {if Sz>64 then Dim:=10 else if Sz>56 then Dim:=9 else if Sz>48 then Dim:=8 else if Sz>40 then Dim:=8 else if Sz>34 then Dim:=7 - else if Sz>28 then Dim:=6 + else} if Sz>28 then Dim:=Round((Sz+20)/8) else if Sz>22 then Dim:=5 else if Sz>12 then Dim:=4 else Dim:=3; @@ -316,13 +316,21 @@ begin end; procedure TRobotField.DrawTag(x,y: integer); -var Sz,sz2: integer; +var sz2: integer; begin - Sz:=CellSize; - if Sz>80 then sz2:=Sz div 2 - 4 - else if Sz>52 then sz2:=Sz div 2 - 3 - else if Sz>12 then sz2:=Sz div 2 - 2 - else sz2:=Sz div 2 - 1; + var Sz:=CellSize; + var s2 := Sz div 2; + {if Sz>172 then + sz2:=S2 - 6 + else} if Sz>132 then + sz2:=S2 - 5 + else if Sz>92 then + sz2:=S2 - 4 + else if Sz>52 then + sz2:=S2 - 3 + else if Sz>12 then + sz2:=S2 - 2 + else sz2:=S2 - 1; if (RobotX=x) and (RobotY=y) then Brush.Color:=clLightGray @@ -417,10 +425,9 @@ begin end; procedure TRobotField.MoveRobot(x,y: integer); -var vx,vy: integer; begin - vx:=RobotX; - vy:=RobotY; + var vx:=RobotX; + var vy:=RobotY; RobotX:=x; RobotY:=y; DrawCell(vx,vy); @@ -716,6 +723,8 @@ procedure MainWindowClose := SaveIni; procedure buttonStartClick(o: Object; e: EventArgs); begin + if t=nil then + exit; if t.ThreadState = System.Threading.ThreadState.Suspended then begin robField.StepFlag := False; @@ -733,6 +742,8 @@ end; procedure buttonStepClick(o: Object; e: EventArgs); begin + if t=nil then + exit; robField.StepFlag := True; t.Resume; (GraphABCControl as Control).Focus; @@ -768,12 +779,11 @@ begin end; procedure CorrectWHLT; -var mw,mh: integer; begin if (RobField.DimX=0) or (RobField.DimY=0) then exit; - mw := (GraphABCControl.Width - 30) div RobField.DimX; - mh := (GraphABCControl.Height - 20) div RobField.DimY; + var mw := (GraphABCControl.Width - 30) div RobField.DimX; + var mh := (GraphABCControl.Height - 20) div RobField.DimY; RobField.CellSize := min(mw,mh); if RobField.CellSize mod 2 = 1 then RobField.CellSize := RobField.CellSize - 1; @@ -1106,6 +1116,7 @@ begin Brush.Color := MainForm.BackColor; FillRectangle(0,0,1280,1024); + Pen.RoundCap := True; LoadIni(settings); MainForm.Invoke(SetWindowBounds, new System.Drawing.Rectangle(settings.Left,settings.Top,settings.Width,settings.Height)); diff --git a/bin/Lib/DrawManField.pas b/bin/Lib/DrawManField.pas index f3a698a0e..80e727e18 100644 --- a/bin/Lib/DrawManField.pas +++ b/bin/Lib/DrawManField.pas @@ -587,6 +587,8 @@ end; procedure buttonStartClick(o: Object; e: EventArgs); begin + if t=nil then + exit; if t.ThreadState = System.Threading.ThreadState.Suspended then begin DMField.StepFlag := False; @@ -604,6 +606,8 @@ end; procedure buttonStepClick(o: Object; e: EventArgs); begin + if t=nil then + exit; DMField.StepFlag := True; t.Resume; (GraphABCControl as Control).Focus; diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 181f9ea54..a51de029e 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -2283,8 +2283,9 @@ const SEEKEOF_FOR_TEXT_WRITEOPENED = 'Функция SeekEof не может быть вызвана для текстового файла, открытого на запись!!SeekEof function can''t be called for file, opened on writing'; SEEKEOLN_FOR_TEXT_WRITEOPENED = 'Функция SeekEoln не может быть вызвана для текстового файла, открытого на запись!!SeekEoln function can''t be called for file, opened on writing'; BAD_TYPE_IN_RUNTIMESIZEOF = 'Bad Type in RunTimeSizeOf'; - PARAMETER_COUNT_MUST_BE_GREATER_0 = 'Параметр count должен быть > 0!!Parameter count must be > 0'; - PARAMETER_COUNT_MUST_BE_GREATER_1 = 'Параметр count должен быть > 1!!Parameter count must be > 1'; + PARAMETER_MUST_BE_GREATER_EQUAL_0 = 'Параметр должен быть >= 0!!Parameter must be >= 0'; + PARAMETER_MUST_BE_GREATER_0 = 'Параметр должен быть > 0!!Parameter must be > 0'; + PARAMETER_MUST_BE_GREATER_1 = 'Параметр должен быть > 1!!Parameter must be > 1'; PARAMETER_STEP_MUST_BE_NOT_EQUAL_0 = 'Параметр step не может быть равен 0!!The step parameter must be not equal to 0'; PARAMETER_STEP_MUST_BE_GREATER_0 = 'Параметр step должен быть > 0!!The step parameter must be not greater than 0'; PARAMETER_FROM_OUT_OF_RANGE = 'Параметр from за пределами диапазона!!The from parameter out of bounds'; @@ -4105,14 +4106,14 @@ end; function SeqGen(count: integer; first: T; next: T->T): sequence of T; begin if count < 1 then - raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_COUNT_MUST_BE_GREATER_0)); + raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_MUST_BE_GREATER_0)); Result := Iterate(first, next).Take(count); end; function SeqGen(count: integer; first, second: T; next: (T,T) ->T): sequence of T; begin if count < 1 then - raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_COUNT_MUST_BE_GREATER_0)); + raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_MUST_BE_GREATER_0)); Result := Iterate(first, second, next).Take(count); end; @@ -4129,7 +4130,7 @@ end; function ArrGen(count: integer; first: T; next: T->T): array of T; begin if count < 1 then - raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_COUNT_MUST_BE_GREATER_0)); + raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_MUST_BE_GREATER_0)); var a := new T[count]; a[0] := first; for var i := 1 to a.Length - 1 do @@ -4140,7 +4141,7 @@ end; function ArrGen(count: integer; first, second: T; next: (T,T) ->T): array of T; begin if count < 2 then - raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_COUNT_MUST_BE_GREATER_1)); + raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_MUST_BE_GREATER_1)); var a := new T[count]; a[0] := first; a[1] := second; @@ -8728,14 +8729,73 @@ end; /// Возвращает последние count элементов последовательности function TakeLast(Self: sequence of T; count: integer): sequence of T; extensionmethod; begin - Result := Self.Reverse.Take(count).Reverse; + if count < 0 then + raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_MUST_BE_GREATER_EQUAL_0)); + if Self is IList then + begin + var lst := Self as IList; + var ind := lst.Count - count; + if ind<0 then ind := 0; + for var i:=ind to lst.Count-1 do + yield lst[i]; + exit; + end; + + var buf := new List; + var p := 0; + + foreach var x in Self do + if buf.Count(Self: sequence of T; count: integer): sequence of T; extensionmethod; +begin + Result := Self.Reverse.Take(count).Reverse; +end;} + /// Возвращает последовательность без последних count элементов -function SkipLast(self: sequence of T; count: integer := 1): sequence of T; extensionmethod; +function SkipLast(Self: sequence of T; count: integer): sequence of T; extensionmethod; +begin + if count < 0 then + raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_MUST_BE_GREATER_EQUAL_0)); + if Self is IList then + begin + var lst := Self as IList; + for var i:=0 to lst.Count - count - 1 do + yield lst[i]; + exit; + end; + + var buf := new List(count); + var p := 0; + + foreach var x in Self do + if buf.Count(self: sequence of T; count: integer := 1): sequence of T; extensionmethod; begin Result := Self.Reverse.Skip(count).Reverse; -end; +end;} /// Декартово произведение последовательностей function Cartesian(Self: sequence of T; b: sequence of T1): sequence of (T, T1); extensionmethod; @@ -9302,7 +9362,7 @@ begin raise new ArgumentException(GetTranslation(PARAMETER_STEP_MUST_BE_NOT_EQUAL_0)); if count < 0 then - raise new ArgumentException(GetTranslation(PARAMETER_COUNT_MUST_BE_GREATER_0)); + raise new System.ArgumentOutOfRangeException('count', count, GetTranslation(PARAMETER_MUST_BE_GREATER_EQUAL_0)); if (from < 0) or (from > Len - 1) then raise new ArgumentException(GetTranslation(PARAMETER_FROM_OUT_OF_RANGE)); diff --git a/bin/Lib/RobotField.pas b/bin/Lib/RobotField.pas index 0fc56b44d..b13931351 100644 --- a/bin/Lib/RobotField.pas +++ b/bin/Lib/RobotField.pas @@ -723,6 +723,8 @@ procedure MainWindowClose := SaveIni; procedure buttonStartClick(o: Object; e: EventArgs); begin + if t=nil then + exit; if t.ThreadState = System.Threading.ThreadState.Suspended then begin robField.StepFlag := False; @@ -740,6 +742,8 @@ end; procedure buttonStepClick(o: Object; e: EventArgs); begin + if t=nil then + exit; robField.StepFlag := True; t.Resume; (GraphABCControl as Control).Focus;