public IEnumerable<string> GenerateInputForProc(string name)
{
if (name == null) {
throw new ArgumentNullException ("procname");
}
Proc proc;
if (!_Procs.TryGetValue (name, out proc)) {
Console.WriteLine ("Unknown procedure: " + proc);
yield break;
}
int i = 0;
while (i < proc.Commands.Count) {
var line = proc.Commands[i];
yield return line;
i++;
if (_RequestReturn) {
_RequestReturn = false;
break;
}
if (_RequestJump != null) {
int to;
if (proc.JumpMarks.TryGetValue (_RequestJump, out to)) {
i = to;
}
else {
Console.WriteLine ("Could not find jump target \"" + _RequestJump + "\", aborting.");
yield break;
}
_RequestJump = null;
}
}
}