mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Patched from mail. See ChangeLog
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@743 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c731a96267
commit
009510d132
5 changed files with 21 additions and 27 deletions
|
@ -12,8 +12,6 @@
|
|||
#include <stdio.h>
|
||||
#include <objc/objc-api.h>
|
||||
|
||||
extern char *objc_executable_location();
|
||||
|
||||
extern long objc_load_module(
|
||||
const char *filename,
|
||||
FILE *errorStream,
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <Foundation/NSException.h>
|
||||
#include <Foundation/NSString.h>
|
||||
#include <Foundation/NSArray.h>
|
||||
#include <Foundation/NSProcessInfo.h>
|
||||
|
||||
/* Deal with strchr: */
|
||||
#if STDC_HEADERS || HAVE_STRING_H
|
||||
|
@ -85,6 +86,17 @@ static int _loadingBundlePos = -1;
|
|||
|
||||
static BOOL _stripAfterLoading;
|
||||
|
||||
/* Declaration from find_exec.c */
|
||||
extern char *objc_find_executable(const char *name);
|
||||
|
||||
/* This function is provided for objc-load.c, although I'm not sure it
|
||||
really needs it (So far only needed if using GNU dld library) */
|
||||
const char *
|
||||
objc_executable_location( void )
|
||||
{
|
||||
return [[[NSBundle mainBundle] bundlePath] cString];
|
||||
}
|
||||
|
||||
/* Get the object file that should be located in the bundle of the same name */
|
||||
static NSString *
|
||||
bundle_object_name(NSString *path)
|
||||
|
@ -185,7 +197,6 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
|||
addObject:(id)theClass];
|
||||
}
|
||||
|
||||
|
||||
@implementation NSBundle
|
||||
|
||||
+ (NSBundle *)mainBundle
|
||||
|
@ -195,9 +206,11 @@ _bundle_load_callback(Class theClass, Category *theCategory)
|
|||
char *output;
|
||||
NSString *path;
|
||||
|
||||
path = [NSString stringWithCString:objc_executable_location()];
|
||||
assert(path);
|
||||
assert([path length]);
|
||||
path = [[NSProcessInfo processInfo] processName];
|
||||
output = objc_find_executable([path cString]);
|
||||
assert(output);
|
||||
path = [NSString stringWithCString: output];
|
||||
OBJC_FREE(output);
|
||||
|
||||
/* Strip off the name of the program */
|
||||
#if 0
|
||||
|
|
|
@ -121,11 +121,6 @@ static NSArray* _gnu_arguments = nil;
|
|||
// Dictionary of environment vars and their values
|
||||
static NSMutableDictionary* _gnu_environment = nil;
|
||||
|
||||
/* xxx Referenced in objc-load.c,
|
||||
but I can't find it in the OpenStep standard.
|
||||
What's going on here? */
|
||||
const char **NSArgv;
|
||||
|
||||
/*************************************************************************
|
||||
*** Implementing the Libobjects main function
|
||||
*************************************************************************/
|
||||
|
@ -135,10 +130,6 @@ _gnu_process_args(int argc, char *argv[], char *env[])
|
|||
{
|
||||
int i;
|
||||
|
||||
OBJC_MALLOC(NSArgv, const char*, argc);
|
||||
for (i = 0; i < argc; i++)
|
||||
NSArgv[i] = argv[i];
|
||||
|
||||
/* Getting the process name */
|
||||
_gnu_processName = [[NSString alloc] initWithCString:argv[0]];
|
||||
|
||||
|
|
|
@ -43,14 +43,12 @@ extern void __objc_install_premature_dtable(Class);
|
|||
extern void sarray_free(struct sarray*);
|
||||
extern struct sarray *__objc_uninstalled_dtable;
|
||||
|
||||
extern char *objc_find_executable(const char *name);
|
||||
/* Declaration from NSBundle.m */
|
||||
const char *objc_executable_location( void );
|
||||
|
||||
/* This is the GNU name for the CTOR list */
|
||||
#define CTOR_LIST "___CTOR_LIST__"
|
||||
|
||||
/* External variables needed to find the path to the executable program. */
|
||||
extern char **NSArgv;
|
||||
|
||||
/* dynamic_loaded is YES if the dynamic loader was sucessfully initialized. */
|
||||
static BOOL dynamic_loaded;
|
||||
|
||||
|
@ -81,12 +79,6 @@ objc_check_undefineds(FILE *errorStream)
|
|||
return 0;
|
||||
}
|
||||
|
||||
char *
|
||||
objc_executable_location()
|
||||
{
|
||||
return objc_find_executable(NSArgv[0]);
|
||||
}
|
||||
|
||||
/* Invalidate the dtable so it will be rebuild when a message is sent to
|
||||
the object */
|
||||
static void
|
||||
|
@ -106,7 +98,7 @@ objc_invalidate_dtable(Class class)
|
|||
static int
|
||||
objc_initialize_loading(FILE *errorStream)
|
||||
{
|
||||
char *path;
|
||||
const char *path;
|
||||
|
||||
dynamic_loaded = NO;
|
||||
path = objc_executable_location();
|
||||
|
@ -119,7 +111,6 @@ objc_initialize_loading(FILE *errorStream)
|
|||
return 1;
|
||||
} else
|
||||
dynamic_loaded = YES;
|
||||
free(path);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#define __HashTable_h_INCLUDE_GNU
|
||||
|
||||
#include <objc/Object.h>
|
||||
#include <objects/stdobjects.h>
|
||||
#include <objc/hash.h>
|
||||
|
||||
typedef node_ptr NXHashState;
|
||||
|
|
Loading…
Reference in a new issue