本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}