diff --git a/Compiler/Compiler.cs b/Compiler/Compiler.cs index 0e8aeaf5c..32162e924 100644 --- a/Compiler/Compiler.cs +++ b/Compiler/Compiler.cs @@ -2391,9 +2391,16 @@ namespace PascalABCCompiler public string FindPCUFileName(string UnitName) { - return FindFileInDirectories(UnitName + CompilerOptions.CompiledUnitExtension, CompilerOptions.OutputDirectory, CompilerOptions.SourceFileDirectory, CompilerOptions.SearchDirectory); + if (PCUFileNamesDictionary.ContainsKey(UnitName)) + return PCUFileNamesDictionary[UnitName]; + + string fpfn = null; + fpfn = FindFileInDirectories(UnitName + CompilerOptions.CompiledUnitExtension, CompilerOptions.OutputDirectory, CompilerOptions.SourceFileDirectory, CompilerOptions.SearchDirectory); + + PCUFileNamesDictionary[UnitName] = fpfn; + return fpfn; } - + public string FindPCUFileNameWithoutSources(string UnitName, string FileDir) { return FindFileInDirectories(UnitName + CompilerOptions.CompiledUnitExtension, FileDir, CompilerOptions.OutputDirectory, CompilerOptions.SourceFileDirectory, CompilerOptions.SearchDirectory); diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 17938ca78..a30d70ee8 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 = "1406"; + public const string Revision = "1415"; 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 7f9b57054..c8aaf2a5a 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%MINOR%=2 -%REVISION%=1406 %COREVERSION%=0 +%REVISION%=1415 +%MINOR%=2 %MAJOR%=3 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 1f89a18e0..2360e1372 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.2.0.1406' +!define VERSION '3.2.0.1415' diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 973511320..322a8467a 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -1675,6 +1675,11 @@ function MatrFill(m,n: integer; x: T): array [,] of T; function MatrGen(m,n: integer; gen: (integer,integer)->T): array [,] of T; /// Транспонирует двумерный массив function Transpose(a: array [,] of T): array [,] of T; +/// Возвращает матрицу m на n целых, введенных с клавиатуры +function ReadMatrInteger(m,n: integer): array [,] of integer; +/// Возвращает матрицу m на n вещественных, введенных с клавиатуры +function ReadMatrReal(m,n: integer): array [,] of real; + // ----------------------------------------------------- //>> Подпрограммы для создания кортежей # Subroutines for tuple generation @@ -1968,6 +1973,7 @@ const 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'; PARAMETER_TO_OUT_OF_RANGE = 'Параметр to за пределами диапазона!!The to parameter out of bounds'; + ARR_LENGTH_MUST_BE_MATCH_TO_MATR_SIZE = 'Размер одномерного массива не согласован с размером двумерного массива!!The 1-dim array length does not match 2-dim array size'; // ----------------------------------------------------- // WINAPI @@ -8883,6 +8889,7 @@ function SystemSliceQuestion(Self: List; situation: integer; from,&to,step begin Result := SystemSliceListImplQuestion(Self,situation,from,&to,step); end; + // ----------------------------------------------------- //>> Методы расширения типа array [,] of T # Extension methods for array [,] of T // ----------------------------------------------------- @@ -8998,6 +9005,47 @@ begin Swap(Self[i,k1],Self[i,k2]) end; +/// Меняет строку k двумерного массива на другую строку +procedure SetRow(Self: array [,] of T; k: integer; a: array of T); extensionmethod; +begin + if a.Length<>Self.ColCount then + raise new System.ArgumentException(GetTranslation(ARR_LENGTH_MUST_BE_MATCH_TO_MATR_SIZE)); + for var j:=0 to Self.ColCount-1 do + Self[k,j] := a[j] +end; + +/// Меняет столбец k двумерного массива на другой столбец +procedure SetCol(Self: array [,] of T; k: integer; a: array of T); extensionmethod; +begin + if a.Length<>Self.RowCount then + raise new System.ArgumentException(GetTranslation(ARR_LENGTH_MUST_BE_MATCH_TO_MATR_SIZE)); + for var i:=0 to Self.RowCount-1 do + Self[i,k] := a[i] +end; + +/// Возвращает по заданному двумерному массиву последовательность (i,j,a[i,j]) +function ElementsWithIndexes(Self: array [,] of T): sequence of (integer,integer,T); extensionmethod; +begin + for var i:=0 to Self.RowCount-1 do + for var j:=0 to Self.ColCount-1 do + yield (i,j,Self[i,j]) +end; + +/// Возвращает по заданному двумерному массиву последовательность его элементов по строкам +function ElementsByRow(Self: array [,] of T): sequence of T; extensionmethod; +begin + for var i:=0 to Self.RowCount-1 do + for var j:=0 to Self.ColCount-1 do + yield Self[i,j] +end; + +/// Возвращает по заданному двумерному массиву последовательность его элементов по столбцам +function ElementsByCol(Self: array [,] of T): sequence of T; extensionmethod; +begin + for var j:=0 to Self.ColCount-1 do + for var i:=0 to Self.RowCount-1 do + yield Self[i,j] +end; // Реализация операций с матрицами - только после введения RowCount и ColCount function MatrRandom(m: integer; n: integer; a,b: integer): array [,] of integer; @@ -9050,6 +9098,22 @@ begin Result[i,j] := a[j,i] end; +function ReadMatrInteger(m,n: integer): array [,] of integer; +begin + Result := new integer[m,n]; + for var i:=0 to m-1 do + for var j:=0 to n-1 do + Result[i,j] := ReadInteger; +end; + +function ReadMatrReal(m,n: integer): array [,] of real; +begin + Result := new real[m,n]; + for var i:=0 to m-1 do + for var j:=0 to n-1 do + Result[i,j] := ReadReal; +end; + // ----------------------------------------------------- //>> Методы расширения типа array of T # Extension methods for array of T // ----------------------------------------------------- @@ -9740,6 +9804,9 @@ begin Result := Self.Matches(reg,options).Select(m->m.Value); end; +/// Удовлетворяет ли строка регулярному выражению +function IsMatch(Self: string; reg: string; options: RegexOptions := RegexOptions.None): boolean; extensionmethod := Regex.IsMatch(Self, reg, options); + /// Удаляет в строке все вхождения указанных строк function Remove(Self: string; params targets: array of string): string; extensionmethod; begin diff --git a/VisualPascalABCNET/OptionsContent/OptionsForm.cs b/VisualPascalABCNET/OptionsContent/OptionsForm.cs index 8c3cc5238..c23d2dad9 100644 --- a/VisualPascalABCNET/OptionsContent/OptionsForm.cs +++ b/VisualPascalABCNET/OptionsContent/OptionsForm.cs @@ -20,18 +20,14 @@ namespace VisualPascalABC.OptionsContent { var sl = 50; this.contentEngine = contentEngine; - System.Threading.Thread.Sleep(sl); // SSM 07.11.16 - InitializeComponent(); - System.Threading.Thread.Sleep(sl); foreach (IOptionsContent content in contentEngine.ContentList) { TreeNode tn = new TreeNode(content.ContentName); tvContentList.Nodes.Add(tn); nodes.Add(tn, content); } - System.Threading.Thread.Sleep(sl); PascalABCCompiler.StringResources.SetTextForAllObjects(this, strprefix); - System.Threading.Thread.Sleep(sl); } private void btOk_Click(object sender, EventArgs e) diff --git a/VisualPascalABCNET/Workbench/RunnerManagerHandlers.cs b/VisualPascalABCNET/Workbench/RunnerManagerHandlers.cs index adeff8dc7..7cb1fe743 100644 --- a/VisualPascalABCNET/Workbench/RunnerManagerHandlers.cs +++ b/VisualPascalABCNET/Workbench/RunnerManagerHandlers.cs @@ -77,7 +77,7 @@ namespace VisualPascalABC Workbench.WidgetController.SetStopEnabled(false); Workbench.WidgetController.SetCompilingButtonsEnabled(true); Workbench.WidgetController.SetDebugButtonsEnabled(true); - if (IsOneProgramStarted()) + //if (IsOneProgramStarted()) Workbench.WidgetController.SetOptionsEnabled(true); } } @@ -86,7 +86,7 @@ namespace VisualPascalABC Workbench.WidgetController.SetStopEnabled(false); Workbench.WidgetController.SetCompilingButtonsEnabled(true); Workbench.WidgetController.SetDebugButtonsEnabled(true); - if (IsOneProgramStarted()) + //if (IsOneProgramStarted()) Workbench.WidgetController.SetOptionsEnabled(true); } RunTabs[fileName].Run = false; diff --git a/bin/Lib/PABCRtl.dll b/bin/Lib/PABCRtl.dll index c62ccf20a..86ba7ca83 100644 Binary files a/bin/Lib/PABCRtl.dll and b/bin/Lib/PABCRtl.dll differ diff --git a/bin/Lib/PABCSystem.axml b/bin/Lib/PABCSystem.axml index a659dec42..f6a6bd958 100644 --- a/bin/Lib/PABCSystem.axml +++ b/bin/Lib/PABCSystem.axml @@ -1680,6 +1680,37 @@ MaxDouble = real . MaxValue + + \PABCSystem.pas + //>> Методы расширения типа array [,] of T # Extension methods for array [,] of T + + function Sin ( c : Complex ) : = Complex . Sin ( c ) + function Power ( c , power : Complex ) : = Complex . Pow ( c , power ) + function Log10 ( c : Complex ) : = Complex . Log10 ( c ) + function Log ( c : Complex ) : = Complex . Log ( c ) + function Exp ( c : Complex ) : = Complex . Exp ( c ) + function Cos ( c : Complex ) : = Complex . Cos ( c ) + function Conjugate ( c : Complex ) : = Complex . Conjugate ( c ) + function Abs ( c : Complex ) : = Complex . Abs ( c ) + function Sqrt ( c : Complex ) : = Complex . Sqrt ( c ) + function CplxFromPolar ( magnitude , phase : real ) : = Complex . FromPolarCoordinates ( magnitude , phase ) + function Cplx ( re , im : real ) : = new Complex ( re , im ) + + + + + function Low ( i : System . Array ) : integer + function High ( i : System . Array ) : integer + function Length ( a : &Array ) : integer + function Length ( a : &Array ; dim : integer ) : integer + function Copy ( a : &Array ) : &Array + procedure Sort < T > ( a : array of T ) + procedure Sort < T > ( a : array of T ; cmp : ( T , T ) - > integer ) + procedure Sort < T > ( a : array of T ; less : ( T , T ) - > boolean ) + procedure Sort < T > ( l : List < T > ) + procedure Sort < T > ( l : List < T > ; cmp : ( T , T ) - > integer ) + + \PABCSystem.pas //>> Методы расширения типа integer # Extension methods for integer diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 973511320..322a8467a 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -1675,6 +1675,11 @@ function MatrFill(m,n: integer; x: T): array [,] of T; function MatrGen(m,n: integer; gen: (integer,integer)->T): array [,] of T; /// Транспонирует двумерный массив function Transpose(a: array [,] of T): array [,] of T; +/// Возвращает матрицу m на n целых, введенных с клавиатуры +function ReadMatrInteger(m,n: integer): array [,] of integer; +/// Возвращает матрицу m на n вещественных, введенных с клавиатуры +function ReadMatrReal(m,n: integer): array [,] of real; + // ----------------------------------------------------- //>> Подпрограммы для создания кортежей # Subroutines for tuple generation @@ -1968,6 +1973,7 @@ const 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'; PARAMETER_TO_OUT_OF_RANGE = 'Параметр to за пределами диапазона!!The to parameter out of bounds'; + ARR_LENGTH_MUST_BE_MATCH_TO_MATR_SIZE = 'Размер одномерного массива не согласован с размером двумерного массива!!The 1-dim array length does not match 2-dim array size'; // ----------------------------------------------------- // WINAPI @@ -8883,6 +8889,7 @@ function SystemSliceQuestion(Self: List; situation: integer; from,&to,step begin Result := SystemSliceListImplQuestion(Self,situation,from,&to,step); end; + // ----------------------------------------------------- //>> Методы расширения типа array [,] of T # Extension methods for array [,] of T // ----------------------------------------------------- @@ -8998,6 +9005,47 @@ begin Swap(Self[i,k1],Self[i,k2]) end; +/// Меняет строку k двумерного массива на другую строку +procedure SetRow(Self: array [,] of T; k: integer; a: array of T); extensionmethod; +begin + if a.Length<>Self.ColCount then + raise new System.ArgumentException(GetTranslation(ARR_LENGTH_MUST_BE_MATCH_TO_MATR_SIZE)); + for var j:=0 to Self.ColCount-1 do + Self[k,j] := a[j] +end; + +/// Меняет столбец k двумерного массива на другой столбец +procedure SetCol(Self: array [,] of T; k: integer; a: array of T); extensionmethod; +begin + if a.Length<>Self.RowCount then + raise new System.ArgumentException(GetTranslation(ARR_LENGTH_MUST_BE_MATCH_TO_MATR_SIZE)); + for var i:=0 to Self.RowCount-1 do + Self[i,k] := a[i] +end; + +/// Возвращает по заданному двумерному массиву последовательность (i,j,a[i,j]) +function ElementsWithIndexes(Self: array [,] of T): sequence of (integer,integer,T); extensionmethod; +begin + for var i:=0 to Self.RowCount-1 do + for var j:=0 to Self.ColCount-1 do + yield (i,j,Self[i,j]) +end; + +/// Возвращает по заданному двумерному массиву последовательность его элементов по строкам +function ElementsByRow(Self: array [,] of T): sequence of T; extensionmethod; +begin + for var i:=0 to Self.RowCount-1 do + for var j:=0 to Self.ColCount-1 do + yield Self[i,j] +end; + +/// Возвращает по заданному двумерному массиву последовательность его элементов по столбцам +function ElementsByCol(Self: array [,] of T): sequence of T; extensionmethod; +begin + for var j:=0 to Self.ColCount-1 do + for var i:=0 to Self.RowCount-1 do + yield Self[i,j] +end; // Реализация операций с матрицами - только после введения RowCount и ColCount function MatrRandom(m: integer; n: integer; a,b: integer): array [,] of integer; @@ -9050,6 +9098,22 @@ begin Result[i,j] := a[j,i] end; +function ReadMatrInteger(m,n: integer): array [,] of integer; +begin + Result := new integer[m,n]; + for var i:=0 to m-1 do + for var j:=0 to n-1 do + Result[i,j] := ReadInteger; +end; + +function ReadMatrReal(m,n: integer): array [,] of real; +begin + Result := new real[m,n]; + for var i:=0 to m-1 do + for var j:=0 to n-1 do + Result[i,j] := ReadReal; +end; + // ----------------------------------------------------- //>> Методы расширения типа array of T # Extension methods for array of T // ----------------------------------------------------- @@ -9740,6 +9804,9 @@ begin Result := Self.Matches(reg,options).Select(m->m.Value); end; +/// Удовлетворяет ли строка регулярному выражению +function IsMatch(Self: string; reg: string; options: RegexOptions := RegexOptions.None): boolean; extensionmethod := Regex.IsMatch(Self, reg, options); + /// Удаляет в строке все вхождения указанных строк function Remove(Self: string; params targets: array of string): string; extensionmethod; begin