diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs
index 7f0df5c53..4dce51d45 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 = "2";
public const string Build = "0";
- public const string Revision = "1336";
+ public const string Revision = "1337";
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 8388ab7fa..da6af5805 100644
--- a/Configuration/Version.defs
+++ b/Configuration/Version.defs
@@ -1,4 +1,4 @@
-%MINOR%=2
-%REVISION%=1336
%COREVERSION%=0
+%REVISION%=1337
+%MINOR%=2
%MAJOR%=3
diff --git a/PascalABCNET.axml b/PascalABCNET.axml
index b130b7cd3..148101910 100644
--- a/PascalABCNET.axml
+++ b/PascalABCNET.axml
@@ -1440,6 +1440,17 @@
+
+ \SyntaxTree\tree\TreeHelper.cs
+ public int FindIndex(syntax_tree_node node)
+
+ public int FindIndex ( syntax_tree_node node )
+ public partial class syntax_tree_node
+ namespace PascalABCCompiler . SyntaxTree
+
+
+
+
\ No newline at end of file
diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh
index b54c65faa..3605937bd 100644
--- a/ReleaseGenerators/PascalABCNET_version.nsh
+++ b/ReleaseGenerators/PascalABCNET_version.nsh
@@ -1 +1 @@
-!define VERSION '3.2.0.1336'
+!define VERSION '3.2.0.1337'
diff --git a/StandardSyntaxTreeConverter/StandOutExprWithLambdaInForeachSequenceConverter.cs b/StandardSyntaxTreeConverter/StandOutExprWithLambdaInForeachSequenceConverter.cs
index 79ffb61e3..6f814ae47 100644
--- a/StandardSyntaxTreeConverter/StandOutExprWithLambdaInForeachSequenceConverter.cs
+++ b/StandardSyntaxTreeConverter/StandOutExprWithLambdaInForeachSequenceConverter.cs
@@ -20,7 +20,7 @@ public class StandOutExprWithLambdaInForeachSequenceVisitor : BaseEnterExitVisit
return new ident("$GenContFE" + GenIdNum.ToString());
}
- public void ReplaceStatement(statement from, IEnumerable to)
+ public void ReplaceStatement(statement from, IEnumerable to, Desc d = Desc.DirectDescendants)
{
foreach (var x in to)
x.Parent = from.Parent;
@@ -34,7 +34,7 @@ public class StandOutExprWithLambdaInForeachSequenceVisitor : BaseEnterExitVisit
var l = new statement_list();
l.AddMany(to);
l.source_context = from.source_context;
- from.Parent.Replace(from, l);
+ from.Parent.Replace(from, l, d);
}
}
diff --git a/SyntaxTree/tree/TreeHelper.cs b/SyntaxTree/tree/TreeHelper.cs
index c0358dc63..20c6a705e 100644
--- a/SyntaxTree/tree/TreeHelper.cs
+++ b/SyntaxTree/tree/TreeHelper.cs
@@ -26,13 +26,22 @@ namespace PascalABCCompiler.SyntaxTree
PreOrder
}
+ public enum Desc
+ {
+ All,
+ DirectDescendants
+ }
+
public partial class syntax_tree_node
{
public syntax_tree_node Parent;
- public int FindIndex(syntax_tree_node node)
+ public int FindIndex(syntax_tree_node node, Desc d = Desc.All)
{
int ind = -1;
- for (var i = 0; i < subnodes_count; i++)
+
+ var count = d == Desc.All ? subnodes_count : subnodes_without_list_elements_count;
+
+ for (var i = 0; i < count; i++)
if (node == this[i])
{
ind = i;
@@ -43,9 +52,16 @@ namespace PascalABCCompiler.SyntaxTree
return ind;
}
- public void Replace(syntax_tree_node from, syntax_tree_node to) // есть риск, что типы не совпадут
+ /*public void Replace(syntax_tree_node from, syntax_tree_node to, Desc d = Desc.All) // есть риск, что типы не совпадут
{
- var ind = FindIndex(from);
+ var ind = FindIndex(from,d);
+ this[ind] = to;
+ }*/
+
+ // Безопасная версия Replace
+ public void Replace(T from, T1 to, Desc d = Desc.All) where T: syntax_tree_node where T1 : T
+ {
+ var ind = FindIndex(from,d);
this[ind] = to;
}
diff --git a/SyntaxTree/tree/tree.nin b/SyntaxTree/tree/tree.nin
index 60570af62..f412f807a 100644
Binary files a/SyntaxTree/tree/tree.nin and b/SyntaxTree/tree/tree.nin differ
diff --git a/TestSuite/CompilationSamples/DrawManField.pas b/TestSuite/CompilationSamples/DrawManField.pas
index 79ac0f2d0..594c8b947 100644
--- a/TestSuite/CompilationSamples/DrawManField.pas
+++ b/TestSuite/CompilationSamples/DrawManField.pas
@@ -44,6 +44,7 @@ type
procedure DrawFieldOnly;
procedure DrawXY;
public
+ dmwidth := 2;
// Добавил - МА
TaskName: string;
//
@@ -70,6 +71,8 @@ type
procedure MakerPenDown;
procedure MakerToPoint(x,y: integer);
procedure MakerOnVector(x,y: integer);
+
+ procedure SetDrawManWidth(w: integer);
// примитивы для выполнителя
procedure DrawDM;
@@ -217,16 +220,14 @@ begin
end;
procedure TDMField.DrawDMDrawing;
-var i: integer;
begin
- for i:=0 to DMColl.Count-1 do
+ for var i:=0 to DMColl.Count-1 do
DMLine(DMColl[i].p.x,DMColl[i].p.y,DMColl[i].p.x+DMColl[i].v.x,DMColl[i].p.y+DMColl[i].v.y,colorSolve);
end;
procedure TDMField.DrawDMMakerDrawing;
-var i: integer;
begin
- for i:=0 to DMMakerColl.Count-1 do
+ for var i:=0 to DMMakerColl.Count-1 do
DMLine(DMMakerColl[i].p.x,DMMakerColl[i].p.y,DMMakerColl[i].p.x+DMMakerColl[i].v.x,DMMakerColl[i].p.y+DMMakerColl[i].v.y,colorTask);
end;
@@ -243,17 +244,16 @@ begin
end;
procedure TDMField.DrawFieldOnly;
-var ix,iy,w,h: integer;
begin
- w := CellSize*DimX;
- h := CellSize*DimY;
+ var w := CellSize*DimX;
+ var h := CellSize*DimY;
Brush.Color := clWhite;
FillRectangle(X0,Y0,X0+ZazX1+w+1+ZazX2,Y0+ZazY1+h+1+ZazY2);
Pen.Width := 1;
Pen.Color := RGB(191,191,191);
- for ix:=0 to DimX do
+ for var ix:=0 to DimX do
Line(X0+ZazX1+ix*CellSize,Y0+ZazY1,X0+ZazX1+ix*CellSize,Y0+ZazY1+h);
- for iy:=0 to DimY do
+ for var iy:=0 to DimY do
Line(X0+ZazX1,Y0+ZazY1+iy*CellSize,X0+ZazX1+w,Y0+ZazY1+iy*CellSize);
Pen.Color := clGray;
if (orx>-DimX) and (orx<0) then
@@ -266,7 +266,7 @@ begin
end;
procedure TDMField.DrawXY;
-var x,y,ww: integer;
+var ww: integer;
s: string;
interval: integer;
bs: BrushStyleType;
@@ -283,7 +283,7 @@ begin
Brush.Style := bsClear;
Font.Name := 'MS Sans Serif';
Font.Size := 8;
- for x:=0 to DimX do
+ for var x:=0 to DimX do
if (x+orx) mod interval = 0 then
begin
s:=IntToStr(x+orx);
@@ -291,7 +291,7 @@ begin
// hh:=Canvas.TextHeight(s);
TextOut(X0+ZazX1+x*CellSize-ww div 2+1,Y0+ZazY1+DimY*CellSize+1+2,s);
end;
- for y:=0 to DimY do
+ for var y:=0 to DimY do
if (y+ory) mod interval = 0 then
begin
s:=IntToStr(y+ory);
@@ -306,6 +306,7 @@ end;
procedure TDMField.DMLine(x1,y1,x2,y2: integer; c: GraphABC.Color);
begin
+ Pen.Width := dmwidth;
Line(X0+ZazX1+(x1-orx)*CellSize,Y0+ZazY1+(DimY-y1+ory)*CellSize,X0+ZazX1+(x2-orx)*CellSize,Y0+ZazY1+(DimY-y2+ory)*CellSize,c);
end;
@@ -364,6 +365,11 @@ begin
MakerToPoint(MakerX+x,MakerY+y);
end;
+procedure TDMField.SetDrawManWidth(w: integer);
+begin
+ dmwidth := 2;
+end;
+
procedure TDMField.DrawDM;
var
ZZ: integer;
@@ -376,6 +382,7 @@ begin
r1 := r;
r1.Offset(X0+ZazX1+(DMX-orx)*CellSize-4+1,Y0+ZazY1+(DimY-DMY+ory)*CellSize-4+1);
DMPicture.CopyRect(r,GraphBufferBitmap,r1);
+ Pen.Width := 1;
DrawRectangle(X0+ZazX1+(DMX-orx)*CellSize-ZZ+1,Y0+ZazY1+(DimY+ory-DMY)*CellSize-ZZ+1,X0+ZazX1+(DMX-orx)*CellSize+ZZ,Y0+ZazY1+(DimY+ory-DMY)*CellSize+ZZ);
end;
diff --git a/TestSuite/CompilationSamples/Drawman.pas b/TestSuite/CompilationSamples/Drawman.pas
index 6b0f85b9d..c519ab475 100644
--- a/TestSuite/CompilationSamples/Drawman.pas
+++ b/TestSuite/CompilationSamples/Drawman.pas
@@ -1,4 +1,4 @@
-// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
+// Copyright (c) Ivan Bondarev, Stanislav Mihalkovich (for details please see \doc\copyright.txt)
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
///Исполнитель Чертежник предназначен для построения рисунков и чертежей на плоскости с координатами.
@@ -29,6 +29,9 @@ procedure Start;
/// Остановить Чертежника
procedure Stop;
+/// Установить ширину пера Чертежника
+procedure SetDrawmanWidth(w: integer);
+
///--
procedure __InitModule__;
///--
@@ -38,6 +41,11 @@ implementation
uses DMTaskMaker,DMZadan,DrawmanField;
+procedure SetDrawmanWidth(w: integer);
+begin
+ DMField.dmwidth := w
+end;
+
procedure Start;
begin
DMField.Start;
diff --git a/TestSuite/CompilationSamples/GraphABC.pas b/TestSuite/CompilationSamples/GraphABC.pas
index b83342d50..4f223219f 100644
--- a/TestSuite/CompilationSamples/GraphABC.pas
+++ b/TestSuite/CompilationSamples/GraphABC.pas
@@ -2904,7 +2904,10 @@ end;
procedure SetPenWidth(Width: integer);
begin
lock f do
+ begin
Pen.NETPen.Width := Width;
+ _ColorLinePen.Width := Width;
+ end;
end;
function PenWidth: integer;
diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas
index 8e9f96daf..2c5417217 100644
--- a/TestSuite/CompilationSamples/PABCSystem.pas
+++ b/TestSuite/CompilationSamples/PABCSystem.pas
@@ -8636,6 +8636,16 @@ begin
Result := Self;
end;
+function Rows(Self: array [,] of T): integer; extensionmethod;
+begin
+ Result := Self.GetLength(0);
+end;
+
+function Cols(Self: array [,] of T): integer; extensionmethod;
+begin
+ Result := Self.GetLength(1);
+end;
+
// -----------------------------------------------------
//>> Методы расширения типа array of T # Extension methods for array of T
// -----------------------------------------------------
diff --git a/bin/Lib/PABCRtl.dll b/bin/Lib/PABCRtl.dll
index 23b03baa1..0d51ac30c 100644
Binary files a/bin/Lib/PABCRtl.dll and b/bin/Lib/PABCRtl.dll differ
diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas
index 2c5417217..3d98df9cb 100644
--- a/bin/Lib/PABCSystem.pas
+++ b/bin/Lib/PABCSystem.pas
@@ -8646,6 +8646,24 @@ begin
Result := Self.GetLength(1);
end;
+function Row(Self: array [,] of T; k: integer): array of T; extensionmethod;
+begin
+ var n := Self.Cols();
+ var res := new T[n];
+ for var j:=0 to n-1 do
+ res[j] := Self[k,j];
+ Result := res;
+end;
+
+function Col(Self: array [,] of T; k: integer): array of T; extensionmethod;
+begin
+ var m := Self.Rows();
+ var res := new T[m];
+ for var i:=0 to m-1 do
+ res[i] := Self[i,k];
+ Result := res;
+end;
+
// -----------------------------------------------------
//>> Методы расширения типа array of T # Extension methods for array of T
// -----------------------------------------------------