Permalink
Browse files

streamlining for Lion/iOS5 runtimes. Dropping GNUstep support.

  • Loading branch information...
1 parent f477014 commit 6be192c177dba5ec3d0556cdcfb5c0de03afd84f @timburks committed Jun 15, 2011
Oops, something went wrong.
@@ -9,11 +9,11 @@
continueAfterRunningActions = "No"
isPathRelative = "0"
filePath = "/Volumes/Users/tim/Desktop/Repositories/nu/objc/NuClass.m"
- timestampString = "329615877.019981"
+ timestampString = "329696440.2529"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
- startingLineNumber = "294"
- endingLineNumber = "294"
+ startingLineNumber = "295"
+ endingLineNumber = "295"
landmarkName = "-instanceVariableNames"
landmarkType = "5">
</FileBreakpoint>
@@ -17,7 +17,6 @@
#import "NuException.h"
#import "NuExtensions.h"
#import "NuHandler.h"
-#import "mach_override.h"
#import "NuMacro_0.h"
#import "NuMacro_1.h"
#import "NuMain.h"
View
@@ -28,7 +28,6 @@ limitations under the License.
#import <Nu/NuException.h>
#import <Nu/NuExtensions.h>
#import <Nu/NuHandler.h>
-#import <Nu/mach_override.h>
#import <Nu/NuMacro_0.h>
#import <Nu/NuMacro_1.h>
#import <Nu/NuMain.h>
View
@@ -1,6 +1,6 @@
/*!
@file main.m
-@copyright Copyright (c) 2007 Radtastical Inc.
+@copyright Copyright (c) 2007,2011 Radtastical Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -14,7 +14,6 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
-#if defined(DARWIN)
int NuMain(int argc, const char *argv[]);
@@ -23,18 +22,4 @@ int main(int argc, const char *argv[])
return NuMain(argc, argv);
}
-#else
-int NuMain(int argc, const char *argv[], const char *envp[]);
-
-#if defined(FREEBSD)
-#include "GNUstepBase/GSConfig.h"
-int gnustep_base_user_main(int argc, const char* argv[], const char *envp[])
-#else
-int main(int argc, const char *argv[], const char *envp[])
-#endif
-{
- return NuMain(argc, argv, envp);
-}
-
-#endif
View
@@ -98,21 +98,12 @@ void NuMain_exceptionHandler(NSException* e)
exit(1);
}
-
-#ifdef DARWIN
int NuMain(int argc, const char *argv[])
-#else
-int NuMain(int argc, const char *argv[], const char *envp[])
-#endif
{
#ifdef IPHONE
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#endif
- #ifdef GNUSTEP
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- [NSProcessInfo initializeWithArguments:(char **) argv count:argc environment:(char **) envp];
- #endif
void NuInit();
NuInit();
@@ -239,10 +230,6 @@ int NuMain(int argc, const char *argv[], const char *envp[])
NSLog(@"%@: %@", [exception name], [exception reason]);
}
- #ifdef GNUSTEP
- [pool release];
- #endif
-
#ifdef IPHONE
[pool release];
#endif
@@ -273,8 +260,8 @@ void NuInit()
#ifdef DARWIN
// note known placeholder classes
- extern void nu_note_placeholders();
- nu_note_placeholders();
+// extern void nu_note_placeholders();
+// nu_note_placeholders();
#endif
// check UTF8 support in PCRE
View
@@ -1357,9 +1357,6 @@ id add_method_to_class(Class c, NSString *methodName, NSString *signature, NuBlo
return [NSNull null];
}
-#ifdef GNUSTEP
-#define __USE_GNU
-#endif
#include <dlfcn.h>
@implementation NuBridgedFunction
@@ -1403,6 +1400,7 @@ - (id) evalWithArguments:(id) cdr context:(NSMutableDictionary *) context
{
//NSLog(@"----------------------------------------");
//NSLog(@"calling C function %s with signature %s", name, signature);
+ id result;
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
char *return_type_identifier = strdup(signature);
@@ -1447,7 +1445,7 @@ - (id) evalWithArguments:(id) cdr context:(NSMutableDictionary *) context
arg_cursor = [arg_cursor cdr];
}
ffi_call(cif, FFI_FN(function), result_value, argument_values);
- id result = get_nu_value_from_objc_value(result_value, return_type_identifier);
+ result = get_nu_value_from_objc_value(result_value, return_type_identifier);
// free the value structures
for (i = 0; i < argument_count; i++) {
View
@@ -37,11 +37,12 @@ + (id) cellWithCar:(id)car cdr:(id)cdr
- (id) init
{
- [super init];
- car = Nu__null;
- cdr = Nu__null;
- file = -1;
- line = -1;
+ if ((self = [super init])) {
+ car = Nu__null;
+ cdr = Nu__null;
+ file = -1;
+ line = -1;
+ }
return self;
}
@@ -497,9 +498,10 @@ - (void)encodeWithCoder:(NSCoder *)coder
- (id) initWithCoder:(NSCoder *)coder
{
- [super init];
- car = [[coder decodeObject] retain];
- cdr = [[coder decodeObject] retain];
+ if ((self = [super init])) {
+ car = [[coder decodeObject] retain];
+ cdr = [[coder decodeObject] retain];
+ }
return self;
}
View
@@ -61,9 +61,10 @@ - (id) initWithClassNamed:(NSString *) string
- (id) initWithClass:(Class) class
{
- [super init];
- c = class;
- isRegistered = YES; // unless we explicitly set otherwise
+ if ((self = [super init])) {
+ c = class;
+ isRegistered = YES; // unless we explicitly set otherwise
+ }
return self;
}
@@ -292,7 +293,7 @@ @implementation NuClass (Experiments)
- (NSArray *) instanceVariableNames {
NSMutableArray *names = [NSMutableArray array];
- int ivarCount;
+ unsigned int ivarCount;
Ivar *ivarList = class_copyIvarList(c, &ivarCount);
NSLog(@"%d ivars", ivarCount);
View
@@ -116,9 +116,7 @@ limitations under the License.
- (id) lookupObjectForKey:(id)key;
/*! Add an object to a dictionary, automatically converting nil into [NSNull null]. */
- (void) setPossiblyNullObject:(id) anObject forKey:(id) aKey;
-#ifdef GNUSTEP
-- (void) setValue:(id) value forKey:(id) key;
-#endif
+
@end
/*!
@@ -185,10 +183,6 @@ limitations under the License.
/*! Iterate over each character in a string, evaluating the provided block for each character. */
- (id) each:(id) block;
-#ifdef GNUSTEP
-+ (NSString *) stringWithCString:(const char *) cString encoding:(NSStringEncoding) encoding;
-- (const char *) cStringUsingEncoding:(NSStringEncoding) encoding;
-#endif
@end
/*!
@@ -294,14 +288,6 @@ limitations under the License.
- (NSString *) typeString;
@end
-#ifdef GNUSTEP
-@interface NSObject (morestuff)
-- (void)willChangeValueForKey:(NSString *)key;
-- (void)didChangeValueForKey:(NSString *)key;
-+ (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector;
-@end
-#endif
-
/*!
@class NuAutomaticIvars
@abstract Include this class to get handleUnknownMessage:withContext: to emulate ivar accessors.
View
@@ -301,12 +301,6 @@ - (void) setPossiblyNullObject:(id) anObject forKey:(id) aKey
[self setObject:((anObject == nil) ? (id)[NSNull null] : anObject) forKey:aKey];
}
-#ifdef GNUSTEP
-- (void) setValue:(id) value forKey:(id) key
-{
- [self setObject:value forKey:key];
-}
-#endif
@end
@interface NuStringEnumerator : NSEnumerator
@@ -516,30 +510,6 @@ - (id) objectEnumerator
return [NuStringEnumerator enumeratorWithString:self];
}
-#ifdef GNUSTEP
-/*
-+ (NSString *) stringWithCString:(const char *) cString encoding:(NSStringEncoding) encoding
-{
- return [[[NSString alloc] initWithCString:cString] autorelease];
-}
-
-- (const char *) cStringUsingEncoding:(NSStringEncoding) encoding
-{
- return [self cString];
-}
-*/
-
-- (NSString *) stringByReplacingOccurrencesOfString:(NSString *) before withString:(NSString *) after
-{
- return [self stringByReplacingString:before withString:after];
-}
-
-+ (NSString *) stringWithContentsOfFile:(NSString *) filePath encoding:(NSStringEncoding) encoding error:(NSError **) error
-{
- return [NSString stringWithContentsOfFile:filePath];
-}
-#endif
-
- (id) each:(id) block
{
id args = [[NuCell alloc] init];
@@ -934,28 +904,6 @@ - (id) loadNuFile:(NSString *) nuFileName withContext:(NSMutableDictionary *) co
@end
-#ifdef DARWIN
-#ifndef IPHONE
-#import <Cocoa/Cocoa.h>
-
-@implementation NSView(Nu)
-
-- (id) nuRetain
-{
- extern void nu_disableNSLog();
- extern void nu_enableNSLog();
- // Send
- // "NSView not correctly initialized. Did you forget to call super?”
- // into a black hole.
- nu_disableNSLog();
- id result = [self nuRetain];
- nu_enableNSLog();
- return result;
-}
-
-@end
-#endif
-#endif
@implementation NSMethodSignature(Nu)
@@ -979,74 +927,6 @@ - (NSString *) typeString
@end
-#ifdef GNUSTEP
-@implementation NXConstantString (extra)
-- (const char *) cStringUsingEncoding:(NSStringEncoding) encoding
-{
- return [self cString];
-}
-
-@end
-
-@implementation NSObject (morestuff)
-
-- (void)willChangeValueForKey:(NSString *)key
-{
-}
-
-- (void)didChangeValueForKey:(NSString *)key
-{
-}
-
-+ (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
-{
- register const char *types = NULL;
-
- if (aSelector == NULL) // invalid selector
- return nil;
-
- if (types == NULL) {
- // lookup method for selector
- struct objc_method *mth;
- mth = (object_is_instance(self) ?
- class_get_instance_method(self->class_pointer, aSelector)
- : class_get_class_method(self->class_pointer, aSelector));
- if (mth) types = mth->method_types;
- }
-
- if (types == NULL) {
- /* construct a id-signature */
- register const char *sel;
- if ((sel = sel_get_name(aSelector))) {
- register int colCount = 0;
- static char *idSigs[] = {
- "@@:", "@@:@", "@@:@@", "@@:@@@", "@@:@@@@", "@@:@@@@@",
- "@@:@@@@@@", "@@:@@@@@@", "@@:@@@@@@@", "@@:@@@@@@@@"
- };
-
- while (*sel) {
- if (*sel == ':')
- colCount++;
- sel++;
- }
- types = idSigs[colCount];
- }
- else
- return nil;
- }
-
- // NSLog(@"types: %s", types);
- return [NSMethodSignature signatureWithObjCTypes:types];
-}
-
-@end
-
-const char *stringValue(id object)
-{
- return [[object stringValue] cString];
-}
-#endif
-
@implementation NuAutomaticIvars
- (id) handleUnknownMessage:(NuCell *) message withContext:(id) context
@@ -52,8 +52,6 @@ Protocol **class_copyProtocolList(Class cls, unsigned int *outCount);
Method_t class_getInstanceMethod(Class cls, SEL name);
Ivar_t class_getInstanceVariable(Class cls, const char *name);
-// defined as a macro in GNUstep
-// struct objc_method_list *class_nextMethodList( Class cls, void **methods);
const char *ivar_getName(Ivar_t v);
unsigned method_getArgumentInfo(struct objc_method *m, int arg, const char **type, int *offset);
@@ -129,7 +127,3 @@ void nu_markEndOfObjCTypeString(char *type, size_t len);
// This makes it safe to insert nil into container classes
void nu_swizzleContainerClasses();
-#ifdef GNUSTEP
-// defined as a macro in GNUstep
-// Method_t class_getClassMethod (MetaClass class, SEL op);
-#endif
Oops, something went wrong.

0 comments on commit 6be192c

Please sign in to comment.