From 8b971136dc687b5363f1b0272aa988484a2f7758 Mon Sep 17 00:00:00 2001 From: samuraiGH Date: Mon, 29 Jan 2024 20:53:20 +0300 Subject: [PATCH 1/2] repair TargetFramework directive --- Compiler/Compiler.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Compiler/Compiler.cs b/Compiler/Compiler.cs index 6430aaced..3b033793c 100644 --- a/Compiler/Compiler.cs +++ b/Compiler/Compiler.cs @@ -2005,14 +2005,14 @@ private void SetOutputPlatformOption(NETGenerator.CompilerOptions compilerOption } if (CompilerOptions.Only32Bit) compilerOptions.platformtarget = NETGenerator.CompilerOptions.PlatformTarget.x86; - - // целевой framework - if (this.compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.compiler_directive_targetframework, out compilerDirectivesList)) + } + if (compilerDirectives.TryGetValue(TreeConverter.compiler_string_consts.compiler_directive_targetframework, out compilerDirectivesList)) + { + compilerOptions.TargetFramework = compilerDirectivesList[0].directive; + if (!(new string[] { "net40", "net403", "net45", "net451", "net452", "net46", "net461", "net462", "net47", "net471", "net472", "net48", "net481" }) + .Contains(compilerOptions.TargetFramework)) { - compilerOptions.TargetFramework = compilerDirectivesList[0].directive; - if (!(new string[] { "net40", "net403", "net45", "net451", "net452", "net46", "net461", "net462", "net47", "net471", "net472", "net48", "net481" }) - .Contains(compilerOptions.TargetFramework)) - ErrorsList.Add(new UnsupportedTargetFramework(compilerOptions.TargetFramework, compilerDirectivesList[0].location)); + ErrorsList.Add(new UnsupportedTargetFramework(compilerOptions.TargetFramework, compilerDirectivesList[0].location)); } } } @@ -2329,7 +2329,7 @@ private void PrebuildMainSemanticTreeActions(out NETGenerator.CompilerOptions co compilerOptions = new NETGenerator.CompilerOptions(); - // выяснение целевой платформы + // выяснение TargetFramework и целевой платформы SetOutputPlatformOption(compilerOptions); // остальные директивы From e17dd66fd557b9bb8940af0856ab8b7371f73d09 Mon Sep 17 00:00:00 2001 From: bormant Date: Thu, 1 Feb 2024 22:08:40 +0300 Subject: [PATCH 2/2] Make KeyPressed act hand by hand with ReadKey (#3036) --- bin/Lib/CRT.pas | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/Lib/CRT.pas b/bin/Lib/CRT.pas index 013f7c6f6..3ac48ff32 100644 --- a/bin/Lib/CRT.pas +++ b/bin/Lib/CRT.pas @@ -155,9 +155,9 @@ function ReadKey: char;// TODO продумать это var KeyInfo: ConsoleKeyInfo; begin - if NextKey <> Chr(0) then + if NextKey <> #0 then begin - ReadKey := nextkey; + ReadKey := NextKey; NextKey := #0; end else @@ -172,7 +172,7 @@ function ReadKey: char;// TODO продумать это function KeyPressed: boolean; begin - KeyPressed := Console.KeyAvailable; + KeyPressed := (NextKey <> #0) or Console.KeyAvailable; end; function WindowWidth: integer; @@ -300,4 +300,4 @@ procedure __InitModule__; begin //zdes oshibka ISConsoleApplication u nas nikogda ne inicializiruetsja __InitModule; -end. \ No newline at end of file +end.