summaryrefslogtreecommitdiff
path: root/src/pkg/runtime/print.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pkg/runtime/print.c')
-rw-r--r--src/pkg/runtime/print.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/pkg/runtime/print.c b/src/pkg/runtime/print.c
index 5e4f2f595..12484329e 100644
--- a/src/pkg/runtime/print.c
+++ b/src/pkg/runtime/print.c
@@ -348,68 +348,3 @@ void
{
write(fd, "\n", 1);
}
-
-// print an empty interface, for use by panic.
-// this could be arbitrarily complex in general,
-// so we pick off only a few important cases:
-// int, string, and values with a String() string method.
-void
-printany(Eface e)
-{
- int32 i;
- FuncType *ft;
- Method *m;
- String s;
- Type *rt;
- UncommonType *x;
-
- if(e.type == nil) {
- write(fd, "nil", 3);
- return;
- }
-
- if((x=e.type->x) != nil) {
- for(i=0; i<x->mhdr.len; i++) {
- // Look for String() string method.
- m = &x->m[i];
- if(m->name->len == 6 &&
- mcmp(m->name->str, (byte*)"String", 6) == 0 &&
- // Found String; check method signature for func() string.
- m->mtyp->kind == KindFunc &&
- (ft = (FuncType*)m->mtyp)->in.len == 0 &&
- ft->out.len == 1 &&
- // Found single output. Is it string?
- // Only base types have name != nil but pkgPath == nil.
- (rt = *(Type**)ft->out.array)->kind == KindString &&
- rt->x != nil &&
- rt->x->name != nil && rt->x->pkgPath == nil) {
- // Found the method!
- // Have to use assembly to call it
- // and save the return value.
- callString(m->ifn, e.data, &s);
- ·printstring(s);
- return;
- }
- }
- }
-
- switch(e.type->kind & ~KindNoPointers) {
- case KindInt:
- mcpy((byte*)&i, (byte*)&e.data, sizeof(i));
- ·printint(i);
- break;
-
- case KindString:
- ·printstring(*(String*)e.data);
- break;
-
- default:
- // Could print the other numeric types,
- // but that's overkill: good panics have
- // a string method anyway.
- ·printstring(*e.type->string);
- write(fd, "(???)", 5);
- break;
- }
-
-}