diff --git a/Compiler/Compiler.cs b/Compiler/Compiler.cs index 17ee77e54..27ca268eb 100644 --- a/Compiler/Compiler.cs +++ b/Compiler/Compiler.cs @@ -276,6 +276,7 @@ public enum OutputType { ClassLibrary = 0, ConsoleApplicaton = 1, WindowsApplica public bool ForIntellisense = false; public bool Rebuild = false; public bool Optimise = false; + public bool DisableStandardUnits = false; // true устанавливается соответствующей директивой public bool SavePCUInThreadPull = false; public bool RunWithEnvironment = false; public string CompiledUnitExtension = StringConstants.pascalCompiledUnitExtension; @@ -488,14 +489,12 @@ public class CompilerInternalDebug public bool CodeGeneration = true; public bool SemanticAnalysis = true; public bool PCUGenerate = true; - public bool AddStandartUnits = true; public bool SkipPCUErrors = true; public bool IncludeDebugInfoInPCU = true; public bool AlwaysGenerateXMLDoc = false; public bool SkipInternalErrorsIfSyntaxTreeIsCorrupt = true; public bool UseStandarParserForIntellisense = true; public bool RunOnMono = false; - public List DocumentedUnits = new List(); #if DEBUG public bool DebugVersion @@ -662,7 +661,7 @@ public SupportedSourceFile[] SupportedProjectFiles public List UnitsTopologicallySortedList = new List(); private List StandardModules = new List(); - public CompilerOptions CompilerOptions { get; set; } = new CompilerOptions(); + public CompilerOptions CompilerOptions { get; set; } private Dictionary DLLCache = new Dictionary(); @@ -802,6 +801,9 @@ public Compiler(ICompiler comp, SourceFilesProviderDelegate SourceFilesProvider, supportedSourceFiles = comp.SupportedSourceFiles; supportedProjectFiles = comp.SupportedProjectFiles; + + // 29.07.2024 EVA + CompilerOptions = new CompilerOptions(); } public Compiler(SourceFilesProviderDelegate SourceFilesProvider, ChangeCompilerStateEventDelegate ChangeCompilerState) @@ -828,6 +830,9 @@ public void Reload() Warnings.Clear(); InternalDebug = new CompilerInternalDebug(); + // 29.07.2024 EVA + CompilerOptions = new CompilerOptions(); + SaveUnitCheckInParsers(); SyntaxTreeToSemanticTreeConverter = new TreeConverter.SyntaxTreeToSemanticTreeConverter(); @@ -969,6 +974,9 @@ private void Reset() UnitsToCompileDelayedList.Clear(); DLLCache.Clear(); project = null; + + // обнуляем здесь, чтобы значение не сохранялось между запусками EVA + CompilerOptions.DisableStandardUnits = false; } void CheckErrorsAndThrowTheFirstOne() @@ -3049,8 +3057,14 @@ public unit_node_list GetReferences(CompilationUnit compilationUnit) directives = (compilationUnit.SemanticTree as common_unit_node).compiler_directives; else directives = GetDirectivesAsSemanticNodes(compilationUnit.SyntaxTree.compiler_directives, compilationUnit.SyntaxTree.file_name); + + DisablePABCRtlIfUsingDotnet5(directives); - AddReferencesToSystemUnits(compilationUnit, directives); + if (CompilerOptions.UseDllForSystemUnits) + { + directives.Add(new compiler_directive("reference", "%GAC%\\PABCRtl.dll", null, ".")); + AddReferencesToNetSystemLibraries(compilationUnit, directives); + } var referenceDirectives = new List(); foreach (compiler_directive directive in directives) @@ -3090,15 +3104,15 @@ public unit_node_list GetReferences(CompilationUnit compilationUnit) throw new CommonCompilerError(ex.Message, compilationUnit.SyntaxTree.file_name, reference.location.begin_line_num, reference.location.end_line_num); } } - - + + foreach (var reference in referenceDirectives) CompileReference(dlls, reference); return dlls; } - private void AddReferencesToSystemUnits(CompilationUnit compilationUnit, List directives) + private void DisablePABCRtlIfUsingDotnet5(List directives) { foreach (compiler_directive cd in directives) { @@ -3108,31 +3122,58 @@ private void AddReferencesToSystemUnits(CompilationUnit compilationUnit, List + /// Добавляет ссылки на стандартные системные dll .NET - версия с директивами уровня семантики + /// + /// + /// + private void AddReferencesToNetSystemLibraries(CompilationUnit compilationUnit, List directives) + { + IEnumerable librariesToAdd = StringConstants.netSystemLibraries.Select(dll => $"%GAC%\\{dll}") + .Except(directives.Where(directive => directive.name.Equals("reference", StringComparison.CurrentCultureIgnoreCase)) + .Select(directive => directive.directive), StringComparer.CurrentCultureIgnoreCase); + + directives.AddRange(librariesToAdd.Select(dll => new compiler_directive("reference", dll, null, "."))); + + if (compilationUnit.SyntaxTree is SyntaxTree.program_module program && program.used_units != null) { - directives.Add(new compiler_directive("reference", "%GAC%\\PABCRtl.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\mscorlib.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\System.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\System.Core.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\System.Numerics.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\System.Windows.Forms.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\System.Drawing.dll", null, ".")); - - if (compilationUnit.SyntaxTree is SyntaxTree.program_module && (compilationUnit.SyntaxTree as SyntaxTree.program_module).used_units != null) + var graph3DUnit = program.used_units.units.FirstOrDefault(u => u.name.ToString() == "Graph3D"); + if (graph3DUnit != null) { - foreach (SyntaxTree.unit_or_namespace usedUnit in (compilationUnit.SyntaxTree as SyntaxTree.program_module).used_units.units) - { - if (usedUnit.name.ToString() == "Graph3D") - { - directives.Add(new compiler_directive("reference", "%GAC%\\PresentationFramework.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\WindowsBase.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\PresentationCore.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\HelixToolkit.Wpf.dll", null, ".")); - directives.Add(new compiler_directive("reference", "%GAC%\\HelixToolkit.dll", null, ".")); + IEnumerable graphLibrariesToAdd = StringConstants.graph3DDependencies.Select(dll => $"%GAC%\\{dll}") + .Except(directives.Where(directive => directive.name.Equals("reference", StringComparison.CurrentCultureIgnoreCase)) + .Select(directive => directive.directive), StringComparer.CurrentCultureIgnoreCase); - break; - } - } + directives.AddRange(graphLibrariesToAdd.Select(dll => new compiler_directive("reference", dll, null, "."))); + } + } + } + + /// + /// Добавляет ссылки на стандартные системные dll .NET - версия с директивами уровня синтаксиса + /// + /// + /// + private void AddReferencesToNetSystemLibraries(CompilationUnit compilationUnit, List directives) + { + IEnumerable librariesToAdd = StringConstants.netSystemLibraries.Select(dll => $"%GAC%\\{dll}") + .Except(directives.Where(directive => directive.Name.text.Equals("reference", StringComparison.CurrentCultureIgnoreCase)) + .Select(directive => directive.Directive.text), StringComparer.CurrentCultureIgnoreCase); + + directives.AddRange(librariesToAdd.Select(dll => new SyntaxTree.compiler_directive(new SyntaxTree.token_info("reference"), new SyntaxTree.token_info(dll)))); + + if (compilationUnit.SyntaxTree is SyntaxTree.program_module program && program.used_units != null) + { + var graph3DUnit = program.used_units.units.FirstOrDefault(u => u.name.ToString() == "Graph3D"); + if (graph3DUnit != null) + { + IEnumerable graphLibrariesToAdd = StringConstants.graph3DDependencies.Select(dll => $"%GAC%\\{dll}") + .Except(directives.Where(directive => directive.Name.text.Equals("reference", StringComparison.CurrentCultureIgnoreCase)) + .Select(directive => directive.Directive.text), StringComparer.CurrentCultureIgnoreCase); + + directives.AddRange(graphLibrariesToAdd.Select(dll => new SyntaxTree.compiler_directive(new SyntaxTree.token_info("reference"), new SyntaxTree.token_info(dll)))); } } } @@ -3312,19 +3353,16 @@ public static bool IsDll(SyntaxTree.compilation_unit unitSyntaxTree) /// public static bool IsDll(SyntaxTree.compilation_unit unitSyntaxTree, out SyntaxTree.compiler_directive dllDirective) { - if (unitSyntaxTree != null) + foreach (SyntaxTree.compiler_directive directive in unitSyntaxTree.compiler_directives) { - foreach (SyntaxTree.compiler_directive directive in unitSyntaxTree.compiler_directives) + if (string.Equals(directive.Name.text, StringConstants.compiler_directive_apptype, StringComparison.CurrentCultureIgnoreCase) + && string.Equals(directive.Directive.text, "dll", StringComparison.CurrentCultureIgnoreCase)) { - if (string.Equals(directive.Name.text, "apptype", StringComparison.CurrentCultureIgnoreCase) - && string.Equals(directive.Directive.text, "dll", StringComparison.CurrentCultureIgnoreCase)) - { - dllDirective = directive; - return true; - } + dllDirective = directive; + return true; } } - + dllDirective = null; return false; } @@ -3377,7 +3415,7 @@ public CompilationUnit CompileUnit(unit_node_list unitsFromUsesSection, Dictiona return currentUnit; // нет pcu и модуль не откомпилирован => новый модуль EVA - InitializeNewUnit(unitFileName, unitId, ref currentUnit, ref docs); + InitializeNewUnit(unitFileName, unitId, ref currentUnit, out docs); } // формирование списков зависимостей текущего модуля (uses list, dll, пространства имен) @@ -3725,7 +3763,7 @@ private void SetUseDLLForSystemUnits(string currentDirectory, List - private void InitializeNewUnit(string unitFileName, string UnitId, ref CompilationUnit currentUnit, ref Dictionary docs) + private void InitializeNewUnit(string unitFileName, string UnitId, ref CompilationUnit currentUnit, out Dictionary docs) { currentUnit = new CompilationUnit(); if (firstCompilationUnit == null) @@ -3736,28 +3774,76 @@ private void InitializeNewUnit(string unitFileName, string UnitId, ref Compilati // запоминание языка currentUnit.Language = LanguageProvider.SelectLanguageByExtension(unitFileName); - OnChangeCompilerState(this, CompilerState.BeginCompileFile, unitFileName); // начало компиляции модуля + currentUnit.CaseSensitive = currentUnit.Language.CaseSensitive; + + // получение итогового синтаксического дерева после сахарных преобразований + ConstructSyntaxTreeAndRunSugarConversions(unitFileName, currentUnit, out docs); + + InitializeCompilerOptionsRelatedToStandardUnits(currentUnit.SyntaxTree); + + RunSemanticChecks(unitFileName, currentUnit); + + // местоположение этой строчки важно, потому что проверяется UnitTable.Count > 0 выше EVA + UnitTable[UnitId] = currentUnit; + + // здесь добавляем стандартные модули в секцию uses интерфейса + if (!CompilerOptions.DisableStandardUnits) + AddStandardUnitsToInterfaceUsesSection(currentUnit); + else + { + AddReferencesToNetSystemLibraries(currentUnit, currentUnit.SyntaxTree.compiler_directives); + } + } - #region SYNTAX TREE CONSTRUCTING + + /// + /// Строит синтаксическое дерево, бросает первую из найденных ошибок (если они есть) и запускает сахарные преобразования + /// + private void ConstructSyntaxTreeAndRunSugarConversions(string unitFileName, CompilationUnit currentUnit, out Dictionary docs) + { + OnChangeCompilerState(this, CompilerState.BeginCompileFile, unitFileName); // начало компиляции модуля + // получение синтаксического дерева string sourceText = GetSourceCode(unitFileName, currentUnit); currentUnit.SyntaxTree = ConstructSyntaxTree(unitFileName, currentUnit, sourceText); - #endregion - if (currentUnit.SyntaxTree is SyntaxTree.unit_module) - CompilerOptions.UseDllForSystemUnits = false; + // сопоставление нодам ошибок EVA + MatchSyntaxErrorsToBadNodes(currentUnit); - if (errorsList.Count == 0) // SSM 2/05/16 - для преобразования синтаксических деревьев извне (синтаксический сахар) - { - currentUnit.SyntaxTree = ConvertSyntaxTree(currentUnit.SyntaxTree, currentUnit.Language.SyntaxTreeConverters); - } + CheckErrorsAndThrowTheFirstOne(); + + // SSM 2/05/16 - для преобразования синтаксических деревьев извне (синтаксический сахар) + currentUnit.SyntaxTree = ConvertSyntaxTree(currentUnit.SyntaxTree, currentUnit.Language.SyntaxTreeConverters); // генерация документации к узлам синтаксического дерева EVA docs = GenUnitDocumentation(currentUnit, sourceText); + } - #region SEMANTIC CHECKS : DIRECTIVES AND OUTPUT FILE TYPE + /// + /// Устанавливает значения опций DisableStandardUnits и UseDllForSystemUnits + /// + private void InitializeCompilerOptionsRelatedToStandardUnits(SyntaxTree.compilation_unit unitSyntaxTree) + { + // проверяем только для основной программы или dll + if (UnitTable.Count == 0) + { + var disableStandardUnitsDirective = unitSyntaxTree.compiler_directives.Find(directive => + directive.Name.text.Equals(StringConstants.compiler_directive_disable_standard_units, StringComparison.CurrentCultureIgnoreCase)); + + if (disableStandardUnitsDirective != null) + CompilerOptions.DisableStandardUnits = true; + } + + if (unitSyntaxTree is SyntaxTree.unit_module) + CompilerOptions.UseDllForSystemUnits = false; + } + /// + /// Семантические проверки по директивам и по типу файла + /// + private void RunSemanticChecks(string unitFileName, CompilationUnit currentUnit) + { // SSM 21/05/20 Проверка, что мы не записали apptype dll в небиблиотеку bool isDll = IsDll(currentUnit.SyntaxTree, out var dllDirective); SemanticCheckDLLDirectiveOnlyForLibraries(currentUnit.SyntaxTree, isDll, dllDirective); @@ -3767,30 +3853,10 @@ private void InitializeNewUnit(string unitFileName, string UnitId, ref Compilati // ошибка директива include в паскалевском юните SemanticCheckNoIncludeNamespaceDirectivesInUnit(currentUnit); - #endregion - - if (isDll) - CompilerOptions.OutputFileType = CompilerOptions.OutputType.ClassLibrary; // есть также в конце Compile - - currentUnit.CaseSensitive = currentUnit.Language.CaseSensitive; - - // currentUnit.SyntaxUnitName = currentUnitNode; - // сопоставление нодам ошибок EVA - MatchErrorsToBadNodes(currentUnit); + SemanticCheckDisableStandardUnitsDirectiveInUnit(currentUnit.SyntaxTree); CheckErrorsAndThrowTheFirstOne(); - - // местоположение этой строчки важно, потому что проверяется UnitTable.Count > 0 выше EVA - UnitTable[UnitId] = currentUnit; - - // здесь добавляем стандартные модули в секцию uses интерфейса -#if DEBUG - if (InternalDebug.AddStandartUnits) -#endif - AddStandardUnitsToInterfaceUsesSection(currentUnit); - - currentUnit.possibleNamespaces.Clear(); } private SyntaxTree.compilation_unit ConvertSyntaxTree(SyntaxTree.compilation_unit syntaxTree, List converters) @@ -3828,7 +3894,7 @@ private void SemanticCheckCurrentUnitMustBeUnitModule(string UnitFileName, Compi } } - private void MatchErrorsToBadNodes(CompilationUnit currentUnit) + private void MatchSyntaxErrorsToBadNodes(CompilationUnit currentUnit) { if (errorsList.Count > 0) { @@ -3846,7 +3912,7 @@ private void MatchErrorsToBadNodes(CompilationUnit currentUnit) private void SemanticCheckDLLDirectiveOnlyForLibraries(SyntaxTree.compilation_unit unitSyntaxTree, bool isDll, SyntaxTree.compiler_directive dllDirective) { // Если Library и apptype dll не указано, то никакой ошибки нет EVA - if (unitSyntaxTree != null && isDll) + if (isDll) { if (!(unitSyntaxTree is SyntaxTree.unit_module) || (unitSyntaxTree is SyntaxTree.unit_module unitNode && unitNode.unit_name.HeaderKeyword != SyntaxTree.UnitHeaderKeyword.Library)) @@ -3857,6 +3923,25 @@ private void SemanticCheckDLLDirectiveOnlyForLibraries(SyntaxTree.compilation_un } } + /// + /// Ошибка указания директивы DisableStandardUnits в подключенном модулей + /// + /// + private void SemanticCheckDisableStandardUnitsDirectiveInUnit(SyntaxTree.compilation_unit unitSyntaxTree) + { + // проверяем для используемых модулей + if (UnitTable.Count > 0) + { + var foundDirective = unitSyntaxTree.compiler_directives.Find(directive => + directive.Name.text.Equals(StringConstants.compiler_directive_disable_standard_units, StringComparison.CurrentCultureIgnoreCase)); + + if (foundDirective != null) + { + ErrorsList.Add(new DisableStandardUnitsDirectiveDisallowedInUsedUnits(unitSyntaxTree.file_name, foundDirective.source_context)); + } + } + } + private SyntaxTree.compilation_unit ConstructSyntaxTree(string unitFileName, CompilationUnit currentUnit, string sourceText) { List DefinesList = new List { "PASCALABC" }; @@ -3914,7 +3999,7 @@ private bool CurrentUnitIsNotMainProgram() { Dictionary docs = null; - if (errorsList.Count == 0 && IsDocumentationNeeded(currentUnit.SyntaxTree)) + if (IsDocumentationNeeded(currentUnit.SyntaxTree)) { if (SourceText != null) { @@ -3987,9 +4072,6 @@ private bool IsDocumentationNeeded(SyntaxTree.compilation_unit unitSyntaxTree) if (unitSyntaxTree == null) return false; - if (unitSyntaxTree.file_name != null && internalDebug.DocumentedUnits.Contains(unitSyntaxTree.file_name.ToLower())) - return true; - foreach (SyntaxTree.compiler_directive directive in unitSyntaxTree.compiler_directives) { if (string.Equals(directive.Name.text, "gendoc", StringComparison.CurrentCultureIgnoreCase) diff --git a/Compiler/Errors.cs b/Compiler/Errors.cs index f0b5aa8a2..071f9b9ac 100644 --- a/Compiler/Errors.cs +++ b/Compiler/Errors.cs @@ -85,6 +85,18 @@ public AppTypeDllIsAllowedOnlyForLibraries(string FileName, SyntaxTree.SourceCon } } + /// + /// Бросается при обраружении директивы {$DisableStandardUnits} в подключенном модуле + /// + public class DisableStandardUnitsDirectiveDisallowedInUsedUnits : CompilerThrownError + { + public DisableStandardUnitsDirectiveDisallowedInUsedUnits(string FileName, SyntaxTree.SourceContext sc) + : base(StringResources.Get("COMPILATIONERROR_DISABLE_STANDARD_UNITS_DIRECTIVE_DISALLOWED_IN_USED_UNITS"), FileName) + { + this.source_context = sc; + } + } + /// /// Бросается при компиляции библиотеки не первой /// diff --git a/Parsers/PascalABCParserNewSaushkin/Parser.cs b/Parsers/PascalABCParserNewSaushkin/Parser.cs index 7695e5c39..78ec587f4 100644 --- a/Parsers/PascalABCParserNewSaushkin/Parser.cs +++ b/Parsers/PascalABCParserNewSaushkin/Parser.cs @@ -122,6 +122,7 @@ private void InitializeValidDirectives() [StringConstants.compiler_directive_include] = new DirectiveInfo(quotesAreSpecialSymbols: true), [StringConstants.compiler_directive_targetframework] = new DirectiveInfo(), [StringConstants.compiler_directive_hidden_idents] = NoParamsDirectiveInfo(), + [StringConstants.compiler_directive_disable_standard_units] = NoParamsDirectiveInfo(), [StringConstants.compiler_directive_version_string] = new DirectiveInfo(IsValidVersionCheck()), [StringConstants.compiler_directive_product_string] = new DirectiveInfo(quotesAreSpecialSymbols: true), [StringConstants.compiler_directive_company_string] = new DirectiveInfo(quotesAreSpecialSymbols: true), diff --git a/PascalABCNET.sln b/PascalABCNET.sln index 047776b8e..0674cebc6 100644 --- a/PascalABCNET.sln +++ b/PascalABCNET.sln @@ -39,8 +39,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SyntaxTreeVisualisator", "V EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PT4Provider", "VisualPlugins\PT4Provider\PT4Provider.csproj", "{4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelpBuilder", "VisualPlugins\HelpBuilder\HelpBuilder.csproj", "{FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{F8CE2712-826B-450B-A72F-D32D80C99858}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Compiler", "Compiler\Compiler.csproj", "{1E42361A-EDA3-4872-88AF-A3AAF600D36D}" @@ -203,16 +201,6 @@ Global {4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU {4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|Mixed Platforms.Build.0 = Release|Any CPU {4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D}.Release|x86.ActiveCfg = Release|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Debug|x86.ActiveCfg = Debug|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|Any CPU.Build.0 = Release|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|Mixed Platforms.Build.0 = Release|Any CPU - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF}.Release|x86.ActiveCfg = Release|Any CPU {1E42361A-EDA3-4872-88AF-A3AAF600D36D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {1E42361A-EDA3-4872-88AF-A3AAF600D36D}.Debug|Any CPU.Build.0 = Debug|Any CPU {1E42361A-EDA3-4872-88AF-A3AAF600D36D}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU @@ -549,7 +537,6 @@ Global {A36031B7-D3D1-4372-B478-07621069602E} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7} {1437FD01-0741-4912-8035-6BDFEAA45626} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7} {4A9AC1AA-698E-49C2-B1ED-15B5E4AB963D} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7} - {FFF73A7C-22E5-4BB6-B7AA-6A0DC970DFDF} = {EC68A3D8-6D63-4A79-ABA6-BF8E9D7756D7} {1E42361A-EDA3-4872-88AF-A3AAF600D36D} = {F8CE2712-826B-450B-A72F-D32D80C99858} {A25D26FB-3043-4BCF-833E-E3F4C3BE795E} = {F8CE2712-826B-450B-A72F-D32D80C99858} {7FE7173B-22EB-46E5-897B-02F422662E51} = {F8CE2712-826B-450B-A72F-D32D80C99858} diff --git a/StringConstants/StringConstants.cs b/StringConstants/StringConstants.cs index e580a8ff4..3958ded8b 100644 --- a/StringConstants/StringConstants.cs +++ b/StringConstants/StringConstants.cs @@ -317,33 +317,34 @@ public static string GetSetTypeName(string elem_type_name) public static string default_constructor_name = "create"; #region PASCAL COMPILER DIRECTIVES - public static string compiler_directive_apptype = "apptype"; - public static string compiler_directive_reference = "reference"; - public static string compiler_directive_include_namespace = "includenamespace"; - public static string compiler_directive_savepcu = "savepcu"; - public static string compiler_directive_zerobasedstrings = "zerobasedstrings"; - public static string compiler_directive_zerobasedstrings_ON = "string_zerobased+"; - public static string compiler_directive_zerobasedstrings_OFF = "string_zerobased-"; - public static string compiler_directive_nullbasedstrings_ON = "string_nullbased+"; // для совместимости. Deprecated - public static string compiler_directive_nullbasedstrings_OFF = "string_nullbased-"; // для совместимости. Deprecated - public static string compiler_directive_initstring_as_empty_ON = "string_initempty+"; - public static string compiler_directive_initstring_as_empty_OFF = "string_initempty-"; - public static string compiler_directive_resource = "resource"; - public static string compiler_directive_platformtarget = "platformtarget"; - public static string compiler_directive_faststrings = "faststrings"; - public static string compiler_directive_gendoc = "gendoc"; - public static string compiler_directive_region = "region"; - public static string compiler_directive_endregion = "endregion"; - public static string compiler_directive_ifdef = "ifdef"; - public static string compiler_directive_endif = "endif"; - public static string compiler_directive_ifndef = "ifndef"; - public static string compiler_directive_else = "else"; - public static string compiler_directive_undef = "undef"; - public static string compiler_directive_define = "define"; - public static string compiler_directive_include = "include"; - public static string compiler_directive_targetframework = "targetframework"; - public static string compiler_directive_hidden_idents = "hiddenidents"; - public static string compiler_directive_omp = "omp"; + public const string compiler_directive_apptype = "apptype"; + public const string compiler_directive_reference = "reference"; + public const string compiler_directive_include_namespace = "includenamespace"; + public const string compiler_directive_savepcu = "savepcu"; + public const string compiler_directive_zerobasedstrings = "zerobasedstrings"; + public const string compiler_directive_zerobasedstrings_ON = "string_zerobased+"; + public const string compiler_directive_zerobasedstrings_OFF = "string_zerobased-"; + public const string compiler_directive_nullbasedstrings_ON = "string_nullbased+"; // для совместимости. Deprecated + public const string compiler_directive_nullbasedstrings_OFF = "string_nullbased-"; // для совместимости. Deprecated + public const string compiler_directive_initstring_as_empty_ON = "string_initempty+"; + public const string compiler_directive_initstring_as_empty_OFF = "string_initempty-"; + public const string compiler_directive_resource = "resource"; + public const string compiler_directive_platformtarget = "platformtarget"; + public const string compiler_directive_faststrings = "faststrings"; + public const string compiler_directive_gendoc = "gendoc"; + public const string compiler_directive_region = "region"; + public const string compiler_directive_endregion = "endregion"; + public const string compiler_directive_ifdef = "ifdef"; + public const string compiler_directive_endif = "endif"; + public const string compiler_directive_ifndef = "ifndef"; + public const string compiler_directive_else = "else"; + public const string compiler_directive_undef = "undef"; + public const string compiler_directive_define = "define"; + public const string compiler_directive_include = "include"; + public const string compiler_directive_targetframework = "targetframework"; + public const string compiler_directive_hidden_idents = "hiddenidents"; + public const string compiler_directive_disable_standard_units = "disablestandardunits"; + public const string compiler_directive_omp = "omp"; public const string compiler_directive_version_string = "version"; public const string compiler_directive_product_string = "product"; public const string compiler_directive_company_string = "company"; @@ -372,6 +373,10 @@ public static string GetSetTypeName(string elem_type_name) public const string pascalLanguageDllName = "PascalLanguage.dll"; #endregion + public static readonly string[] netSystemLibraries = new[] { "mscorlib.dll", "System.dll", "System.Core.dll", "System.Numerics.dll", "System.Windows.Forms.dll", "System.Drawing.dll" }; + + public static readonly string[] graph3DDependencies = new[] { "PresentationFramework.dll", "WindowsBase.dll", "PresentationCore.dll", "HelixToolkit.Wpf.dll", "HelixToolkit.dll" }; + public static string get_array_type_name(string type_name, int rank) { if (rank == 1) diff --git a/TreeConverter/TreeRealization/programs.cs b/TreeConverter/TreeRealization/programs.cs index 6260db2a0..152d0f15d 100644 --- a/TreeConverter/TreeRealization/programs.cs +++ b/TreeConverter/TreeRealization/programs.cs @@ -317,7 +317,7 @@ public void create_main_function(string[] used_stand_modules, Dictionary