Revision: 6424
          http://skim-app.svn.sourceforge.net/skim-app/?rev=6424&view=rev
Author:   hofman
Date:     2010-04-06 17:28:53 +0000 (Tue, 06 Apr 2010)

Log Message:
-----------
store object in IB array in a c-array and use accessors to translate to outlets

Modified Paths:
--------------
    trunk/SKIBArray.h
    trunk/SKIBArray.m

Modified: trunk/SKIBArray.h
===================================================================
--- trunk/SKIBArray.h   2010-04-06 17:18:53 UTC (rev 6423)
+++ trunk/SKIBArray.h   2010-04-06 17:28:53 UTC (rev 6424)
@@ -40,7 +40,7 @@
 
 
 @interface SKIBArray : NSArray {
-    id object1, object2, object3, object4, object5, object6, object7, object8, 
object9;
+    id object[9];
 }
 @property (nonatomic, assign) IBOutlet id object1, object2, object3, object4, 
object5, object6, object7, object8, object9;
 @end

Modified: trunk/SKIBArray.m
===================================================================
--- trunk/SKIBArray.m   2010-04-06 17:18:53 UTC (rev 6423)
+++ trunk/SKIBArray.m   2010-04-06 17:28:53 UTC (rev 6424)
@@ -41,10 +41,23 @@
 
 @implementation SKIBArray
 
-...@synthesize object1, object2, object3, object4, object5, object6, object7, 
object8, object9;
+...@dynamic object1, object2, object3, object4, object5, object6, object7, 
object8, object9;
 
+#define DEFINE_ACCESSORS(i) \
+- (id)object##i { return object[i-1]; } \
+- (void)setObject##i:(id)obj { object[i-1] = obj; }
+
+DEFINE_ACCESSORS(1)
+DEFINE_ACCESSORS(2)
+DEFINE_ACCESSORS(3)
+DEFINE_ACCESSORS(4)
+DEFINE_ACCESSORS(5)
+DEFINE_ACCESSORS(6)
+DEFINE_ACCESSORS(7)
+DEFINE_ACCESSORS(8)
+DEFINE_ACCESSORS(9)
+
 - (NSUInteger)count {
-    id object[] = {object1, object2, object3, object4, object5, object6, 
object7, object8, object9};
     NSUInteger i;
     for (i = 0; i < 9; i++)
         if (object[i] == nil) break;
@@ -52,20 +65,15 @@
 }
 
 - (id)objectAtIndex:(NSUInteger)anIndex {
-    id object[] = {object1, object2, object3, object4, object5, object6, 
object7, object8, object9};
     return object[anIndex];
 }
 
 - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state 
objects:(id *)stackbuf count:(NSUInteger)len {
     static const unsigned long const_mu = 1;
-    id object[] = {object1, object2, object3, object4, object5, object6, 
object7, object8, object9};
-    NSUInteger i = 0, current = state->state;
-    for (i = 0, current = state->state; current < 9 && i < len && 
object[current] != nil; i++, current++)
-        stackbuf[i] = object[current];
-    state->state = current;
-    state->itemsPtr = stackbuf;
+    state->state = 1;
+    state->itemsPtr = object;
        state->mutationsPtr = (unsigned long *)&const_mu;
-    return i;
+    return [self count];
 }
 
 @end


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to