예제 #1
0
        public override void InstFromXmlNode(XmlNode xmlNode)
        {
            //基类成员解析
            base.InstFromXmlNode(xmlNode);

            //循环条件解析
            XmlNode loopCondition = xmlNode.SelectSingleNode("loop_contidion");

            if (loopCondition != null)
            {
                m_loopCondition = loopCondition.InnerText;
            }
            else
            {
                m_loopCondition = "1 !> 1";
            }

            //成员解析
            m_waiting.name = name + ":wating";
            Parent.events.Add(m_waiting.name, m_waiting);
            m_waiting.m_timer.mission_name = m_waiting.name + ":timer";

            //新增flow
            CFlow flow_w2s = new CFlow(Parent.paramstable, false);

            flow_w2s.expression        = "1 == 1";
            flow_w2s.source_event      = m_waiting.name;
            flow_w2s.destination_event = this.name;
            flow_w2s.PrePase();
            Parent.AppendFlow(flow_w2s);

            CFlow flow_s2w = new CFlow(Parent.paramstable, false);

            flow_s2w.expression        = m_loopCondition;
            flow_s2w.source_event      = this.name;
            flow_s2w.destination_event = m_waiting.name;
            flow_s2w.PrePase();
            Parent.AppendFlow(flow_s2w);

            //循环时间控制
            XmlNode cornStr = xmlNode.SelectSingleNode("loop_time");

            m_cornString = cornStr.InnerText;

            XmlNode attTimer = xmlNode.SelectSingleNode("attach_timer");

            if (attTimer != null && attTimer.InnerText.Trim() != "")
            {
                m_waiting.m_timerID = Convert.ToInt32(attTimer.InnerText);
            }

            m_waiting.SetWaitingTime(m_cornString.Trim());
        }
예제 #2
0
        private AsmSimulator(ITextBuffer buffer, IBufferTagAggregatorFactoryService aggregatorFactory, AsmParameters p = null)
        {
            this._buffer            = buffer;
            this._aggregatorFactory = aggregatorFactory;
            this._cflow             = new CFlow(this._buffer.CurrentSnapshot.GetText());
            this._cachedStates      = new Dictionary <int, IState_R>();
            this.Is_Enabled         = true;
            this._scheduled         = new HashSet <int>();

            Dictionary <string, string> settings = new Dictionary <string, string>
            {
                /*
                 *      Legal parameters are:
                 *          auto_config(bool)(default: true)
                 *          debug_ref_count(bool)(default: false)
                 *          dump_models(bool)(default: false)
                 *          model(bool)(default: true)
                 *          model_validate(bool)(default: false)
                 *          proof(bool)(default: false)
                 *          rlimit(unsigned int)(default: 4294967295)
                 *          smtlib2_compliant(bool)(default: false)
                 *          timeout(unsigned int)(default: 4294967295)
                 *          trace(bool)(default: false)
                 *          trace_file_name(string)(default: z3.log)
                 *          type_check(bool)(default: true)
                 *          unsat_core(bool)(default: false)
                 *          well_sorted_check(bool)(default: false)
                 */
                { "unsat-core", "false" },   // enable generation of unsat cores
                { "model", "false" },        // enable model generation
                { "proof", "false" }         // enable proof generation
            };
            Context ctx = new Context(settings);

            if (p == null)
            {
                p = new AsmParameters();
            }
            bool useForward = true;
            bool useUndef   = true;

            this._runner = new RunnerZ3(p, ctx, useForward, useUndef, true)
            {
                OutputPane = AsmDudeToolsStatic.GetOutputPane()
            };
            this._buffer.Changed += this.Buffer_Changed;
        }