예제 #1
0
 public void LoadOptions(PascalABCCompiler.IProjectInfo prj)
 {
     proj = prj;
     this.cbDeleteExe.Checked = prj.DeleteEXE;
     this.cbDeletePdb.Checked = prj.DeletePDB;
     if (prj.IncludeDebugInfo)
     {
         this.cbDebugRelease.SelectedIndex = 0;
     }
     else
     {
         this.cbDebugRelease.SelectedIndex = 1;
     }
     this.tbOutputDirectory.Text = prj.OutputDirectory;
     this.tbRunArguments.Text    = prj.CommandLineArguments;
     if (!string.IsNullOrEmpty(prj.AppIcon))
     {
         this.tbAppIcon.Text = prepare_icon_name(prj.AppIcon);
     }
     this.tbMajor.Text             = Convert.ToString(prj.MajorVersion);
     this.tbMinor.Text             = Convert.ToString(prj.MinorVersion);
     this.tbBuild.Text             = Convert.ToString(prj.BuildVersion);
     this.tbRevision.Text          = Convert.ToString(prj.RevisionVersion);
     this.cbGenerateXmlDoc.Checked = prj.GenerateXMLDoc;
     this.tbProduct.Text           = prj.Product;
     this.tbCompany.Text           = prj.Company;
     this.tbTradeMark.Text         = prj.Trademark;
     this.tbCopyright.Text         = prj.Copyright;
     //if (prj.Title != null) { this.tbTitle.Text = prj.Description; } else { this.tbTitle.Text = ""; };
     //if (prj.Description != null) { this.tbDescription.Text = prj.Description; } else { this.tbDescription.Text = ""; };
 }
예제 #2
0
 public void SetOptions(PascalABCCompiler.IProjectInfo prj)
 {
     prj.DeleteEXE            = this.cbDeleteExe.Checked;
     prj.DeletePDB            = this.cbDeletePdb.Checked;
     prj.IncludeDebugInfo     = this.cbDebugRelease.SelectedIndex == 0;
     prj.OutputDirectory      = this.tbOutputDirectory.Text;
     prj.CommandLineArguments = this.tbRunArguments.Text;
     if (!string.IsNullOrEmpty(this.tbAppIcon.Text))
     {
         /*if (File.Exists(this.tbAppIcon.Text))
          *  prj.AppIcon = this.tbAppIcon.Text;
          * else*/
         prj.AppIcon = Path.Combine(prj.ProjectDirectory, this.tbAppIcon.Text);
     }
     else
     {
         prj.AppIcon = null;
     }
     prj.MajorVersion    = Convert.ToInt32(this.tbMajor.Text);
     prj.MinorVersion    = Convert.ToInt32(this.tbMinor.Text);
     prj.BuildVersion    = Convert.ToInt32(this.tbBuild.Text);
     prj.RevisionVersion = Convert.ToInt32(this.tbRevision.Text);
     prj.GenerateXMLDoc  = this.cbGenerateXmlDoc.Checked;
     prj.Product         = this.tbProduct.Text;
     prj.Company         = this.tbCompany.Text;
     prj.Trademark       = this.tbTradeMark.Text;
     prj.Copyright       = this.tbCopyright.Text;
     //prj.Title = this.tbTitle.Text;
     //prj.Description = this.tbDescription.Text;
 }
예제 #3
0
 public void LoadOptions(PascalABCCompiler.IProjectInfo prj)
 {
     proj = prj;
     this.cbDeleteExe.Checked = prj.DeleteEXE;
     this.cbDeletePdb.Checked = prj.DeletePDB;
     if (prj.IncludeDebugInfo)
         this.cbDebugRelease.SelectedIndex = 0;
     else
         this.cbDebugRelease.SelectedIndex = 1;
     this.tbOutputDirectory.Text = prj.OutputDirectory;
     this.tbRunArguments.Text = prj.CommandLineArguments;
     if (!string.IsNullOrEmpty(prj.AppIcon))
     {
         this.tbAppIcon.Text = prepare_icon_name(prj.AppIcon);
     }
     this.tbMajor.Text = Convert.ToString(prj.MajorVersion);
     this.tbMinor.Text = Convert.ToString(prj.MinorVersion);
     this.tbBuild.Text = Convert.ToString(prj.BuildVersion);
     this.tbRevision.Text = Convert.ToString(prj.RevisionVersion);
     this.cbGenerateXmlDoc.Checked = prj.GenerateXMLDoc;
     this.tbProduct.Text = prj.Product;
     this.tbCompany.Text = prj.Company;
     this.tbTradeMark.Text = prj.Trademark;
     this.tbCopyright.Text = prj.Copyright;
 }
예제 #4
0
        //kompilacija proekta
        public string Compile(PascalABCCompiler.IProjectInfo project, bool rebuild, string RuntimeServicesModule, bool ForRun, bool RunWithEnvironment)
        {
            ProjectService.SaveProject();
            Workbench.WidgetController.CompilingButtonsEnabled = false;
            Workbench.CompilerConsoleWindow.ClearConsole();
            CompilerOptions1.SourceFileName  = project.Path;
            CompilerOptions1.OutputDirectory = project.OutputDirectory;
            CompilerOptions1.ProjectCompiled = true;
            if (project.ProjectType == PascalABCCompiler.ProjectType.WindowsApp)
            {
                CompilerOptions1.OutputFileType = PascalABCCompiler.CompilerOptions.OutputType.WindowsApplication;
            }
            ErrorsList.Clear();
            CompilerOptions1.Rebuild = rebuild;
            CompilerOptions1.Locale  = PascalABCCompiler.StringResourcesLanguage.CurrentTwoLetterISO;
            CompilerOptions1.UseDllForSystemUnits = false;
            CompilerOptions1.RunWithEnvironment   = RunWithEnvironment;
            bool savePCU = Workbench.VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate;

            if (Path.GetDirectoryName(CompilerOptions1.SourceFileName).ToLower() == ((string)WorkbenchStorage.StandartDirectories[Constants.LibSourceDirectoryIdent]).ToLower())
            {
                Workbench.VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate = false;
            }
            if (RuntimeServicesModule != null)
            {
                CompilerOptions1.StandartModules.Add(new PascalABCCompiler.CompilerOptions.StandartModule(RuntimeServicesModule, PascalABCCompiler.CompilerOptions.StandartModuleAddMethod.RightToMain, PascalABCCompiler.SyntaxTree.LanguageId.C | PascalABCCompiler.SyntaxTree.LanguageId.PascalABCNET | PascalABCCompiler.SyntaxTree.LanguageId.CommonLanguage));
            }

            string ofn = Workbench.VisualEnvironmentCompiler.Compile(CompilerOptions1);

            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));
            }
            return(ofn);
        }
예제 #5
0
        public void LoadProject(string projectName, PascalABCCompiler.IProjectInfo project)
        {
            TreeNode proj_tn = this.tvProjectExplorer.Nodes.Add(Form1StringResources.Get("MR_PROJECT") + " " + projectName);

            ProjectNode = proj_tn;
            project_item_nodes.Add(proj_tn);
            proj_tn.ImageIndex         = ProjectImageIndex;
            proj_tn.SelectedImageIndex = ProjectImageIndex;
            TreeNode ref_tn = proj_tn.Nodes.Add(Form1StringResources.Get("PRJ_PROJECT_REFERENCES"));

            ReferencesNode = ref_tn;
            reference_nodes.Add(ref_tn);
            ref_tn.ImageIndex = ClosedReferencesImageIndex;
            foreach (PascalABCCompiler.IFileInfo fi in project.SourceFiles)
            {
                TreeNode tn = proj_tn.Nodes.Add(fi.Name);
                tn.ImageIndex         = SourceFileImageIndex;
                tn.SelectedImageIndex = SourceFileImageIndex;
                items[tn]             = fi;
                if (VisualPABCSingleton.MainForm.IsForm(fi.Path))
                {
                    tn.ImageIndex         = FormImageIndex;
                    tn.SelectedImageIndex = FormImageIndex;
                    NodeInfo ni = new NodeInfo();
                    ni.IsForm = true;
                    tn.Tag    = ni;
                }
                source_item_nodes.Add(tn);
            }
            foreach (PascalABCCompiler.IReferenceInfo ri in project.References)
            {
                TreeNode tn = ref_tn.Nodes.Add(ri.AssemblyName);
                tn.ImageIndex         = ReferenceImageIndex;
                tn.SelectedImageIndex = ReferenceImageIndex;
                items[tn]             = ri;
                reference_item_nodes.Add(tn);
            }
            proj_tn.Expand();
        }
예제 #6
0
        public void StartCompile(PascalABCCompiler.IProjectInfo project, bool rebuild, string RuntimeServicesModule, bool ForRun, bool RunWithEnvironment)
        {
            ProjectService.SaveProject();
            __RuntimeServicesModule = RuntimeServicesModule;
            __ForRun = ForRun;
            Workbench.CompilerConsoleWindow.ClearConsole();
            var UserOptions = Workbench.UserOptions;

            CompilerOptions1.SourceFileName  = project.Path;
            CompilerOptions1.ProjectCompiled = true;
            CompilerOptions1.Locale          = PascalABCCompiler.StringResourcesLanguage.CurrentTwoLetterISO;
            if (UserOptions.UseOutputDirectory && Directory.Exists(UserOptions.OutputDirectory))
            {
                CompilerOptions1.OutputDirectory = UserOptions.OutputDirectory;
            }

            CompilerOptions1.Rebuild            = rebuild;
            CompilerOptions1.RunWithEnvironment = RunWithEnvironment;
            //string runtimeModuleFileName = CompilerOptions1.SearchDirectory + "\\" + RuntimeServicesModule;
            //if (RuntimeServicesModule!=null && File.Exists(runtimeModuleFileName))
            //    CompilerOptions1.StandartModules.Add(new PascalABCCompiler.CompilerOptions.StandartModule(runtimeModuleFileName, PascalABCCompiler.CompilerOptions.StandartModuleAddMethod.RightToMain));
            if (__RuntimeServicesModule != null)
            {
                CompilerOptions1.StandartModules.Add(new PascalABCCompiler.CompilerOptions.StandartModule(RuntimeServicesModule, PascalABCCompiler.CompilerOptions.StandartModuleAddMethod.RightToMain, PascalABCCompiler.SyntaxTree.LanguageId.C | PascalABCCompiler.SyntaxTree.LanguageId.PascalABCNET | PascalABCCompiler.SyntaxTree.LanguageId.CommonLanguage));
            }


            ErrorsList.Clear();

            //CompilerOptions1.SavePCUInThreadPull = true;
            __savePCU = Workbench.VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate;
            //if (Path.GetDirectoryName(FileName).ToLower() == ((string)StandartDirectories[Constants.LibSourceDirectoryIdent]).ToLower())
            //    VisualEnvironmentCompiler.Compiler.InternalDebug.PCUGenerate = false;

            Workbench.VisualEnvironmentCompiler.Compiler.OnChangeCompilerState += CompilationOnChangeCompilerState;

            Workbench.VisualEnvironmentCompiler.StartCompile(CompilerOptions1);
        }
예제 #7
0
        // Построение и отображение дерева аспектов
        public void ShowTree()
        {
            try
            {
                string[] file_names = new string[100];
                file_names[0] = VisualPascalABC.VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName;

                treeView.Nodes.Clear();
                treeView.Invalidate();
                treeView.Refresh();
                treeView.Update();

                AspectPreprocessorReset();

                if (!VisualPascalABC.ProjectFactory.Instance.ProjectLoaded)
                {
                    RootFileName = file_names[0];

                    //for (int i = 0; i < UsedUnits.Count; i++)
                    //  file_names[i] = UsedUnits[i];
                }
                else
                {
                    //work with project
                    RootProjectInfo = VisualPascalABC.ProjectFactory.Instance.CurrentProject;
                    RootFileName    = RootProjectInfo.MainFile;
                    int i = 0;
                    foreach (PascalABCCompiler.IFileInfo fi in RootProjectInfo.SourceFiles)
                    {
                        file_names[i] = fi.Name;
                        i++;
                    }
                }

                List <string> temp = new List <string>();
                treeView.Nodes.Add("&all");
                foreach (string name in file_names)
                {
                    string[] files = new string[1];
                    files[0] = name;

                    AspectTxt = AspectPreprocessor.Build(files, AspectErrors, AspectScm);

                    // Вывод ошибок
                    if (AspectErrors.Count > 0)
                    {
                        PascalABCCompiler.CompilerType ct = VisualEnvironmentCompiler.DefaultCompilerType;
                        VisualEnvironmentCompiler.DefaultCompilerType = PascalABCCompiler.CompilerType.Standart;
                        VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.Build, null);
                        VisualEnvironmentCompiler.DefaultCompilerType = ct;
                    }
                    else
                    {
                        for (int i = 0; i < AspectPreprocessor.CompilerDirectives.Count; i++)
                        {
                            if (AspectPreprocessor.CompilerDirectives[i].Name.text == "asp")
                            {
                                if (!(temp.Contains(AspectPreprocessor.CompilerDirectives[i].Directive.text)))
                                {
                                    treeView.Nodes.Add(AspectPreprocessor.CompilerDirectives[i].Directive.text);
                                    temp.Add(AspectPreprocessor.CompilerDirectives[i].Directive.text);
                                }
                            }

                            //aspdata
                            string s = AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm);
                            if (AspectPreprocessor.CompilerDirectives[i].Name.text == "aspdata")
                            {
                                string t = AspectPreprocessor.CompilerDirectives[i].Directive.text;
                                if (t.IndexOf(' ') > 0)
                                {
                                    string n     = t.Substring(0, t.IndexOf(' ')).Trim();
                                    string param = t.Substring(t.IndexOf(' ')).Trim();
                                    if (AspectPreprocessor.AspectsMap.ContainsKey(n))
                                    {
                                        int c = param.IndexOf(' ');
                                        if (c > 0)
                                        {
                                            AspectPreprocessor.AspectsMap[n].Author = param.Substring(0, c).Trim();
                                            if (param.IndexOf(' ', c + 1) > 0)
                                            {
                                                AspectPreprocessor.AspectsMap[n].Version = param.Substring(c, param.IndexOf(' ', c + 1) - c).Trim();
                                            }
                                            else
                                            {
                                                AspectPreprocessor.AspectsMap[n].Version = param.Substring(c).Trim();
                                            }
                                        }
                                    }
                                }
                            }
                            //end aspdata
                        }

                        //sozdat etot file esli netu
                        //VisualPascalABC.VisualPABCSingleton.MainForm.OpenFile(Path.GetDirectoryName(file_names[0]) + "\\" + Path.GetFileNameWithoutExtension(file_names[0]) + "_asp.pas", null);
                        VisualPascalABC.VisualPABCSingleton.MainForm.OpenTabWithText(Path.GetFileNameWithoutExtension(file_names[0]) + "_asp", "");
                        TabWithAspects = VisualPascalABC.VisualPABCSingleton.MainForm.CurrentCodeFileDocument;

                        VisualPascalABC.VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.ExecuteAction(VisualPascalABCPlugins.VisualEnvironmentCompilerAction.SetCurrentSourceFileText, AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm));
                        AspectTxtName = "&all";
                    }
                }

                /*
                 * for (int i = 0; i < AspectPreprocessor.CompilerDirectives.Count; i++)
                 * {
                 *  //aspdata
                 *  string s = AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm);
                 *  if (AspectPreprocessor.CompilerDirectives[i].Name.text == "aspdata")
                 *  {
                 *      string t = AspectPreprocessor.CompilerDirectives[i].Directive.text;
                 *      string n = t.Substring(0, t.IndexOf(' ')).Trim();
                 *      string param = t.Substring(t.IndexOf(' ')).Trim();
                 *      if (AspectPreprocessor.AspectsMap.ContainsKey(n))
                 *      {
                 *          AspectPreprocessor.AspectsMap[n].Author = param.Substring(0, param.IndexOf(' ')).Trim();
                 *          AspectPreprocessor.AspectsMap[n].Author = param.Substring(param.IndexOf(' ')).Trim();
                 *          AspectPreprocessor.AspectsMap[n].IsSavedParams = true;
                 *      }
                 *  }
                 *  //end aspdata
                 * }
                 */
            }
            catch (Exception e)
            {
                //VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.AddTextToCompilerMessages, "AspectTree Exception: " + e.ToString());
            }
        }
예제 #8
0
        // Построение и отображение дерева аспектов
        public void ShowTree()
        {           
            try
            {                
                string[] file_names = new string[100];
                file_names[0] = VisualPascalABC.VisualPABCSingleton.MainForm.CurrentCodeFileDocument.FileName;
                
                treeView.Nodes.Clear();
                treeView.Invalidate();
                treeView.Refresh();                
                treeView.Update();

                AspectPreprocessorReset();
                
                if (!VisualPascalABC.ProjectFactory.Instance.ProjectLoaded)
                {
                    RootFileName = file_names[0];

                    //for (int i = 0; i < UsedUnits.Count; i++)
                    //  file_names[i] = UsedUnits[i];                    
                }
                else
                {
                    //work with project
                    RootProjectInfo = VisualPascalABC.ProjectFactory.Instance.CurrentProject;
                    RootFileName = RootProjectInfo.MainFile; 
                    int i = 0;
                    foreach (PascalABCCompiler.IFileInfo fi in RootProjectInfo.SourceFiles)
                    {
                        file_names[i] = fi.Name;
                        i++;
                    }                    
                }

                List<string> temp = new List<string>();                    
                treeView.Nodes.Add("&all");
                foreach (string name in file_names)
                {
                    string[] files = new string[1];
                    files[0] = name;

                    AspectTxt = AspectPreprocessor.Build(files, AspectErrors, AspectScm);

                    // Вывод ошибок                    
                    if (AspectErrors.Count > 0)
                    {
                        PascalABCCompiler.CompilerType ct = VisualEnvironmentCompiler.DefaultCompilerType;
                        VisualEnvironmentCompiler.DefaultCompilerType = PascalABCCompiler.CompilerType.Standart;
                        VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.Build, null);
                        VisualEnvironmentCompiler.DefaultCompilerType = ct;
                    }
                    else
                    {
                        for (int i = 0; i < AspectPreprocessor.CompilerDirectives.Count; i++)
                        {
                            if (AspectPreprocessor.CompilerDirectives[i].Name.text == "asp")
                                if (!(temp.Contains(AspectPreprocessor.CompilerDirectives[i].Directive.text)))
                                {
                                    treeView.Nodes.Add(AspectPreprocessor.CompilerDirectives[i].Directive.text);
                                    temp.Add(AspectPreprocessor.CompilerDirectives[i].Directive.text);
                                }
                                
                                //aspdata
                                string s = AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm);
                                if (AspectPreprocessor.CompilerDirectives[i].Name.text == "aspdata")
                                {
                                    string t = AspectPreprocessor.CompilerDirectives[i].Directive.text;
                                    if (t.IndexOf(' ') > 0)
                                    {
                                        string n = t.Substring(0, t.IndexOf(' ')).Trim();
                                        string param = t.Substring(t.IndexOf(' ')).Trim();
                                        if (AspectPreprocessor.AspectsMap.ContainsKey(n))
                                        {
                                            int c = param.IndexOf(' ');
                                            if (c > 0)
                                            {
                                                AspectPreprocessor.AspectsMap[n].Author = param.Substring(0, c).Trim();
                                                if (param.IndexOf(' ',c+1) >0)
                                                    AspectPreprocessor.AspectsMap[n].Version = param.Substring(c, param.IndexOf(' ',c+1) - c) .Trim();
                                                else
                                                    AspectPreprocessor.AspectsMap[n].Version = param.Substring(c).Trim();
                                            }
                                        }
                                    }
                                }
                                //end aspdata
                                
                        }
                        
                        //sozdat etot file esli netu
                        //VisualPascalABC.VisualPABCSingleton.MainForm.OpenFile(Path.GetDirectoryName(file_names[0]) + "\\" + Path.GetFileNameWithoutExtension(file_names[0]) + "_asp.pas", null);
                        VisualPascalABC.VisualPABCSingleton.MainForm.OpenTabWithText(Path.GetFileNameWithoutExtension(file_names[0]) + "_asp", "");
                        TabWithAspects = VisualPascalABC.VisualPABCSingleton.MainForm.CurrentCodeFileDocument;
               
                        VisualPascalABC.VisualPABCSingleton.MainForm.VisualEnvironmentCompiler.ExecuteAction(VisualPascalABCPlugins.VisualEnvironmentCompilerAction.SetCurrentSourceFileText, AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm));
                        AspectTxtName = "&all";
                    }
                }
                /*
                for (int i = 0; i < AspectPreprocessor.CompilerDirectives.Count; i++)
                {
                    //aspdata
                    string s = AspectPreprocessor.GetAspects(AspectPreprocessor.CompilerDirectives, AspectScm);
                    if (AspectPreprocessor.CompilerDirectives[i].Name.text == "aspdata")
                    {
                        string t = AspectPreprocessor.CompilerDirectives[i].Directive.text;
                        string n = t.Substring(0, t.IndexOf(' ')).Trim();
                        string param = t.Substring(t.IndexOf(' ')).Trim();
                        if (AspectPreprocessor.AspectsMap.ContainsKey(n))
                        {
                            AspectPreprocessor.AspectsMap[n].Author = param.Substring(0, param.IndexOf(' ')).Trim();
                            AspectPreprocessor.AspectsMap[n].Author = param.Substring(param.IndexOf(' ')).Trim();
                            AspectPreprocessor.AspectsMap[n].IsSavedParams = true;
                        }
                    }
                    //end aspdata
                }
                */
            }
            catch (Exception e)
            {
                //VisualEnvironmentCompiler.ExecuteAction(VisualEnvironmentCompilerAction.AddTextToCompilerMessages, "AspectTree Exception: " + e.ToString());
            }            
        }