当前位置: 首页>>代码示例>>C#>>正文


C# ErrorHandler.OnModel方法代码示例

本文整理汇总了C#中ErrorHandler.OnModel方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorHandler.OnModel方法的具体用法?C# ErrorHandler.OnModel怎么用?C# ErrorHandler.OnModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorHandler的用法示例。


在下文中一共展示了ErrorHandler.OnModel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CheckOutcomeCore

        public override Outcome CheckOutcomeCore(ErrorHandler handler, int taskID = -1)
        {
            Contract.EnsuresOnThrow<UnexpectedProverOutputException>(true);

              var result = Outcome.Undetermined;

              if (Process == null)
            return result;

              try {
            currentErrorHandler = handler;
            FlushProverWarnings();

            var errorsLeft = CommandLineOptions.Clo.ProverCCLimit;

            if (CommandLineOptions.Clo.ConcurrentHoudini) {
              Contract.Assert(taskID >= 0);
              errorsLeft = CommandLineOptions.Clo.Cho[taskID].ProverCCLimit;
            }

            if (errorsLeft < 1)
              errorsLeft = 1;

            var globalResult = Outcome.Undetermined;

            while (true) {
              errorsLeft--;
              string[] labels = null;

              result = GetResponse();
              if (globalResult == Outcome.Undetermined)
            globalResult = result;

              if (result == Outcome.Invalid || result == Outcome.TimeOut || result == Outcome.OutOfMemory) {
            IList<string> xlabels;
            if (CommandLineOptions.Clo.UseLabels) {
              labels = GetLabelsInfo();
              if (labels == null)
              {
                xlabels = new string[] { };
              }
              else
              {
                xlabels = labels.Select(a => a.Replace("@", "").Replace("+", "")).ToList();
              }
            }
            else {
              labels = CalculatePath(handler.StartingProcId());
              xlabels = labels;
            }
              Model model = (result == Outcome.TimeOut || result == Outcome.OutOfMemory) ? null :
                  GetErrorModel();
            handler.OnModel(xlabels, model);
              }

              if (labels == null || !labels.Any() || errorsLeft == 0) break;

              if (CommandLineOptions.Clo.UseLabels) {
            var negLabels = labels.Where(l => l.StartsWith("@")).ToArray();
            var posLabels = labels.Where(l => !l.StartsWith("@"));
            Func<string, string> lbl = (s) => SMTLibNamer.QuoteId(SMTLibNamer.LabelVar(s));
            if (!options.MultiTraces)
              posLabels = Enumerable.Empty<string>();
            var conjuncts = posLabels.Select(s => "(not " + lbl(s) + ")").Concat(negLabels.Select(lbl)).ToArray();
            string expr = conjuncts.Length == 1 ? conjuncts[0] : ("(or " + conjuncts.Concat(" ") + ")"); ;
            if (!conjuncts.Any())
            {
              expr = "false";
            }
            SendThisVC("(assert " + expr + ")");
            SendThisVC("(check-sat)");
              }
              else {
            string source = labels[labels.Length - 2];
            string target = labels[labels.Length - 1];
            SendThisVC("(assert (not (= (ControlFlow 0 " + source + ") (- " + target + "))))");
            SendThisVC("(check-sat)");
              }
            }

            FlushLogFile();

            if (CommandLineOptions.Clo.RestartProverPerVC && Process != null)
              Process.NeedsRestart = true;

            return globalResult;

              } finally {
            currentErrorHandler = null;
              }
        }
开发者ID:Chenguang-Zhu,项目名称:ICE-C5,代码行数:91,代码来源:ProverInterface.cs

示例2: CheckOutcomeCore


//.........这里部分代码省略.........
                else
                {
                  break;
                }
              }

              unverified.UnionWith(timedOut);

              var end = DateTime.UtcNow;

              SendThisVC("; end timeout diagnostics");

              if (CommandLineOptions.Clo.TraceDiagnosticsOnTimeout)
              {
                Console.Out.WriteLine("Terminated timeout diagnostics after {0:F0} ms and {1} prover queries.", end.Subtract(start).TotalMilliseconds, queries);
                Console.Out.WriteLine("Outcome: {0}", result);
                Console.Out.WriteLine("Unverified assertions: {0} (of {1})", unverified.Count, ctx.TimeoutDiagnosticIDToAssertion.Keys.Count);

                string filename = "unknown";
                var assertion = ctx.TimeoutDiagnosticIDToAssertion.Values.Select(t => t.Item1).FirstOrDefault(a => a.tok != null && a.tok != Token.NoToken && a.tok.filename != null);
                if (assertion != null)
                {
                  filename = assertion.tok.filename;
                }
                File.AppendAllText("timeouts.csv", string.Format(";{0};{1};{2:F0};{3};{4};{5};{6}\n", filename, options.TimeLimit, end.Subtract(start).TotalMilliseconds, queries, result, unverified.Count, ctx.TimeoutDiagnosticIDToAssertion.Keys.Count));
              }

              #endregion
            }

            if (globalResult == Outcome.Undetermined)
              globalResult = result;
            
            if (result == Outcome.Invalid || result == Outcome.TimeOut || result == Outcome.OutOfMemory) {
              IList<string> xlabels;
              if (CommandLineOptions.Clo.UseLabels) {
                labels = GetLabelsInfo();
                if (labels == null)
                {
                  xlabels = new string[] { };
                }
                else
                {
                  xlabels = labels.Select(a => a.Replace("@", "").Replace("+", "")).ToList();
                }
              }
              else if(CommandLineOptions.Clo.SIBoolControlVC) {
                  labels = new string[0];
                  xlabels = labels;
              } else {
                labels = CalculatePath(handler.StartingProcId());
                xlabels = labels;
              }
                Model model = (result == Outcome.TimeOut || result == Outcome.OutOfMemory) ? null :
                    GetErrorModel();
              handler.OnModel(xlabels, model, result);
            }
            
            if (labels == null || !labels.Any() || errorsLeft == 0) break;
          } finally {
            if (popLater)
            {
              SendThisVC("(pop 1)");
            }
          }

          if (CommandLineOptions.Clo.UseLabels) {
            var negLabels = labels.Where(l => l.StartsWith("@")).ToArray();
            var posLabels = labels.Where(l => !l.StartsWith("@"));
            Func<string, string> lbl = (s) => SMTLibNamer.QuoteId(SMTLibNamer.LabelVar(s));
            if (!options.MultiTraces)
              posLabels = Enumerable.Empty<string>();
            var conjuncts = posLabels.Select(s => "(not " + lbl(s) + ")").Concat(negLabels.Select(lbl)).ToArray();
            string expr = conjuncts.Length == 1 ? conjuncts[0] : ("(or " + conjuncts.Concat(" ") + ")"); ;
            if (!conjuncts.Any())
            {
              expr = "false";
            }
            SendThisVC("(assert " + expr + ")");
            SendCheckSat();
          }
          else {
            string source = labels[labels.Length - 2];
            string target = labels[labels.Length - 1];
            SendThisVC("(assert (not (= (ControlFlow 0 " + source + ") (- " + target + "))))");
            SendCheckSat();
          }
        }

        FlushLogFile();

        if (CommandLineOptions.Clo.RestartProverPerVC && Process != null)
          Process.NeedsRestart = true;

        return globalResult;

      } finally {
        currentErrorHandler = null;
      }
    }
开发者ID:qunyanm,项目名称:boogie,代码行数:101,代码来源:ProverInterface.cs

示例3: CheckOutcomeCore

 public override Outcome CheckOutcomeCore(ErrorHandler handler) {
   if (outcome == Outcome.Invalid) {
     foreach (Z3ErrorModelAndLabels z3LabelModel in z3LabelModels) {
       List<string> unprefixedLabels = RemovePrefixes(z3LabelModel.RelevantLabels);
       handler.OnModel(unprefixedLabels, z3LabelModel.Model);
     }
   }
   return outcome;
 }
开发者ID:qunyanm,项目名称:boogie,代码行数:9,代码来源:ProverLayer.cs


注:本文中的ErrorHandler.OnModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。