Beispiel #1
0
        public Results(AnalyseType analyser, bool errors, string failMessage, GOLD.Reduction root)
        {
            InitializeComponent();
            this.ShowInTaskbar = true;
            this.Title = analyser == AnalyseType.lexical
                ? "Lexical analyzer results"
                : "Syntax analyzer results";

            if (errors)
                txtTree.Text = String.Format("An error occured while trying to parse code.\n{0}", failMessage);
            else
            {
                _root = root;

                switch (analyser)
                {
                    case (AnalyseType.lexical):
                        ShowTokens();
                        break;
                    case (AnalyseType.syntax):
                        ShowParseTree();
                        break;
                    default:
                        break;
                }
            }
        }
Beispiel #2
0
 public AnalyseEventMessage(AnalyseType type,
                            AnalyseState state,
                            int steps,
                            int currentStep) : this(type, state)
 {
     Steps       = steps;
     CurrentStep = currentStep;
 }
Beispiel #3
0
        bool _AnalyseSolution(bool useClang, AnalyseType type = AnalyseType.ANALYSE_SOLUTION)
        {
            if (!GetCommandActive())
            {
                return(false);
            }
            try
            {
                Logger.Info("Analysis Begin.");
                SetCommandActive(false);
                var traverser = new ProjectFileCollector();
                if (type == AnalyseType.ANALYSE_SELECTED_PROJECTS)
                {
                    traverser.SetToSelectedProjects();
                }
                if (type == AnalyseType.ANALYSE_OPENED_FILES)
                {
                    traverser.SetIncludeScope(ProjectFileCollector.IncludeScope.INCLUDE_OPEN_FOLDERS);
                }
                else
                {
                    traverser.SetIncludeScope(ProjectFileCollector.IncludeScope.INCLUDE_PROJECT_FOLDERS);
                }
                var scene = UIManager.Instance().GetScene();
                traverser.SetCustomExtension(scene.GetCustomExtensionDict());
                traverser.SetCustomMacro(scene.GetCustomMacroSet());
                traverser.Traverse();
                var dirList        = traverser.GetDirectoryList();
                var solutionFolder = traverser.GetSolutionFolder();

                if ((type == AnalyseType.ANALYSE_DUMMY && dirList.Count == 0) || solutionFolder == "")
                {
                    SetCommandActive(true);
                    return(false);
                }
                string doxyFolder = solutionFolder;
                if (analysisWindow.customDirectoryEdit.Text != null && analysisWindow.customDirectoryEdit.Text != "")
                {
                    doxyFolder = analysisWindow.customDirectoryEdit.Text;
                }
                doxyFolder += "/CodeGraphData";
                CheckOrCreateFolder(doxyFolder);
                Logger.Info("Folder: " + doxyFolder);

                // Use selected projects as postfix
                string postFix = "";
                if (type == AnalyseType.ANALYSE_SELECTED_PROJECTS)
                {
                    var projectNameList = traverser.GetSelectedProjectName();
                    foreach (string item in projectNameList)
                    {
                        postFix += "_" + item;
                    }
                }
                else if (type == AnalyseType.ANALYSE_DUMMY)
                {
                    postFix = "_dummy";
                }
                else if (type == AnalyseType.ANALYSE_OPENED_FILES)
                {
                    postFix = "_files";
                }
                else
                {
                    postFix = "_solution";
                }
                postFix = postFix.Replace(" ", "");

                DoxygenDB.DoxygenDBConfig config = new DoxygenDB.DoxygenDBConfig();
                config.m_configPath = doxyFolder + "/Result" + postFix + ".graph";
                if (type != AnalyseType.ANALYSE_DUMMY)
                {
                    config.m_inputFolders = dirList;
                    config.m_includePaths = traverser.GetAllIncludePath();
                }
                config.m_outputDirectory = doxyFolder + "/Result" + postFix;
                config.m_projectName     = traverser.GetSolutionName() + postFix;
                config.m_defines         = traverser.GetAllDefines();
                config.m_useClang        = useClang;
                config.m_mainLanguage    = traverser.GetMainLanguage();
                config.m_customExt       = scene.GetCustomExtensionDict();
                DBManager.Instance().CloseDB();

                System.Threading.Thread analysisThread = new System.Threading.Thread((ThreadStart) delegate
                {
                    try
                    {
                        if (DoxygenDB.DoxygenDB.GenerateDB(config))
                        {
                            DBManager.Instance().OpenDB(config.m_configPath);
                        }
                        else
                        {
                            SetCommandActive(true);
                        }
                    }
                    catch (Exception)
                    {
                        SetCommandActive(true);
                    }
                });
                analysisThread.Name = "Analysis Thread";
                analysisThread.Start();
            }
            catch (Exception)
            {
                Logger.Warning("Analyse failed. Please try again.");
                DBManager.Instance().CloseDB();
                SetCommandActive(true);
            }
            return(true);
        }
Beispiel #4
0
        public readonly int CurrentStep; //Current (or completed) analysis stage

        public AnalyseEventMessage(AnalyseType type,
                                   AnalyseState state)
        {
            Type  = type;
            State = state;
        }