mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Switched over the startup code and the library itself to use
constructor/destructor functions for initialization and cleanup purposes. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14882 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.68k,v 1.40 2005-03-11 09:37:27 obarthel Exp $
|
||||
# $Id: GNUmakefile.68k,v 1.41 2005-03-11 13:23:17 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -110,7 +110,7 @@ WARNINGS = \
|
||||
# -Wconversion -Wshadow
|
||||
|
||||
INCLUDES = -Iinclude -I. -Inetinclude
|
||||
OPTIONS = -DNDEBUG -fno-builtin
|
||||
OPTIONS = -DNDEBUG -fno-builtin -fno-common
|
||||
#OPTIONS = -D__MEM_DEBUG -fno-builtin
|
||||
#OPTIONS = -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG -fno-builtin
|
||||
OPTIMIZE = -O -fomit-frame-pointer -fstrength-reduce -finline-functions
|
||||
@ -940,7 +940,7 @@ $(LIBC_OBJS)/stdlib_red_black.o : stdlib_red_black.c stdlib_mem_debug.h
|
||||
|
||||
##############################################################################
|
||||
|
||||
# The -fbaserel32 option requires the CPU type to be 68010/68020, too.
|
||||
# The -fbaserel32 option requires the CPU type to be 68020, too.
|
||||
ifneq (,$(findstring fbaserel32,$(CODE_FLAGS)))
|
||||
LOCAL_CODE_FLAGS := $(CODE_FLAGS) $(CODE_TYPE)
|
||||
else
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#
|
||||
# $Id: GNUmakefile.os4,v 1.41 2005-03-11 09:37:28 obarthel Exp $
|
||||
# $Id: GNUmakefile.os4,v 1.42 2005-03-11 13:23:18 obarthel Exp $
|
||||
#
|
||||
# :ts=8
|
||||
#
|
||||
@ -111,7 +111,7 @@ WARNINGS = \
|
||||
# -Wconversion -Wshadow
|
||||
|
||||
INCLUDES = -Iinclude -I. -I$(SDK_INCLUDE)
|
||||
OPTIONS = -D__THREAD_SAFE -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames
|
||||
OPTIONS = -D__THREAD_SAFE -DNDEBUG -DUSE_64_BIT_INTS -D__USE_INLINE__ -Wa,-mregnames -fno-common
|
||||
OPTIMIZE = -O -fomit-frame-pointer -funroll-loops
|
||||
#DEBUG = -g
|
||||
|
||||
|
||||
@ -62,6 +62,10 @@
|
||||
- Introduced new constructor types and changed the overall priority
|
||||
order.
|
||||
|
||||
- Switched over the startup code and the library itself to use
|
||||
constructor/destructor functions for initialization and cleanup
|
||||
purposes.
|
||||
|
||||
|
||||
c.lib 1.189 (5.3.2005)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: dirent_closedir.c,v 1.8 2005-03-09 10:48:59 obarthel Exp $
|
||||
* $Id: dirent_closedir.c,v 1.9 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -48,7 +48,7 @@
|
||||
/****************************************************************************/
|
||||
|
||||
/* Directories being scanned whose locks need to be freed when shutting down. */
|
||||
struct MinList NOCOMMON __directory_list;
|
||||
struct MinList __directory_list;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: locale_init_exit.c,v 1.8 2005-03-03 14:20:55 obarthel Exp $
|
||||
* $Id: locale_init_exit.c,v 1.9 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -41,22 +41,22 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct Library * NOCOMMON __LocaleBase;
|
||||
struct Library * __LocaleBase;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
struct LocaleIFace * NOCOMMON __ILocale;
|
||||
struct LocaleIFace * __ILocale;
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct Locale * NOCOMMON __default_locale;
|
||||
struct Locale * NOCOMMON __locale_table[NUM_LOCALES];
|
||||
struct Locale * __default_locale;
|
||||
struct Locale * __locale_table[NUM_LOCALES];
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
char NOCOMMON __locale_name_table[NUM_LOCALES][MAX_LOCALE_NAME_LEN];
|
||||
char __locale_name_table[NUM_LOCALES][MAX_LOCALE_NAME_LEN];
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: macros.h,v 1.15 2005-03-11 11:35:31 obarthel Exp $
|
||||
* $Id: macros.h,v 1.16 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -131,12 +131,12 @@
|
||||
#else
|
||||
|
||||
#define CONSTRUCTOR(name,pri) \
|
||||
STATIC VOID __attribute__((constructor)) __ctor##pri##_##name##(VOID); \
|
||||
STATIC void __ctor##pri##_##name##(VOID)
|
||||
VOID __attribute__((constructor)) __ctor##pri##_##name##(VOID); \
|
||||
VOID __attribute__((constructor)) __ctor##pri##_##name##(VOID)
|
||||
|
||||
#define DESTRUCTOR(name,pri) \
|
||||
STATIC VOID __attribute__((destructor)) __dtor##pri##_##name##(VOID); \
|
||||
STATIC VOID __dtor##pri##_##name##(VOID)
|
||||
VOID __attribute__((destructor)) __dtor##pri##_##name##(VOID); \
|
||||
VOID __attribute__((destructor)) __dtor##pri##_##name##(VOID)
|
||||
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
@ -158,32 +158,32 @@
|
||||
constructors and the user-supplied destructors before the library
|
||||
destructors. */
|
||||
|
||||
#define STDLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 100)
|
||||
#define STDLIB_DESTRUCTOR(name) DESTRUCTOR(name, 100)
|
||||
#define STDLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 1)
|
||||
#define STDLIB_DESTRUCTOR(name) DESTRUCTOR(name, 1)
|
||||
|
||||
#define STK_CONSTRUCTOR(name) CONSTRUCTOR(name, 110)
|
||||
#define STK_DESTRUCTOR(name) DESTRUCTOR(name, 110)
|
||||
#define STK_CONSTRUCTOR(name) CONSTRUCTOR(name, 2)
|
||||
#define STK_DESTRUCTOR(name) DESTRUCTOR(name, 2)
|
||||
|
||||
#define STDIO_CONSTRUCTOR(name) CONSTRUCTOR(name, 120)
|
||||
#define STDIO_DESTRUCTOR(name) DESTRUCTOR(name, 120)
|
||||
#define STDIO_CONSTRUCTOR(name) CONSTRUCTOR(name, 3)
|
||||
#define STDIO_DESTRUCTOR(name) DESTRUCTOR(name, 3)
|
||||
|
||||
#define FILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 130)
|
||||
#define FILE_DESTRUCTOR(name) DESTRUCTOR(name, 130)
|
||||
#define FILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 4)
|
||||
#define FILE_DESTRUCTOR(name) DESTRUCTOR(name, 4)
|
||||
|
||||
#define MATH_CONSTRUCTOR(name) CONSTRUCTOR(name, 140)
|
||||
#define MATH_DESTRUCTOR(name) DESTRUCTOR(name, 140)
|
||||
#define MATH_CONSTRUCTOR(name) CONSTRUCTOR(name, 5)
|
||||
#define MATH_DESTRUCTOR(name) DESTRUCTOR(name, 5)
|
||||
|
||||
#define SOCKET_CONSTRUCTOR(name) CONSTRUCTOR(name, 150)
|
||||
#define SOCKET_DESTRUCTOR(name) DESTRUCTOR(name, 150)
|
||||
#define SOCKET_CONSTRUCTOR(name) CONSTRUCTOR(name, 6)
|
||||
#define SOCKET_DESTRUCTOR(name) DESTRUCTOR(name, 6)
|
||||
|
||||
#define ARG_CONSTRUCTOR(name) CONSTRUCTOR(name, 160)
|
||||
#define ARG_DESTRUCTOR(name) DESTRUCTOR(name, 160)
|
||||
#define ARG_CONSTRUCTOR(name) CONSTRUCTOR(name, 7)
|
||||
#define ARG_DESTRUCTOR(name) DESTRUCTOR(name, 7)
|
||||
|
||||
#define CLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 170)
|
||||
#define CLIB_DESTRUCTOR(name) DESTRUCTOR(name, 170)
|
||||
#define CLIB_CONSTRUCTOR(name) CONSTRUCTOR(name, 8)
|
||||
#define CLIB_DESTRUCTOR(name) DESTRUCTOR(name, 8)
|
||||
|
||||
#define PROFILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 180)
|
||||
#define PROFILE_DESTRUCTOR(name) DESTRUCTOR(name, 180)
|
||||
#define PROFILE_CONSTRUCTOR(name) CONSTRUCTOR(name, 9)
|
||||
#define PROFILE_DESTRUCTOR(name) DESTRUCTOR(name, 9)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: math_init_exit.c,v 1.10 2005-03-09 10:48:59 obarthel Exp $
|
||||
* $Id: math_init_exit.c,v 1.11 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -71,10 +71,8 @@ double __huge_val;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
CLIB_DESTRUCTOR(__math_exit)
|
||||
MATH_DESTRUCTOR(__math_exit)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
#if defined(IEEE_FLOATING_POINT_SUPPORT)
|
||||
{
|
||||
if(MathIeeeSingBasBase != NULL)
|
||||
@ -96,16 +94,13 @@ CLIB_DESTRUCTOR(__math_exit)
|
||||
}
|
||||
}
|
||||
#endif /* IEEE_FLOATING_POINT_SUPPORT */
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__math_init(void)
|
||||
MATH_CONSTRUCTOR(__math_init)
|
||||
{
|
||||
int result = ERROR;
|
||||
BOOL success = FALSE;
|
||||
|
||||
#if defined(IEEE_FLOATING_POINT_SUPPORT)
|
||||
{
|
||||
@ -170,11 +165,14 @@ __math_init(void)
|
||||
}
|
||||
#endif /* USE_LONG_DOUBLE */
|
||||
|
||||
result = OK;
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
|
||||
return(result);
|
||||
if(success)
|
||||
CONSTRUCTOR_SUCCEED();
|
||||
else
|
||||
CONSTRUCTOR_FAIL();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: socket_init_exit.c,v 1.15 2005-03-09 12:06:10 obarthel Exp $
|
||||
* $Id: socket_init_exit.c,v 1.16 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -92,10 +92,8 @@ int h_errno;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
CLIB_DESTRUCTOR(__socket_exit)
|
||||
SOCKET_DESTRUCTOR(__socket_exit)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
/* Disable ^C checking. */
|
||||
if(__SocketBase != NULL)
|
||||
{
|
||||
@ -132,21 +130,16 @@ CLIB_DESTRUCTOR(__socket_exit)
|
||||
CloseLibrary(__SocketBase);
|
||||
__SocketBase = NULL;
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__socket_init(void)
|
||||
SOCKET_CONSTRUCTOR(__socket_init)
|
||||
{
|
||||
struct TagItem tags[5];
|
||||
int result = ERROR;
|
||||
BOOL success = FALSE;
|
||||
LONG status;
|
||||
|
||||
ENTER();
|
||||
|
||||
PROFILE_OFF();
|
||||
|
||||
/* bsdsocket.library V3 is sufficient for all the tasks we
|
||||
@ -341,12 +334,14 @@ __socket_init(void)
|
||||
}
|
||||
}
|
||||
|
||||
result = OK;
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
if(success)
|
||||
CONSTRUCTOR_SUCCEED();
|
||||
else
|
||||
CONSTRUCTOR_FAIL();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_file_init.c,v 1.2 2005-03-11 09:37:29 obarthel Exp $
|
||||
* $Id: stdio_file_init.c,v 1.3 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -70,7 +70,7 @@ struct WBStartup * __WBenchMsg;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
CLIB_DESTRUCTOR(workbench_exit)
|
||||
FILE_DESTRUCTOR(workbench_exit)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
@ -196,20 +196,17 @@ wb_file_init(void)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__stdio_file_init(void)
|
||||
FILE_CONSTRUCTOR(__stdio_file_init)
|
||||
{
|
||||
struct SignalSemaphore * stdio_lock;
|
||||
struct SignalSemaphore * fd_lock;
|
||||
BPTR default_file;
|
||||
ULONG fd_flags,iob_flags;
|
||||
int result = ERROR;
|
||||
BOOL success = FALSE;
|
||||
char * buffer;
|
||||
char * aligned_buffer;
|
||||
int i;
|
||||
|
||||
ENTER();
|
||||
|
||||
/* If we were invoked from Workbench, set up the standard I/O streams. */
|
||||
if(__WBenchMsg != NULL)
|
||||
{
|
||||
@ -358,10 +355,12 @@ __stdio_file_init(void)
|
||||
|
||||
PROFILE_ON();
|
||||
|
||||
result = OK;
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
if(success)
|
||||
CONSTRUCTOR_SUCCEED();
|
||||
else
|
||||
CONSTRUCTOR_FAIL();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_headers.h,v 1.18 2005-02-28 13:22:53 obarthel Exp $
|
||||
* $Id: stdio_headers.h,v 1.19 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -366,6 +366,10 @@ struct bcpl_name
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern struct WBStartup * NOCOMMON __WBenchMsg;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The file handle table. */
|
||||
extern struct iob ** NOCOMMON __iob;
|
||||
extern int NOCOMMON __num_iob;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_init_exit.c,v 1.26 2005-03-11 09:37:29 obarthel Exp $
|
||||
* $Id: stdio_init_exit.c,v 1.27 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -99,25 +99,20 @@ __close_all_files(void)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
CLIB_DESTRUCTOR(__stdio_exit)
|
||||
STDIO_DESTRUCTOR(__stdio_exit)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
__close_all_files();
|
||||
|
||||
__stdio_lock_exit();
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__stdio_init(void)
|
||||
STDIO_CONSTRUCTOR(__stdio_init)
|
||||
{
|
||||
const int num_standard_files = (STDERR_FILENO - STDIN_FILENO + 1);
|
||||
|
||||
int result = ERROR;
|
||||
BOOL success = FALSE;
|
||||
|
||||
ENTER();
|
||||
|
||||
@ -130,10 +125,12 @@ __stdio_init(void)
|
||||
if(__grow_fd_table(num_standard_files) < 0)
|
||||
goto out;
|
||||
|
||||
result = OK;
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
if(success)
|
||||
CONSTRUCTOR_SUCCEED();
|
||||
else
|
||||
CONSTRUCTOR_FAIL();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_arg.c,v 1.2 2005-03-07 14:04:09 obarthel Exp $
|
||||
* $Id: stdlib_arg.c,v 1.3 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -110,10 +110,9 @@ is_final_quote_character(const unsigned char * str)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__arg_init(void)
|
||||
ARG_CONSTRUCTOR(__arg_init)
|
||||
{
|
||||
int result = ERROR;
|
||||
BOOL success = FALSE;
|
||||
|
||||
/* Shell startup? */
|
||||
if(__WBenchMsg == NULL)
|
||||
@ -321,9 +320,12 @@ __arg_init(void)
|
||||
__argv = (char **)__WBenchMsg;
|
||||
}
|
||||
|
||||
result = OK;
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
|
||||
return(result);
|
||||
if(success)
|
||||
CONSTRUCTOR_SUCCEED();
|
||||
else
|
||||
CONSTRUCTOR_FAIL();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_init_exit.c,v 1.7 2005-03-11 09:37:29 obarthel Exp $
|
||||
* $Id: stdlib_init_exit.c,v 1.8 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -51,11 +51,8 @@ char * __program_name;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__stdlib_exit(void)
|
||||
STDLIB_DESTRUCTOR(__stdlib_exit)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
__memory_exit();
|
||||
|
||||
if(free_program_name && __program_name != NULL)
|
||||
@ -63,18 +60,13 @@ __stdlib_exit(void)
|
||||
FreeVec(__program_name);
|
||||
__program_name = NULL;
|
||||
}
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__stdlib_init(void)
|
||||
STDLIB_CONSTRUCTOR(__stdlib_init)
|
||||
{
|
||||
int result = ERROR;
|
||||
|
||||
ENTER();
|
||||
BOOL success = FALSE;
|
||||
|
||||
if(__machine_test() < 0)
|
||||
goto out;
|
||||
@ -101,10 +93,12 @@ __stdlib_init(void)
|
||||
if(__memory_init() < 0)
|
||||
goto out;
|
||||
|
||||
result = OK;
|
||||
success = TRUE;
|
||||
|
||||
out:
|
||||
|
||||
RETURN(result);
|
||||
return(result);
|
||||
if(success)
|
||||
CONSTRUCTOR_SUCCEED();
|
||||
else
|
||||
CONSTRUCTOR_FAIL();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_main.c,v 1.14 2005-03-11 09:37:29 obarthel Exp $
|
||||
* $Id: stdlib_main.c,v 1.15 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -115,54 +115,12 @@ _EPILOG(REG(a0,char * id))
|
||||
STATIC int
|
||||
call_main(void)
|
||||
{
|
||||
/* Initialization functions; must be called exactly in this
|
||||
order because there are dependencies between the
|
||||
individual functions. */
|
||||
static init_func_ptr init_functions[] =
|
||||
{
|
||||
__stdlib_init,
|
||||
__stk_init,
|
||||
__stdio_init,
|
||||
__stdio_file_init,
|
||||
__math_init,
|
||||
__socket_init,
|
||||
__arg_init,
|
||||
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Finalization functions; these may be called
|
||||
essentially in any order. But this one makes the
|
||||
most sense (roll-back of the corresponding
|
||||
initialization functions). */
|
||||
static exit_func_ptr exit_functions[] =
|
||||
{
|
||||
__stdlib_exit,
|
||||
|
||||
NULL
|
||||
};
|
||||
|
||||
static size_t i;
|
||||
|
||||
ENTER();
|
||||
|
||||
/* This plants the return buffer for _exit(). */
|
||||
if(setjmp(__exit_jmp_buf) != 0)
|
||||
goto out;
|
||||
|
||||
SHOWMSG("calling init functions");
|
||||
|
||||
for(i = 0 ; init_functions[i] != NULL ; i++)
|
||||
{
|
||||
D(("calling init function #%ld",i));
|
||||
|
||||
if((*init_functions[i])() != OK)
|
||||
{
|
||||
SHOWMSG("that didn't work");
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
SHOWMSG("now invoking the constructors");
|
||||
|
||||
/* Go through the constructor list */
|
||||
@ -231,20 +189,6 @@ call_main(void)
|
||||
|
||||
SHOWMSG("done.");
|
||||
|
||||
SHOWMSG("calling the exit functions");
|
||||
|
||||
/* Any of the following cleanup routines may call
|
||||
_exit() by way of abort() or through a hook
|
||||
function. Which is why we redirect the exit
|
||||
return procedure. */
|
||||
for(i = 0 ; exit_functions[i] != NULL ; i++)
|
||||
{
|
||||
D(("calling exit function #%ld",i));
|
||||
|
||||
if(setjmp(__exit_jmp_buf) == 0)
|
||||
(*exit_functions[i])();
|
||||
}
|
||||
|
||||
RETURN(__exit_value);
|
||||
return(__exit_value);
|
||||
}
|
||||
@ -322,11 +266,11 @@ struct UtilityIFace * __IUtility;
|
||||
int
|
||||
_main(void)
|
||||
{
|
||||
struct Process * child_process = NULL;
|
||||
struct WBStartup * startup_message;
|
||||
volatile struct Process * child_process = NULL;
|
||||
volatile struct WBStartup * startup_message;
|
||||
volatile APTR old_window_pointer = NULL;
|
||||
volatile BOOL old_window_pointer_valid = FALSE;
|
||||
struct Process * this_process;
|
||||
APTR old_window_pointer = NULL;
|
||||
BOOL old_window_pointer_valid = FALSE;
|
||||
int return_code = RETURN_FAIL;
|
||||
ULONG current_stack_size;
|
||||
int os_version;
|
||||
@ -356,7 +300,7 @@ _main(void)
|
||||
startup_message = NULL;
|
||||
}
|
||||
|
||||
__WBenchMsg = startup_message;
|
||||
__WBenchMsg = (struct WBStartup *)startup_message;
|
||||
|
||||
/* Check which minimum operating system version we actually require. */
|
||||
os_version = 37;
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_malloc.c,v 1.10 2005-03-03 14:20:55 obarthel Exp $
|
||||
* $Id: stdlib_malloc.c,v 1.11 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -63,8 +63,8 @@ struct MemoryTree __memory_tree;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
APTR NOCOMMON __memory_pool;
|
||||
struct MinList NOCOMMON __memory_list;
|
||||
APTR __memory_pool;
|
||||
struct MinList __memory_list;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_stackcheck.c,v 1.4 2005-01-02 09:07:18 obarthel Exp $
|
||||
* $Id: stdlib_stackcheck.c,v 1.5 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -115,8 +115,7 @@ UBYTE * __base;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__stk_init(void)
|
||||
STK_CONSTRUCTOR(__stk_init)
|
||||
{
|
||||
struct Task * this_task = FindTask(NULL);
|
||||
ULONG lower = (ULONG)this_task->tc_SPLower;
|
||||
@ -133,5 +132,5 @@ __stk_init(void)
|
||||
}
|
||||
#endif /* __SASC */
|
||||
|
||||
return(OK);
|
||||
CONSTRUCTOR_SUCCEED();
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_stackextension.c,v 1.7 2005-03-11 09:37:29 obarthel Exp $
|
||||
* $Id: stdlib_stackextension.c,v 1.8 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -282,13 +282,10 @@ ULONG __stk_size;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__stk_init(void)
|
||||
STK_CONSTRUCTOR(__stk_init)
|
||||
{
|
||||
struct Task *task = FindTask(NULL);
|
||||
|
||||
ENTER();
|
||||
|
||||
__stk_initial_sp_lower = __stk_sp_lower = task->tc_SPLower; /* Lower stack bound */
|
||||
__stk_initial_sp_upper = __stk_sp_upper = task->tc_SPUpper; /* Upper stack bound +1 */
|
||||
|
||||
@ -297,17 +294,14 @@ __stk_init(void)
|
||||
|
||||
D(("stack size = %ld",(ULONG)__stk_sp_upper - (ULONG)__stk_sp_lower));
|
||||
|
||||
RETURN(OK);
|
||||
return(OK);
|
||||
CONSTRUCTOR_SUCCEED();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* Free all spare stackframes */
|
||||
CLIB_DESTRUCTOR(__stk_exit)
|
||||
STK_DESTRUCTOR(__stk_exit)
|
||||
{
|
||||
ENTER();
|
||||
|
||||
if(__memory_pool == NULL)
|
||||
{
|
||||
struct stackframe *sf, *sf_next;
|
||||
@ -323,8 +317,6 @@ CLIB_DESTRUCTOR(__stk_exit)
|
||||
}
|
||||
|
||||
__stk_spare = NULL;
|
||||
|
||||
LEAVE();
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_chdir_exit.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $
|
||||
* $Id: unistd_chdir_exit.c,v 1.4 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -43,9 +43,9 @@
|
||||
|
||||
/* If the program's current directory was changed, here is where
|
||||
we find out about it. */
|
||||
BPTR NOCOMMON __original_current_directory;
|
||||
BOOL NOCOMMON __current_directory_changed;
|
||||
BOOL NOCOMMON __unlock_current_directory;
|
||||
BPTR __original_current_directory;
|
||||
BOOL __current_directory_changed;
|
||||
BOOL __unlock_current_directory;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_init_exit.c,v 1.7 2005-01-02 09:07:19 obarthel Exp $
|
||||
* $Id: unistd_init_exit.c,v 1.8 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -42,7 +42,7 @@
|
||||
/****************************************************************************/
|
||||
|
||||
/* Names of files and directories to delete when shutting down. */
|
||||
struct MinList NOCOMMON __unlink_list;
|
||||
struct MinList __unlink_list;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: unistd_timer.c,v 1.3 2005-01-02 09:07:19 obarthel Exp $
|
||||
* $Id: unistd_timer.c,v 1.4 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -46,15 +46,15 @@
|
||||
/****************************************************************************/
|
||||
|
||||
/* Local timer I/O. */
|
||||
struct MsgPort * NOCOMMON __timer_port;
|
||||
struct timerequest * NOCOMMON __timer_request;
|
||||
BOOL NOCOMMON __timer_busy;
|
||||
struct Library * NOCOMMON __TimerBase;
|
||||
struct MsgPort * __timer_port;
|
||||
struct timerequest * __timer_request;
|
||||
BOOL __timer_busy;
|
||||
struct Library * __TimerBase;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
struct TimerIFace * NOCOMMON __ITimer;
|
||||
struct TimerIFace * __ITimer;
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: usergroup_init_exit.c,v 1.6 2005-02-27 21:58:21 obarthel Exp $
|
||||
* $Id: usergroup_init_exit.c,v 1.7 2005-03-11 13:23:18 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -50,12 +50,12 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
struct Library * NOCOMMON __UserGroupBase;
|
||||
struct Library * __UserGroupBase;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__amigaos4__)
|
||||
struct UserGroupIFace * NOCOMMON __IUserGroup;
|
||||
struct UserGroupIFace * __IUserGroup;
|
||||
#endif /* __amigaos4__ */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
Reference in New Issue
Block a user