1#import <Foundation/Foundation.h> 2 3NSMutableArray * 4GetArray () 5{ 6 static NSMutableArray *the_array = NULL; 7 if (the_array == NULL) 8 the_array = [[NSMutableArray alloc] init]; 9 return the_array; 10} 11 12int 13AddElement (char *value) 14{ 15 NSString *element = [NSString stringWithUTF8String: value]; 16 int cur_elem = [GetArray() count]; 17 [GetArray() addObject: element]; 18 return cur_elem; 19} 20 21const char * 22GetElement (int idx) 23{ 24 if (idx >= [GetArray() count]) 25 return NULL; 26 else 27 return [[GetArray() objectAtIndex: idx] UTF8String]; 28} 29