This commit is contained in:
Бондарев Иван 2017-12-17 12:40:06 +01:00
parent 07097940a7
commit fb60f8884d
41 changed files with 535 additions and 53 deletions

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Äóãè è ñåêòîðû';
Window.Title := 'Дуги и секторы';
var (x,y) := (200,Window.Height/2);
Circle(x,y,5);
for var i:=1 to 18*2 do

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Öèôðîâûå ÷àñû';
Window.Title := 'Цифровые часы';
Font.Size := 180;
while True do
begin

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Всякая Курья Мурья';
Window.Title := 'Всякая Курья Мурья';
Pen.Width := 0.5;
Brush.Color := RGB(128,200,100);
Ellipse(100,100,30,20);
@ -23,14 +23,14 @@ begin
Font.Color := Colors.Blue;
Font.Name := 'Times New Roman';
Font.Style := FontStyle.BoldItalic;
TextOut(200,0,'Привет');
TextOut(200,0,'Привет');
Sleep(1000);
Window.Save('1.png');
Window.Title := 'Сохранили';
Window.Title := 'Сохранили';
Sleep(1000);
Window.Clear;
Window.Title := 'Очистили';
Window.Title := 'Очистили';
Sleep(1000);
Window.Load('1.png');
Window.Title := 'Загрузили';
Window.Title := 'Загрузили';
end.

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Ãðàôèêè ôóíêöèé';
Window.Title := 'Графики функций';
var ww := Window.Width / 2;
var hh := Window.Height / 2;
DrawGraph(x -> sin(4 * x) + cos(3 * x), -5, 5, 0, 0, ww, hh);

View file

@ -1,4 +1,4 @@
uses GraphWPF;
uses GraphWPF;
begin
Pen.Width := 1;

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Рисование эллипсов';
Window.Title := 'Рисование эллипсов';
Pen.Width := 1;
var n := 20000;
for var i:=1 to n do

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Простая анимация';
Window.Title := 'Простая анимация';
var x := 30;
Brush.Color := Colors.Beige;
Circle(x,50,20);

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Отражение шарика. Вещественное направление движения';
Window.Title := 'Отражение шарика. Вещественное направление движения';
Brush.Color := Colors.Beige;
var x := 400.0;
var y := 300.0;
@ -20,6 +20,6 @@ begin
dy := -dy;
Circle(x,y,20);
if Milliseconds>2000 then
Window.Title := 'Секунды: ' + (Milliseconds div 100)/10;
Window.Title := 'Секунды: ' + (Milliseconds div 100)/10;
end;
end.

View file

@ -1,4 +1,4 @@
uses GraphWPF;
uses GraphWPF;
function RandomReal(a,b: real): real := Random*(b-a)+a;
@ -31,7 +31,7 @@ type
end;
begin
Window.Title := 'Отражение шариков. Анимация на основе кадра';
Window.Title := 'Отражение шариков. Анимация на основе кадра';
var n := 1000;
var a := BallInfo.CreateRandomBallArray(n);

View file

@ -1,4 +1,4 @@
uses GraphWPF;
uses GraphWPF;
begin
OnMouseDown := (x,y,mb) -> if mb=1 then Circle(x,y,5);

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Рисование мышью';
Window.Title := 'Рисование мышью';
Pen.Color := Colors.Blue;
Pen.Width := 3;
OnMouseDown := (x,y,mb) -> MoveTo(x,y);

View file

@ -1,6 +1,6 @@
uses GraphWPF;
uses GraphWPF;
procedure ÂñåÒî÷êèÌíîãîóãîëüíèêà(x0,y0,r: real; n: integer);
procedure ВсеТочкиМногоугольника(x0,y0,r: real; n: integer);
begin
var q := Partition(0,2*Pi,n).Select(a->Pnt(x0 + r * Cos(a), y0 - r * Sin(a)));
q.Cartesian(q).ForEach(p->Line(p[0].x,p[0].y,p[1].x,p[1].y,RandomColor));
@ -8,5 +8,5 @@ end;
begin
Pen.Width := 0.5;
ÂñåÒî÷êèÌíîãîóãîëüíèêà(400,300,290,30)
ВсеТочкиМногоугольника(400,300,290,30)
end.

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Выравнивание шрифта';
Window.Title := 'Выравнивание шрифта';
Font.Size := 20;
var (x,y) := (200,200);
var (w,h) := (400,200);
@ -15,7 +15,7 @@ begin
DrawText(x,y,w,h,'RightTop',Alignment.RightTop);
DrawText(x,y,w,h,'RightCenter',Alignment.RightCenter);
DrawText(x,y,w,h,'RightBottom',Alignment.RightBottom);
// Выравнивание относительно точки
// Выравнивание относительно точки
TextOut(150,100,'PointRightBottom',Alignment.RightBottom);
TextOut(150,100,'PointRightTop',Alignment.RightTop);
TextOut(150,100,'PointLeftTop',Alignment.LeftTop);

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Выравнивание шрифта';
Window.Title := 'Выравнивание шрифта';
Font.Size := 20;
var sc := 40;
@ -19,7 +19,7 @@ begin
DrawText(x,y,w,h,'RightTop',Alignment.RightTop);
DrawText(x,y,w,h,'RightCenter',Alignment.RightCenter);
DrawText(x,y,w,h,'RightBottom',Alignment.RightBottom);
// Выравнивание относительно точки
// Выравнивание относительно точки
TextOut(-5,5,'PointRightBottom',Alignment.RightBottom);
TextOut(-5,5,'PointRightTop',Alignment.RightTop);
TextOut(-5,5,'PointLeftTop',Alignment.LeftTop);

View file

@ -1,6 +1,6 @@
uses GraphWPF;
uses GraphWPF;
procedure Ìíîãîóãîëüíèê(x0,y0,r: real; n: integer);
procedure Многоугольник(x0,y0,r: real; n: integer);
begin
var a := Pi / 2;
MoveTo(x0 + r * Cos(a), y0 - r * Sin(a));
@ -16,5 +16,5 @@ begin
var (x0,y0) := (400.0,300.0);
var r := 30.0;
for var n := 3 to 11 do
Ìíîãîóãîëüíèê(x0,y0,r+(n-3)*30,n)
Многоугольник(x0,y0,r+(n-3)*30,n)
end.

View file

@ -1,6 +1,6 @@
uses GraphWPF;
uses GraphWPF;
procedure Ñâåòîôîð(x,y,r: real);
procedure Светофор(x,y,r: real);
begin
Rectangle(x,y,4*r,10*r,Colors.LightGray);
x += 2*r;
@ -14,6 +14,6 @@ end;
begin
Pen.Width := 2;
Window.Title := 'Ñâåòîôîð';
Ñâåòîôîð(150,40,50);
Window.Title := 'Светофор';
Светофор(150,40,50);
end.

View file

@ -1,15 +1,15 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Ñèñòåìà êîîðäèíàò';
Window.Title := 'Система координат';
Font.Size := 20;
// SetMathematicCoords; // òàê òîæå ìîæíî
// SetMathematicCoords(-10,10); // òàê òîæå ìîæíî
// SetMathematicCoords; // так тоже можно
// SetMathematicCoords(-10,10); // так тоже можно
SetMathematicCoords(-10,10,-9.2);
DrawGrid;
Print('Âèäèìûå êîîðäèíàòû:',XMin,XMax,YMin,YMax);
Print('Видимые координаты:',XMin,XMax,YMin,YMax);
Polygon(Arr((-3,2),(2,1),(-2,-4)),ARGB(100,255,228,196));
TextOut(-3,2,'A(-3,2)',Alignment.RightBottom);

View file

@ -1,7 +1,7 @@
uses GraphWPF;
uses GraphWPF;
begin
Window.Title := 'Таблица умножения';
Window.Title := 'Таблица умножения';
Font.Size := 16;
var n := 9;
var w := 40;

View file

@ -1,4 +1,4 @@
Uses System,System.Net,System.Threading.Tasks;
Uses System,System.Net,System.Threading.Tasks;
begin
Parallel.Invoke (

View file

@ -0,0 +1,15 @@
uses GraphWPF;
begin
Window.Title := 'Дуги и секторы';
var (x,y) := (200,Window.Height/2);
Circle(x,y,5);
for var i:=1 to 18*2 do
Arc(x,y,5*i,0,10*i);
(x,y) := (600,Window.Height/2);
for var i:=1 to 12 do
begin
Brush.Color := RandomColor;
Sector(x,y,180,30*(i-1),30*i);
end;
end.

View file

@ -0,0 +1,12 @@
uses GraphWPF;
begin
Window.Title := 'Цифровые часы';
Font.Size := 180;
while True do
begin
DrawText(Window.ClientRect,System.DateTime.Now.ToLongTimeString,Colors.Red);
Sleep(1000);
Window.Clear;
end;
end.

View file

@ -0,0 +1,36 @@
uses GraphWPF;
begin
Window.Title := 'Всякая Курья Мурья';
Pen.Width := 0.5;
Brush.Color := RGB(128,200,100);
Ellipse(100,100,30,20);
Brush.Color := RandomColor;
Circle(170,100,20);
Brush.Color := RandomColor;
Rectangle(220,80,70,50);
Line(220,80,220+70,80+50);
//DrawImage(200,140,'cofe.jpg');
Brush.Color := RGB(200,200,255);
Polygon(Arr(Pnt(20,20),Pnt(20,120),Pnt(120,20)));
Brush.Color := Colors.Black;
for var i:=0 to 400 do
Rectangle(1+2*i,2,0,0);
Font.Size := 30;
Font.Color := Colors.Red;
TextOut(0,0,'Hello');
Font.Size := 40;
Font.Color := Colors.Blue;
Font.Name := 'Times New Roman';
Font.Style := FontStyle.BoldItalic;
TextOut(200,0,'Привет');
Sleep(1000);
Window.Save('1.png');
Window.Title := 'Сохранили';
Sleep(1000);
Window.Clear;
Window.Title := 'Очистили';
Sleep(1000);
Window.Load('1.png');
Window.Title := 'Загрузили';
end.

View file

@ -0,0 +1,11 @@
uses GraphWPF;
begin
Window.Title := 'Графики функций';
var ww := Window.Width / 2;
var hh := Window.Height / 2;
DrawGraph(x -> sin(4 * x) + cos(3 * x), -5, 5, 0, 0, ww, hh);
DrawGraph(x -> x * x, -5, 5, ww - 1, 0, ww, hh);
DrawGraph(x -> exp(x), -5, 5, 0, hh-1, ww, hh);
DrawGraph(x -> x*cos(2*x-1), -5, 5, ww - 1, hh-1, ww, hh);
end.

View file

@ -0,0 +1,7 @@
uses GraphWPF;
begin
Pen.Width := 1;
Rectangle(0,0,Window.Width-1,Window.Height-1);
Ellipse((Window.Width-1)/2,(Window.Height-1)/2,(Window.Width-1)/2,(Window.Height-1)/2);
end.

View file

@ -0,0 +1,14 @@
uses GraphWPF;
begin
Window.Title := 'Рисование эллипсов';
Pen.Width := 1;
var n := 20000;
for var i:=1 to n do
begin
if i mod 10000 = 0 then
Println(i,MillisecondsDelta);
Brush.Color := RandomColor;
Ellipse(Random(800),Random(600),Random(20),Random(20));
end;
end.

View file

@ -0,0 +1,8 @@
Uses System,System.Net,System.Threading.Tasks;
begin
Parallel.Invoke (
procedure -> begin (new WebClient()).DownloadFile ('http://yandex.ru', 'yandex.html') end,
procedure -> begin (new WebClient()).DownloadFile ('http://pascalabc.net', 'pabc.html') end
);
end.

View file

@ -0,0 +1,46 @@
uses
System, System.Net, System.Threading.Tasks;
type
Int = class
N: int64;
constructor(NN: int64);
begin
N := NN;
end;
function IsPrime: boolean;
begin
Result := True;
for var i: int64 := 2 to round(sqrt(N)) do
if N mod i = 0 then
begin
Result := False;
exit;
end;
end;
end;
type
BTask = Task<boolean>;
begin
var ss: array of int64 := (1265713689122381, 1265713689122461, 1265713689142451, 1265713689542501); // Все числа - простые
var tb := new BTask[4];
// Запуск 4 потоков из пула потоков
// У каждого tb[i] свой Result!
for var i := 0 to ss.Length - 1 do
tb[i] := Task.Factory.StartNew((new Int(ss[i])).IsPrime);
// Если поток не закончился, то обращение к tb[i].Result приостанавливает основную программу
for var i := 0 to tb.Length - 1 do
writeln(tb[i].Result);
// В эту точку мы попадем только после окончания всех четырех потоков
writeln(Milliseconds);
// Последовательное выполнение
var t := Milliseconds;
for var i := 0 to ss.Length - 1 do
writeln((new Int(ss[i])).IsPrime);
writeln(Milliseconds - t);
end.

View file

@ -0,0 +1,57 @@
uses
System, System.Net, System.Threading.Tasks, System.Collections.Generic;
type
ListSimple = class
l := new List<int64>();
procedure AddSimple(N: int64);
begin
var Result := True;
for var i: int64 := 2 to round(sqrt(N)) do
if N mod i = 0 then
begin
Result := False;
break;
end;
// lock не позволяет нескольким потокам одновременно выполнять эту секцию.
// Это обязательно, иначе если несколько потоков одновременно будут пытаться добавить значение в список, список может оказаться испорченным
// Секция, охраняемая lock, называется критической
lock l do
if Result then
l.Add(N);
end;
end;
var hh := 1000;
begin
var ls := new ListSimple;
var ii: int64 := 1265713689181;
Parallel.For(ii,ii+hh,ls.AddSimple);
writeln(ls.l.Count);
// ls.l := ls.l.OrderBy(x->x).ToList(); - это можно включить для проверки того, что в обоих списках - одинаковые простые числа
for var i:=0 to ls.l.Count-1 do
write(ls.l[i],' ');
// Надо обратить внимание, что выводится неупорядоченная последовательность простых чисел !
writeln;
writeln('Время выполнения = ',Milliseconds);
// То же, но непараллельно
var ls1 := new ListSimple;
var t := Milliseconds;
for var i:=ii to ii+hh-1 do
ls1.AddSimple(i);
writeln(ls1.l.Count);
for var i:=0 to ls1.l.Count-1 do
write(ls1.l[i],' ');
writeln;
writeln('Время выполнения = ',Milliseconds-t);
// Проверка того, что списки простых как множества совпадают
writeln('Количество элементов в разности множеств = ',ls.l.Except(ls1.l).Count());
end.

View file

@ -0,0 +1,16 @@
uses GraphWPF;
begin
Window.Title := 'Простая анимация';
var x := 30;
Brush.Color := Colors.Beige;
Circle(x,50,20);
loop 600 do
begin
Sleep(10);
Window.Clear;
x += 1;
Circle(x,50,20);
Window.Title := '' + (Milliseconds div 100)/10;
end;
end.

View file

@ -0,0 +1,25 @@
uses GraphWPF;
begin
Window.Title := 'Отражение шарика. Вещественное направление движения';
Brush.Color := Colors.Beige;
var x := 400.0;
var y := 300.0;
var dx := 2.1;
var dy := -1.2;
Circle(x,y,20);
while True do
begin
Sleep(10);
Window.Clear;
x += dx;
y += dy;
if not x.Between(0,Window.Width) then
dx := -dx;
if not y.Between(0,Window.Height) then
dy := -dy;
Circle(x,y,20);
if Milliseconds>2000 then
Window.Title := 'Секунды: ' + (Milliseconds div 100)/10;
end;
end.

View file

@ -0,0 +1,45 @@
uses GraphWPF;
function RandomReal(a,b: real): real := Random*(b-a)+a;
type
BallInfo = auto class
x,y,r,dx,dy: real;
c: Color;
procedure Move := (x,y) := (x+dx,y+dy);
procedure Draw := FillCircle(x,y,r,c);
procedure CheckDirection;
begin
if not x.Between(r,Window.Width-r) then
dx := -dx;
if not y.Between(r,Window.Height-r) then
dy := -dy;
end;
procedure Step;
begin
Move;
CheckDirection;
Draw;
end;
class function CreateRandomBallArray(n: integer): array of BallInfo;
begin
var rr := 20;
Result := ArrGen(n,i->new BallInfo(RandomReal(rr,Window.Width-rr),
RandomReal(rr,Window.Height-rr),RandomReal(5,15),
RandomReal(-3,3),RandomReal(-3,3),RandomColor));
end;
end;
begin
Window.Title := 'Отражение шариков. Анимация на основе кадра';
var n := 1000;
var a := BallInfo.CreateRandomBallArray(n);
BeginFrameBasedAnimation(()->
foreach var ball in a do
ball.Step
);
//BeginFrameBasedAnimation(()->a.ForEach(ball->ball.Step));
end.

View file

@ -0,0 +1,6 @@
uses GraphWPF;
begin
OnMouseDown := (x,y,mb) -> if mb=1 then Circle(x,y,5);
OnKeyDown := k -> Print(k);
end.

View file

@ -0,0 +1,10 @@
uses GraphWPF;
begin
Window.Title := 'Рисование мышью';
Pen.Color := Colors.Blue;
Pen.Width := 3;
OnMouseDown := (x,y,mb) -> MoveTo(x,y);
OnMouseMove := (x,y,mb) -> if mb=1 then LineTo(x,y);
OnKeyDown := k -> if k = Key.Space then Window.Save('a.png');
end.

View file

@ -0,0 +1,12 @@
uses GraphWPF;
procedure ВсеТочкиМногоугольника(x0,y0,r: real; n: integer);
begin
var q := Partition(0,2*Pi,n).Select(a->Pnt(x0 + r * Cos(a), y0 - r * Sin(a)));
q.Cartesian(q).ForEach(p->Line(p[0].x,p[0].y,p[1].x,p[1].y,RandomColor));
end;
begin
Pen.Width := 0.5;
ВсеТочкиМногоугольника(400,300,290,30)
end.

View file

@ -0,0 +1,30 @@
uses GraphWPF;
begin
Window.Title := 'Выравнивание шрифта';
Font.Size := 20;
var (x,y) := (200,200);
var (w,h) := (400,200);
DrawRectangle(x,y,w,h);
DrawText(x,y,w,h,'LeftTop',Alignment.LeftTop);
DrawText(x,y,w,h,'LeftCenter',Alignment.LeftCenter);
DrawText(x,y,w,h,'LeftBottom',Alignment.LeftBottom);
DrawText(x,y,w,h,'CenterTop',Alignment.CenterTop);
DrawText(x,y,w,h,'Center');
DrawText(x,y,w,h,'CenterBottom',Alignment.CenterBottom);
DrawText(x,y,w,h,'RightTop',Alignment.RightTop);
DrawText(x,y,w,h,'RightCenter',Alignment.RightCenter);
DrawText(x,y,w,h,'RightBottom',Alignment.RightBottom);
// Выравнивание относительно точки
TextOut(150,100,'PointRightBottom',Alignment.RightBottom);
TextOut(150,100,'PointRightTop',Alignment.RightTop);
TextOut(150,100,'PointLeftTop',Alignment.LeftTop);
TextOut(150,100,'PointLeftBottom',Alignment.LeftBottom);
FillCircle(150,100,5,Colors.Red);
TextOut(600,100,'PointCenterTop',Alignment.CenterTop);
TextOut(600,100,'PointCenterBottom',Alignment.CenterBottom);
FillCircle(600,100,5,Colors.Red);
TextOut(400,500,'PointLeftCenter',Alignment.LeftCenter);
TextOut(400,500,'PointRightCenter',Alignment.RightCenter);
FillCircle(400,500,5,Colors.Red);
end.

View file

@ -0,0 +1,34 @@
uses GraphWPF;
begin
Window.Title := 'Выравнивание шрифта';
Font.Size := 20;
var sc := 40;
SetMathematicCoords;
var (x,y) := (-5,-2);
var (w,h) := (10,4);
DrawRectangle(x,y,w,h);
DrawText(x,y,w,h,'LeftTop',Alignment.LeftTop);
DrawText(x,y,w,h,'LeftCenter',Alignment.LeftCenter);
DrawText(x,y,w,h,'LeftBottom',Alignment.LeftBottom);
DrawText(x,y,w,h,'CenterTop',Alignment.CenterTop);
DrawText(x,y,w,h,'Center');
DrawText(x,y,w,h,'CenterBottom',Alignment.CenterBottom);
DrawText(x,y,w,h,'RightTop',Alignment.RightTop);
DrawText(x,y,w,h,'RightCenter',Alignment.RightCenter);
DrawText(x,y,w,h,'RightBottom',Alignment.RightBottom);
// Выравнивание относительно точки
TextOut(-5,5,'PointRightBottom',Alignment.RightBottom);
TextOut(-5,5,'PointRightTop',Alignment.RightTop);
TextOut(-5,5,'PointLeftTop',Alignment.LeftTop);
TextOut(-5,5,'PointLeftBottom',Alignment.LeftBottom);
FillCircle(-5,5,0.1,Colors.Red);
TextOut(5,5,'PointCenterTop',Alignment.CenterTop);
TextOut(5,5,'PointCenterBottom',Alignment.CenterBottom);
FillCircle(5,5,0.1,Colors.Red);
TextOut(5,-5,'PointLeftCenter',Alignment.LeftCenter);
TextOut(5,-5,'PointRightCenter',Alignment.RightCenter);
FillCircle(5,-5,0.1,Colors.Red);
end.

View file

@ -0,0 +1,20 @@
uses GraphWPF;
procedure Многоугольник(x0,y0,r: real; n: integer);
begin
var a := Pi / 2;
MoveTo(x0 + r * Cos(a), y0 - r * Sin(a));
loop n do
begin
a += 2 * Pi / n;
//FillCircle(x0 + r * Cos(a), y0 - r * Sin(a),3,Colors.Black);
LineTo(x0 + r * Cos(a), y0 - r * Sin(a));
end;
end;
begin
var (x0,y0) := (400.0,300.0);
var r := 30.0;
for var n := 3 to 11 do
Многоугольник(x0,y0,r+(n-3)*30,n)
end.

View file

@ -0,0 +1,19 @@
uses GraphWPF;
procedure Светофор(x,y,r: real);
begin
Rectangle(x,y,4*r,10*r,Colors.LightGray);
x += 2*r;
y += 2*r;
var dy := 3*r;
Circle(x,y,r,Colors.Red);
Circle(x,y + dy,r,Colors.Yellow);
Circle(x,y + 2*dy,r,Colors.Green);
end;
begin
Pen.Width := 2;
Window.Title := 'Светофор';
Светофор(150,40,50);
end.

View file

@ -0,0 +1,18 @@
uses GraphWPF;
begin
Window.Title := 'Система координат';
Font.Size := 20;
// SetMathematicCoords; // так тоже можно
// SetMathematicCoords(-10,10); // так тоже можно
SetMathematicCoords(-10,10,-9.2);
DrawGrid;
Print('Видимые координаты:',XMin,XMax,YMin,YMax);
Polygon(Arr((-3,2),(2,1),(-2,-4)),ARGB(100,255,228,196));
TextOut(-3,2,'A(-3,2)',Alignment.RightBottom);
TextOut(2,1,'B(2,1)',Alignment.LeftBottom);
TextOut(-2,-4,'C(-2,-4)',Alignment.CenterTop);
end.

View file

@ -0,0 +1,16 @@
uses GraphWPF;
begin
Window.Title := 'Таблица умножения';
Font.Size := 16;
var n := 9;
var w := 40;
var (x0,y0) := (50,50);
for var i:=0 to n-1 do
for var j:=0 to n-1 do
begin
var (xx,yy) := (x0+i*w,y0+j*w);
Rectangle(xx,yy,w,w);
DrawText(xx,yy,w,w,(i+1)*(j+1));
end;
end.

View file

@ -5496,6 +5496,7 @@ namespace PascalABCCompiler.TreeConverter
{
exprCounter++;
}
List<expression_node> params_exprs = new List<expression_node>();
foreach (SyntaxTree.expression en in _method_call.parameters.expressions)
{
if (!(en is SyntaxTree.function_lambda_definition))
@ -5506,13 +5507,37 @@ namespace PascalABCCompiler.TreeConverter
else
{
var enLambda = (SyntaxTree.function_lambda_definition)en;
LambdaHelper.InferTypesFromVarStmt(ffn.parameters[exprCounter].type, enLambda, this);
enLambda.lambda_visit_mode = LambdaVisitMode.VisitForAdvancedMethodCallProcessing;
exprs[exprCounter] = convert_strong(en);
enLambda.lambda_visit_mode = LambdaVisitMode.VisitForInitialMethodCallProcessing;
if (ffn.parameters[Math.Min(exprCounter, ffn.parameters.Count - 1)].is_params)
{
LambdaHelper.InferTypesFromVarStmt(ffn.parameters[Math.Min(exprCounter, ffn.parameters.Count - 1)].type.element_type, enLambda, this);
enLambda.lambda_visit_mode = LambdaVisitMode.VisitForAdvancedMethodCallProcessing;
if (exprCounter <= ffn.parameters.Count - 1)
exprs[exprCounter] = convert_strong(en);
else
exprs.AddElement(convert_strong(en));
enLambda.lambda_visit_mode = LambdaVisitMode.VisitForInitialMethodCallProcessing;
}
else
{
LambdaHelper.InferTypesFromVarStmt(ffn.parameters[exprCounter].type, enLambda, this);
enLambda.lambda_visit_mode = LambdaVisitMode.VisitForAdvancedMethodCallProcessing;
exprs[exprCounter] = convert_strong(en);
enLambda.lambda_visit_mode = LambdaVisitMode.VisitForInitialMethodCallProcessing;
}
exprCounter++;
}
}
/*if (params_exprs.Count > 0)
{
location loc = get_location(_method_call);
typeof_operator to = new typeof_operator(params_exprs[0].type, loc);
expression_node retv = convertion_data_and_alghoritms.create_simple_function_call(SystemLibrary.SystemLibInitializer.NewArrayProcedureDecl, loc, to, new int_const_node(params_exprs.Count, loc));
base_function_call cnfc = retv as base_function_call;
foreach (expression_node e in params_exprs)
cnfc.parameters.AddElement(e);
exprs[exprCounter] = cnfc;
}*/
}
catch (SeveralFunctionsCanBeCalled sf)
{