mirror of
https://github.com/adtools/clib2.git
synced 2025-12-08 14:59:05 +00:00
- Moved the call chain printing out of stdlib_main.c and into
separate files. - Removed some more redundant data from stdlib_main.c. - Added the first real C99 function: _Exit(). git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14892 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
@ -101,6 +101,13 @@
|
||||
- Dropped unused stub code which is now redundant because of
|
||||
the constructor/destructor mechanism.
|
||||
|
||||
- Moved the call chain printing out of stdlib_main.c and into
|
||||
separate files.
|
||||
|
||||
- Removed some more redundant data from stdlib_main.c.
|
||||
|
||||
- Added the first real C99 function: _Exit().
|
||||
|
||||
|
||||
c.lib 1.189 (5.3.2005)
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vasprintf.c,v 1.10 2005-03-18 12:38:23 obarthel Exp $
|
||||
* $Id: stdio_vasprintf.c,v 1.11 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -41,6 +41,10 @@
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
#ifndef _STDIO_HEADERS_H
|
||||
#include "stdio_headers.h"
|
||||
#endif /* _STDIO_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_MEMORY_H
|
||||
@ -49,12 +53,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDIO_HEADERS_H
|
||||
#include "stdio_headers.h"
|
||||
#endif /* _STDIO_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdio_vasprintf_hook_entry.c,v 1.5 2005-02-20 15:46:52 obarthel Exp $
|
||||
* $Id: stdio_vasprintf_hook_entry.c,v 1.6 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -41,14 +41,18 @@
|
||||
#include "stdio_headers.h"
|
||||
#endif /* _STDIO_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_MEMORY_H
|
||||
#include "stdlib_memory.h"
|
||||
#endif /* _STDLIB_MEMORY_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
int
|
||||
__vasprintf_hook_entry(
|
||||
struct iob * string_iob,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_assertion_failure.c,v 1.8 2005-03-18 12:38:23 obarthel Exp $
|
||||
* $Id: stdlib_assertion_failure.c,v 1.9 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -31,16 +31,6 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
#ifndef _STDIO_HEADERS_H
|
||||
#include "stdio_headers.h"
|
||||
#endif /* _STDIO_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef PROTO_EXEC_H
|
||||
#include <proto/exec.h>
|
||||
#endif /* PROTO_EXEC_H */
|
||||
@ -58,6 +48,16 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
#ifndef _STDIO_HEADERS_H
|
||||
#include "stdio_headers.h"
|
||||
#endif /* _STDIO_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__assertion_failure(
|
||||
const char * file_name,
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_exit.c,v 1.3 2005-01-02 09:07:18 obarthel Exp $
|
||||
* $Id: stdlib_exit.c,v 1.4 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -52,10 +52,18 @@ _exit(int return_code)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The C99 version of _exit(). */
|
||||
void
|
||||
_Exit(int return_code)
|
||||
{
|
||||
_exit(return_code);
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
exit(int return_code)
|
||||
{
|
||||
/* ZZZ what about inifinite recursion in __exit_trap_trigger()? */
|
||||
__exit_trap_trigger();
|
||||
|
||||
_exit(return_code);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: stdlib_main.c,v 1.17 2005-03-18 12:38:24 obarthel Exp $
|
||||
* $Id: stdlib_main.c,v 1.18 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -41,6 +41,14 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
@ -51,16 +59,9 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
typedef int (*init_func_ptr)(void);
|
||||
typedef void (*exit_func_ptr)(void);
|
||||
#ifndef _STDLIB_PROFILE_MONITORING_H
|
||||
#include "stdlib_profile_monitoring.h"
|
||||
#endif /* _STDLIB_PROFILE_MONITORING_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -73,49 +74,6 @@ BOOL __stack_overflow;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The SAS/C profiling hooks can be used to track call chains. Neat
|
||||
trick, but not always necessary. Don't enable this unless you know
|
||||
what you're doing... */
|
||||
#if defined(__USE_SAS_PROFILING_FOR_MONITORING)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static BOOL show_profile_names = FALSE;
|
||||
static int nest_level;
|
||||
|
||||
void ASM
|
||||
_PROLOG(REG(a0,char * id))
|
||||
{
|
||||
nest_level++;
|
||||
|
||||
if(id != NULL && __program_name != NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
kprintf("[%s]",__program_name);
|
||||
|
||||
for(i = 0 ; i < nest_level ; i++)
|
||||
kputc(' ');
|
||||
|
||||
kprintf("%s\n",id);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void ASM
|
||||
_EPILOG(REG(a0,char * id))
|
||||
{
|
||||
if(nest_level > 0)
|
||||
nest_level--;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __USE_SAS_PROFILING_FOR_MONITORING */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
STATIC int
|
||||
call_main(void)
|
||||
{
|
||||
@ -134,11 +92,7 @@ call_main(void)
|
||||
|
||||
/* If the SAS/C profiling code is set up for printing function
|
||||
call chains, switch it on now. */
|
||||
#if defined(__USE_SAS_PROFILING_FOR_MONITORING)
|
||||
{
|
||||
show_profile_names = TRUE;
|
||||
}
|
||||
#endif /* __USE_SAS_PROFILING_FOR_MONITORING */
|
||||
__show_profile_names();
|
||||
|
||||
/* After all these preparations, get this show on the road... */
|
||||
exit(main((int)__argc,(char **)__argv));
|
||||
@ -146,11 +100,7 @@ call_main(void)
|
||||
out:
|
||||
|
||||
/* Switch off function name printing, if it was enabled. */
|
||||
#if defined(__USE_SAS_PROFILING_FOR_MONITORING)
|
||||
{
|
||||
show_profile_names = FALSE;
|
||||
}
|
||||
#endif /* __USE_SAS_PROFILING_FOR_MONITORING */
|
||||
__hide_profile_names();
|
||||
|
||||
/* If we end up here with the __stack_overflow variable
|
||||
set then the stack overflow handler dropped into
|
||||
|
||||
94
library/stdlib_profile_monitoring.c
Normal file
94
library/stdlib_profile_monitoring.c
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* $Id: stdlib_profile_monitoring.c,v 1.1 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if defined(__SASC)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
static BOOL show_profile_names = FALSE;
|
||||
static int nest_level;
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void ASM
|
||||
_PROLOG(REG(a0,char * id))
|
||||
{
|
||||
nest_level++;
|
||||
|
||||
if(id != NULL && __program_name != NULL)
|
||||
{
|
||||
int i;
|
||||
|
||||
kprintf("[%s]",__program_name);
|
||||
|
||||
for(i = 0 ; i < nest_level ; i++)
|
||||
kputc(' ');
|
||||
|
||||
kprintf("%s\n",id);
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void ASM
|
||||
_EPILOG(REG(a0,char * id))
|
||||
{
|
||||
if(nest_level > 0)
|
||||
nest_level--;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__show_profile_names(void)
|
||||
{
|
||||
show_profile_names = TRUE;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
void
|
||||
__hide_profile_names(void)
|
||||
{
|
||||
show_profile_names = FALSE;
|
||||
}
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __SASC */
|
||||
71
library/stdlib_profile_monitoring.h
Normal file
71
library/stdlib_profile_monitoring.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
* $Id: stdlib_profile_monitoring.h,v 1.1 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
* Portable ISO 'C' (1994) runtime library for the Amiga computer
|
||||
* Copyright (c) 2002-2005 by Olaf Barthel <olsen@sourcery.han.de>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
*
|
||||
* - Neither the name of Olaf Barthel nor the names of contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _STDLIB_PROFILE_MONITORING_H
|
||||
#define _STDLIB_PROFILE_MONITORING_H
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The SAS/C profiling hooks can be used to track call chains. Neat
|
||||
trick, but not always necessary. Don't enable this unless you know
|
||||
what you're doing... */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/*#define USE_PROFILE_MONITORING*/
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#if defined(__SASC) && defined(USE_PROFILE_MONITORING)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
extern void __show_profile_names(void);
|
||||
extern void __hide_profile_names(void);
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#else
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#define __show_profile_names() ((void)0)
|
||||
#define __hide_profile_names() ((void)0)
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* __SASC && USE_PROFILE_MONITORING */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _STDLIB_PROFILE_MONITORING_H */
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: string_strdup.c,v 1.7 2005-03-18 12:38:25 obarthel Exp $
|
||||
* $Id: string_strdup.c,v 1.8 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -41,8 +41,6 @@
|
||||
#include "string_headers.h"
|
||||
#endif /* _STRING_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_HEADERS_H
|
||||
#include "stdlib_headers.h"
|
||||
#endif /* _STDLIB_HEADERS_H */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: time_gettimeofday.c,v 1.8 2005-03-18 12:38:25 obarthel Exp $
|
||||
* $Id: time_gettimeofday.c,v 1.9 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -31,6 +31,16 @@
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef PROTO_TIMER_H
|
||||
#include <proto/timer.h>
|
||||
#endif /* PROTO_TIMER_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _TIME_HEADERS_H
|
||||
#include "time_headers.h"
|
||||
#endif /* _TIME_HEADERS_H */
|
||||
@ -45,16 +55,6 @@
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef PROTO_TIMER_H
|
||||
#include <proto/timer.h>
|
||||
#endif /* PROTO_TIMER_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: utime_headers.h,v 1.2 2005-01-02 09:07:19 obarthel Exp $
|
||||
* $Id: utime_headers.h,v 1.3 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -40,6 +40,20 @@
|
||||
#include "stdio_headers.h"
|
||||
#endif /* _STDIO_HEADERS_H */
|
||||
|
||||
#ifndef _LOCALE_HEADERS_H
|
||||
#include "locale_headers.h"
|
||||
#endif /* _LOCALE_HEADERS_H */
|
||||
|
||||
#ifndef _TIME_HEADERS_H
|
||||
#include "time_headers.h"
|
||||
#endif /* _TIME_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_PROFILE_H
|
||||
#include "stdlib_profile.h"
|
||||
#endif /* _STDLIB_PROFILE_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#endif /* _UTIME_HEADERS_H */
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: utime_utime.c,v 1.8 2005-03-18 12:38:25 obarthel Exp $
|
||||
* $Id: utime_utime.c,v 1.9 2005-03-19 10:15:56 obarthel Exp $
|
||||
*
|
||||
* :ts=4
|
||||
*
|
||||
@ -41,20 +41,6 @@
|
||||
#include "utime_headers.h"
|
||||
#endif /* _UTIME_HEADERS_H */
|
||||
|
||||
#ifndef _LOCALE_HEADERS_H
|
||||
#include "locale_headers.h"
|
||||
#endif /* _LOCALE_HEADERS_H */
|
||||
|
||||
#ifndef _TIME_HEADERS_H
|
||||
#include "time_headers.h"
|
||||
#endif /* _TIME_HEADERS_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
#ifndef _STDLIB_PROFILE_H
|
||||
#include "stdlib_profile.h"
|
||||
#endif /* _STDLIB_PROFILE_H */
|
||||
|
||||
/****************************************************************************/
|
||||
|
||||
/* The following is not part of the ISO 'C' (1994) standard. */
|
||||
|
||||
Reference in New Issue
Block a user