From 90c406e0ccd05d7e6f488d0b0b4ab31d800bf508 Mon Sep 17 00:00:00 2001 From: Mikhalkovich Stanislav Date: Tue, 19 Mar 2019 16:45:47 +0300 Subject: [PATCH] =?UTF-8?q?pabcnetcclear=20-=20=D0=B4=D0=BE=D0=B1=D0=B0?= =?UTF-8?q?=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B4=D0=B8=D1=80=D0=B5?= =?UTF-8?q?=D0=BA=D1=82=D0=B8=D0=B2=20=D0=B2=20=D0=BA=D0=BE=D0=BC=D0=B0?= =?UTF-8?q?=D0=BD=D0=B4=D0=BD=D1=83=D1=8E=20=D1=81=D1=82=D1=80=D0=BE=D0=BA?= =?UTF-8?q?=D1=83=20=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B5=D1=80=D0=B0=D0=B1?= =?UTF-8?q?=D0=BE=D1=82=D0=BA=D0=B0=20=D0=B4=D0=B8=D0=B0=D0=B3=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BA=D0=B8=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE?= =?UTF-8?q?=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Configuration/GlobalAssemblyInfo.cs | 2 +- Configuration/Version.defs | 4 +- Localization/DefaultLang.resources | Bin 89833 -> 89831 bytes ReleaseGenerators/PascalABCNET_version.nsh | 2 +- TestSuite/CompilationSamples/GraphWPF.pas | 23 +++- bin/Lng/Eng/PABCNETC.dat | 4 +- bin/Lng/Rus/PABCNETC.dat | 2 +- pabcnetc_clear/ConsoleCompiler.cs | 125 +++++++++++++++++++-- pabcnetc_clear/PABCNETCclear.csproj.user | 2 +- 9 files changed, 147 insertions(+), 17 deletions(-) diff --git a/Configuration/GlobalAssemblyInfo.cs b/Configuration/GlobalAssemblyInfo.cs index 178a97939..459ace208 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 = "4"; public const string Build = "2"; - public const string Revision = "2001"; + public const string Revision = "2002"; 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 833a5fc8a..11fc31240 100644 --- a/Configuration/Version.defs +++ b/Configuration/Version.defs @@ -1,4 +1,4 @@ -%COREVERSION%=2 -%REVISION%=2001 %MINOR%=4 +%REVISION%=2002 +%COREVERSION%=2 %MAJOR%=3 diff --git a/Localization/DefaultLang.resources b/Localization/DefaultLang.resources index 5968af6687d510c8f73fe1a86df05615906ddeca..6e4c31a50448301113a3632f0dec06cfed409d7a 100644 GIT binary patch delta 42 zcmV+_0M-BLy#?pJ1(4tY1F_*DD-zV;>FXeSFnu8HEz|@gBC2e7AyhNGT*)x A%K!iX delta 44 zcmV+{0Mq~Hy#?vL1(4tY1+n2FD-_Q1@$>TW^5XO5@*wo!>FXeSFnxm*EVmRa0n;)} C^%$}M diff --git a/ReleaseGenerators/PascalABCNET_version.nsh b/ReleaseGenerators/PascalABCNET_version.nsh index 1685ea509..23129d8b0 100644 --- a/ReleaseGenerators/PascalABCNET_version.nsh +++ b/ReleaseGenerators/PascalABCNET_version.nsh @@ -1 +1 @@ -!define VERSION '3.4.2.2001' +!define VERSION '3.4.2.2002' diff --git a/TestSuite/CompilationSamples/GraphWPF.pas b/TestSuite/CompilationSamples/GraphWPF.pas index 69c4e09f3..6fb4262a0 100644 --- a/TestSuite/CompilationSamples/GraphWPF.pas +++ b/TestSuite/CompilationSamples/GraphWPF.pas @@ -478,6 +478,11 @@ procedure AddBottomPanel(Height: real := 100; c: Color := Colors.LightGray); procedure AddStatusBar(Height: real := 24);} +{function GetDC: DrawingContext; +procedure ReleaseDC(dc: DrawingContext); +procedure FastDraw(d: DrawingContext->()); +procedure FastClear(var dc: DrawingContext);} + procedure __InitModule__; procedure __FinalizeModule__; @@ -551,6 +556,23 @@ begin end; end; +procedure FastDraw(d: DrawingContext->()); +begin + Invoke(()-> + begin + var dc := GetDC; + d(dc); + ReleaseDC(dc); + end); +end; + +procedure FastClear(var dc: DrawingContext); +begin + ReleaseDC(dc); + Window.Clear; + dc := GetDC; +end; + function GetDC(t: Transform): DrawingContext; begin var visual := new DrawingVisual(); @@ -1313,7 +1335,6 @@ begin FillRectangle(0,0,Window.Width,Window.Height,c) end; - procedure WindowTypeWPF.Clear := Invoke(WindowTypeClearP); procedure WindowTypeWPF.Clear(c: Color) := Invoke(WindowTypeClearPC,c); diff --git a/bin/Lng/Eng/PABCNETC.dat b/bin/Lng/Eng/PABCNETC.dat index 2455591d4..3953b33e4 100644 --- a/bin/Lng/Eng/PABCNETC.dat +++ b/bin/Lng/Eng/PABCNETC.dat @@ -12,8 +12,8 @@ ERROR_PARSERS_NOT_FOUND=Error: Parsers not found! CONNECTED_PARSERS=Connected parsers: CONNECTED_CONVERSIONS=Connected conversions: STARTING=Starting... -COMMANDLINEISABSENT=Command line is absent -FILEISABSENT{0}=File {0} is absent +COMMANDLINEISABSENT=Command line is empty +FILEISABSENT{0}=File {0} not found COMPILEERRORS=Compile errors: HELP=16LINES diff --git a/bin/Lng/Rus/PABCNETC.dat b/bin/Lng/Rus/PABCNETC.dat index 1e8b08eaa..450529a24 100644 --- a/bin/Lng/Rus/PABCNETC.dat +++ b/bin/Lng/Rus/PABCNETC.dat @@ -14,7 +14,7 @@ CONNECTED_PARSERS=Подключены парсеры: CONNECTED_CONVERSIONS=Подключены преобразования: STARTING=Запуск... COMMANDLINEISABSENT=Отсутствует командная строка -FILEISABSENT{0}=Отсутствует файл {0} +FILEISABSENT{0}=Файл {0} не найден COMPILEERRORS=Ошибки компиляции: HELP=17LINES diff --git a/pabcnetc_clear/ConsoleCompiler.cs b/pabcnetc_clear/ConsoleCompiler.cs index 323f2dcf8..c6c2d730b 100644 --- a/pabcnetc_clear/ConsoleCompiler.cs +++ b/pabcnetc_clear/ConsoleCompiler.cs @@ -3,6 +3,7 @@ using System; using PascalABCCompiler.Errors; using System.IO; +using System.Linq; using System.Collections.Generic; namespace PascalABCCompiler @@ -38,8 +39,77 @@ namespace PascalABCCompiler } } + public static bool CheckAndSplitDirective(string directive, out string name, out string value) + { + System.Diagnostics.Debug.Assert(directive[0] == '/'); + directive = directive.Remove(0, 1); + + name = null; + value = null; + var ss = directive.Split(':'); + if (ss.Length>2) + { + Console.WriteLine("Directive can contain only one ':' sign"); + return false; + } + name = ss[0].ToLower(); + if (ss.Length > 1) + value = ss[1].ToLower(); + + return true; + } + + public static bool ApplyDirective(string name, string value, CompilerOptions co) + { + switch (name) + { + case "debug": + switch (value) + { + case "0": + co.Debug = false; + co.Optimise = true; + return true; + case "1": + co.Debug = true; + return true; + default: + Console.WriteLine("Bad value in 'Debug' directive '{0}'. Acceptable values are 0 or 1", value); + return false; + } + default: + Console.WriteLine("No such directive name: '{0}'", name); + return false; + } + } + + public static bool CheckAndApplyDirective(string directive, CompilerOptions co) + { + string name, value; + var b = CheckAndSplitDirective(directive,out name, out value); + if (!b) + return false; + + b = ApplyDirective(name, value, co); + return b; + } + + public static void OutputHelp() + { + Console.WriteLine("Command line: "); + Console.WriteLine("pabcnetcclear /directive1:value1 /directive2:value2 ... [inputfile]\n"); + Console.WriteLine("Available directives:\n /Help /H /?\n /Debug:0(1)\n"); + Console.WriteLine("/Debug:0 generates code with all .NET optimizations!"); + } + public static int Main(string[] args) { + // SSM 18.03.19 Делаю параметры командной строки. Формат: pabcnetc.exe /Dir1=value1 /Dir2=value2 ... fname dir + // dir - это пережиток старого - так можно было задавать каталог раньше. Пока - увы - пусть останется + // Пока сделаю только директивы /Help /H /? и /Debug=0(1) + // Имя директивы - это одно слово. Равенства может не быть - тогда value директивы равно null + // Вычленяем первое равенство и делим директиву: до него - name, после него - value. Если name или value - пустые строки, то ошибка + DateTime ldt = DateTime.Now; PascalABCCompiler.StringResourcesLanguage.LoadDefaultConfig(); @@ -47,33 +117,72 @@ namespace PascalABCCompiler StringResourcesLanguage.CurrentLanguageName = StringResourcesLanguage.AccessibleLanguages[0]; //Console.WriteLine("OK {0}ms", (DateTime.Now - ldt).TotalMilliseconds); ldt = DateTime.Now; - + //ShowConnectedParsers(); - if (args.Length == 0) + var n = args.Length; + if (n == 0) { - Console.WriteLine(StringResourcesGet("COMMANDLINEISABSENT")); + //Console.WriteLine(StringResourcesGet("COMMANDLINEISABSENT")); + OutputHelp(); return 2; } - FileName = args[0]; + var n1 = args.TakeWhile(a => a[0] == '/').Count(); // количество директив + + if (n1 Project - a.pas + d:\a.pas