From 5f0f8e7c29b6812c1f7a2696d345a5dc7b1a217a Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Thu, 28 Aug 2008 16:57:09 +0200 Subject: LOAD: Print messages on *STANDARD-OUTPUT* instead of stderr. --- MLKInterpreter.m | 8 +++++--- MLKRoot.m | 24 ++++++++++++++---------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/MLKInterpreter.m b/MLKInterpreter.m index a808909..81415d1 100644 --- a/MLKInterpreter.m +++ b/MLKInterpreter.m @@ -140,10 +140,12 @@ PRIMARY (NSArray *array) formdesc = MLKPrintToString(code); //fprintf (stderr, "; COMPILE-MINIMALLY: %s\n", [formdesc UTF8String]); - fprintf (stderr, "; "); + MLKCharacterStream *ostream = [[MLKDynamicContext currentContext] + valueForSymbol:[cl intern:@"*STANDARD-OUTPUT*"]]; + [ostream writeString:@"; "]; for (i = 0; i < level; i++) - fprintf (stderr, "| "); - fprintf (stderr, "LOAD: %s\n", [formdesc UTF8String]); + [ostream writeString:@"| "]; + [ostream writeString:[NSString stringWithFormat:@"LOAD: %@\n", formdesc]]; if (MLKLoadCompilesP) { diff --git a/MLKRoot.m b/MLKRoot.m index 2184d6a..eaff94c 100644 --- a/MLKRoot.m +++ b/MLKRoot.m @@ -109,17 +109,21 @@ load (id _data, NSString *fileName, id _marker) MLKDynamicContext *ctx; l = [fileName length]; - fprintf (stderr, ";\n; "); + + MLKCharacterStream *ostream = [[MLKDynamicContext currentContext] + valueForSymbol:[cl intern:@"*STANDARD-OUTPUT*"]]; + + [ostream writeString:@";\n; "]; for (i = 0; i < 68 - 2*level; i++) - fprintf (stderr, "_"); + [ostream writeChar:'_']; - fprintf (stderr, "\n; /"); + [ostream writeString:@"\n; /"]; for (i = 0; i < 30 - l/2 - level; i++) - fprintf (stderr, "-"); - fprintf (stderr, " LOAD: %s ", [fileName UTF8String]); + [ostream writeChar:'-']; + [ostream writeString:[NSString stringWithFormat:@" LOAD: %s ", [fileName UTF8String]]]; for (i = 0; i < 30 - (l+1)/2 - level; i++) - fprintf (stderr, "-"); - fprintf (stderr, "\n; |\n"); + [ostream writeChar:'-']; + [ostream writeString:@"\n; |\n"]; //NSLog (@"%d", [input hasBytesAvailable]); [input open]; @@ -153,10 +157,10 @@ load (id _data, NSString *fileName, id _marker) LRELEASE (ctx); [input close]; - fprintf (stderr, "; \\"); + [ostream writeString:@"; \\"]; for (i = 0; i < 68 - 2*level; i++) - fprintf (stderr, "_"); - fprintf (stderr, "\n; \n"); + [ostream writeChar:'_']; + [ostream writeString:@"\n; \n"]; return truify (success); } -- cgit v1.2.3