Beispiel #1
0
        public ParameterConfiguration GetParameterConfiguration()
        {
            ParameterConfiguration config = ParameterConfiguration.loadParameterConfigurationFromSettings();

            config.z3LogFile       = logFilePath.Text;
            config.checkToConsider = checkFilteringEnabled.Checked ? (int)checkFilteringNumber.Value : 0;
            return(config);
        }
Beispiel #2
0
        public Loader(ParameterConfiguration config)
        {
            List <FileInfo> filelist = new List <FileInfo>();

            this.config = config;

            processor = new LogProcessor(filelist, config.skipDecisions, config.checkToConsider);
        }
Beispiel #3
0
        public int checkToConsider = 0; // 0 is a special value, meaning "process all checks"


        public static ParameterConfiguration loadParameterConfigurationFromSettings()
        {
            ParameterConfiguration config = new ParameterConfiguration();

            config.z3LogFile = Properties.Settings.Default.LogFile;

            return(config);
        }
        private void AxiomProfiler_Load(object sender, EventArgs e)
        {
            if (parameterConfiguration == null)
            {
                return;
            }
            loadModel(parameterConfiguration);
            ParameterConfiguration.saveParameterConfigurationToSettings(parameterConfiguration);

            if (ScriptingSupport.RunScriptingTasks(model, scriptingTasks))
            {
                Environment.Exit(0);
            }
        }
        private void loadModel(ParameterConfiguration config)
        {
            resetProfiler();

            // Create a new loader and LoadingProgressForm and execute the loading
            Loader loader = new Loader(config);
            LoadingProgressForm lprogf = new LoadingProgressForm(loader);

            lprogf.ShowDialog();

            model = loader.GetModel();
            loadTree();
            dagView.drawGraphNoFilterQuestion();
        }
Beispiel #6
0
        public static bool saveParameterConfigurationToSettings(ParameterConfiguration config)
        {
            try
            {
                Properties.Settings.Default.LogFile = config.z3LogFile;

                Properties.Settings.Default.Save();
                return(true);
            }
            catch
            {
                return(false);
            }
        }
        public bool parseCommandLineArguments(string[] args, out string error)
        {
            bool retval = false;
            int  idx;

            ParameterConfiguration config = new ParameterConfiguration();

            error = "";

            for (idx = 0; idx < args.Length; idx++)
            {
                args[idx] = stripCygdrive(args[idx]);
                if (args[idx].StartsWith("-"))
                {
                    args[idx] = "/" + args[idx].Substring(1);
                }
                if (args[idx].StartsWith("/") && !File.Exists(args[idx]))
                {
                    // parse command line parameter switches
                    if (args[idx].StartsWith("/l:"))
                    {
                        config.z3LogFile = args[idx].Substring(3);
                        // minimum requirements have been fulfilled.
                        retval = true;
                    }
                    else if (args[idx].StartsWith("/c:"))
                    {
                        uint ch;
                        if (!uint.TryParse(args[idx].Substring(3), out ch))
                        {
                            error = $"Cannot parse check number \"{args[idx].Substring(3)}\"";
                            return(false);
                        }
                        config.checkToConsider = (int)ch;
                    }
                    else if (args[idx] == "/s")
                    {
                        config.skipDecisions = true;
                    }
                    else if (args[idx].StartsWith("/loops:"))
                    {
                        if (Int32.TryParse(args[idx].Substring(7), out var numPaths))
                        {
                            if (numPaths <= 0)
                            {
                                error = "Invalid command line argument: number of paths to check for matching loops must be >= 1.";
                                return(false);
                            }
                            scriptingTasks.NumPathsToExplore = numPaths;
                        }
                        else
                        {
                            error = "Invalid command line argument: specified number of paths to check for matching loops was not a number.";
                            return(false);
                        }
                    }
                    else if (args[idx] == "/showNumChecks")
                    {
                        scriptingTasks.ShowNumChecks = true;
                    }
                    else if (args[idx] == "/showQuantStatistics")
                    {
                        scriptingTasks.ShowQuantStatistics = true;
                    }
                    else if (args[idx].StartsWith("/findHighBranching:"))
                    {
                        if (Int32.TryParse(args[idx].Substring(19), out var threshold))
                        {
                            if (threshold < 0)
                            {
                                error = "Invalid command line argument: high branching threshold must be non-negative.";
                                return(false);
                            }
                            scriptingTasks.FindHighBranchingThreshold = threshold;
                        }
                        else
                        {
                            error = "Invalid command line argument: specified high branching threshold was not a number.";
                            return(false);
                        }
                    }
                    else if (args[idx].StartsWith("/outPrefix:"))
                    {
                        scriptingTasks.OutputFilePrefix = args[idx].Substring(11);
                    }
                    else if (args[idx] == "/autoQuit")
                    {
                        scriptingTasks.QuitOnCompletion = true;
                    }
                    else
                    {
                        error = $"Unknown command line argument \"{args[idx]}\".";
                        return(false);
                    }
                }
                else
                {
                    bool isLogFile = false;
                    try
                    {
                        using (var s = File.OpenText(args[idx]))
                        {
                            var l = s.ReadLine();
                            if (l.StartsWith("[mk-app]") || l.StartsWith("Z3 error model") || l.StartsWith("partitions:") || l.StartsWith("*** MODEL"))
                            {
                                isLogFile = true;
                            }
                        }
                    }
                    catch (Exception)
                    {
                    }

                    if (isLogFile)
                    {
                        config.z3LogFile = args[idx];
                        retval           = true;
                    }
                    else
                    {
                        error = "Incorrect file format.";
                        return(false);
                    }
                }
            }

            if (retval)
            {
                parameterConfiguration = config;
            }
            return(true);
        }
Beispiel #8
0
 public void setParameterConfiguration(ParameterConfiguration config)
 {
     logFilePath.Text = (config.z3LogFile == null) ? "" : config.z3LogFile;
     checkFilteringEnabled.Checked = config.checkToConsider != 0;
     checkFilteringNumber.Value    = config.checkToConsider == 0 ? 1 : config.checkToConsider;
 }
Beispiel #9
0
        public void reloadParameterConfiguration()
        {
            ParameterConfiguration config = ParameterConfiguration.loadParameterConfigurationFromSettings();

            setParameterConfiguration(config);
        }