StepTalk framework: int->NSInteger transition

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@36657 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2013-05-26 15:35:06 +00:00
parent ba12bd3874
commit 7532ab371a
13 changed files with 86 additions and 61 deletions

View file

@ -1,3 +1,19 @@
2013-05-26 Wolfgang Lux <wolfgang.lux@gmail.com>
* Frameworks/StepTalk/NSInvocation+additions.h:
* Frameworks/StepTalk/NSInvocation+additions.m:
* Frameworks/StepTalk/NSNumber+additions.h:
* Frameworks/StepTalk/NSNumber+additions.m:
* Frameworks/StepTalk/STActor.m:
* Frameworks/StepTalk/STEnvironmentDescription.h:
* Frameworks/StepTalk/STEnvironmentDescription.m:
* Frameworks/StepTalk/STLanguageManager.m:
* Frameworks/StepTalk/STObjCRuntime.m:
* Frameworks/StepTalk/STScriptObject.m:
* Frameworks/StepTalk/STStructure.h:
* Frameworks/StepTalk/STStructure.m:
int->NSInteger transition
2013-04-06 Wolfgang Lux <wolfgang.lux@gmail.com> 2013-04-06 Wolfgang Lux <wolfgang.lux@gmail.com>
* Frameworks/StepTalk/STActor.m (-setValue:forKey:): Fix bug where * Frameworks/StepTalk/STActor.m (-setValue:forKey:): Fix bug where

View file

@ -34,8 +34,8 @@ id STObjectFromValueOfType(void *value, const char *type);
+ invocationWithTarget:(id)target selectorName:(NSString *)selectorName; + invocationWithTarget:(id)target selectorName:(NSString *)selectorName;
+ invocationWithTarget:(id)target selector:(SEL)selector; + invocationWithTarget:(id)target selector:(SEL)selector;
- (void)setArgumentAsObject:(id)anObject atIndex:(int)anIndex; - (void)setArgumentAsObject:(id)anObject atIndex:(NSInteger)anIndex;
- (id)getArgumentAsObjectAtIndex:(int)anIndex; - (id)getArgumentAsObjectAtIndex:(NSInteger)anIndex;
- (id)returnValueAsObject; - (id)returnValueAsObject;
@end @end

View file

@ -283,7 +283,7 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject)
return invocation; return invocation;
} }
- (void)setArgumentAsObject:(id)anObject atIndex:(int)anIndex - (void)setArgumentAsObject:(id)anObject atIndex:(NSInteger)anIndex
{ {
const char *type; const char *type;
NSUInteger size; NSUInteger size;
@ -300,7 +300,7 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject)
} }
- (id)getArgumentAsObjectAtIndex:(int)anIndex - (id)getArgumentAsObjectAtIndex:(NSInteger)anIndex
{ {
const char *type; const char *type;
NSUInteger size; NSUInteger size;
@ -321,7 +321,7 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject)
- (id)returnValueAsObject - (id)returnValueAsObject
{ {
const char *type; const char *type;
int returnLength; NSUInteger returnLength;
void *value; void *value;
id returnObject = nil; id returnObject = nil;
@ -331,7 +331,8 @@ void STGetValueOfTypeFromObject(void *value, const char *type, id anObject)
returnLength = [signature methodReturnLength]; returnLength = [signature methodReturnLength];
NSDebugLLog(@"STSending", NSDebugLLog(@"STSending",
@" return type '%s', buffer length %i",type,returnLength); @" return type '%s', buffer length %lu",
type,(unsigned long)returnLength);
if(returnLength!=0) if(returnLength!=0)
{ {

View file

@ -32,7 +32,7 @@
- subtract:(NSNumber *)number; - subtract:(NSNumber *)number;
- multiply:(NSNumber *)number; - multiply:(NSNumber *)number;
- divide:(NSNumber *)number; - divide:(NSNumber *)number;
- (unsigned int)isLessThan:(NSNumber *)number; - (BOOL)isLessThan:(NSNumber *)number;
- (BOOL)isGreatherThan:(NSNumber *)number; - (BOOL)isGreatherThan:(NSNumber *)number;
- (BOOL)isLessOrEqualThan:(NSNumber *)number; - (BOOL)isLessOrEqualThan:(NSNumber *)number;
- (BOOL)isGreatherOrEqualThan:(NSNumber *)number; - (BOOL)isGreatherOrEqualThan:(NSNumber *)number;
@ -40,13 +40,13 @@
@interface NSNumber (STLogicOperations) @interface NSNumber (STLogicOperations)
- (unsigned int)or:(NSNumber *)number; - (NSUInteger)or:(NSNumber *)number;
- (unsigned int)and:(NSNumber *)number; - (NSUInteger)and:(NSNumber *)number;
- (unsigned int)not; - (NSUInteger)not;
@end @end
@interface NSNumber (STStructure) @interface NSNumber (STStructure)
- rangeWith:(int)length; - rangeWith:(NSUInteger)length;
- pointWith:(float)y; - pointWith:(float)y;
- sizeWith:(float)h; - sizeWith:(float)h;
@end @end

View file

@ -77,7 +77,7 @@
return [NSNumber numberWithDouble:(fmod([self doubleValue], return [NSNumber numberWithDouble:(fmod([self doubleValue],
[number doubleValue]))]; [number doubleValue]))];
} }
- (unsigned int)isLessThan:(NSNumber *)number - (BOOL)isLessThan:(NSNumber *)number
{ {
return ([self doubleValue] < [number doubleValue]); return ([self doubleValue] < [number doubleValue]);
} }
@ -99,28 +99,29 @@
@implementation NSNumber (STLogicOperations) @implementation NSNumber (STLogicOperations)
- (unsigned int)or:(NSNumber *)number - (NSUInteger)or:(NSNumber *)number
{ {
return ([self intValue] | [number intValue]); return ([self integerValue] | [number integerValue]);
} }
- (unsigned int)and:(NSNumber *)number - (NSUInteger)and:(NSNumber *)number
{ {
return ([self intValue] & [number intValue]); return ([self integerValue] & [number integerValue]);
} }
- (unsigned int)not - (NSUInteger)not
{ {
/* FIXME */ /* FIXME */
return ![self intValue]; return ![self integerValue];
} }
@end @end
@implementation NSNumber (STStructure) @implementation NSNumber (STStructure)
- rangeWith:(int)length - rangeWith:(NSUInteger)length
{ {
return [STStructure structureWithRange:NSMakeRange([self intValue], length)]; NSRange r = NSMakeRange([self unsignedIntegerValue], length);
return [STStructure structureWithRange:r];
} }
- pointWith:(float)y - pointWith:(float)y
{ {

View file

@ -169,8 +169,8 @@ some other, more clever mechanism. */
NSString *methodName = NSStringFromSelector([invocation selector]); NSString *methodName = NSStringFromSelector([invocation selector]);
NSMutableArray *args; NSMutableArray *args;
id arg; id arg;
int index; NSUInteger index;
int count; NSUInteger count;
id retval = nil; id retval = nil;
method = [methodDictionary objectForKey:methodName]; method = [methodDictionary objectForKey:methodName];

View file

@ -47,7 +47,7 @@ enum
NSMutableArray *frameworks; NSMutableArray *frameworks;
NSMutableArray *finders; NSMutableArray *finders;
int restriction; NSInteger restriction;
} }
+ (NSString *)defaultDescriptionName; + (NSString *)defaultDescriptionName;

View file

@ -159,7 +159,7 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
{ {
NSAutoreleasePool *pool; NSAutoreleasePool *pool;
NSString *str; NSString *str;
BOOL saveFlag = restriction; NSInteger saveFlag = restriction;
if(!def) if(!def)
{ {
@ -417,8 +417,8 @@ static NSDictionary *dictForDescriptionWithName(NSString *defName)
flag = [def objectForKey:@"Restriction"]; flag = [def objectForKey:@"Restriction"];
NSDebugLLog(@"STEnvironment", @"Class %@ restriction %@ (default %i)", NSDebugLLog(@"STEnvironment", @"Class %@ restriction %@ (default %li)",
className, flag, restriction); className, flag, (long)restriction);
if(flag) if(flag)
{ {

View file

@ -148,7 +148,7 @@ static STLanguageManager *defaultManager = nil;
NSDictionary *langDict; NSDictionary *langDict;
NSEnumerator *enumerator; NSEnumerator *enumerator;
NSString *language; NSString *language;
int foundLanguages = 0; NSUInteger foundLanguages = 0;
/* /*
StepTalkLanguages = { Smalltalk = { EngineClass = SmalltalkEngine} }; StepTalkLanguages = { Smalltalk = { EngineClass = SmalltalkEngine} };

View file

@ -58,7 +58,7 @@ static const char *selector_types[] =
NSMutableDictionary *STAllObjectiveCClasses(void) NSMutableDictionary *STAllObjectiveCClasses(void)
{ {
int i, numClasses; NSInteger i, numClasses;
NSString *name; NSString *name;
NSMutableDictionary *dict; NSMutableDictionary *dict;
Class *classes; Class *classes;
@ -68,7 +68,7 @@ NSMutableDictionary *STAllObjectiveCClasses(void)
numClasses = objc_getClassList(NULL, 0); numClasses = objc_getClassList(NULL, 0);
classes = (Class *)NSZoneMalloc(STMallocZone, numClasses * sizeof(Class)); classes = (Class *)NSZoneMalloc(STMallocZone, numClasses * sizeof(Class));
numClasses = objc_getClassList(classes, numClasses); numClasses = objc_getClassList(classes, numClasses);
// NSLog(@"%i Objective-C classes found", numClasses); // NSLog(@"%li Objective-C classes found", (unsigned long)numClasses);
for(i = 0; i < numClasses; i++) for(i = 0; i < numClasses; i++)
{ {
@ -120,7 +120,7 @@ static const char *STSelectorTypes(const char *name)
{ {
const char *ptr; const char *ptr;
const char *types = 0; const char *types = 0;
unsigned argc = 0; NSUInteger argc = 0;
for (ptr = name; *ptr; ptr++) for (ptr = name; *ptr; ptr++)
if (*ptr == ':') if (*ptr == ':')
@ -140,8 +140,8 @@ static const char *STSelectorTypes(const char *name)
0, 0, 0, 0, 0x46, 0x3d, 0, 0x0f, 0, 0, 0, 0, 0x46, 0x3d, 0, 0x0f,
0x80, 0, 0, 0x08, 0, 0, 0, 0x0a 0x80, 0, 0, 0x08, 0, 0, 0, 0x0a
}; };
unsigned ofs = (unsigned)*ptr >> 3; NSUInteger ofs = (NSUInteger)*ptr >> 3;
unsigned mask = *ptr & 7; NSUInteger mask = *ptr & 7;
if (!(binaryCharset[ofs] & mask)) if (!(binaryCharset[ofs] & mask))
break; break;
} }
@ -153,8 +153,8 @@ static const char *STSelectorTypes(const char *name)
{ {
NSDebugLLog(@"STSending", NSDebugLLog(@"STSending",
@"registering selector '%s' " @"registering selector '%s' "
@"with %i arguments, types:'%s'", @"with %lu arguments, types:'%s'",
name,argc,selector_types[argc]); name,(unsigned long)argc,selector_types[argc]);
types = selector_types[argc]; types = selector_types[argc];
} }
@ -237,10 +237,10 @@ NSMethodSignature *STMethodSignatureForSelector(SEL sel)
} }
static NSArray *selectors_from_list(Method *methods, unsigned int numMethods) static NSArray *selectors_from_list(Method *methods, NSUInteger numMethods)
{ {
NSMutableArray *array = [NSMutableArray array]; NSMutableArray *array = [NSMutableArray array];
unsigned int i; NSUInteger i;
for (i = 0; i < numMethods; i++) for (i = 0; i < numMethods; i++)
{ {
@ -253,7 +253,7 @@ static NSArray *selectors_from_list(Method *methods, unsigned int numMethods)
NSArray *STAllObjectiveCSelectors(void) NSArray *STAllObjectiveCSelectors(void)
{ {
int i, numClasses; NSInteger i, numClasses;
unsigned int numMethods; unsigned int numMethods;
NSMutableArray *array; NSMutableArray *array;
NSArray *selectors; NSArray *selectors;

View file

@ -120,8 +120,8 @@ some other, more clever mechanism. */
NSString *methodName = NSStringFromSelector([invocation selector]); NSString *methodName = NSStringFromSelector([invocation selector]);
NSMutableArray *args; NSMutableArray *args;
id arg; id arg;
int index; NSUInteger index;
int count; NSUInteger count;
id retval = nil; id retval = nil;
method = [methodDictionary objectForKey:methodName]; method = [methodDictionary objectForKey:methodName];

View file

@ -57,11 +57,12 @@
- (NSRect)rectValue; - (NSRect)rectValue;
- (NSSize)sizeValue; - (NSSize)sizeValue;
- valueAtIndex:(unsigned)index; - valueAtIndex:(NSUInteger)index;
- (void)setValue:anObject atIndex:(unsigned)index; - (void)setValue:anObject atIndex:(NSUInteger)index;
- (int)intValueAtIndex:(unsigned)index; - (int)intValueAtIndex:(NSUInteger)index;
- (float)floatValueAtIndex:(unsigned)index; - (NSInteger)integerValueAtIndex:(NSUInteger)index;
- (float)floatValueAtIndex:(NSUInteger)index;
- extent:(NSSize)size; - extent:(NSSize)size;
- corner:(NSPoint)corner; - corner:(NSPoint)corner;
@ -69,9 +70,9 @@
/* /*
@interface STRange:STStructure @interface STRange:STStructure
- rangeWithLocation:(int)loc length:(int)length; - rangeWithLocation:(NSUInteger)loc length:(NSUInteger)length;
- (int)location; - (NSUInteger)location;
- (int)length; - (NSUInteger)length;
@end @end
@interface STPoint:STStructure @interface STPoint:STStructure

View file

@ -166,7 +166,7 @@
{ {
return name; return name;
} }
- (const char *)typeOfFieldAtIndex:(unsigned)index - (const char *)typeOfFieldAtIndex:(NSUInteger)index
{ {
const char *type = [structType cString]; const char *type = [structType cString];
@ -186,7 +186,7 @@
- (NSRange)rangeValue - (NSRange)rangeValue
{ {
/* FIXME: do some checking */ /* FIXME: do some checking */
return NSMakeRange([self intValueAtIndex:0],[self intValueAtIndex:1]); return NSMakeRange([self integerValueAtIndex:0],[self integerValueAtIndex:1]);
} }
- (NSPoint)pointValue - (NSPoint)pointValue
@ -213,44 +213,50 @@
return rect; return rect;
} }
- valueAtIndex:(unsigned)index - valueAtIndex:(NSUInteger)index
{ {
return [fields objectAtIndex:index]; return [fields objectAtIndex:index];
} }
- (void)setValue:anObject atIndex:(unsigned)index - (void)setValue:anObject atIndex:(NSUInteger)index
{ {
[fields replaceObjectAtIndex:index withObject:anObject]; [fields replaceObjectAtIndex:index withObject:anObject];
} }
- (int)intValueAtIndex:(unsigned)index - (int)intValueAtIndex:(NSUInteger)index
{ {
return (int)[[fields objectAtIndex:index] intValue]; return [[fields objectAtIndex:index] intValue];
} }
- (float)floatValueAtIndex:(unsigned)index - (NSInteger)integerValueAtIndex:(NSUInteger)index
{
return [[fields objectAtIndex:index] integerValue];
}
- (float)floatValueAtIndex:(NSUInteger)index
{ {
return (float)[[fields objectAtIndex:index] floatValue]; return (float)[[fields objectAtIndex:index] floatValue];
} }
/* NSRange */ /* NSRange */
- (int)location - (NSUInteger)location
{ {
return [[fields objectAtIndex:0] intValue]; return [[fields objectAtIndex:0] integerValue];
} }
- (int)length - (NSUInteger)length
{ {
return [[fields objectAtIndex:1] intValue]; return [[fields objectAtIndex:1] integerValue];
} }
- (void)setLocation:(int)location - (void)setLocation:(NSUInteger)location
{ {
[fields replaceObjectAtIndex:0 withObject: [NSNumber numberWithInt:location]]; NSNumber *n = [NSNumber numberWithUnsignedInteger:location];
[fields replaceObjectAtIndex:0 withObject:n];
} }
- (void)setLength:(int)length - (void)setLength:(NSUInteger)length
{ {
[fields replaceObjectAtIndex:1 withObject: [NSNumber numberWithInt:length]]; NSNumber *n = [NSNumber numberWithUnsignedInteger:length];
[fields replaceObjectAtIndex:1 withObject: n];
} }
/* NSPoint */ /* NSPoint */