Skip to content
This repository
Browse code

cleaned up the print/puts methods for iOS

previously both were referring to the NuConsoleViewController
class, which is only used on Cocoa for the interactive console.
This class has a method named "write:", which apparently causes
problems for the App Store static analyzer. That method reference
is eliminated now on iOS.
  • Loading branch information...
commit 41865a894574e7a0c539678a87e9b116edf6df51 1 parent 0a13c78
Tim Burks authored November 11, 2011

Showing 1 changed file with 15 additions and 2 deletions. Show diff stats Hide diff stats

  1. 17  objc/Nu.m
17  objc/Nu.m
@@ -8264,9 +8264,11 @@ - (id) callWithArguments:(id)cdr context:(NSMutableDictionary *)context
8264 8264
 
8265 8265
 @end
8266 8266
 
  8267
+#if !TARGET_OS_IPHONE
8267 8268
 @interface NuConsoleViewController : NSObject {}
8268 8269
 - (void) write:(id) string;
8269 8270
 @end
  8271
+#endif
8270 8272
 
8271 8273
 @interface Nu_puts_operator : NuOperator {}
8272 8274
 @end
@@ -8274,22 +8276,28 @@ @interface Nu_puts_operator : NuOperator {}
8274 8276
 @implementation Nu_puts_operator
8275 8277
 - (id) callWithArguments:(id)cdr context:(NSMutableDictionary *)context
8276 8278
 {
  8279
+#if !TARGET_OS_IPHONE
8277 8280
     NuSymbolTable *symbolTable = [context objectForKey:SYMBOLS_KEY];
8278 8281
     NuConsoleViewController *console = (NuConsoleViewController*)
8279 8282
     [[symbolTable symbolWithString:@"$$console"] value];
  8283
+#endif
8280 8284
     NSString *string;
8281 8285
     id cursor = cdr;
8282 8286
     while (cursor && (cursor != Nu__null)) {
8283 8287
         id value = [[cursor car] evalWithContext:context];
8284 8288
         if (value) {
8285 8289
             string = [value stringValue];
  8290
+#if !TARGET_OS_IPHONE
8286 8291
             if (console && (console != Nu__null)) {
8287 8292
                 [console write:string];
8288 8293
                 [console write:[NSString carriageReturn]];
8289 8294
             }
8290 8295
             else {
  8296
+#endif
8291 8297
                 printf("%s\n", [string cStringUsingEncoding:NSUTF8StringEncoding]);
  8298
+#if !TARGET_OS_IPHONE
8292 8299
             }
  8300
+#endif
8293 8301
         }
8294 8302
         cursor = [cursor cdr];
8295 8303
     }
@@ -8319,19 +8327,24 @@ @interface Nu_print_operator : NuOperator {}
8319 8327
 @implementation Nu_print_operator
8320 8328
 - (id) callWithArguments:(id)cdr context:(NSMutableDictionary *)context
8321 8329
 {
  8330
+#if !TARGET_OS_IPHONE
8322 8331
     NuSymbolTable *symbolTable = [context objectForKey:SYMBOLS_KEY];
8323 8332
     NuConsoleViewController *console = (NuConsoleViewController*)[[symbolTable symbolWithString:@"$$console"] value];
8324  
-    
  8333
+#endif
8325 8334
     NSString *string;
8326 8335
     id cursor = cdr;
8327 8336
     while (cursor && (cursor != Nu__null)) {
8328 8337
         string = [[[cursor car] evalWithContext:context] stringValue];
  8338
+#if !TARGET_OS_IPHONE
8329 8339
         if (console && (console != Nu__null)) {
8330 8340
             [console write:string];
8331 8341
         }
8332 8342
         else {
  8343
+#endif
8333 8344
             printf("%s", [string cStringUsingEncoding:NSUTF8StringEncoding]);
  8345
+#if !TARGET_OS_IPHONE
8334 8346
         }
  8347
+#endif
8335 8348
         cursor = [cursor cdr];
8336 8349
     }
8337 8350
     return Nu__null;;
@@ -9057,7 +9070,7 @@ void load_builtins(NuSymbolTable *symbolTable)
9057 9070
 #endif
9058 9071
     install(@"puts",     Nu_puts_operator);
9059 9072
     install(@"print",    Nu_print_operator);
9060  
-    
  9073
+  
9061 9074
     install(@"let",      Nu_let_operator);
9062 9075
     
9063 9076
     install(@"load",     Nu_load_operator);

0 notes on commit 41865a8

Please sign in to comment.
Something went wrong with that request. Please try again.