diff options
author | Rich Hickey <richhickey@gmail.com> | 2006-09-25 15:00:34 +0000 |
---|---|---|
committer | Rich Hickey <richhickey@gmail.com> | 2006-09-25 15:00:34 +0000 |
commit | 33ef71cb45a818ff9f7324899b8e964f0ed3bfac (patch) | |
tree | f91fcc40cee77c96483c36bb0a56e2ac10b44402 /src | |
parent | fc795d4a8da2e9fc990037678b22a51475685600 (diff) |
enhanced format
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/runtime/RT.cs | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/cli/runtime/RT.cs b/src/cli/runtime/RT.cs index 76d19cc7..52c81ece 100644 --- a/src/cli/runtime/RT.cs +++ b/src/cli/runtime/RT.cs @@ -21,7 +21,8 @@ public class RT {
public static Symbol T = Symbol.intern("t");
- public static Object[] EMPTY_ARRAY = new Object[0];
+ static public Var OUT = Namespace.intern("clojure", "^out");
+ public static Object[] EMPTY_ARRAY = new Object[0];
static public readonly Object[] chars;
@@ -542,7 +543,21 @@ static public void formatStandard(TextWriter w,Object obj) { w.Write(obj.ToString());
}
-static public void format(TextWriter w, String s, ISeq args) {
+static public Object format(Object o, String s, params Object[] args) {
+ TextWriter w;
+ if(o == null)
+ w = new StringWriter();
+ else if(equal(o,T))
+ w = (TextWriter)OUT.getValue();
+ else
+ w = (TextWriter)o;
+ doFormat(w,s,ArraySeq.create(args));
+ if(o == null)
+ return w.ToString();
+ return null;
+}
+
+static public void doFormat(TextWriter w, String s, ISeq args) {
for (int i = 0; i < s.Length;)
{
char c = s[i++];
|