From 674ca7d5cf95249be719bb4392fccffa7648c4a6 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Fri, 15 Apr 2022 21:20:19 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=20School=20=D1=83=D0=B1=D1=80?= =?UTF-8?q?=D0=B0=D0=BD=20PrintType=20-=20=D1=82.=D0=BA.=20=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D1=8C=20TypeName=20=D1=81=D1=82=D0=B0=D0=BD=D0=B4=D0=B0?= =?UTF-8?q?=D1=80=D1=82=D0=BD=D1=8B=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 4 +- Release/pabcversion.txt | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/CompilationSamples/GraphWPF.pas | 3 ++ TestSuite/CompilationSamples/PABCSystem.pas | 1 + TestSuite/CompilationSamples/School.pas | 54 +-------------------- bin/Lib/PABCSystem.pas | 1 + bin/Lib/School.pas | 54 +-------------------- 9 files changed, 12 insertions(+), 111 deletions(-) diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 318844ffb..ae8365fee 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 = "8"; public const string Build = "3"; - public const string Revision = "3101"; + public const string Revision = "3104"; 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 a7581db29..d30613a18 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=8 -%REVISION%=3101 %COREVERSION%=3 +%REVISION%=3104 +%MINOR%=8 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index bc17425ba..38ae34dbe 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.8.3.3101 +3.8.3.3104 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index ed78195d9..bae161b96 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.8.3.3101' +!define VERSION '3.8.3.3104' diff --git a/TestSuite/CompilationSamples/GraphWPF.pas b/TestSuite/CompilationSamples/GraphWPF.pas index fe3e9a50b..ed6768bd0 100644 --- a/TestSuite/CompilationSamples/GraphWPF.pas +++ b/TestSuite/CompilationSamples/GraphWPF.pas @@ -354,6 +354,8 @@ procedure DrawSector(x, y, r, angle1, angle2: real); procedure FillSector(x, y, r, angle1, angle2: real); /// Рисует сектор окружности с центром в точке (x,y) и радиусом r, заключенный между двумя лучами, образующими углы angle1 и angle2 с осью OX, цветом c procedure Sector(x, y, r, angle1, angle2: real; c: Color); +/// Рисует сектор окружности с центром в точке (x,y) и радиусом r, заключенный между двумя лучами, образующими углы angle1 и angle2 с осью OX, цветом c +procedure Pie(x, y, r, angle1, angle2: real; c: Color); /// Рисует контур сектора окружности с центром в точке (x,y) и радиусом r, заключенного между двумя лучами, образующими углы angle1 и angle2 с осью OX, цветом c procedure DrawSector(x, y, r, angle1, angle2: real; c: Color); /// Рисует внутренность сектора окружности с центром в точке (x,y) и радиусом r, заключенного между двумя лучами, образующими углы angle1 и angle2 с осью OX, цветом c @@ -1391,6 +1393,7 @@ procedure Pie(x, y, r, angle1, angle2: real) := InvokeVisual(SectorP,x, y, r, an procedure DrawSector(x, y, r, angle1, angle2: real) := InvokeVisual(DrawSectorP,x, y, r, angle1, angle2); procedure FillSector(x, y, r, angle1, angle2: real) := InvokeVisual(FillSectorP,x, y, r, angle1, angle2); procedure Sector(x, y, r, angle1, angle2: real; c: GColor) := InvokeVisual(SectorPC,x, y, r, angle1, angle2, c); +procedure Pie(x, y, r, angle1, angle2: real; c: GColor) := InvokeVisual(SectorPC,x, y, r, angle1, angle2, c); procedure DrawSector(x, y, r, angle1, angle2: real; c: GColor) := InvokeVisual(DrawSectorPC,x, y, r, angle1, angle2, c); procedure FillSector(x, y, r, angle1, angle2: real; c: GColor) := InvokeVisual(FillSectorPC,x, y, r, angle1, angle2, c); diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index c7978f9b3..b78645fad 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -13169,6 +13169,7 @@ begin TypeCode.SByte: Result := 'shortint'; TypeCode.Double: Result := 'real'; TypeCode.Single: Result := 'single'; + else Result := t.ToString; end else if t = typeof(string) then Result := 'string' diff --git a/TestSuite/CompilationSamples/School.pas b/TestSuite/CompilationSamples/School.pas index 50093872a..aeec9516b 100644 --- a/TestSuite/CompilationSamples/School.pas +++ b/TestSuite/CompilationSamples/School.pas @@ -145,12 +145,6 @@ function ReplaceMany(s: string; source, target: IList): string; /// В строке s меняет местами подстроки ss1 и ss2 procedure SwapSubstr(var s: string; ss1, ss2: string); -/// Выводит тип переменной или выражения -procedure PrintType(o: Object); - -/// Выводит тип переменной или выражения, затем переходит к новой строке вывода -procedure PrintlnType(o: Object); - implementation type @@ -968,53 +962,7 @@ end; /// В строке s меняет местами подстроки ss1 и ss2 procedure SwapSubstr(var Self: string; ss1, ss2: string); -extensionmethod := SwapSubstr(Self, ss1, ss2); - -function InternalConvertTupleString(s: string): string; -begin - var tt := '([\w.`<>\[\],()]+?)'; - s := Regex.Replace(s,$'System.Tuple`2\[{tt},{tt}\]','($1,$2)'); - s := Regex.Replace(s,$'System.Tuple`3\[{tt},{tt},{tt}\]','($1,$2,$3)'); - s := Regex.Replace(s,$'System.Tuple`4\[{tt},{tt},{tt},{tt}\]','($1,$2,$3,$4)'); - s := Regex.Replace(s,$'System.Tuple`5\[{tt},{tt},{tt},{tt},{tt}\]','($1,$2,$3,$4,$5)'); - s := Regex.Replace(s,$'System.Tuple`6\[{tt},{tt},{tt},{tt},{tt},{tt}\]','($1,$2,$3,$4,$5,$6)'); - Result := Regex.Replace(s,$'System.Tuple`7\[{tt},{tt},{tt},{tt},{tt},{tt},{tt}\]','($1,$2,$3,$4,$5,$6,$7)'); -end; - -function InternalConvertTypeString(s: string): string; -begin - s := s.Replace('System.Int32','integer'); - s := s.Replace('System.Int64','int64'); - s := s.Replace('System.Double','real'); - s := s.Replace('System.String','string'); - s := s.Replace('System.Char','char'); - s := s.Replace('System.Numerics.BigInteger','BigInteger'); - var tt := '([\w.`<>\[\],()]+?)'; - s := Regex.Replace(s,$'{tt}\[\]\[\]','array of array of $1'); - s := Regex.Replace(s,$'{tt}\[\]','array of $1'); - s := Regex.Replace(s,$'{tt}\[,\]','array [,] of $1'); - s := Regex.Replace(s,$'System.Collections.Generic.(Dictionary|SortedDictionary)`2\[{tt},{tt}\]','$1<$2,$3>'); - s := Regex.Replace(s,$'System.Collections.Generic.(List|Stack|Queue|HashSet|SortedSet)`1\[{tt}\]','$1<$2>'); - s := InternalConvertTupleString(s); - s := InternalConvertTupleString(s); - Result := s; -end; - -/// Выводит тип переменной или выражения -procedure PrintType(o: Object); -begin - var y := o.GetType.GetInterfaces.Select(i->i.ToString).Where(s->s.StartsWith('System.Collections.Generic.IEnumerable`')).FirstOrDefault; - var s := o.GetType.ToString; - s := InternalConvertTypeString(s); - Print(s); -end; - -/// Выводит тип переменной или выражения, затем переходит к новой строке вывода -procedure PrintlnType(o: Object); -begin - PrintType(o); - Println; -end; + extensionmethod := SwapSubstr(Self, ss1, ss2); /// Возвращает все перестановки букв в строке в виде последовательности строк function Permutations(Self: string): sequence of string; extensionmethod diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index c7978f9b3..b78645fad 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -13169,6 +13169,7 @@ begin TypeCode.SByte: Result := 'shortint'; TypeCode.Double: Result := 'real'; TypeCode.Single: Result := 'single'; + else Result := t.ToString; end else if t = typeof(string) then Result := 'string' diff --git a/bin/Lib/School.pas b/bin/Lib/School.pas index 50093872a..aeec9516b 100644 --- a/bin/Lib/School.pas +++ b/bin/Lib/School.pas @@ -145,12 +145,6 @@ function ReplaceMany(s: string; source, target: IList): string; /// В строке s меняет местами подстроки ss1 и ss2 procedure SwapSubstr(var s: string; ss1, ss2: string); -/// Выводит тип переменной или выражения -procedure PrintType(o: Object); - -/// Выводит тип переменной или выражения, затем переходит к новой строке вывода -procedure PrintlnType(o: Object); - implementation type @@ -968,53 +962,7 @@ end; /// В строке s меняет местами подстроки ss1 и ss2 procedure SwapSubstr(var Self: string; ss1, ss2: string); -extensionmethod := SwapSubstr(Self, ss1, ss2); - -function InternalConvertTupleString(s: string): string; -begin - var tt := '([\w.`<>\[\],()]+?)'; - s := Regex.Replace(s,$'System.Tuple`2\[{tt},{tt}\]','($1,$2)'); - s := Regex.Replace(s,$'System.Tuple`3\[{tt},{tt},{tt}\]','($1,$2,$3)'); - s := Regex.Replace(s,$'System.Tuple`4\[{tt},{tt},{tt},{tt}\]','($1,$2,$3,$4)'); - s := Regex.Replace(s,$'System.Tuple`5\[{tt},{tt},{tt},{tt},{tt}\]','($1,$2,$3,$4,$5)'); - s := Regex.Replace(s,$'System.Tuple`6\[{tt},{tt},{tt},{tt},{tt},{tt}\]','($1,$2,$3,$4,$5,$6)'); - Result := Regex.Replace(s,$'System.Tuple`7\[{tt},{tt},{tt},{tt},{tt},{tt},{tt}\]','($1,$2,$3,$4,$5,$6,$7)'); -end; - -function InternalConvertTypeString(s: string): string; -begin - s := s.Replace('System.Int32','integer'); - s := s.Replace('System.Int64','int64'); - s := s.Replace('System.Double','real'); - s := s.Replace('System.String','string'); - s := s.Replace('System.Char','char'); - s := s.Replace('System.Numerics.BigInteger','BigInteger'); - var tt := '([\w.`<>\[\],()]+?)'; - s := Regex.Replace(s,$'{tt}\[\]\[\]','array of array of $1'); - s := Regex.Replace(s,$'{tt}\[\]','array of $1'); - s := Regex.Replace(s,$'{tt}\[,\]','array [,] of $1'); - s := Regex.Replace(s,$'System.Collections.Generic.(Dictionary|SortedDictionary)`2\[{tt},{tt}\]','$1<$2,$3>'); - s := Regex.Replace(s,$'System.Collections.Generic.(List|Stack|Queue|HashSet|SortedSet)`1\[{tt}\]','$1<$2>'); - s := InternalConvertTupleString(s); - s := InternalConvertTupleString(s); - Result := s; -end; - -/// Выводит тип переменной или выражения -procedure PrintType(o: Object); -begin - var y := o.GetType.GetInterfaces.Select(i->i.ToString).Where(s->s.StartsWith('System.Collections.Generic.IEnumerable`')).FirstOrDefault; - var s := o.GetType.ToString; - s := InternalConvertTypeString(s); - Print(s); -end; - -/// Выводит тип переменной или выражения, затем переходит к новой строке вывода -procedure PrintlnType(o: Object); -begin - PrintType(o); - Println; -end; + extensionmethod := SwapSubstr(Self, ss1, ss2); /// Возвращает все перестановки букв в строке в виде последовательности строк function Permutations(Self: string): sequence of string; extensionmethod