mkhl / nu fork watch download tarball
public
Fork of timburks/nu
Description: The Nu programming language. A clone of the official repository at http://code.neontology.com.
Homepage: http://programming.nu
Clone URL: git://github.com/mkhl/nu.git
Search Repo:
iPhone related changes.

Here are the file modifications that go with my previous commit.
timburks (author)
Wed Apr 09 09:44:19 -0700 2008
commit  fd6b505f4081374ebc439f2da1817e2a54318652
tree    670e60aec45b8a79a0738d2c070737f7bc01b7b1
parent  817882a6e0f25849b53a0b123ba4b230c88e1fb1
...
8
9
10
11
 
12
13
14
15
 
16
17
18
...
8
9
10
 
11
12
 
 
 
13
14
15
16
0
@@ -8,11 +8,9 @@
0
 
0
 (case platform
0
       ("iPhone"
0
- (set PLATFORM "-isysroot /Developer/Platforms/Aspen.platform/Developer/SDKs/Aspen1.2.sdk")
0
+ (set PLATFORM "-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.0.sdk")
0
                (set @arch '("armv6"))
0
- (@c_files unionSet:(filelist "^libffi/.*\.c$"))
0
- (@c_files unionSet:(filelist "^libffi/.*\.S$"))
0
- (set @cc "/Developer/Platforms/Aspen.platform/Developer/usr/bin/gcc-4.0"))
0
+ (set @cc "/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.0"))
0
       ("simulator"
0
                   (set PLATFORM "-isysroot /Developer/Platforms/AspenSimulator.platform/Developer/SDKs/AspenSimulator1.2.sdk")
0
                   (set @arch '("i386")))
...
258
259
260
 
261
262
263
 
264
265
266
...
258
259
260
261
262
263
264
265
266
267
268
0
@@ -258,9 +258,11 @@ void NuInit()
0
         [NSView exchangeInstanceMethod:@selector(retain) withMethod:@selector(nuRetain)];
0
         #endif
0
 
0
+ #ifndef IPHONE
0
         // Enable support for protocols in Nu. Apple doesn't have an API for this, so we use our own.
0
         extern void nu_initProtocols();
0
         nu_initProtocols();
0
+ #endif
0
 
0
         // if you don't like making Protocol a subclass of NSObject (see nu_initProtocols), you can do this instead.
0
         // transplant_nu_methods([Protocol class], [NSObject class]);
...
176
177
178
 
 
 
 
 
 
 
179
180
181
 
182
183
184
...
250
251
252
 
253
254
255
...
280
281
282
 
283
284
285
286
287
 
288
289
290
...
311
312
313
 
314
315
316
...
404
405
406
407
 
408
409
410
...
476
477
478
479
 
 
480
481
482
483
484
 
485
486
487
...
543
544
545
546
 
547
548
549
...
176
177
178
179
180
181
182
183
184
185
186
187
 
188
189
190
191
...
257
258
259
260
261
262
263
...
288
289
290
291
292
293
294
295
296
297
298
299
300
...
321
322
323
324
325
326
327
...
415
416
417
 
418
419
420
421
...
487
488
489
 
490
491
492
493
494
495
 
496
497
498
499
...
555
556
557
 
558
559
560
561
0
@@ -176,9 +176,16 @@ SEL sel_getUid(const char *str)
0
 }
0
 #endif
0
 
0
+#ifdef IPHONE
0
+#import "objc/runtime.h"
0
+IMP nu_class_replaceMethod(Class cls, SEL name, IMP imp, const char *types) {
0
+ return class_replaceMethod(cls, name, imp, types);
0
+}
0
+#endif
0
+
0
 #ifndef LEOPARD_OBJC2
0
 #include "objc_runtime.h"
0
-
0
+#ifndef IPHONE
0
 BOOL class_hasMethod(Class cls, SEL name)
0
 {
0
     // Method (Method_t on Linux) existing_method = class_getInstanceMethod(cls, name);
0
@@ -250,6 +257,7 @@ Ivar *class_copyIvarList(Class cls, unsigned int *outCount)
0
     return list;
0
 }
0
 
0
+
0
 #ifdef DARWIN
0
 Method *class_copyMethodList(Class cls, unsigned int *outCount)
0
 #else
0
@@ -280,11 +288,13 @@ Method_t *class_copyMethodList(Class cls, unsigned int *outCount)
0
     return list;
0
 }
0
 
0
+
0
 Class class_getSuperclass(Class cls)
0
 {
0
     return cls->super_class;
0
 }
0
 
0
+
0
 #ifdef DARWIN
0
 const char *ivar_getName(Ivar v)
0
 #else
0
@@ -311,6 +321,7 @@ const char *ivar_getTypeEncoding(Ivar_t v)
0
 {
0
     return v->ivar_type;
0
 }
0
+#endif
0
 
0
 #ifdef DARWIN
0
 char *method_copyArgumentType(Method m, unsigned int index)
0
@@ -404,7 +415,7 @@ static struct objc_method_list** method_list_alloc(int cnt)
0
     mlp[cnt-1] = (struct objc_method_list*)-1; // END_OF_METHODS_LIST
0
     return mlp;
0
 }
0
-
0
+#ifndef IPHONE
0
 // this function was taken from RubyCocoa
0
 #ifdef DARWIN
0
 Class objc_allocateClassPair(Class super_class, const char *name, size_t extraBytes)
0
@@ -476,12 +487,13 @@ Class objc_allocateClassPair(Class super_class, const char *name, size_t extraBy
0
     return c;
0
 }
0
 #endif
0
-
0
+#endif
0
+#ifndef IPHONE
0
 void objc_registerClassPair(Class cls)
0
 {
0
     objc_addClass(cls);
0
 }
0
-
0
+#endif
0
 Class object_getClass(id obj)
0
 {
0
 #ifdef DARWIN
0
@@ -543,7 +555,7 @@ IMP nu_class_replaceMethod(Class cls, SEL name, IMP imp, const char *types)
0
 
0
 void class_addInstanceVariable_withSignature(Class thisClass, const char *variableName, const char *signature)
0
 {
0
- #ifdef __x86_64__
0
+ #if defined(__x86_64__) || defined(IPHONE)
0
     extern size_t size_of_objc_type(const char *typeString);
0
     size_t size = size_of_objc_type(signature);
0
     uint8_t alignment = log2(size);
...
709
710
711
712
 
 
713
714
715
...
745
746
747
748
 
 
749
750
751
...
1144
1145
1146
 
1147
1148
1149
...
1156
1157
1158
 
1159
1160
1161
...
1395
1396
1397
1398
 
1399
1400
1401
...
1410
1411
1412
1413
 
1414
1415
1416
...
1440
1441
1442
1443
 
1444
1445
1446
...
1492
1493
1494
1495
 
1496
1497
1498
...
1527
1528
1529
1530
 
1531
1532
1533
...
1756
1757
1758
1759
1760
 
 
1761
1762
1763
...
1825
1826
1827
 
1828
 
1829
1830
1831
...
709
710
711
 
712
713
714
715
716
...
746
747
748
 
749
750
751
752
753
...
1146
1147
1148
1149
1150
1151
1152
...
1159
1160
1161
1162
1163
1164
1165
...
1399
1400
1401
 
1402
1403
1404
1405
...
1414
1415
1416
 
1417
1418
1419
1420
...
1444
1445
1446
 
1447
1448
1449
1450
...
1496
1497
1498
 
1499
1500
1501
1502
...
1531
1532
1533
 
1534
1535
1536
1537
...
1760
1761
1762
 
 
1763
1764
1765
1766
1767
...
1829
1830
1831
1832
1833
1834
1835
1836
1837
0
@@ -709,7 +709,8 @@ static bool valueIsTrue(id value)
0
     id args = [[cdr cdr] car];
0
     id body = [[cdr cdr] cdr];
0
     NuBlock *block = [[NuBlock alloc] initWithParameters:args body:body context:context];
0
- [context setPossiblyNullObject:block forKey:symbol]; // this defines the function in the calling context
0
+ // this defines the function in the calling context
0
+ [context setPossiblyNullObject:block forKey:symbol];
0
                                                   // this defines the function in the block context, which allows recursion
0
     [[block context] setPossiblyNullObject:block forKey:symbol];
0
     return block;
0
@@ -745,7 +746,8 @@ static bool valueIsTrue(id value)
0
     id body = [cdr cdr];
0
 
0
     NuMacro *macro = [[NuMacro alloc] initWithName:name body:body];
0
- [context setPossiblyNullObject:macro forKey:name]; // this defines the function in the calling context
0
+ // this defines the function in the calling context
0
+ [context setPossiblyNullObject:macro forKey:name];
0
     return macro;
0
 }
0
 
0
@@ -1144,6 +1146,7 @@ static bool valueIsTrue(id value)
0
 
0
 @end
0
 
0
+#ifndef IPHONE
0
 @interface Nu_gets_operator : NuOperator {}
0
 @end
0
 
0
@@ -1156,6 +1159,7 @@ static bool valueIsTrue(id value)
0
 }
0
 
0
 @end
0
+#endif
0
 
0
 @interface Nu_print_operator : NuOperator {}
0
 @end
0
@@ -1395,7 +1399,7 @@ id loadNuLibraryFile(NSString *nuFileName, id parser, id context, id symbolTable
0
     NuSymbolTable *symbolTable = [context objectForKey:SYMBOLS_KEY];
0
     id className = [cdr car];
0
     id body = Nu__null;
0
- #ifdef __x86_64__
0
+ #if defined(__x86_64__) || defined(IPHONE)
0
     Class newClass = nil;
0
     #endif
0
     NuClass *childClass;
0
@@ -1410,7 +1414,7 @@ id loadNuLibraryFile(NSString *nuFileName, id parser, id context, id symbolTable
0
         if (!parentClass)
0
             [NSException raise:@"NuUndefinedSuperclass" format:@"undefined superclass %@", [parentName stringValue]];
0
 
0
- #ifdef __x86_64__
0
+ #if defined(__x86_64__) || defined(IPHONE)
0
         newClass = objc_allocateClassPair(parentClass, [[className stringValue] cStringUsingEncoding:NSUTF8StringEncoding], 0);
0
         childClass = [NuClass classWithClass:newClass];
0
         [childClass setRegistered:NO];
0
@@ -1440,7 +1444,7 @@ id loadNuLibraryFile(NSString *nuFileName, id parser, id context, id symbolTable
0
         result = [block evalWithArguments:Nu__null context:Nu__null];
0
         [block release];
0
     }
0
- #ifdef __x86_64__
0
+ #if defined(__x86_64__) || defined(IPHONE)
0
     if (newClass && ([childClass isRegistered] == NO)) {
0
         [childClass registerClass];
0
     }
0
@@ -1492,7 +1496,7 @@ id loadNuLibraryFile(NSString *nuFileName, id parser, id context, id symbolTable
0
 {
0
     NuSymbolTable *symbolTable = [context objectForKey:SYMBOLS_KEY];
0
     NuClass *classWrapper = [context objectForKey:[symbolTable symbolWithCString:"_class"]];
0
- #ifdef __x86_64__
0
+ #if defined(__x86_64__) || defined(IPHONE)
0
     // this will only work if the class is unregistered...
0
     if ([classWrapper isRegistered]) {
0
         [NSException raise:@"NuIvarAddedTooLate" format:@"instance variables must be added when a class is created and before any method declarations"];
0
@@ -1527,7 +1531,7 @@ id loadNuLibraryFile(NSString *nuFileName, id parser, id context, id symbolTable
0
     NuSymbolTable *symbolTable = [context objectForKey:SYMBOLS_KEY];
0
 
0
     NuClass *classWrapper = [context objectForKey:[symbolTable symbolWithCString:"_class"]];
0
- #ifdef __x86_64__
0
+ #if defined(__x86_64__) || defined(IPHONE)
0
     // this will only work if the class is unregistered...
0
     if ([classWrapper isRegistered]) {
0
         [NSException raise:@"NuIvarAddedTooLate" format:@"instance variables must be added when a class is created and before any method declarations"];
0
@@ -1756,8 +1760,8 @@ void load_builtins(NuSymbolTable *symbolTable)
0
 
0
     install("car", Nu_car_operator);
0
     install("cdr", Nu_cdr_operator);
0
- install("first", Nu_car_operator);
0
- install("rest", Nu_cdr_operator);
0
+ install("first", Nu_car_operator);
0
+ install("rest", Nu_cdr_operator);
0
     install("head", Nu_car_operator);
0
     install("tail", Nu_cdr_operator);
0
     install("atom", Nu_atom_operator);
0
@@ -1825,7 +1829,9 @@ void load_builtins(NuSymbolTable *symbolTable)
0
 
0
     install("do", Nu_do_operator);
0
 
0
+ #ifndef IPHONE
0
     install("gets", Nu_gets_operator);
0
+ #endif
0
     install("puts", Nu_puts_operator);
0
     install("print", Nu_print_operator);
0
 
...
15
16
17
 
18
19
20
...
39
40
41
 
42
43
44
...
342
343
344
 
...
15
16
17
18
19
20
21
...
40
41
42
43
44
45
46
...
344
345
346
347
0
@@ -15,6 +15,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
0
 See the License for the specific language governing permissions and
0
 limitations under the License.
0
 */
0
+
0
 #ifdef LINUX
0
 #define true 1
0
 #define false 0
0
@@ -39,6 +40,7 @@ struct objc_method_description_list
0
 };
0
 #endif
0
 
0
+#ifndef IPHONE
0
 #ifndef __x86_64__
0
 
0
 @interface Protocol : NSObject
0
@@ -342,3 +344,4 @@ void nu_initProtocols()
0
 
0
 @end
0
 #endif
0
+#endif

Comments

    No one has commented yet.