mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 00:11:26 +00:00
Tidy up use of white space so we have it after if/for/while and not after (
or before ) or padding at end of line. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20773 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c5f49ccbcb
commit
0708409c1b
180 changed files with 2181 additions and 2156 deletions
|
@ -1,32 +1,32 @@
|
|||
/* objc-load - Dynamically load in Obj-C modules (Classes, Categories)
|
||||
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
|
||||
|
||||
Written by: Adam Fedor, Pedja Bogdanovich
|
||||
|
||||
|
||||
This file is part of the GNUstep Base Library.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
|
||||
*/
|
||||
*/
|
||||
|
||||
/*
|
||||
CAVEATS:
|
||||
- unloading modules not implemented
|
||||
- would like to raise exceptions without having to turn this into
|
||||
a .m file (right now NSBundle does this for us, ok?)
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
@ -73,8 +73,8 @@ static int
|
|||
objc_check_undefineds(FILE *errorStream)
|
||||
{
|
||||
int count = __objc_dynamic_undefined_symbol_count();
|
||||
|
||||
if (count != 0)
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
int i;
|
||||
char **undefs;
|
||||
|
@ -97,39 +97,39 @@ objc_check_undefineds(FILE *errorStream)
|
|||
}
|
||||
|
||||
/* Initialize for dynamic loading */
|
||||
static int
|
||||
static int
|
||||
objc_initialize_loading(FILE *errorStream)
|
||||
{
|
||||
const char *path;
|
||||
|
||||
|
||||
dynamic_loaded = NO;
|
||||
path = objc_executable_location();
|
||||
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): initializing dynamic loader for %s",
|
||||
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): initializing dynamic loader for %s",
|
||||
path);
|
||||
|
||||
if (__objc_dynamic_init(path))
|
||||
|
||||
if (__objc_dynamic_init(path))
|
||||
{
|
||||
if (errorStream)
|
||||
{
|
||||
__objc_dynamic_error(errorStream,
|
||||
__objc_dynamic_error(errorStream,
|
||||
"Error (objc-load): Cannot initialize dynamic linker");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dynamic_loaded = YES;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* A callback received from the Object initializer (_objc_exec_class).
|
||||
Do what we need to do and call our own callback.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
objc_load_callback(Class class, struct objc_category * category)
|
||||
{
|
||||
if (_objc_load_load_callback)
|
||||
|
@ -157,7 +157,7 @@ objc_load_module (const char *filename,
|
|||
void_fn *ctor_list;
|
||||
int i;
|
||||
#endif
|
||||
|
||||
|
||||
if (!dynamic_loaded)
|
||||
{
|
||||
if (objc_initialize_loading(errorStream))
|
||||
|
@ -165,15 +165,15 @@ objc_load_module (const char *filename,
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
_objc_load_load_callback = loadCallback;
|
||||
_objc_load_callback = objc_load_callback;
|
||||
|
||||
|
||||
/* Link in the object file */
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): Linking file %s\n", filename);
|
||||
handle = __objc_dynamic_link(filename, 1, debugFilename);
|
||||
if (handle == 0)
|
||||
if (handle == 0)
|
||||
{
|
||||
if (errorStream)
|
||||
{
|
||||
|
@ -184,41 +184,41 @@ objc_load_module (const char *filename,
|
|||
return 1;
|
||||
}
|
||||
dynamic_handles = list_cons(handle, dynamic_handles);
|
||||
|
||||
|
||||
/* If there are any undefined symbols, we can't load the bundle */
|
||||
if (objc_check_undefineds(errorStream))
|
||||
if (objc_check_undefineds(errorStream))
|
||||
{
|
||||
__objc_dynamic_unlink(handle);
|
||||
_objc_load_load_callback = 0;
|
||||
_objc_load_callback = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
#if !defined(__ELF__) && !defined(CON_AUTOLOAD)
|
||||
/* Get the constructor list and load in the objects */
|
||||
ctor_list = (void_fn *)__objc_dynamic_find_symbol(handle, CTOR_LIST);
|
||||
if (!ctor_list)
|
||||
if (!ctor_list)
|
||||
{
|
||||
if (errorStream)
|
||||
{
|
||||
fprintf(errorStream,
|
||||
fprintf(errorStream,
|
||||
"Error (objc-load): Cannot load objects (no CTOR list)\n");
|
||||
}
|
||||
_objc_load_load_callback = 0;
|
||||
_objc_load_callback = 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): %d modules\n", (int)ctor_list[0]);
|
||||
for (i = 1; ctor_list[i]; i++)
|
||||
for (i = 1; ctor_list[i]; i++)
|
||||
{
|
||||
NSDebugFLLog(@"NSBundle",
|
||||
@"Debug (objc-load): Invoking CTOR %p\n", ctor_list[i]);
|
||||
ctor_list[i]();
|
||||
}
|
||||
#endif /* not __ELF__ */
|
||||
|
||||
|
||||
__objc_resolve_class_links(); /* fill in subclass_list and sibling_class */
|
||||
_objc_load_callback = 0;
|
||||
_objc_load_load_callback = 0;
|
||||
|
@ -226,7 +226,7 @@ objc_load_module (const char *filename,
|
|||
#endif /* not NeXT_RUNTIME */
|
||||
}
|
||||
|
||||
long
|
||||
long
|
||||
objc_unload_module(FILE *errorStream,
|
||||
void (*unloadCallback)(Class, struct objc_category *))
|
||||
{
|
||||
|
@ -234,7 +234,7 @@ objc_unload_module(FILE *errorStream,
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (errorStream)
|
||||
{
|
||||
fprintf(errorStream, "Warning: unloading modules not implemented\n");
|
||||
|
@ -247,10 +247,10 @@ long objc_load_modules(char *files[],FILE *errorStream,
|
|||
void **header,
|
||||
char *debugFilename)
|
||||
{
|
||||
while (*files)
|
||||
while (*files)
|
||||
{
|
||||
if (objc_load_module(*files, errorStream, callback,
|
||||
(void *)header, debugFilename))
|
||||
if (objc_load_module(*files, errorStream, callback,
|
||||
(void *)header, debugFilename))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ long objc_load_modules(char *files[],FILE *errorStream,
|
|||
return 0;
|
||||
}
|
||||
|
||||
long
|
||||
long
|
||||
objc_unload_modules(FILE *errorStream,
|
||||
void (*unloadCallback)(Class, struct objc_category *))
|
||||
{
|
||||
|
@ -267,12 +267,12 @@ objc_unload_modules(FILE *errorStream,
|
|||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if (errorStream)
|
||||
{
|
||||
fprintf(errorStream, "Warning: unloading modules not implemented\n");
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ objc_get_symbol_path(Class theClass, Category *theCategory)
|
|||
const char *ret;
|
||||
char buf[125], *p = buf;
|
||||
int len = strlen(theClass->name);
|
||||
|
||||
|
||||
if (theCategory == NULL)
|
||||
{
|
||||
if (len + sizeof(char)*19 > sizeof(buf))
|
||||
|
@ -329,11 +329,11 @@ objc_get_symbol_path(Class theClass, Category *theCategory)
|
|||
{
|
||||
free(p);
|
||||
}
|
||||
|
||||
|
||||
if (ret)
|
||||
{
|
||||
return [NSString stringWithCString: ret];
|
||||
}
|
||||
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue