Permalink
Browse files

Add maximum loop output

  • Loading branch information...
1 parent ed4b4e1 commit 77a3eacaefb343cd5f59c5a63534dc1349bcc7b1 @ermau committed Apr 18, 2012
Showing with 29 additions and 1 deletion.
  1. +2 −0 Prototype/MainWindow.xaml
  2. +15 −1 Prototype/MainWindowViewModel.cs
  3. +12 −0 Prototype/StringObjectLogger.cs
@@ -37,6 +37,8 @@
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Label Target="{Binding ElementName=timeout}">Time_out (ms):</Label>
<TextBox Name="timeout" Margin="4" Text="{Binding ExecutionTimeout}" Width="50" />
+ <Label Target="{Binding ElementName=loops}">_Max Loops:</Label>
+ <TextBox Name="loops" Margin="4" Text="{Binding MaximumLoops}" Width="40" />
<CheckBox IsChecked="{Binding DebugTree}">Show _Tree</CheckBox>
<CheckBox IsChecked="{Binding ShowCompilerErrors}">Show Compiler _Errors</CheckBox>
</StackPanel>
@@ -111,6 +111,19 @@ public bool ShowCompilerErrors
}
}
+ public int MaximumLoops
+ {
+ get { return this.maxLoops; }
+ set
+ {
+ if (this.maxLoops == value)
+ return;
+
+ this.maxLoops = value;
+ OnPropertyChanged ("MaximumLoops");
+ }
+ }
+
public int ExecutionTimeout
{
get { return this.timeout; }
@@ -124,7 +137,7 @@ public int ExecutionTimeout
}
}
- private int timeout = 5000;
+ private int timeout = 5000, maxLoops = 100;
private bool showDebugTree, showCompilerErrors;
private string input, output, debug = "Initializing";
@@ -181,6 +194,7 @@ private void ProcessInput()
}
StringObjectLogger logger = new StringObjectLogger (this.cancelSource.Token);
+ logger.MaximumLoops = MaximumLoops;
new Timer (o =>
{
@@ -30,6 +30,12 @@ public StringObjectLogger (CancellationToken cancelToken)
CancelToken = cancelToken;
}
+ public int MaximumLoops
+ {
+ get;
+ set;
+ }
+
public readonly CancellationToken CancelToken;
private int loopLevel;
@@ -94,6 +100,12 @@ public void EndLoop()
int lcount = valueLists.Max (l => l.Count);
for (int i = 0; i < lcount; ++i)
{
+ if (i == MaximumLoops && i != 0)
+ {
+ this.builder.AppendLine (String.Format ("{0:N0} loops not shown", lcount - MaximumLoops));
+ break;
+ }
+
object[] vs = new object[valueLists.Length];
for (int n = 0; n < valueLists.Length; ++n)
{

0 comments on commit 77a3eac

Please sign in to comment.