From f733799b1fc07b2b5c821153cd3ae7a43baee4ca Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Sat, 10 Jul 2021 10:45:02 +0300 Subject: [PATCH] ErrOutput write(output,1) --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 4 +-- Release/pabcversion.txt | 2 +- ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/CompilationSamples/PABCSystem.pas | 32 ++++++++++++--------- TreeConverter/TreeRealization/generics.cs | 14 ++++++++- bin/Lib/PABCSystem.pas | 32 ++++++++++++--------- 7 files changed, 56 insertions(+), 32 deletions(-) diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 1f6e72489..5bad82d25 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 = "0"; - public const string Revision = "2926"; + public const string Revision = "2931"; 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 484e950c8..9ab7a9cc7 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=0 -%REVISION%=2926 %MINOR%=8 +%REVISION%=2931 +%COREVERSION%=0 %MAJOR%=3 diff --git a/Release/pabcversion.txt b/Release/pabcversion.txt index beb402e6b..3e3a1420b 100644 --- a/Release/pabcversion.txt +++ b/Release/pabcversion.txt @@ -1 +1 @@ -3.8.0.2926 +3.8.0.2931 diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 1e3c7c229..022a4657b 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.8.0.2926' +!define VERSION '3.8.0.2931' diff --git a/TestSuite/CompilationSamples/PABCSystem.pas b/TestSuite/CompilationSamples/PABCSystem.pas index 31965644c..a5c7e6809 100644 --- a/TestSuite/CompilationSamples/PABCSystem.pas +++ b/TestSuite/CompilationSamples/PABCSystem.pas @@ -370,7 +370,7 @@ type private fi: FileInfo; sr: StreamReader; - sw: StreamWriter; + sw: TextWriter; public /// Возвращает значение типа integer, введенное из текстового файла function ReadInteger: integer; @@ -2502,6 +2502,8 @@ var output: TextFile; /// Стандартный текстовый файл для ввода. Связывается процедурой Assign с файлом на диске, после чего весь ввод с консоли перенаправляется из этого файла input: TextFile; + /// Стандартный текстовый файл ошибок. Связывается процедурой Assign с файлом на диске, после чего весь вывод с использованием ErrOutput перенаправляется в этот файл + ErrOutput: TextFile; /// Определяет текущую систему ввода-вывода CurrentIOSystem: IOSystem; /// Принимает значение True, если приложение имеет консольное окно @@ -6807,7 +6809,7 @@ end; procedure Write(obj: object); begin - if output.sw <> nil then + if output.sw is StreamWriter then write_in_output(obj) else CurrentIOSystem.Write(obj); end; @@ -6819,7 +6821,7 @@ end; procedure Write(obj1, obj2: object); begin - if output.sw <> nil then + if output.sw is StreamWriter then begin write_in_output(obj1); write_in_output(obj2); @@ -6834,7 +6836,7 @@ end; procedure Write(params args: array of object); begin for var i := 0 to args.length - 1 do - if output.sw <> nil then + if output.sw is StreamWriter then write_in_output(args[i]) else CurrentIOSystem.Write(args[i]); @@ -6842,7 +6844,7 @@ end; procedure Writeln(obj: object); begin - if output.sw <> nil then + if output.sw is StreamWriter then begin write_in_output(obj); writeln_in_output; @@ -6862,7 +6864,7 @@ end; procedure Writeln(obj1, obj2: object); begin - if output.sw <> nil then + if output.sw is StreamWriter then begin write_in_output(obj1); write_in_output(obj2); @@ -6878,14 +6880,14 @@ end; procedure Writeln; begin - if output.sw <> nil then + if output.sw is StreamWriter then writeln_in_output else CurrentIOSystem.Writeln; end; procedure Writeln(params args: array of object); begin - if output.sw <> nil then + if output.sw is StreamWriter then begin for var i := 0 to args.length - 1 do write_in_output(args[i]); @@ -6905,7 +6907,7 @@ end; procedure Write(f: Text; val: object); begin - if f.fi = nil then + if (f.fi = nil) and (f<>output) and (f<>ErrOutput) then raise new System.IO.IOException(GetTranslation(FILE_NOT_ASSIGNED)); if f.sw = nil then raise new System.IO.IOException(GetTranslation(FILE_NOT_OPENED_FOR_WRITING)); @@ -6934,7 +6936,7 @@ end; procedure Writeln(f: Text); begin - if f.fi = nil then + if (f.fi = nil) and (f<>output) and (f<>ErrOutput) then raise new System.IO.IOException(GetTranslation(FILE_NOT_ASSIGNED)); if f.sw = nil then raise new System.IO.IOException(GetTranslation(FILE_NOT_OPENED_FOR_WRITING)); @@ -7154,7 +7156,8 @@ begin end else begin - f.sw.BaseStream.Position := 0; + if f.sw is StreamWriter then + (f.sw as StreamWriter).BaseStream.Position := 0; end; end; @@ -13982,8 +13985,11 @@ begin // SSM 10/11/18 восстановил эту строку чтобы в главном потоке в вещественных была точка System.Threading.Thread.CurrentThread.CurrentCulture := new System.Globalization.CultureInfo('en-US'); - output := new TextFile(); input := new TextFile(); + output := new TextFile(); + output.sw := Console.Out; + ErrOutput := new TextFile(); + ErrOutput.sw := Console.Error; {if (Environment.OSVersion.Platform = PlatformID.Unix) or (Environment.OSVersion.Platform = PlatformID.MacOSX) then foreach var listener in System.Diagnostics.Trace.Listeners do @@ -14010,7 +14016,7 @@ end; procedure __FinalizeModule__; begin - if (output.sw <> nil) and (output.sw.BaseStream <> nil) then + if (output.sw <> nil) and (output.sw is StreamWriter) and ((output.sw as StreamWriter).BaseStream <> nil) then output.sw.Close; if (input.sr <> nil) and (input.sr.BaseStream <> nil) then input.sr.Close; diff --git a/TreeConverter/TreeRealization/generics.cs b/TreeConverter/TreeRealization/generics.cs index 0a7703b5a..e29a97fed 100644 --- a/TreeConverter/TreeRealization/generics.cs +++ b/TreeConverter/TreeRealization/generics.cs @@ -901,6 +901,15 @@ namespace PascalABCCompiler.TreeRealization .Select(t => t.Index) .ToArray(); + // SSM 08/07/21 попытаться вывести нефункциональные параметры первыми + /*for (int i = 0; i < count_params_to_see; ++i) + if (!(fact[i].type is delegated_methods)) + { + bool b = DeduceInstanceTypes(formal[i].type, fact[i].type, deduced, nils, generic_params); + b = b; + }*/ + + for (int i = 0; i < count_params_to_see; ++i) { if (alone && fact[i].type is delegated_methods && (fact[i].type as delegated_methods).empty_param_method != null && DeduceInstanceTypes(formal[i].type, (fact[i].type as delegated_methods).empty_param_method.type, deduced, nils, generic_params)) @@ -1213,6 +1222,8 @@ namespace PascalABCCompiler.TreeRealization } } + // SSM 09.07 - My(f: T->T1) при наличии двух f - следующие 2 else дают пропуск этой ошибки!! Она внесена 10.01 в 20:54 при исправлении 1093 + // Видимо, это улучшило ситуацию - просто надо точнее отбрасывать часть fact_funcs else if (dm != null && dm.proper_methods.Count > 1 && formal_type.original_generic is compiled_type_node && (formal_type.original_generic as compiled_type_node).compiled_type.FullName.StartsWith("System.Func`")) { var ctn = formal_type.original_generic as compiled_type_node; @@ -1234,7 +1245,8 @@ namespace PascalABCCompiler.TreeRealization fact_funcs.Add(fc.simple_function_node); } } - } + } + // end SSM 09.07 - конец кода, который был написан раньше IB. Здесь поясняется его влияние на ошибки for (int j = 0; j < fact_funcs.Count; j++) { fact_func = fact_funcs[j]; diff --git a/bin/Lib/PABCSystem.pas b/bin/Lib/PABCSystem.pas index 31965644c..a5c7e6809 100644 --- a/bin/Lib/PABCSystem.pas +++ b/bin/Lib/PABCSystem.pas @@ -370,7 +370,7 @@ type private fi: FileInfo; sr: StreamReader; - sw: StreamWriter; + sw: TextWriter; public /// Возвращает значение типа integer, введенное из текстового файла function ReadInteger: integer; @@ -2502,6 +2502,8 @@ var output: TextFile; /// Стандартный текстовый файл для ввода. Связывается процедурой Assign с файлом на диске, после чего весь ввод с консоли перенаправляется из этого файла input: TextFile; + /// Стандартный текстовый файл ошибок. Связывается процедурой Assign с файлом на диске, после чего весь вывод с использованием ErrOutput перенаправляется в этот файл + ErrOutput: TextFile; /// Определяет текущую систему ввода-вывода CurrentIOSystem: IOSystem; /// Принимает значение True, если приложение имеет консольное окно @@ -6807,7 +6809,7 @@ end; procedure Write(obj: object); begin - if output.sw <> nil then + if output.sw is StreamWriter then write_in_output(obj) else CurrentIOSystem.Write(obj); end; @@ -6819,7 +6821,7 @@ end; procedure Write(obj1, obj2: object); begin - if output.sw <> nil then + if output.sw is StreamWriter then begin write_in_output(obj1); write_in_output(obj2); @@ -6834,7 +6836,7 @@ end; procedure Write(params args: array of object); begin for var i := 0 to args.length - 1 do - if output.sw <> nil then + if output.sw is StreamWriter then write_in_output(args[i]) else CurrentIOSystem.Write(args[i]); @@ -6842,7 +6844,7 @@ end; procedure Writeln(obj: object); begin - if output.sw <> nil then + if output.sw is StreamWriter then begin write_in_output(obj); writeln_in_output; @@ -6862,7 +6864,7 @@ end; procedure Writeln(obj1, obj2: object); begin - if output.sw <> nil then + if output.sw is StreamWriter then begin write_in_output(obj1); write_in_output(obj2); @@ -6878,14 +6880,14 @@ end; procedure Writeln; begin - if output.sw <> nil then + if output.sw is StreamWriter then writeln_in_output else CurrentIOSystem.Writeln; end; procedure Writeln(params args: array of object); begin - if output.sw <> nil then + if output.sw is StreamWriter then begin for var i := 0 to args.length - 1 do write_in_output(args[i]); @@ -6905,7 +6907,7 @@ end; procedure Write(f: Text; val: object); begin - if f.fi = nil then + if (f.fi = nil) and (f<>output) and (f<>ErrOutput) then raise new System.IO.IOException(GetTranslation(FILE_NOT_ASSIGNED)); if f.sw = nil then raise new System.IO.IOException(GetTranslation(FILE_NOT_OPENED_FOR_WRITING)); @@ -6934,7 +6936,7 @@ end; procedure Writeln(f: Text); begin - if f.fi = nil then + if (f.fi = nil) and (f<>output) and (f<>ErrOutput) then raise new System.IO.IOException(GetTranslation(FILE_NOT_ASSIGNED)); if f.sw = nil then raise new System.IO.IOException(GetTranslation(FILE_NOT_OPENED_FOR_WRITING)); @@ -7154,7 +7156,8 @@ begin end else begin - f.sw.BaseStream.Position := 0; + if f.sw is StreamWriter then + (f.sw as StreamWriter).BaseStream.Position := 0; end; end; @@ -13982,8 +13985,11 @@ begin // SSM 10/11/18 восстановил эту строку чтобы в главном потоке в вещественных была точка System.Threading.Thread.CurrentThread.CurrentCulture := new System.Globalization.CultureInfo('en-US'); - output := new TextFile(); input := new TextFile(); + output := new TextFile(); + output.sw := Console.Out; + ErrOutput := new TextFile(); + ErrOutput.sw := Console.Error; {if (Environment.OSVersion.Platform = PlatformID.Unix) or (Environment.OSVersion.Platform = PlatformID.MacOSX) then foreach var listener in System.Diagnostics.Trace.Listeners do @@ -14010,7 +14016,7 @@ end; procedure __FinalizeModule__; begin - if (output.sw <> nil) and (output.sw.BaseStream <> nil) then + if (output.sw <> nil) and (output.sw is StreamWriter) and ((output.sw as StreamWriter).BaseStream <> nil) then output.sw.Close; if (input.sr <> nil) and (input.sr.BaseStream <> nil) then input.sr.Close;