1
0
mirror of https://github.com/adtools/clib2.git synced 2025-12-08 14:59:05 +00:00

- Added a simple test for sprintf() which does not use any of the

normal library startup code.


git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@14952 87f5fb63-7c3d-0410-a384-fd976d0f7a62
This commit is contained in:
Olaf Barthel
2005-05-17 19:15:32 +00:00
parent a1ffc20864
commit df05c80c57
4 changed files with 131 additions and 15 deletions

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.68k,v 1.6 2005-05-08 16:27:25 obarthel Exp $
# $Id: GNUmakefile.68k,v 1.7 2005-05-17 19:15:31 obarthel Exp $
#
# :ts=8
#
@ -31,12 +31,12 @@ WARNINGS = \
INCLUDE = -I../library/include
LIB = -L../library/lib
OPTIONS = -DNDEBUG -fno-builtin -DNO_INLINE_STDARG -DIEEE_FLOATING_POINT_SUPPORT
OPTIONS = -DNDEBUG -fno-builtin -fwritable-strings -DNO_INLINE_STDARG -DIEEE_FLOATING_POINT_SUPPORT
#OPTIONS = -D__MEM_DEBUG -fno-builtin
#OPTIONS = -DDEBUG -D__MEM_DEBUG -DNO_INLINE_STDARG -fno-builtin
OPTIMIZE = -O
#OPTIMIZE = -O2 -fomit-frame-pointer
#DEBUG = -g2
DEBUG = -ggdb
CFLAGS = $(WARNINGS) $(OPTIMIZE) $(DEBUG) $(OPTIONS) $(CODE_TYPE) $(INCLUDE) $(LIB)
@ -46,12 +46,14 @@ LIBS = -lm -lc -lgcc
##############################################################################
all: test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test \
translate_test strtok_test uname simple fstat_stdout_test
all: test fgets_test iotest sscanf_test printf_test sprintf_test \
stack_size_test translate_test strtok_test uname simple \
fstat_stdout_test simple_sprintf
clean:
$(DELETE) #?.o #?.map test fgets_test iotest sscanf_test printf_test sprintf_test \
stack_size_test translate_test strtok_test uname simple fstat_stdout_test
$(DELETE) #?.o #?.map test fgets_test iotest sscanf_test printf_test \
sprintf_test stack_size_test translate_test strtok_test uname \
simple fstat_stdout_test simple_sprintf
##############################################################################
@ -103,6 +105,10 @@ fstat_stdout_test : fstat_stdout_test.o
@echo "Linking $@"
$(CC) $(CFLAGS) -o $@ fstat_stdout_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
simple_sprintf : simple_sprintf.o
@echo "Linking $@"
$(CC) -nostdlib $(CFLAGS) -o $@ simple_sprintf.o -lc -Wl,--cref,-M,-Map=$@.map
##############################################################################
mkid:

View File

@ -1,5 +1,5 @@
#
# $Id: GNUmakefile.os4,v 1.6 2005-05-08 16:27:25 obarthel Exp $
# $Id: GNUmakefile.os4,v 1.7 2005-05-17 19:15:32 obarthel Exp $
#
# :ts=8
#
@ -38,12 +38,14 @@ LIBS = -lm -lc
##############################################################################
all: test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test \
translate_test strtok_test uname simple fstat_stdout_test
all: test fgets_test iotest sscanf_test printf_test sprintf_test \
stack_size_test translate_test strtok_test uname simple \
fstat_stdout_test simple_sprintf
clean:
$(DELETE) *.o *.map test fgets_test iotest sscanf_test printf_test sprintf_test \
stack_size_test translate_test strtok_test uname simple fstat_stdout_test
$(DELETE) *.o *.map test fgets_test iotest sscanf_test printf_test \
sprintf_test stack_size_test translate_test strtok_test \
uname simple fstat_stdout_test simple_sprintf
##############################################################################
@ -94,3 +96,7 @@ simple : simple.o
fstat_stdout_test : fstat_stdout_test.o
@echo "Linking $@"
$(CC) $(CFLAGS) -o $@ fstat_stdout_test.o $(LIBS) -Wl,--cref,-M,-Map=$@.map
simple_sprintf : simple_sprintf.o
@echo "Linking $@"
$(CC) -nostdlib $(CFLAGS) -o $@ simple_sprintf.o -lc -Wl,--cref,-M,-Map=$@.map

View File

@ -0,0 +1,95 @@
/*
* $Id: simple_sprintf.c,v 1.1 2005-05-17 19:15:32 obarthel Exp $
*
* :ts=4
*/
#include <exec/execbase.h>
/****************************************************************************/
#define __NOLIBBASE__
#define __USE_INLINE__
#define __NOGLOBALIFACE__
/****************************************************************************/
#include <proto/exec.h>
#include <proto/dos.h>
/****************************************************************************/
#include <string.h>
#include <stdio.h>
#include <dos.h>
/****************************************************************************/
struct Library * SysBase;
struct Library * DOSBase;
/****************************************************************************/
#if defined(__amigaos4__)
struct ExecIFace * IExec;
struct DOSIFace * IDOS;
#endif /* __amigaos4__ */
/****************************************************************************/
BOOL __check_abort_enabled = FALSE;
/****************************************************************************/
int _start(void);
/****************************************************************************/
int
_start(void)
{
char string[80];
SysBase = *(struct Library **)4;
DOSBase = OpenLibrary("dos.library",37);
if(DOSBase == NULL)
goto out;
#if defined(__amigaos4__)
{
IExec = (struct ExecIFace *)((struct ExecBase *)SysBase)->MainInterface;
IDOS = (struct DOSIFace *)GetInterface(DOSBase, "main", 1, 0);
if(IDOS == NULL)
goto out;
}
#endif /* __amigaos4__ */
sprintf(string,"a %s c\n","b");
Write(Output(),string,strlen(string));
out:
#if defined(__amigaos4__)
{
if(IDOS != NULL)
DropInterface((struct Interface *)IDOS);
}
#endif /* __amigaos4__ */
if(DOSBase != NULL)
CloseLibrary(DOSBase);
return(0);
}
/****************************************************************************/
void
__check_abort(void)
{
}

View File

@ -1,5 +1,5 @@
#
# $Id: smakefile,v 1.6 2005-05-08 16:27:25 obarthel Exp $
# $Id: smakefile,v 1.7 2005-05-17 19:15:32 obarthel Exp $
#
# :ts=8
#
@ -66,11 +66,15 @@ AFLAGS = \
all: \
setup \
test fgets_test iotest sscanf_test printf_test sprintf_test \
stack_size_test translate_test strtok_test uname simple fstat_stdout_test \
stack_size_test translate_test strtok_test uname simple \
fstat_stdout_test simple_sprintf \
cleanup
clean:
-delete \#?.o \#?.map test fgets_test iotest sscanf_test printf_test sprintf_test stack_size_test translate_test strtok_test uname simple
-delete \#?.o \#?.map \
test fgets_test iotest sscanf_test printf_test sprintf_test \
stack_size_test translate_test strtok_test uname simple \
simple_sprintf
##############################################################################
@ -144,6 +148,11 @@ fstat_stdout_test: fstat_stdout_test.o
@slink $(LIB)startup.o fstat_stdout_test.o to $@ lib $(LIB)c.lib addsym \
map $@.map,fhx fwidth 32 pwidth 32 swidth 32
simple_sprintf: simple_sprintf.o
@echo "Linking $@"
@slink simple_sprintf.o to $@ lib $(LIB)c.lib addsym \
map $@.map,fhx fwidth 32 pwidth 32 swidth 32
##############################################################################
mkid: