add support for variable formatters

R=rsc
DELTA=134  (75 added, 41 deleted, 18 changed)
OCL=27245
CL=27247
diff --git a/src/lib/reflect/value.go b/src/lib/reflect/value.go
index ad0cd46..af43de9 100644
--- a/src/lib/reflect/value.go
+++ b/src/lib/reflect/value.go
@@ -914,3 +914,17 @@
 	*ap = value;
 	return newValueAddr(typ, Addr(ap));
 }
+
+// Indirect indirects one level through a value, if it is a pointer.
+// If not a pointer, the value is returned unchanged.
+// Useful when walking arbitrary data structures.
+func Indirect(v Value) Value {
+	if v.Kind() == PtrKind {
+		p := v.(PtrValue);
+		if p.Get() == nil {
+			return nil
+		}
+		v = p.Sub()
+	}
+	return v
+}