summaryrefslogtreecommitdiff
path: root/Objective-C
diff options
context:
space:
mode:
authorMatthias Benkard <code@mail.matthias.benkard.de>2008-03-02 20:57:47 +0100
committerMatthias Benkard <code@mail.matthias.benkard.de>2008-03-02 20:57:47 +0100
commit2ded853ee7a127f573dc61297cf5ed4d1b059d08 (patch)
tree428154a11351408cf1ee2a9309ef46f356d5f47e /Objective-C
parentfbc1ec5ed1a48ee3536849eb3665c9275c3986fd (diff)
Objective-C layer: Improve robustness a bit.
darcs-hash:f4386c84fffb2588cf848a3a63ae5ccd27754217
Diffstat (limited to 'Objective-C')
-rw-r--r--Objective-C/libobjcl.m40
1 files changed, 26 insertions, 14 deletions
diff --git a/Objective-C/libobjcl.m b/Objective-C/libobjcl.m
index 997553e..36fb811 100644
--- a/Objective-C/libobjcl.m
+++ b/Objective-C/libobjcl.m
@@ -26,6 +26,7 @@
#ifdef GNUSTEP
#import "GNUstepBase/GSLock.h"
+#import "GNUstepBase/GSConfig.h"
/* #import "GNUstepBase/GSObjCRuntime.h" */
#endif
@@ -86,24 +87,31 @@ objcl_memmove (void *dest, void *src, unsigned long length)
void
objcl_initialise_runtime (void)
{
-#ifndef __NEXT_RUNTIME__
- if (!process)
- {
- static char *argv[] = { "" };
- static char *env[] = { (char *) 0 };
- [NSProcessInfo initializeWithArguments: argv
- count: 0
- environment: env];
- process = [NSProcessInfo processInfo];
- }
-#endif
-
TRACE (@"Check whether initialisation is pending.");
if (init_count <= 0)
{
TRACE (@"Initialise runtime.");
- TRACE (@"Allocate exceptions.");
objcl_autorelease_pool = [[NSAutoreleasePool alloc] init];
+
+#ifndef __NEXT_RUNTIME__
+#if defined(GS_FAKE_MAIN) || defined(GS_PASS_ARGUMENTS) \
+ || defined(LIB_FOUNDATION_LIBRARY)
+
+ TRACE (@"Initialise environment.");
+ if (!process)
+ {
+ static char *argv[] = { "objective-cl", 0 };
+ /* static char *environ[] = { (char *) 0 }; */
+ extern char **environ;
+ [NSProcessInfo initializeWithArguments: argv
+ count: 1
+ environment: environ];
+ process = [NSProcessInfo processInfo];
+ }
+#endif
+#endif
+
+ TRACE (@"Allocate exceptions.");
objcl_oom_exception = [NSException exceptionWithName: @"MLKOutOfMemoryException"
reason: @"Out of memory"
userInfo: nil];
@@ -372,6 +380,10 @@ objcl_get_method_implementation (id object,
TRACE (@"method-impl %p %p", object, selector);
#ifdef __NEXT_RUNTIME__
Class target_class;
+ /* struct objc_super super_struct;
+ super_struct.receiver = object;
+ super_struct.super_class = superclass_for_send_super;
+ */
if (objcl_object_is_class (object))
{
@@ -967,7 +979,7 @@ objcl_for_each_class_do (void (*function) (Class))
int i;
Class class_list[class_num];
- objc_getClassList (&class_list, class_num);
+ objc_getClassList (class_list, class_num);
for (i = 0; i < class_num; i++)
{
function (class_list[i]);