Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Finish implementation of CATCH/CONTROL
  • Loading branch information
sorear committed Oct 20, 2011
1 parent 3842922 commit ba7d08c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
30 changes: 20 additions & 10 deletions lib/CodeGen.cs
Expand Up @@ -3555,17 +3555,19 @@ public class DowncallReceiver : CallReceiver {
}
}

object Call(object[] args) {
if (TraceDown) {
StringBuilder sb = new StringBuilder();
foreach(object a in args) {
char ch = (a is int) ? 'i' : (a is Handle) ? 'h' :
(a is string) ? 's' : (a is bool) ? 'b' :
(a == null) ? 'n' : 'X';
sb.AppendFormat("{0}:{1}; ", ch, a);
}
Console.WriteLine(sb.ToString());
void ShowCall(object[] args) {
StringBuilder sb = new StringBuilder();
foreach(object a in args) {
char ch = (a is int) ? 'i' : (a is Handle) ? 'h' :
(a is string) ? 's' : (a is bool) ? 'b' :
(a == null) ? 'n' : 'X';
sb.AppendFormat("{0}:{1}; ", ch, a);
}
Console.WriteLine(sb.ToString());
}

object Call(object[] args) {
if (TraceDown) ShowCall(args);
string cmd = (string) args[0];
if (cmd == "gettype") {
object o = Handle.Unbox(args[1]);
Expand Down Expand Up @@ -4093,6 +4095,13 @@ public class DowncallReceiver : CallReceiver {
tgt.sig_i = sig_i.ToArray();
tgt.sig_r = sig_r.ToArray();
return null;
} else if (cmd == "sub_contains_phaser") {
SubInfo s = (SubInfo)Handle.Unbox(args[1]);
int p = (int)args[2];
foreach (SubInfo z in s.children)
if (z.phaser == p)
return true;
return false;
} else if (cmd == "sub_set_phaser") {
SubInfo s = (SubInfo)Handle.Unbox(args[1]);
int p = (int)args[2];
Expand Down Expand Up @@ -4165,6 +4174,7 @@ public class DowncallReceiver : CallReceiver {
Kernel.SaferMode = true;
return null;
} else {
ShowCall(args);
return new Exception("No handler for downcall " + cmd);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Kernel.cs
Expand Up @@ -497,7 +497,7 @@ class IdentityComparer : IEqualityComparer<object> {

if (!is_mainish && bottom == null) {
Kernel.RunInferior(Kernel.GetInferiorRoot().
MakeChild(null, mainline, AnyP));
MakeChild(null, mainline, Kernel.AnyP));
}
}

Expand Down

0 comments on commit ba7d08c

Please sign in to comment.