// Обработчик изменения состояния компилятора void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: BuildButtonsEnabled = false; this.Refresh(); break; case PascalABCCompiler.CompilerState.CompilationFinished: /* * TemplateButtonEnabled = false; * ShowTree(); * asp_count = this.treeView.Nodes.Count; * SaveButtonsEnabled = true; * if (asp_count <= 1) * { * BuildButtonsEnabled = true; * TemplateButtonEnabled = true; * SaveButtonsEnabled = false; * SaveOneButtonEnabled = false; * treeView.Nodes.Clear(); * treeView.Invalidate(); * treeView.Refresh(); * treeView.Update(); * AspectPreprocessorReset(); * } */ break; } }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { if (State == PascalABCCompiler.CompilerState.CodeGeneration) { LastGeneratedFile = FileName; } }
void CompilationOnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { switch (State) { case PascalABCCompiler.CompilerState.CompilationFinished: Workbench.VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate = __savePCU; if (__RuntimeServicesModule != null) { CompilerOptions1.RemoveStandartModuleAtIndex(CompilerOptions1.StandartModules.Count - 1); } if (Workbench.VisualEnvironmentCompiler.Compiler.ErrorsList.Count != 0 || Workbench.VisualEnvironmentCompiler.Compiler.Warnings.Count != 0) { List <PascalABCCompiler.Errors.Error> ErrorsAndWarnings = new List <PascalABCCompiler.Errors.Error>(); List <PascalABCCompiler.Errors.Error> Errors = Workbench.ErrorsManager.CreateErrorsList(Workbench.VisualEnvironmentCompiler.Compiler.ErrorsList); AddErrors(ErrorsAndWarnings, Errors); //if (!ForRun) AddWarnings(ErrorsAndWarnings, Workbench.VisualEnvironmentCompiler.Compiler.Warnings); Workbench.ErrorsListWindow.ShowErrorsSync(ErrorsAndWarnings, Errors.Count != 0 || (Workbench.VisualEnvironmentCompiler.Compiler.Warnings.Count != 0 && !__ForRun)); } Workbench.VisualEnvironmentCompiler.Compiler.OnChangeCompilerState -= CompilationOnChangeCompilerState; break; } }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: FirstCompiledFileName = FileName; break; case PascalABCCompiler.CompilerState.ReadPCUFile: case PascalABCCompiler.CompilerState.BeginCompileFile: if (Path.GetFileNameWithoutExtension(FileName.ToLower()) == PT4Provider.Constants.PT4UnitName) { PT4UnitUsed = true; } break; case PascalABCCompiler.CompilerState.CodeGeneration: if (CompiledProgrammsWithPT4Unit.ContainsKey(FileName)) { CompiledProgrammsWithPT4Unit.Remove(FileName); } if (FirstCompiledFileName != null && PT4UnitUsed) { CompiledProgrammsWithPT4Unit.Add(FileName, FirstCompiledFileName); } break; case PascalABCCompiler.CompilerState.CompilationFinished: FirstCompiledFileName = null; PT4UnitUsed = false; break; } }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { if (!Visible) { return; } switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: BuildButtonsEnabled = syntaxTreeSelectComboBox.Enabled = false; this.Refresh(); break; case PascalABCCompiler.CompilerState.CompilationFinished: Errors.Clear(); if (VisualEnvironmentCompiler.Compiler.ErrorsList.Count > 0) { SyntaxError er; for (int i = 0; i < VisualEnvironmentCompiler.Compiler.ErrorsList.Count; i++) { er = VisualEnvironmentCompiler.Compiler.ErrorsList[i] as SyntaxError; if (er != null && er.bad_node != null) { Errors[er.bad_node] = i; } } } UpdateSelectList(); ShowTree(); BuildButtonsEnabled = true; break; } }
public SemanticTree.IProgramNode Convert(PascalABCCompiler.ICompiler Compiler, SemanticTree.IProgramNode ProgramNode) { Optimizer Optimizer = new Optimizer(); Compiler.AddWarnings(Optimizer.Optimize(ProgramNode as TreeRealization.program_node)); return(ProgramNode); }
void Compiler_OnChangeCompilerStateSync(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { if (this.Visible) { BeginInvoke(new OnChangeCompilerStateDelegate(Compiler_OnChangeCompilerState), sender, State, FileName); } }
void AddCompilerTextToCompilerMessages(PascalABCCompiler.ICompiler sender, string text) { if (sender.CompilerType == PascalABCCompiler.CompilerType.Standart) { AddTextToCompilerMessages(VECStringResources.Get("LOCAL_COMPILER_PREFIX") + text); } else { AddTextToCompilerMessages(VECStringResources.Get("REMOTE_COMPILER_PREFIX") + text); } }
private void OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { if (CurrentThreadIsMainThread()) { OnChangeCompilerStateEx(sender, State, FileName); } else { BeginInvoke(new ChangeCompilerStateDelegate(OnChangeCompilerStateEx), sender, State, FileName); } }
internal void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: SetStartCompilingButtonsEnabled(false); break; case PascalABCCompiler.CompilerState.CompilationFinished: this.builder.parser.SetSemanticTree(sender.SemanticTree); SetStartCompilingButtonsEnabled(true); break; } }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: BuildButtonsEnabled = false; this.Refresh(); break; case PascalABCCompiler.CompilerState.CompilationFinished: ShowTree(); BuildButtonsEnabled = true; break; } }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { string text; if (State == PascalABCCompiler.CompilerState.CompilationStarting || State == PascalABCCompiler.CompilerState.Reloading) { //CompilerConsole.Clear(); dt = DateTime.Now; if (OnRebuld.Checked) { VisualEnvironmentCompiler.Compiler.CompilerOptions.Rebuild = true; } } text = State.ToString(); if (FileName != null) { text += " " + System.IO.Path.GetFileName(FileName) + "..."; } if (State == PascalABCCompiler.CompilerState.Ready) { if (VisualEnvironmentCompiler.Compiler.ErrorsList.Count > 0) { text += string.Format(" [{0} errors]", VisualEnvironmentCompiler.Compiler.ErrorsList.Count); } text += string.Format(" [{0}ms]", (int)(DateTime.Now - dt).TotalMilliseconds); if (sender == VisualEnvironmentCompiler.RemoteCompiler) { text += string.Format(Environment.NewLine + "WorkingSet {0}", VisualEnvironmentCompiler.RemoteCompiler.RemoteCompilerWorkingSet / 1024 / 1024); } NoSavePCU.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate; NoSemantic.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SemanticAnalysis; NoCodeGeneration.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.CodeGeneration; NoAddStandartUnits.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.AddStandartUnits; NoSkipPCUErrors.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SkipPCUErrors; NoSkipInternalErrorsIfSyntaxTreeIsCorrupt.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.SkipInternalErrorsIfSyntaxTreeIsCorrupt; NoIncludeDebugInfoInPCU.Checked = !VisualEnvironmentCompiler.Compiler.InternalDebug.IncludeDebugInfoInPCU; cbUseStandarParserForInellisense.Checked = VisualEnvironmentCompiler.Compiler.InternalDebug.UseStandarParserForIntellisense; //OnRebuld.Checked = VisualEnvironmentCompiler.Compiler.CompilerOptions.Rebuild; } text += Environment.NewLine; if (sender.CompilerType == PascalABCCompiler.CompilerType.Remote) { text = "[remote]" + text; } CompilerConsole.AppendText(text); CompilerConsole.SelectionStart = CompilerConsole.Text.Length; CompilerConsole.ScrollToCaret(); }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { States += State.ToString(); if (FileName != null) { States += " " + System.IO.Path.GetFileName(FileName); } States += Environment.NewLine; switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: FileNames.Clear(); States = ""; break; case PascalABCCompiler.CompilerState.BeginCompileFile: FileNames.Add(FileName); break; case PascalABCCompiler.CompilerState.ReadPCUFile: FileNames.Add(FileName); FileNames.Add(System.IO.Path.ChangeExtension(FileName, ".pas")); break; case PascalABCCompiler.CompilerState.Ready: foreach (PascalABCCompiler.Errors.Error error in VisualEnvironmentCompiler.Compiler.ErrorsList) { if (error is PascalABCCompiler.Errors.CompilerInternalError) { ReportText = DateTime.Now.ToString() + Environment.NewLine; ReportText += GetInfo() + Environment.NewLine; ReportText += "StatesList: " + Environment.NewLine + States + Environment.NewLine; for (int i = 0; i < VisualEnvironmentCompiler.Compiler.ErrorsList.Count; i++) { ReportText += string.Format("Error[{0}]: {1}{2}", i, VisualEnvironmentCompiler.Compiler.ErrorsList[i].ToString(), Environment.NewLine); } CompilerInternalErrorReport.ErrorMessage.Text = error.ToString(); CompilerInternalErrorReport.ReportText = ReportText; CompilerInternalErrorReport.FileNames = FileNames; CompilerInternalErrorReport.VEC = VisualEnvironmentCompiler; CompilerInternalErrorReport.ShowDialog(); return; } } break; } }
private void AboutBox_Shown(object sender, EventArgs e) { lVersion.Text = string.Format("{0}, сборка {1} ({2})", PascalABCCompiler.Compiler.ShortVersion, RevisionClass.Revision, PascalABCCompiler.Compiler.VersionDateTime.ToShortDateString()); dgvModules.Items.Clear(); string apppatch = Path.GetDirectoryName(Application.ExecutablePath); VisualEnvironmentCompiler vec = (Owner as Form1).VisualEnvironmentCompiler; PascalABCCompiler.ICompiler comp = vec.StandartCompiler; if (comp != null) { Assembly a = Assembly.GetAssembly(comp.GetType()); dgvModules.Items.Add(MakeItem("Core", "PascalABCCompiler.Core", a.GetName().Version.ToString(), "Copyright © 2005-2016 by Ivan Bondarev, Stanislav Mihalkovich")); foreach (PascalABCCompiler.Parsers.IParser parser in comp.ParsersController.Parsers) { dgvModules.Items.Add(MakeItem("Parser", parser.Name, parser.Version, parser.Copyright)); } foreach (PascalABCCompiler.SemanticTreeConverters.ISemanticTreeConverter conv in comp.SemanticTreeConvertersController.SemanticTreeConverters) { dgvModules.Items.Add(MakeItem("Converter", conv.Name, conv.Version, conv.Copyright)); } foreach (VisualPascalABCPlugins.IVisualPascalABCPlugin plugin in vec.PluginsController.Plugins) { dgvModules.Items.Add(MakeItem("Plugin", plugin.Name, plugin.Version, plugin.Copyright)); } } dgvModules.Items.Add(MakeItem(Assembly.LoadFile(Path.Combine(apppatch, "ICSharpCode.TextEditor.dll")))); dgvModules.Items.Add(MakeItem(Assembly.LoadFile(Path.Combine(apppatch, "Debugger.Core.dll")))); dgvModules.Items.Add(MakeItem(Assembly.LoadFile(Path.Combine(apppatch, "WeifenLuo.WinFormsUI.Docking.dll")))); ActiveControl = button1; /*lbComponents.Items.Clear(); * PascalABCCompiler.Compiler comp = (Owner as Form1).VisualEnvironmentCompiler.Compiler; * if (comp != null) * { * lbComponents.Items.Add(BuildComponentString(comp)); * foreach (PascalABCCompiler.ParserTools.BaseParser parser in comp.ParsersController.Parsers) * lbComponents.Items.Add("Language: "+BuildComponentString(parser)); * foreach (VisualPascalABCPlugins.IVisualPascalABCPlugin plugin in (Owner as Form1).VisualEnvironmentCompiler.PluginsController.Plugins) * lbComponents.Items.Add("Plugin: "+BuildComponentString(plugin)); * foreach (PascalABCCompiler.SemanticTreeConverters.ISemanticTreeConverter conv in (Owner as Form1).VisualEnvironmentCompiler.Compiler.SemanticTreeConvertersController.SemanticTreeConverters) * lbComponents.Items.Add("Converter: " + BuildComponentString(conv)); * * }*/ }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { if (!MyCompilation) { return; } switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: //this.Refresh(); break; case PascalABCCompiler.CompilerState.CompilationFinished: ConvertSourceText(); MyCompilation = false; break; } }
private void OnChangeCompilerStateEx(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FullFileName) { string RusName = null; string FileName = null; if (FullFileName != null) { FileName = Path.GetFileName(FullFileName); } switch (State) { case PascalABCCompiler.CompilerState.CompilationStarting: RusName = VECStringResources.Get("STATE_START_COMPILING_ASSEMBLY{0}"); SetCompilingButtonsEnabled(false); ParsedFiles.Clear(); break; case PascalABCCompiler.CompilerState.BeginCompileFile: RusName = VECStringResources.Get("STATE_BEGINCOMPILEFILE{0}"); break; case PascalABCCompiler.CompilerState.CompileInterface: RusName = VECStringResources.Get("STATE_COMPILEINTERFACE{0}"); break; case PascalABCCompiler.CompilerState.CompileImplementation: RusName = VECStringResources.Get("STATE_COMPILEIMPLEMENTATION{0}"); break; case PascalABCCompiler.CompilerState.EndCompileFile: RusName = VECStringResources.Get("STATE_ENDCOMPILEFILE{0}"); break; case PascalABCCompiler.CompilerState.CodeGeneration: RusName = VECStringResources.Get("STATE_CODEGENERATION{0}"); break; case PascalABCCompiler.CompilerState.ReadDLL: RusName = VECStringResources.Get("STATE_READDLL{0}"); break; case PascalABCCompiler.CompilerState.SavePCUFile: RusName = VECStringResources.Get("STATE_SAVEPCUFILE{0}"); break; case PascalABCCompiler.CompilerState.ReadPCUFile: RusName = VECStringResources.Get("STATE_READPCUFILE{0}"); break; case PascalABCCompiler.CompilerState.PCUReadingError: RusName = VECStringResources.Get("STATE_PCUREADINGERROR{0}"); break; case PascalABCCompiler.CompilerState.PCUWritingError: RusName = VECStringResources.Get("STATE_PCUWRITINGERROR{0}"); break; case PascalABCCompiler.CompilerState.SemanticTreeConversion: RusName = VECStringResources.Get("STATE_SEMANTICTREECONVERSION{0}"); break; case PascalABCCompiler.CompilerState.SemanticTreeConverterConnected: RusName = VECStringResources.Get("STATE_SEMANTICTREECONVERTERCONNECTED{0}"); break; case PascalABCCompiler.CompilerState.SyntaxTreeConversion: RusName = VECStringResources.Get("STATE_SYNTAXTREECONVERSION{0}"); break; case PascalABCCompiler.CompilerState.SyntaxTreeConverterConnected: RusName = VECStringResources.Get("STATE_SYNTAXTREECONVERTERCONNECTED{0}"); break; case PascalABCCompiler.CompilerState.ParserConnected: FileName = Path.GetFileName(FileName); if (sender.CompilerType == PascalABCCompiler.CompilerType.Standart) { RusName = string.Format(VECStringResources.Get("PARSER_CONNECTED{0}{1}"), sender.ParsersController.LastParser, FileName); } else { RusName = string.Format(VECStringResources.Get("PARSER_CONNECTED{0}"), FileName); } FileName = null; break; case PascalABCCompiler.CompilerState.Ready: RusName = VECStringResources.Get("STATE_READY"); if (!StartingCompleted) { switch (sender.CompilerType) { case PascalABCCompiler.CompilerType.Standart: standartCompiler = (PascalABCCompiler.Compiler)sender; break; case PascalABCCompiler.CompilerType.Remote: remoteCompiler = (PascalABCCompiler.RemoteCompiler)sender; break; } if (!(defaultCompilerType == PascalABCCompiler.CompilerType.Remote) || (standartCompiler.State == PascalABCCompiler.CompilerState.Ready && (remoteCompiler != null && remoteCompiler.State == PascalABCCompiler.CompilerState.Ready))) { StartingCompleted = true; } AddCompilerTextToCompilerMessages(sender, VECStringResources.Get("SUPPORTED_LANGUAGES") + Environment.NewLine); foreach (PascalABCCompiler.SupportedSourceFile ssf in standartCompiler.SupportedSourceFiles) { AddCompilerTextToCompilerMessages(sender, string.Format(VECStringResources.Get("CM_LANGUAGE_{0}"), ssf) + Environment.NewLine); } if (StartingCompleted) { ChangeVisualEnvironmentState(VisualEnvironmentState.FinishCompilerLoading, standartCompiler); compilerLoaded = true; VisualPABCSingleton.MainForm.StartTimer(); /*if (!ThreadPool.QueueUserWorkItem(new WaitCallback(CompileTestProgram))) * CompileTestProgram(null);*/ if (!ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPlugins))) { LoadPlugins(null); } SetCompilingButtonsEnabled(true); SetDebugButtonsEnabled(true); } } else { if (Compiler == sender) { SetCompilingButtonsEnabled(true); } } break; case PascalABCCompiler.CompilerState.Reloading: if (Compiler == sender) { SetCompilingButtonsEnabled(false); } RusName = VECStringResources.Get("STATE_RELOADING"); break; case PascalABCCompiler.CompilerState.CompilationFinished: RusName = VECStringResources.Get("STATE_COMPILATIONFINISHED{0}"); if (Compiler.ErrorsList.Count == 0) { SaveSourceFilesIfCompilationOk(); AddTextToCompilerMessages(string.Format(VECStringResources.Get("CM_OK_{0}MS") + Environment.NewLine, (DateTime.Now - compilationStartTime).TotalMilliseconds) + Environment.NewLine); } else { List <PascalABCCompiler.Errors.Error> ErrorsList = ErrorsManager.CreateErrorsList(Compiler.ErrorsList); AddTextToCompilerMessages(string.Format(VECStringResources.Get("CM_{0}_ERROS") + Environment.NewLine, ErrorsList.Count)); foreach (PascalABCCompiler.Errors.Error Err in ErrorsList) { AddTextToCompilerMessages(Err.ToString() + Environment.NewLine); } } break; default: //RusName = State.ToString(); break; } if (RusName != null) { if (FileName != null) { RusName = string.Format(RusName, FileName); } else { RusName = string.Format(RusName, ""); } RusName += Environment.NewLine; AddCompilerTextToCompilerMessages(sender, RusName); } RusName = null; switch (State) { case PascalABCCompiler.CompilerState.BeginParsingFile: ParsedFiles.Add(FullFileName); break; case PascalABCCompiler.CompilerState.BeginCompileFile: RusName = VECStringResources.Get("STATETEXT_BEGINCOMPILEFILE{0}"); break; //case PascalABCCompiler.CompilerState.ReadPCUFile: RusName = "Чтение {0}..."; break; case PascalABCCompiler.CompilerState.CodeGeneration: RusName = VECStringResources.Get("STATETEXT_CODEGENERATION{0}"); break; //case PascalABCCompiler.CompilerState.ReadDLL: //case PascalABCCompiler.CompilerState.ReadPCUFile: RusName = "Чтение {0}..."; break; case PascalABCCompiler.CompilerState.Ready: if (Compiler != null) { List <PascalABCCompiler.Errors.Error> ErrorsList = ErrorsManager.CreateErrorsList(Compiler.ErrorsList); if (ErrorsList.Count > 0) { RusName = string.Format(VECStringResources.Get("STATETEXT_{0}_ERROS"), ErrorsList.Count); } else if (Compilation) { if (Compiler.Warnings.Count > 0) { RusName = string.Format(VECStringResources.Get("STATETEXT_COMPILATION_SUCCESS_{0}LINES_{1}WARNINGS"), Compiler.LinesCompiled, Compiler.Warnings.Count); } else { RusName = string.Format(VECStringResources.Get("STATETEXT_COMPILATION_SUCCESS_{0}LINES"), Compiler.LinesCompiled); } } else { RusName = VECStringResources.Get("STATETEXT_READY"); } } else { RusName = VECStringResources.Get("STATETEXT_READY"); } break; case PascalABCCompiler.CompilerState.Reloading: RusName = VECStringResources.Get("STATETEXT_RELOADING"); break; } if (RusName != null) { if (FileName != null) { RusName = string.Format(RusName, FileName); } SetStateText(RusName); } if (!Compilation && State == PascalABCCompiler.CompilerState.CompilationStarting) { Compilation = true; } if (Compilation && State == PascalABCCompiler.CompilerState.Ready) { Compilation = false; } }
void Compiler_OnChangeCompilerState(PascalABCCompiler.ICompiler sender, PascalABCCompiler.CompilerState State, string FileName) { //compiler states }