diff --git a/ChangeLog b/ChangeLog index 06b4d42..7c6f1c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2012-01-15 Wolfgang Lux * Modules/ObjectiveC/ObjectiveCRuntime.m (-allClasses): diff --git a/Frameworks/StepTalk/NSInvocation+additions.m b/Frameworks/StepTalk/NSInvocation+additions.m index 02e234b..631098a 100644 --- a/Frameworks/StepTalk/NSInvocation+additions.m +++ b/Frameworks/StepTalk/NSInvocation+additions.m @@ -31,8 +31,11 @@ #import #import -#import +#import #import +#import + +#import #import "STExterns.h" #import "STObjCRuntime.h" @@ -40,8 +43,6 @@ #import "STSelector.h" #import "STStructure.h" -#import - #if 0 static Class NSNumber_class = nil; static Class NSString_class = nil; @@ -216,7 +217,7 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject) // NSLog(@"REGISTERING SELECTOR"); const char *name = [selectorName cString]; - sel = sel_register_name(name); + sel = sel_registerName(name); if(!sel) { @@ -235,7 +236,7 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject) if(requiresRegistration) { // NSLog(@"REGISTERING SELECTOR TYPES"); - sel = sel_register_typed_name([selectorName cString], [signature methodReturnType]); + sel = GSSelectorFromNameAndTypes([selectorName cString], [signature methodReturnType]); // NSLog(@"REGISTERED %@", NSStringFromSelector(sel)); } @@ -285,10 +286,12 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject) - (void)setArgumentAsObject:(id)anObject atIndex:(int)anIndex { const char *type; + NSUInteger size; void *value; type = [[self methodSignature] getArgumentTypeAtIndex:anIndex]; - value = NSZoneMalloc(STMallocZone,objc_sizeof_type(type)); + NSGetSizeAndAlignment(type, &size, NULL); + value = NSZoneMalloc(STMallocZone, size); STGetValueOfTypeFromObject(value, type, anObject); @@ -300,12 +303,13 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject) - (id)getArgumentAsObjectAtIndex:(int)anIndex { const char *type; + NSUInteger size; void *value; id object; type = [[self methodSignature] getArgumentTypeAtIndex:anIndex]; - - value = NSZoneMalloc(STMallocZone,objc_sizeof_type(type)); + NSGetSizeAndAlignment(type, &size, NULL); + value = NSZoneMalloc(STMallocZone, size); [self getArgument:value atIndex:anIndex]; object = STObjectFromValueOfType(value,type); diff --git a/Frameworks/StepTalk/STStructure.m b/Frameworks/StepTalk/STStructure.m index 23b879d..8c1a46a 100644 --- a/Frameworks/StepTalk/STStructure.m +++ b/Frameworks/StepTalk/STStructure.m @@ -29,13 +29,12 @@ #import "STExterns.h" #import #import +#import #import #import #import #import "NSInvocation+additions.h" -#import - @implementation STStructure + structureWithValue:(void *)value type:(const char*)type { @@ -72,10 +71,10 @@ - initWithValue:(void *)value type:(const char*)type { - const char *nameBeg; - int offset = 0; - int align; - int rem; + const char *nameBeg, *nextType; + NSUInteger offset = 0; + NSUInteger size, align; + NSUInteger rem; self = [super init]; @@ -95,22 +94,18 @@ while(*type != _C_STRUCT_E) { - [fields addObject:STObjectFromValueOfType(((char *)value)+offset,type)]; + nextType = NSGetSizeAndAlignment(type, &size, &align); - offset += objc_sizeof_type(type); - type = objc_skip_typespec(type); - - if(*type == _C_STRUCT_E) - { - break; - } - - align = objc_alignof_type(type); rem = offset % align; if(rem != 0) { offset += align - rem; } + + [fields addObject:STObjectFromValueOfType(((char *)value)+offset,type)]; + + offset += size; + type = nextType; } return self; @@ -126,33 +121,31 @@ - (void)getValue:(void *)value { const char *type = [structType cString]; - int offset=0; - int align; - int rem; - int i = 0; + const char *nextType; + NSUInteger offset = 0; + NSUInteger size, align; + NSUInteger rem; + NSUInteger i = 0; type++; while (*type != _C_STRUCT_E && *type++ != '='); while(*type != _C_STRUCT_E) { - STGetValueOfTypeFromObject((void *)((char*)value+offset), - type, - [fields objectAtIndex:i++]); + nextType = NSGetSizeAndAlignment(type, &size, &align); - offset += objc_sizeof_type(type); - type = objc_skip_typespec(type); - - if(*type == _C_STRUCT_E) - { - break; - } - align = objc_alignof_type(type); rem = offset % align; if(rem != 0) { offset += align - rem; } + + STGetValueOfTypeFromObject((char*)value+offset, + type, + [fields objectAtIndex:i++]); + + offset += size; + type = nextType; } } diff --git a/Languages/Smalltalk/ChangeLog b/Languages/Smalltalk/ChangeLog index f876ab2..a7d4b5f 100644 --- a/Languages/Smalltalk/ChangeLog +++ b/Languages/Smalltalk/ChangeLog @@ -1,3 +1,8 @@ +2012-01-15 Wolfgang Lux + + * STBytecodeInterpreter.m: Remove unnecessary include of Objective-C + runtime header. + 2011-01-20 Wolfgang Lux * SmalltalkInfo.plist: Add missing semicolons at end of plist diff --git a/Languages/Smalltalk/STBytecodeInterpreter.m b/Languages/Smalltalk/STBytecodeInterpreter.m index e25a735..6596f67 100644 --- a/Languages/Smalltalk/STBytecodeInterpreter.m +++ b/Languages/Smalltalk/STBytecodeInterpreter.m @@ -50,8 +50,6 @@ #import #import -#import - @interface STBytecodeInterpreter(STPrivateMethods) - (short)fetchBytecode; - (BOOL)dispatchBytecode:(STBytecode)bytecode; diff --git a/Modules/ObjectiveC/NSObject+additions.m b/Modules/ObjectiveC/NSObject+additions.m index 5976c53..e946e2c 100644 --- a/Modules/ObjectiveC/NSObject+additions.m +++ b/Modules/ObjectiveC/NSObject+additions.m @@ -26,8 +26,6 @@ #import "NSObject+additions.h" -#import - #import #import diff --git a/Modules/ObjectiveC/ObjectiveCRuntime.m b/Modules/ObjectiveC/ObjectiveCRuntime.m index 21166c5..4698bd6 100644 --- a/Modules/ObjectiveC/ObjectiveCRuntime.m +++ b/Modules/ObjectiveC/ObjectiveCRuntime.m @@ -28,8 +28,6 @@ #import "NSObject+additions.h" -#import - #import #import