Clean up imports in several StepTalk files removing includes of the

Objective-C runtime headers. Also replace a few more deprecated
Objective-C runtime calls.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@34532 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2012-01-15 09:04:40 +00:00
parent 9903bbabc3
commit f59cb2fc92
7 changed files with 50 additions and 45 deletions

View file

@ -1,3 +1,12 @@
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com
* Frameworks/StepTalk/NSInvocation+additions.m:
* Frameworks/StepTalk/STStructure.m:
* Modules/ObjectiveC/NSObject+additions.m:
* Modules/ObjectiveC/ObjectiveCRuntime.m:
Clean up imports removing includes of Objective-C runtime headers.
Also replace a few more deprecated Objective-C runtime calls.
2011-04-07 Wolfgang Lux <wolfgang.lux@gmail.com>
* Modules/ObjectiveC/ObjectiveCRuntime.m (-allClasses):

View file

@ -31,8 +31,11 @@
#import <Foundation/NSDebug.h>
#import <Foundation/NSException.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
#import <GNUstepBase/GSObjCRuntime.h>
#import "STExterns.h"
#import "STObjCRuntime.h"
@ -40,8 +43,6 @@
#import "STSelector.h"
#import "STStructure.h"
#import <objc/objc-api.h>
#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);

View file

@ -29,13 +29,12 @@
#import "STExterns.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSException.h>
#import <Foundation/NSObjCRuntime.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
#import <Foundation/NSDebug.h>
#import "NSInvocation+additions.h"
#import <objc/objc-api.h>
@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;
}
}

View file

@ -1,3 +1,8 @@
2012-01-15 Wolfgang Lux <wolfgang.lux@gmail.com>
* STBytecodeInterpreter.m: Remove unnecessary include of Objective-C
runtime header.
2011-01-20 Wolfgang Lux <wolfgang.lux@gmail.com>
* SmalltalkInfo.plist: Add missing semicolons at end of plist

View file

@ -50,8 +50,6 @@
#import <Foundation/NSInvocation.h>
#import <Foundation/NSValue.h>
#import <objc/encoding.h>
@interface STBytecodeInterpreter(STPrivateMethods)
- (short)fetchBytecode;
- (BOOL)dispatchBytecode:(STBytecode)bytecode;

View file

@ -26,8 +26,6 @@
#import "NSObject+additions.h"
#import <objc/objc-api.h>
#import <Foundation/NSArray.h>
#import <Foundation/NSString.h>

View file

@ -28,8 +28,6 @@
#import "NSObject+additions.h"
#import <objc/objc-api.h>
#import <StepTalk/STObjCRuntime.h>
#import <StepTalk/STSelector.h>