Skip to content

Commit

Permalink
Remove many static console write usages (#707)
Browse files Browse the repository at this point in the history
This makes the code more reusable. One use-case is running the code concurrently while keeping the output streams separate.
  • Loading branch information
keyboardDrummer authored Apr 7, 2023
1 parent 54b182b commit 03273e8
Show file tree
Hide file tree
Showing 49 changed files with 1,211 additions and 1,166 deletions.
10 changes: 5 additions & 5 deletions Source/AbstractInterpretation/IntervalDomain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,15 @@ public override void Specialize(Implementation impl)
var tf = new ThresholdFinder(impl);
tf.Find(out downThresholds, out upThresholds);
#if DEBUG_PRINT
Console.Write("DEBUG: for implementation '{0}', setting downs to [", impl.Name);
options.OutputWriter.Write("DEBUG: for implementation '{0}', setting downs to [", impl.Name);
foreach (var i in downThresholds) {
Console.Write(" {0}", i);
options.OutputWriter.Write(" {0}", i);
}
Console.Write(" ] and ups to [");
options.OutputWriter.Write(" ] and ups to [");
foreach (var i in upThresholds) {
Console.Write(" {0}", i);
options.OutputWriter.Write(" {0}", i);
}
Console.WriteLine(" ]");
options.OutputWriter.WriteLine(" ]");
#endif
}

Expand Down
8 changes: 4 additions & 4 deletions Source/AbstractInterpretation/NativeLattice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public void RunAbstractInterpretation(Program program)
DateTime start = new DateTime(); // to please compiler's definite assignment rules
if (options.Trace)
{
Console.WriteLine();
Console.WriteLine("Running abstract interpretation...");
options.OutputWriter.WriteLine();
options.OutputWriter.WriteLine("Running abstract interpretation...");
start = DateTime.UtcNow;
}

Expand Down Expand Up @@ -117,8 +117,8 @@ public void RunAbstractInterpretation(Program program)
{
DateTime end = DateTime.UtcNow;
TimeSpan elapsed = end - start;
Console.WriteLine(" [{0} s]", elapsed.TotalSeconds);
Console.Out.Flush();
options.OutputWriter.WriteLine(" [{0} s]", elapsed.TotalSeconds);
options.OutputWriter.Flush();
}
}

Expand Down
2 changes: 1 addition & 1 deletion Source/BoogieDriver/BoogieDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static int Main(string[] args)
{
Contract.Requires(cce.NonNullElements(args));

var options = new CommandLineOptions(new ConsolePrinter())
var options = new CommandLineOptions(Console.Out, new ConsolePrinter())
{
RunningBoogieFromCommandLine = true
};
Expand Down
Loading

0 comments on commit 03273e8

Please sign in to comment.