Example #1
0
        public void DisplayTree(SpecificationBase Spec)
        {
            try
            {
                Specification = Spec;

                foreach (TreeNode node in TreeView_Model.Nodes)
                {
                    node.Nodes.Clear();
                }

                if (Spec != null)
                {

                    foreach (KeyValuePair<string, Declaration> pair in Spec.DeclaritionTable)
                    {
                        try
                        {
                            TreeNode node = this.TreeView_Model.Nodes[pair.Value.DeclarationType.ToString()].Nodes.Add(pair.Key);

                            node.Tag = pair.Value.DeclarationToken;
                        }
                        catch (Exception)
                        {
                        }
                    }

                    TreeView_Model.ExpandAll();
                }
            }
            catch (Exception)
            {

            }
        }
        public override void Initialize(SpecificationBase spec)
        {
            //initialize the ModelCheckingOptions
            base.Initialize(spec);

            Specification Spec = spec as Specification;
            ReachableStateCondition = Spec.DeclarationDatabase[ReachableStateLabel];

            List<string> varList = Process.GetGlobalVariables();
            varList.AddRange(ReachableStateCondition.GetVars());
            varList.AddRange(ConstraintCondition.GetVars());

            PNValuation GlobalEnv = Spec.SpecValuation.GetVariableChannelClone(varList, Process.GetChannels()) as PNValuation;

            //Initialize InitialStep
            InitialStep = new PNConfiguration(Process, Constants.INITIAL_EVENT, null, GlobalEnv, false);

            MustAbstract = Process.MustBeAbstracted();

            if (MustAbstract)
            {
                throw new ParsingException(
                    "Process " + StartingProcess +
                    " has infinite states and therefore can not be used to assert reachability with MIN/MAX constraints!",
                    AssertToken);

            }
        }
Example #3
0
        public override void Initialize(SpecificationBase spec)
        {
            //initialize the ModelCheckingOptions
            base.Initialize(spec);

            Assertion.Initialize(this, Process, spec);
        }
 /// <summary>
 /// Assertion Initialization to create the initial step based on the concrete types.
 /// This method shall be invoked after the parsing immediately to instanciate the initial step
 /// </summary>
 /// <param name="spec">The concrete specification of the module</param>
 public override void Initialize(SpecificationBase spec)
 {
     //initialize model checking options, the default option is for deadlock/reachablity algorithms
     ModelCheckingOptions = new ModelCheckingOptions();
     List<string> DeadlockEngine = new List<string>();
     DeadlockEngine.Add(Constants.ENGINE_SMT_DTMC);
     DeadlockEngine.Add(Constants.ENGINE_SMT_MDP);
     ModelCheckingOptions.AddAddimissibleBehavior(Constants.COMPLETE_BEHAVIOR, DeadlockEngine);
 }
Example #5
0
        public static void Initialize(AssertionBase Assertion, PetriNet Process, SpecificationBase spec)
        {
            Specification Spec = spec as Specification;

            //get the relevant global variables; remove irrelevant variables so as to save memory;
            Valuation GlobalEnv = Spec.SpecValuation.GetClone();

            //Initialize InitialStep
            Assertion.InitialStep = new PNConfiguration(Process, Constants.INITIAL_EVENT, null, GlobalEnv, false, spec);
        }
Example #6
0
        /// <summary>
        /// Assertion Initialization to create the initial step based on the concrete types.
        /// This method shall be invoked after the parsing immediately to instanciate the initial step
        /// </summary>
        /// <param name="spec">The concrete specification of the module</param>
        public virtual void Initialize(SpecificationBase spec)
        {
            //initialize model checking options, the default option is for deadlock/reachablity algorithms
            ModelCheckingOptions = new ModelCheckingOptions();
            List <string> DeadlockEngine = new List <string>();

            DeadlockEngine.Add(Constants.ENGINE_DEPTH_FIRST_SEARCH);
            DeadlockEngine.Add(Constants.ENGINE_BREADTH_FIRST_SEARCH);
            ModelCheckingOptions.AddAddimissibleBehavior(Constants.COMPLETE_BEHAVIOR, DeadlockEngine);
        }
Example #7
0
        public static void Initialize(AssertionBase Assertion, DefinitionRef Process, SpecificationBase spec)
        {
            Specification Spec = spec as Specification;

            //get the relevant global variables; remove irrelevant variables so as to save memory;
            Valuation GlobalEnv = Spec.SpecValuation.GetVariableChannelClone(Process.GetGlobalVariables(), Process.GetChannels());

            //Initialize InitialStep
            Assertion.InitialStep = new Configuration(Process, Constants.INITIAL_EVENT, null, GlobalEnv, false);

            Assertion.MustAbstract = Process.MustBeAbstracted();
        }
Example #8
0
 public void startVerify()
 {
     if (this.LoadModule(this.ModuleName))
     {
         this.Specification = ParseSpecification();
         this.SpecWorker = new SpecificationWorker(this.Specification);
         this.SpecWorker.startVerification(this.SpecWorker.mSpec.AssertionDatabase.First().Key);
     } else
     {
         System.Console.WriteLine("Error had occur!");
     }
 }
Example #9
0
 public virtual SpecificationBase ParseSpecification(string text, string options, string filePath)
 {
     if (Common.Classes.Ultility.Ultility.GrabSharedDataLock())
     {
         Specification = InstanciateSpecification(text, options, filePath);
         return Specification;
     }
     else
     {
         MessageBox.Show(Resources.Please_stop_verification_or_simulation_before_parsing_the_model_, Common.Utility.Utilities.APPLICATION_NAME, MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation);
         return null;
     }
 }
Example #10
0
        // added by Tinh
        public PNConfiguration(PetriNet p, string e, string displayName, Valuation globalEnv, bool isDataOperation, SpecificationBase spec)
        {
            Process = p;
            Event = e;//base event
            GlobalEnv = globalEnv;
            DisplayName = displayName;
            IsDataOperation = isDataOperation;

            if (spec != null)
            {
                p.Transitions = new List<PNTransition>(16);
                foreach (KeyValuePair<string, PetriNet> entry in (spec as Specification).PNDefinitionDatabase)
                    p.Transitions.AddRange(entry.Value.Transitions);
            }
        }
Example #11
0
 public override void Initialize(SpecificationBase spec)
 {
     if (ConstraintType == QueryConstraintType.NONE)
     {
         base.Initialize(spec);
     }
     else
     {
         //initialize model checking options
         ModelCheckingOptions = new ModelCheckingOptions();
         List<string> LTLEngine = new List<string>();
         LTLEngine.Add(Constants.ENGINE_MDP_SEARCH);
         LTLEngine.Add(Constants.ENGINE_MDP_ANTICHAIN_SEARCH);
         ModelCheckingOptions.AddAddimissibleBehavior(Constants.COMPLETE_BEHAVIOR, LTLEngine);
     }
 }
Example #12
0
        public void FillData(string name, List<ParsingException> usages, SpecificationBase Spec)
        {
            ListView.Enabled = true;
            Term = name;
            ListView.Items.Clear();

            if (Spec.DeclaritionTable.ContainsKey(name))
            {
                ToolStripLabel_Usage.Text = "Usages of " + Spec.DeclaritionTable[name].DeclarationType.ToString() + " \"" + name + "\"";

                ParsingException warning = Spec.DeclaritionTable[name].DeclarationToken;
                string definition = "";
                if(warning.ContainingDefinition != null)
                {
                    definition = warning.ContainingDefinition.Text;
                }

                string[] data = new string[] { (ListView.Items.Count + 1).ToString(), "Declaration at " + warning.Line + " column " + warning.CharPositionInLine + " for '" + warning.Text + "'", warning.Source, definition, warning.DisplayFileName };

                ListViewItem item = new ListViewItem(data);
                item.Tag = warning;
                ListView.Items.Add(item);
            }
            else
            {
                ToolStripLabel_Usage.Text = "Usages of \"" + name + "\"";
                return;
            }

            foreach (ParsingException usage in usages)
            {
                if (usage.Line > 0)
                {
                    string definition = "";
                    if (usage.ContainingDefinition != null)
                    {
                        definition = usage.ContainingDefinition.Text;
                    }

                    string[] data = new string[] { (ListView.Items.Count + 1).ToString(), "Usage found at " + usage.Line + " column " + usage.CharPositionInLine + " for '" + usage.Text + "'", usage.Source, definition, usage.DisplayFileName };
                    ListViewItem item = new ListViewItem(data);
                    item.Tag = usage;
                    ListView.Items.Add(item);
                }
            }
        }
Example #13
0
        public override void Initialize(SpecificationBase spec)
        {
            Specification Spec = spec as Specification;
            List<string> varList = Process.GetGlobalVariables();

            BA.Initialize(Spec.DeclarationDatabase);

            foreach (KeyValuePair<string, Expression> pair in BA.DeclarationDatabase)
                varList.AddRange(pair.Value.GetVars());

            Valuation GlobalEnv = Spec.SpecValuation.GetVariableChannelClone(varList, Process.GetChannels());
            InitialStep = new Configuration(Process, Constants.INITIAL_EVENT, null, GlobalEnv, false);

            MustAbstract = Process.MustBeAbstracted();

            base.Initialize(spec);
        }
        public override void Initialize(SpecificationBase spec)
        {
            //initialize the ModelCheckingOptions
            base.Initialize(spec);

            Specification Spec = spec as Specification;
            ReachableStateCondition = Spec.DeclarationDatabase[ReachableStateLabel];

            List<string> varList = Process.GetGlobalVariables();
            varList.AddRange(ReachableStateCondition.GetVars());

            Valuation GlobalEnv = Spec.SpecValuation.GetVariableChannelClone(varList, Process.GetChannels());

            //Initialize InitialStep
            InitialStep = new Configuration(Process, Constants.INITIAL_EVENT, null, GlobalEnv, false);

            MustAbstract = Process.MustBeAbstracted();
        }
Example #15
0
        public ModelCheckingForm(string Name, SpecificationBase spec, PNExtendInfo extendInfo)
        {
            mSpecWorker = new SpecificationWorker(spec, this, this);
            mExtendInfo = extendInfo;

            InitializeComponent();
            initPerformanceAnalytics();
            initLogic();
            mLatexWorker = new LatexWorker(extendInfo, Name);

            if (Name != "")
            {
            #if DEBUG
                Text = Text + " (Debug Model) - " + Name;
            #else
            this.Text = this.Text + " - " + Name;
            #endif
            }
        }
Example #16
0
        public static void Initialize(AssertionRefinement Assertion, DefinitionRef ImplementationProcess, DefinitionRef SpecificationProcess, SpecificationBase spec)
        {
            Specification Spec = spec as Specification;

            //get the relevant global variables; remove irrelevant variables so as to save memory;
            List<string> varList = ImplementationProcess.GetGlobalVariables();
            varList.AddRange(SpecificationProcess.GetGlobalVariables());

            Valuation GlobalEnv = Spec.SpecValuation.GetVariableChannelClone(varList, ImplementationProcess.GetChannels());

            //Initialize InitialStep
            Assertion.InitialStep = new PNConfiguration(ImplementationProcess, Constants.INITIAL_EVENT, null, GlobalEnv, false, spec);
            Assertion.InitSpecStep = new PNConfiguration(SpecificationProcess, Constants.INITIAL_EVENT, null, GlobalEnv, false, spec);

            Assertion.MustAbstract = ImplementationProcess.MustBeAbstracted();
            if (SpecificationProcess.MustBeAbstracted())
            {
                throw new ParsingException(
                    "Process " + Assertion.SpecProcess + " has infinite states and therefore can not be used as a property model for refinement checking!", Assertion.AssertToken);
            }
        }
Example #17
0
        public ExceptionDialog(Exception ex, string APPLICATION_NAME, SpecificationBase specification)
        {
            InitializeComponent();

            spec = specification;

            this.Text = APPLICATION_NAME + " " + this.Text;

            ActionBox.Text = Resources.You_have_following_options_ + Environment.NewLine;
            ActionBox.Text += Resources._1__Click_the_Email_button_to_report_the_error_to_us_ + Environment.NewLine;
            ActionBox.Text += Resources._2__Click_the_Continue_button_to_ingore_the_error_ + Environment.NewLine;
            ActionBox.Text += Resources._3__Click_the_Stop_button_to_exit_the_application_ + Environment.NewLine;
            ActionBox.Text += Resources.At_same_time__you_can_submit_your_model_to_us_by_using_model_submit_button_in_the_PAT_editor_ + Environment.NewLine;

            DetailBox.Text = ExceptionToString(ex);

            string trace = "";
            if (ex.Data.Contains("trace"))
            {
                trace = Environment.NewLine + "Trace leads to exception:" + Environment.NewLine + ex.Data["trace"].ToString();
            }
            ErrorBox.Text = ErrorBox.Text + APPLICATION_NAME + ". " + Environment.NewLine + ex.Message + trace;
        }
Example #18
0
        /// <summary>
        /// Assertion Initialization to create the initial step based on the concrete types.
        /// This method shall be invoked after the parsing immediately to instanciate the initial step
        /// </summary>
        /// <param name="spec">The concrete specification of the module</param>
        public override void Initialize(SpecificationBase spec)
        {
            //initialize model checking options
            ModelCheckingOptions = new ModelCheckingOptions();
            List<string> LTLEngine = new List<string>();

            if(IsSafety)
            {
                LTLEngine.Add(Constants.ENGINE_DEPTH_FIRST_SEARCH);
                LTLEngine.Add(Constants.ENGINE_BREADTH_FIRST_SEARCH);
                ModelCheckingOptions.AddAddimissibleBehavior(Constants.COMPLETE_BEHAVIOR, LTLEngine);
            }
            else
            {
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH);
            #if DEBUG
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH_IMPROVED);
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH_MULTICORE);
            #endif

                ModelCheckingOptions.AddAddimissibleBehavior(Constants.COMPLETE_BEHAVIOR, LTLEngine);

                LTLEngine = new List<string>();
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH);
            #if DEBUG
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH_MULTICORE);
            #endif
                ModelCheckingOptions.AddAddimissibleBehavior(Constants.BEHAVIOR_EVENT_LEVEL_WEAK_FAIRNESS, LTLEngine);

                LTLEngine = new List<string>();
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH);
            #if DEBUG
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH_MULTICORE);
            #endif
                ModelCheckingOptions.AddAddimissibleBehavior(Constants.BEHAVIOR_EVENT_LEVEL_STRONG_FAIRNESS, LTLEngine);

                if (IsProcessLevelFairnessApplicable())
                {
                    LTLEngine = new List<string>();
                    LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH);
            #if DEBUG
                    LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH_MULTICORE);
            #endif
                    ModelCheckingOptions.AddAddimissibleBehavior(Constants.BEHAVIOR_PROCESS_LEVEL_WEAK_FAIRNESS, LTLEngine);

                    LTLEngine = new List<string>();
                    LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH);
            #if DEBUG
                    LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH_MULTICORE);
            #endif
                    ModelCheckingOptions.AddAddimissibleBehavior(Constants.BEHAVIOR_PROCESS_LEVEL_STRONG_FAIRNESS, LTLEngine);
                }

                LTLEngine = new List<string>();
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH);
            #if DEBUG
                LTLEngine.Add(Constants.ENGINE_SCC_BASED_SEARCH_MULTICORE);
            #endif
                ModelCheckingOptions.AddAddimissibleBehavior(Constants.BEHAVIOR_GLOBAL_FAIRNESS, LTLEngine);
            }
        }
Example #19
0
        public override void Initialize(SpecificationBase spec)
        {
            ltl2ba.Node LTLHeadNode;

            switch (ConstraintType)
            {
                case QueryConstraintType.PROB:
                    //create the DRA from the BA
                    LTLHeadNode = LTL2BA.ParseLTL("!(" + this.LTLString + ")", "", new CommonToken(0, ""));
                    NegativeDRA = BA2DRAConverter.ConvertBA2DRA(BA, LTLHeadNode);
                    NegativeDRA.DeclarationDatabase = BA.DeclarationDatabase;

                    //todo: builf the positve DRA too
                    //create the DRA from the BA
                    LTLHeadNode = LTL2BA.ParseLTL(this.LTLString, "", new CommonToken(0, ""));
                    PositiveDRA = BA2DRAConverter.ConvertBA2DRA(PositiveBA, LTLHeadNode);
                    PositiveDRA.DeclarationDatabase = BA.DeclarationDatabase;
                    break;
                case QueryConstraintType.PMAX:
                    //create the DRA from the BA
                    LTLHeadNode = LTL2BA.ParseLTL(this.LTLString, "", new CommonToken(0, ""));
                    PositiveDRA = BA2DRAConverter.ConvertBA2DRA(PositiveBA, LTLHeadNode);
                    PositiveDRA.DeclarationDatabase = BA.DeclarationDatabase;
                    break;
                case QueryConstraintType.PMIN:
                    //create the DRA from the BA
                    if(AlmostFair)//note add by ssz
                    {
                        LTLHeadNode = LTL2BA.ParseLTL(this.LTLString, "", new CommonToken(0, ""));
                        PositiveDRA = BA2DRAConverter.ConvertBA2DRA(PositiveBA, LTLHeadNode);
                        PositiveDRA.DeclarationDatabase = BA.DeclarationDatabase;
                    }
                    else
                    {
                        LTLHeadNode = LTL2BA.ParseLTL("!(" + this.LTLString + ")", "", new CommonToken(0, ""));
                        NegativeDRA = BA2DRAConverter.ConvertBA2DRA(BA, LTLHeadNode);
                        NegativeDRA.DeclarationDatabase = BA.DeclarationDatabase;
                    }
                    break;

            }

            if (ConstraintType == QueryConstraintType.NONE)
            {
                base.Initialize(spec);
            }
            else
            {
                //initialize model checking options
                ModelCheckingOptions = new ModelCheckingOptions();
                List<string> LTLEngine = new List<string>();
                LTLEngine.Add(Constants.ENGINE_MDP_SEARCH);

            #if DEBUG
                LTLEngine.Add(Constants.ENGINE_MDP_MEC_SEARCH);
                LTLEngine.Add(Constants.ENGINE_MDP_SIM_SEARCH);

            #endif

                ModelCheckingOptions.AddAddimissibleBehavior(Constants.COMPLETE_BEHAVIOR, LTLEngine);
            }
        }
Example #20
0
 /// <summary>
 /// Assertion Initialization to create the initial step based on the concrete types.
 /// This method shall be invoked after the parsing immediately to instanciate the initial step
 /// </summary>
 /// <param name="spec">The concrete specification of the module</param>
 public override void Initialize(SpecificationBase spec)
 {
     //initialize model checking options, the default option is for deadlock/reachablity algorithms
     ModelCheckingOptions = new ModelCheckingOptions();
     List<string> engines = new List<string>();
     engines.Add(Constants.ENGINE_FD_REFINEMENT_ANTICHAIN_DEPTH_FIRST_SEARCH);
     engines.Add(Constants.ENGINE_FD_REFINEMENT_ANTICHAIN_BREADTH_FIRST_SEARCH);
     engines.Add(Constants.ENGINE_FD_REFINEMENT_DEPTH_FIRST_SEARCH);
     engines.Add(Constants.ENGINE_FD_REFINEMENT_BREADTH_FIRST_SEARCH);
     ModelCheckingOptions.AddAddimissibleBehavior(Constants.COMPLETE_BEHAVIOR, engines);
 }
Example #21
0
        //IToken methodName, int size
        public static Expression TestMethod(StaticMethodCall call, IToken ID1, Dictionary<string, ChannelQueue> ChannelDatabase, Dictionary<string, Expression> ConstantDatabase, SpecificationBase Spec)
        {
            if (ChannelDatabase != null)
            {
                switch (call.MethodName)
                {
                    case Common.Classes.Ultility.Constants.cfull:
                    case Common.Classes.Ultility.Constants.cempty:
                    case Common.Classes.Ultility.Constants.ccount:
                    case Common.Classes.Ultility.Constants.csize:
                    case Common.Classes.Ultility.Constants.cpeek:

                        if (call.Arguments.Length != 1)
                        {
                            throw new ParsingException(call.MethodName + " can only take exactly one argument!", ID1);
                        }

                        string cname = call.Arguments[0].ToString();
                        if (!ChannelDatabase.ContainsKey(cname))
                        {
                            throw new ParsingException(cname + " is not a valid channel name!", ID1);
                        }
                        else if (ChannelDatabase[cname].Size == 0)
                        {
                            throw new ParsingException(call + " cannot invoke on a synchronous channel!", ID1);
                        }
                        return call;
                }

                foreach (Expression argument in call.Arguments)
                {
                    if (ChannelDatabase.ContainsKey(argument.ToString()))
                    {
                        throw new ParsingException("Channel name " + argument.ToString() + " cannot be used in method call!", ID1);
                    }
                }
            }
            string key = call.MethodName + call.Arguments.Length;

            if (!Utilities.CSharpMethods.ContainsKey(key))
            {
                if (Spec == null || !Spec.MacroDefinition.ContainsKey(key))
                {
                    throw new ParsingException(string.Format(Resources.Can_NOT_find_the_method__0__with__1__parameters_in_the_imported_C__libraries_, call.MethodName, call.Arguments.Length), ID1);
                }
                else
                {

                    Dictionary<string, Expression> constMapping = new Dictionary<string, Expression>();
                    List<string> para = Spec.MacroDefinition[key].Key;
                    for (int i = 0; i < para.Count; i++)
                    {
                        constMapping.Add(para[i], call.Arguments[i]);
                    }

                    AddIntoUsageTable(Spec.UsageTable, call.MethodName, ID1); //+ "(" + Common.Classes.Ultility.Ultility.PPStringList(para) + ")"

                    return Spec.MacroDefinition[key].Value.ClearConstant(constMapping);
                }
            }
            else
            {
                return call;
            }
        }
Example #22
0
        public void SetSpec(string name, string simulateProcess, SpecificationBase spec, AssertionBase assertion)
        {
            this.Spec = spec;
            Assertion = assertion;

            this.ComboBox_Process.Items.Clear();
            this.ComboBox_Process.Items.Add(simulateProcess);
            ComboBox_Process.SelectedIndexChanged -= ComboBox_Process_SelectedIndexChanged;
            ComboBox_Process.SelectedIndex = 0;
            ComboBox_Process.SelectedIndexChanged += ComboBox_Process_SelectedIndexChanged;

            if (name != "")
            {
                this.Text = this.Text + " - " + name; // +PAT.CSP.Ultility.Ultility.GetVersionNumber();
            }

            DisplayCounterExample();
        }
Example #23
0
        public SpecificationWorker(SpecificationBase spec, ISpecificationWorker listener, Form parentFrm)
        {
            mSpec = spec;
            mListener = listener;
            mForm = parentFrm;

            // Setup timer
            mTimer = new Timer();
            mTimer.Tick += MCTimer_Tick;
            mTimer.Interval = 1000;
        }
Example #24
0
        public void SetSpec(string name, SpecificationBase spec)
        {
            this.Spec = spec;
            this.ComboBox_Process.Items.Clear();

            List<string> names = Spec.GetProcessNames();
            foreach (string s in names)
            {
                this.ComboBox_Process.Items.Add(s);
            }

            if (ComboBox_Process.Items.Count > 0)
            {
                ComboBox_Process.SelectedIndex = 0;
            }

            if (name != "")
            {
            #if DEBUG
                this.Text = this.Text + " (Debug Model) - " + name; // +PAT.CSP.Ultility.Ultility.GetVersionNumber();
            #else
             this.Text = this.Text + " - " + name;
            // +PAT.CSP.Ultility.Ultility.GetVersionNumber();
            #endif

            }
        }
Example #25
0
 /// <summary>
 /// Assertion Initialization to create the initial step based on the concrete types.
 /// This method shall be invoked after the parsing immediately to instanciate the initial step
 /// </summary>
 /// <param name="spec">The concrete specification of the module</param>
 public virtual void Initialize(SpecificationBase spec)
 {
     //initialize model checking options, the default option is for deadlock/reachablity algorithms
     ModelCheckingOptions = new ModelCheckingOptions();
     List<string> DeadlockEngine = new List<string>();
     DeadlockEngine.Add(Constants.ENGINE_DEPTH_FIRST_SEARCH);
     DeadlockEngine.Add(Constants.ENGINE_BREADTH_FIRST_SEARCH);
     ModelCheckingOptions.AddAddimissibleBehavior(Constants.COMPLETE_BEHAVIOR, DeadlockEngine);
 }
Example #26
0
        private void tabItem_FindUsages(string name, List<ParsingException> usages, SpecificationBase spec)
        {
            MenuButton_FindUsages.Checked = true;
            try
            {
                int N;
                foreach (ParsingException parsingException in usages)
                {
                    N = DockContainer.Documents.Length;
                    for (int i = 0; i < N; i++)
                    {
                        EditorTabItem item = DockContainer.Documents[i] as EditorTabItem;
                        if (item == null)
                            continue;

                        if (item.FileName == parsingException.FileName
                            || (!Common.Utility.Utilities.IsWindowsOS && item.FileName.EndsWith(parsingException.FileName)))
                        {
                            parsingException.Source = item.GetLineText(parsingException.Line - 1);
                            break;
                        }
                    }
                }

                ParsingException declarationToken = spec.DeclaritionTable[name].DeclarationToken;
                N = DockContainer.Documents.Length;
                for (int i = 0; i < N; i++)
                {
                    EditorTabItem item = DockContainer.Documents[i] as EditorTabItem;
                    if (item == null)
                        continue;

                    if (item.FileName == declarationToken.FileName
                        || (!Common.Utility.Utilities.IsWindowsOS && item.FileName.EndsWith(declarationToken.FileName)))
                    {
                        declarationToken.Source = item.GetLineText(declarationToken.Line - 1);
                        break;
                    }
                }
            }
            catch (Exception) { }

            FindUsagesWindow.FillData(name, usages, spec);
            if (FindUsagesWindow.VisibleState == DockState.DockBottomAutoHide)
                this.DockContainer.ActiveAutoHideContent = FindUsagesWindow;
        }
Example #27
0
 public SpecificationWorker(SpecificationBase spec)
 {
     this.mSpec = spec;
 }
Example #28
0
 //Exception Logging for the application
 public static void LogException(Exception ex, SpecificationBase spec)
 {
     ExceptionDialog log = new ExceptionDialog(ex, APPLICATION_NAME, spec);
     log.ShowDialog();
     if (Common.Ultility.Ultility.IsWindowsOS)
     {
         FlashWindowEx(log);
     }
 }
Example #29
0
        public static void LoadIncludeModel(IToken libPath, SpecificationBase Spec)
        {
            //string s = libPath.Text;
            try
            {
                string filePath = ParsingException.GetFileNameByLineNumber(libPath.Line);
                //s += "\r\n1" + filePath;

                if (filePath == null)
                {
                    throw new ParsingException(string.Format("Cannot get the current file path"), libPath);
                }

                string dll = libPath.Text.Trim('"');
                /**
                 * Notes: if the dll path is start with "..\",
                 * which means that get the file name from the super directory,
                 * we parse this syntax here and assign the dll directory the value
                 * of the current file's super directory
                 */
                string dllFileDirectory = Path.GetDirectoryName(filePath);

                //s += "\r\n2" + dllFileDirectory;

                if (Common.Utility.Utilities.IsWindowsOS)
                {
                    if (dll.StartsWith("../"))
                    {
                        throw new ParsingException(
                            string.Format("Please use char '\\' instead of '/' in the include file path"),
                            libPath);
                    }

                    while (dll.StartsWith("..\\"))
                    {
                        dllFileDirectory = dllFileDirectory.Substring(0, dllFileDirectory.LastIndexOf('\\'));
                        dll = dll.Substring(dll.IndexOf('\\') + 1);
                    }
                }
                else
                {
                    while (dll.StartsWith("../") || dll.StartsWith("..\\"))
                    {
                        dllFileDirectory = dllFileDirectory.Substring(0, dllFileDirectory.LastIndexOf('/'));
                        if (dll.Contains("\\"))
                        {
                            dll = dll.Substring(dll.IndexOf('\\') + 1);
                        }
                        else if (dll.Contains("/"))
                        {
                            dll = dll.Substring(dll.IndexOf('/') + 1);
                        }
                    }
                }

                //s += "\r\n3" ;
                if (File.Exists(dll))
                {
                    Spec.IncludeFiles.Add(Path.Combine(dllFileDirectory, dll));
                }
                else
                {
                    string dlllocal = "";
                    if (!string.IsNullOrEmpty(filePath))
                    {
                        dlllocal = Path.Combine(dllFileDirectory, dll);
                        //s += "\r\n4" + dlllocal;
                        if (File.Exists(dlllocal))
                        {
                            Spec.IncludeFiles.Add(dlllocal);
                            return;
                        }
                    }

                    throw new ParsingException(string.Format("Cannot find the including file: {0}", dll), libPath);
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(s + "\r\n" + ex.Message + ex.StackTrace);
                //throw new ParsingException(s + "\r\n" + ex.Message + ex.StackTrace, libPath);
                throw new ParsingException(string.Format("Cannot find the including file: {0}", libPath.Text), libPath);
            }
        }