@@ -49,23 +49,30 @@ _types = [self allocMemoryWithSize: length + 1]; memcpy(_types, types, length); _typesPointers = [[OFMutableData alloc] initWithItemSize: sizeof(char *)]; + _offsets = [[OFMutableData alloc] + initWithItemSize: sizeof(size_t)]; last = _types; for (size_t i = 0; i < length; i++) { if (isdigit(_types[i])) { + size_t offset = _types[i] - '0'; + if (last == _types + i) @throw [OFInvalidFormatException exception]; _types[i] = '\0'; [_typesPointers addItem: &last]; i++; - for (; i < length && isdigit(_types[i]); i++); + for (; i < length && isdigit(_types[i]); i++) + offset = offset * 10 + _types[i] - '0'; + + [_offsets addItem: &offset]; last = _types + i; i--; } else if (_types[i] == '{') { size_t depth = 0; @@ -111,10 +118,11 @@ } - (void)dealloc { [_typesPointers release]; + [_offsets release]; [super dealloc]; } - (size_t)numberOfArguments @@ -124,11 +132,21 @@ - (const char *)methodReturnType { return *(const char **)[_typesPointers firstItem]; } + +- (size_t)frameLength +{ + return *(size_t *)[_offsets firstItem]; +} - (const char *)argumentTypeAtIndex: (size_t)index { return *(const char **)[_typesPointers itemAtIndex: index + 1]; } + +- (size_t)argumentOffsetAtIndex: (size_t)index +{ + return *(size_t *)[_offsets itemAtIndex: index + 1]; +} @end