New switch to force user to call NSProcessInfo initialization

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@6841 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fedor 2000-06-29 03:51:06 +00:00
parent e101b26a1e
commit 6238bbb2c5
16 changed files with 404 additions and 264 deletions

View file

@ -1,3 +1,23 @@
2000-06-28 Adam Fedor <fedor@gnu.org>
Extension to force process args to be forwarded by the user.
* configure.in (enable-pass-arguments): New switch that forces user
to call NSProcessInfo initialization with process arguments.
* Headers/gnustep/base/GSConfig.h.in (GS_PASS_ARGUMENTS): New define.
* Source/NSProcessInfo.m (+initializeWithArguments:count:environment:):
New method.
* Tools/defaults.m (main): Update to call method if GS_PASS_ARGUMENTS.
* Tools/gdnc.m: Likewise.
* Tools/gsdoc.m: Likewise.
* Tools/pldes.m: Likewise.
* Tools/plmerge.m: Likewise.
* Tools/plparse.m: Likewise.
* Tools/plser.m: Likewise.
* Tools/sfparse.m: Likewise.
* Source/behavior.m: Define __objc_uninstalled_dtable if not available
from runtime.
2000-06-28 Richard Frith-Macdonald <rfm@gnu.org>
Various minor tidyups for distributed objects - and included development

View file

@ -28,6 +28,13 @@
#ifndef included_GSConfig_h
#define included_GSConfig_h
/* An alternate to GS_FAKE_MAIN which forces the user to call the
NSProcessInfo initialization in 'main', GS_FAKE_MAIN must also
be undefined. */
#if @GS_PASS_ARGUMENTS@
#define GS_PASS_ARGUMENTS @GS_PASS_ARGUMENTS@
#endif
#define GS_FAKE_MAIN @GS_FAKE_MAIN@
#if GS_FAKE_MAIN

View file

@ -57,6 +57,11 @@
/* This method returns a set of debug levels set using the
* --GNU-Debug=... command line option. */
- (NSMutableSet*) debugSet;
/* When non using the other argument initialization hacks... */
+ (void)initializeWithArguments:(char**)argv
count:(int)argc
environment:(char**)env;
@end
/*

View file

@ -510,6 +510,19 @@ int main(int argc, char *argv[], char *env[])
#endif /* HAS_LOAD_METHOD && HAS_PROC_FS */
/* Fallback method. User must call this method if none of the other
above hacks is being used
*/
+ (void)initializeWithArguments:(char**)argv
count:(int)argc
environment:(char**)env;
{
if (!_gnu_processName && !_gnu_arguments && !_gnu_environment)
{
_gnu_process_args(argc, argv, env);
}
}
/*************************************************************************
*** Getting an NSProcessInfo Object
*************************************************************************/

View file

@ -55,6 +55,15 @@
static int behavior_debug = 0;
#ifndef HAVE_OBJC_GET_UNINSTALLED_DTABLE
extern void *__objc_uninstalled_dtable;
static void *
objc_get_uninstalled_dtable()
{
return __objc_uninstalled_dtable;
}
#endif
static Method_t search_for_method_in_list (MethodList_t list, SEL op);
static void __objc_send_initialize(Class class);
#if 0
@ -204,7 +213,6 @@ behavior_class_add_methods (Class class,
the dtable sarray, but if it isn't, let
__objc_install_dispatch_table_for_class do it. */
#ifdef HAVE_OBJC_GET_UNINSTALLED_DTABLE
if (class->dtable != objc_get_uninstalled_dtable())
{
sarray_at_put_safe (class->dtable,
@ -214,7 +222,6 @@ behavior_class_add_methods (Class class,
fprintf(stderr, "\tinstalled method\n");
}
else
#endif
{
if (behavior_debug)
fprintf(stderr, "\tappended method\n");

View file

@ -44,6 +44,14 @@
/* From the objc runtime -- needed when invalidating the dtable */
extern void __objc_install_premature_dtable(Class);
extern void sarray_free(struct sarray*);
#ifndef HAVE_OBJC_GET_UNINSTALLED_DTABLE
extern void *__objc_uninstalled_dtable;
static void *
objc_get_uninstalled_dtable()
{
return __objc_uninstalled_dtable;
}
#endif
/* Declaration from NSBundle.m */
const char *objc_executable_location( void );
@ -85,13 +93,9 @@ objc_invalidate_dtable(Class class)
{
Class s;
#ifdef HAVE_OBJC_GET_UNINSTALLED_DTABLE
if (class->dtable == objc_get_uninstalled_dtable())
return;
#else
if (class->dtable == NULL)
return;
#endif
sarray_free(class->dtable);
__objc_install_premature_dtable(class);
for (s=class->subclass_list; s; s=s->sibling_class)

View file

@ -32,9 +32,9 @@
int
main(int argc, char** argv)
main(int argc, char** argv, char **env)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSAutoreleasePool *pool;
NSUserDefaults *defs;
NSProcessInfo *proc;
NSArray *args;
@ -47,6 +47,10 @@ main(int argc, char** argv)
BOOL found = NO;
int i;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
pool = [NSAutoreleasePool new];
proc = [NSProcessInfo processInfo];
if (proc == nil)
{

View file

@ -750,13 +750,16 @@
@end
int
main()
main(int argc, char** argv, char** env)
{
GDNCServer *server;
NSAutoreleasePool *pool;
NSString *str;
BOOL shouldFork = YES;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
pool = [NSAutoreleasePool new];
str = [[NSUserDefaults standardUserDefaults] stringForKey: @"debug"];
if (str != nil && [str caseInsensitiveCompare: @"yes"] == NSOrderedSame)

View file

@ -2143,14 +2143,19 @@ loader(const char *url, const char* eid, xmlParserCtxtPtr *ctxt)
int
main(int argc, char **argv)
main(int argc, char **argv, char **env)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSAutoreleasePool *pool;
NSProcessInfo *proc;
NSArray *args;
unsigned i;
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
NSUserDefaults *defs;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
pool = [NSAutoreleasePool new];
defs = [NSUserDefaults standardUserDefaults];
[defs registerDefaults: [NSDictionary dictionaryWithObjectsAndKeys:
@"Yes", @"Monolithic",
nil]];

View file

@ -31,13 +31,17 @@
int
main(int argc, char** argv)
main(int argc, char** argv, char **env)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSAutoreleasePool *pool;
NSProcessInfo *proc;
NSArray *args;
unsigned i;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
pool = [NSAutoreleasePool new];
proc = [NSProcessInfo processInfo];
if (proc == nil)
{

View file

@ -28,9 +28,9 @@
#import <Foundation/NSString.h>
int
main(int argc, char** argv)
main(int argc, char** argv, char **env)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSAutoreleasePool *pool;
NSProcessInfo *procinfo;
NSArray *args;
NSString *destName;
@ -38,6 +38,10 @@ main(int argc, char** argv)
NSMutableDictionary *plist;
unsigned i;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
pool = [NSAutoreleasePool new];
procinfo = [NSProcessInfo processInfo];
if (procinfo == nil)
{

View file

@ -29,13 +29,17 @@
int
main(int argc, char** argv)
main(int argc, char** argv, char **env)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSAutoreleasePool *pool;
NSProcessInfo *proc;
NSArray *args;
unsigned i;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
pool = [NSAutoreleasePool new];
proc = [NSProcessInfo processInfo];
if (proc == nil)
{

View file

@ -31,13 +31,17 @@
int
main(int argc, char** argv)
main(int argc, char** argv, char **env)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSAutoreleasePool *pool;
NSProcessInfo *proc;
NSArray *args;
unsigned i;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
pool = [NSAutoreleasePool new];
proc = [NSProcessInfo processInfo];
if (proc == nil)
{

View file

@ -29,13 +29,17 @@
int
main(int argc, char** argv)
main(int argc, char** argv, char **env)
{
NSAutoreleasePool *pool = [NSAutoreleasePool new];
NSAutoreleasePool *pool;
NSProcessInfo *proc;
NSArray *args;
unsigned i;
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env];
#endif
pool = [NSAutoreleasePool new];
proc = [NSProcessInfo processInfo];
if (proc == nil)
{

495
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -721,33 +721,54 @@ fi
#--------------------------------------------------------------------
# Include redefinition of main () only if needed.
# On some systems - force redefinition to be used as the /proc stuff
# doesn't work.
# doesn't work. Allow NSProcessInfo initialization method also.
#--------------------------------------------------------------------
echo "handling fake-main definition"
AC_MSG_CHECKING("use of pass-through arguments")
AC_ARG_ENABLE(pass-arguments,
[ --enable-pass-arguments User main calls NSProcessInfo initialization],,
enable_pass_arguments=no)
case "$target_os" in
cygnus*) enable_pass_arguments=yes;;
esac
if test "$enable_pass_arguments" = "yes"; then
GS_PASS_ARGUMENTS=1
else
GS_PASS_ARGUMENTS=0
fi
AC_SUBST(GS_PASS_ARGUMENTS)
AC_MSG_RESULT($enable_pass_arguments)
AC_MSG_CHECKING("use of fake-main definition")
AC_ARG_ENABLE(fake-main,
[ --enable-fake-main Force use of redefine of the main function],,
enable_fake_main=no)
case "$target_os" in
freebsd*) enable_fake_main=yes;;
netbsd*) enable_fake_main=yes;;
openbsd*) enable_fake_main=yes;;
*sysv*) enable_fake_main=yes;;
esac
if test "$enable_pass_arguments" = "no"; then
case "$target_os" in
freebsd*) enable_fake_main=yes;;
netbsd*) enable_fake_main=yes;;
openbsd*) enable_fake_main=yes;;
*sysv*) enable_fake_main=yes;;
esac
fi
GS_FAKE_MAIN=0
if test "$enable_fake_main" = "yes"; then
GS_FAKE_MAIN=1
else
elif test "$enable_pass_arguments" = "no"; then
if test $objc_load_method_worked = yes -a $sys_proc_fs = yes; then
GS_FAKE_MAIN=0
else
GS_FAKE_MAIN=1
enable_fake_main=yes
fi
if test $sys_proc_fs_exe = yes; then
AC_DEFINE(HAVE_PROC_FS_EXE_LINK)
fi
fi
AC_SUBST(GS_FAKE_MAIN)
AC_MSG_RESULT($enable_fake_main)
#--------------------------------------------------------------------
# Check recent libxlm for GSDoc etc.