diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 789614100..0b42c05d3 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,66 @@ +2007-02-01 Joel Schopp + Kazunori Asayama + + * configure.host: Enable SPU specific stdio directory. + * libc/machine/spu/Makefile.am: Add objects. + * libc/machine/spu/Makefile.in: Regenerated. + * libc/machine/spu/c99ppe.h: Add macros and function + declarations to initialize SPU specific stdio stuffs. + * libc/machine/spu/stdio.c: Add functions to manage Cell SPU + specific FILE structures. + * libc/machine/spu/perror.c: Add initialization routine of + stdio stuffs. + * libc/machine/spu/printf.c: Ditto. + * libc/machine/spu/putchar.c: Ditto. + * libc/machine/spu/puts.c: Ditto. + * libc/machine/spu/vprintf.c: Ditto. + * libc/machine/spu/clearerr.c: New file. Add a stdio function + implementation. + * libc/machine/spu/feof.c: Ditto. + * libc/machine/spu/ferror.c: Ditto. + * libc/machine/spu/fileno.c: Ditto. + * libc/machine/spu/fopen.c: Ditto. + * libc/machine/spu/fclose.c: Ditto. + * libc/machine/spu/freopen.c: Ditto. + * libc/machine/spu/fflush.c: Ditto. + * libc/machine/spu/fseek.c: Ditto. + * libc/machine/spu/ftell.c: Ditto. + * libc/machine/spu/rewind.c: Ditto. + * libc/machine/spu/fgetpos.c: Ditto. + * libc/machine/spu/fsetpos.c: Ditto. + * libc/machine/spu/fread.c: Ditto. + * libc/machine/spu/fwrite.c: Ditto. + * libc/machine/spu/getc.c: Ditto. + * libc/machine/spu/getchar.c: Ditto. + * libc/machine/spu/gets.c: Ditto. + * libc/machine/spu/fgetc.c: Ditto. + * libc/machine/spu/fgets.c: Ditto. + * libc/machine/spu/ungetc.c: Ditto. + * libc/machine/spu/putc.c: Ditto. + * libc/machine/spu/fputc.c: Ditto. + * libc/machine/spu/fputs.c: Ditto. + * libc/machine/spu/vfprintf.c: Ditto. + * libc/machine/spu/vfscanf.c: Ditto. + * libc/machine/spu/fprintf.c: Ditto. + * libc/machine/spu/fscanf.c: Ditto. + * libc/machine/spu/scanf.c: Ditto. + * libc/machine/spu/vscanf.c: Ditto. + * libc/machine/spu/setbuf.c: Ditto. + * libc/machine/spu/setvbuf.c: Ditto. + * libc/machine/spu/tmpfile.c: Ditto. + +2007-02-01 Jeff Johnston + + * libc/include/sys/config.h[__SPU__]: Define __CUSTOM_FILE_IO__. + * libc/include/stdio.h[!__CUSTOM_FILE_IO__]: Add flag check + around stdio macros that manipulate fields in the normal file + structure. + * libc/include/sys/reent.h[__CUSTOM_FILE_IO__]: Include + to define custom FILE structure. + * libc/include/sys/custom_file.h: New default header file + that generates error if not overridden when __CUSTOM_FILE_IO__ set. + * libc/machine/spu/sys/custom_file.h: New file. + 2007-01-31 Kazunori Asayama * configure.host: Define stdio directory as a variable. diff --git a/newlib/configure.host b/newlib/configure.host index cb1e0c93d..16b0cc8fd 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -257,6 +257,7 @@ case "${host_cpu}" in machine_dir=z8k ;; spu) + stdio_dir= machine_dir=spu newlib_cflags="${newlib_cflags} -ffunction-sections -fdata-sections " ;; diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index f99480d44..4d3e0c597 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -395,6 +395,7 @@ FILE *_EXFUN(funopen,(const _PTR _cookie, #define fwopen(cookie, fn) funopen(cookie, (int (*)())0, fn, (fpos_t (*)())0, (int (*)())0) #endif +#ifndef __CUSTOM_FILE_IO__ /* * The __sfoo macros are here so that we can * define function versions in the C library. @@ -472,9 +473,6 @@ static __inline int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { #endif /* lint */ #endif /* __CYGWIN__ */ -#define getchar() getc(stdin) -#define putchar(x) putc(x, stdout) - #ifndef __STRICT_ANSI__ /* fast always-buffered version, true iff error */ #define fast_putc(x,p) (--(p)->_w < 0 ? \ @@ -486,6 +484,11 @@ static __inline int __sputc_r(struct _reent *_ptr, int _c, FILE *_p) { #endif #endif +#endif /* !__CUSTOM_FILE_IO__ */ + +#define getchar() getc(stdin) +#define putchar(x) putc(x, stdout) + _END_STD_C #endif /* _STDIO_H_ */ diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index 1f3c3e03d..58305d4a8 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -132,6 +132,7 @@ #ifdef __SPU__ #define MALLOC_ALIGNMENT 16 +#define __CUSTOM_FILE_IO__ #endif /* This block should be kept in sync with GCC's limits.h. The point diff --git a/newlib/libc/include/sys/custom_file.h b/newlib/libc/include/sys/custom_file.h new file mode 100644 index 000000000..96314fb91 --- /dev/null +++ b/newlib/libc/include/sys/custom_file.h @@ -0,0 +1,2 @@ +#error System-specific custom_file.h is missing. + diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index a7d4f968f..93c79ffc7 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -212,6 +212,12 @@ struct __sFILE { #endif }; +#ifdef __CUSTOM_FILE_IO__ + +/* Get custom _FILE definition. */ +#include + +#else /* !__CUSTOM_FILE_IO__ */ #ifdef __LARGE64_FILES struct __sFILE64 { unsigned char *_p; /* current position in (some) buffer */ @@ -260,6 +266,7 @@ typedef struct __sFILE64 __FILE; #else typedef struct __sFILE __FILE; #endif /* __LARGE64_FILES */ +#endif /* !__CUSTOM_FILE_IO__ */ struct _glue { @@ -459,6 +466,10 @@ extern const struct __sFILE_fake __sf_fake_stderr; #define __reent_assert(x) ((void)0) #endif +#ifdef __CUSTOM_FILE_IO__ +#error Custom FILE I/O and _REENT_SMALL not currently supported. +#endif + /* Generic _REENT check macro. */ #define _REENT_CHECK(var, what, type, size, init) do { \ struct _reent *_r = (var); \ diff --git a/newlib/libc/machine/spu/Makefile.am b/newlib/libc/machine/spu/Makefile.am index 7e24b704d..b2f837d97 100644 --- a/newlib/libc/machine/spu/Makefile.am +++ b/newlib/libc/machine/spu/Makefile.am @@ -8,12 +8,19 @@ noinst_LIBRARIES = lib.a AM_CCASFLAGS = $(INCLUDES) -lib_a_SOURCES = setjmp.S memcpy.c memmove.c memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c printf.c perror.c putchar.c puts.c vsnprintf.c vprintf.c vsprintf.c +lib_a_SOURCES = setjmp.S memcpy.c memmove.c memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c \ + stdio.c clearerr.c feof.c ferror.c fileno.c fopen.c fclose.c freopen.c \ + fflush.c fseek.c ftell.c rewind.c fgetpos.c fsetpos.c fread.c fwrite.c \ + getc.c putc.c fgetc.c fgets.c fputc.c fputs.c ungetc.c \ + fprintf.c fscanf.c vfprintf.c vfscanf.c \ + perror.c gets.c getchar.c putchar.c puts.c \ + printf.c scanf.c vprintf.c vscanf.c \ + setbuf.c setvbuf.c tmpfile.c \ + vsnprintf.c vsprintf.c lib_a_CCASFLAGS = $(AM_CCASFLAGS) lib_a_CFLAGS = $(AM_CFLAGS) ACLOCAL_AMFLAGS = -I ../../.. -AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host diff --git a/newlib/libc/machine/spu/Makefile.in b/newlib/libc/machine/spu/Makefile.in index bdacd8787..8577814ec 100644 --- a/newlib/libc/machine/spu/Makefile.in +++ b/newlib/libc/machine/spu/Makefile.in @@ -51,6 +51,23 @@ DIST_COMMON = $(srcdir)/../../../../config.guess \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ + $(srcdir)/../../../../compile $(srcdir)/../../../../compile \ $(srcdir)/../../../../compile subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 @@ -74,10 +91,27 @@ am_lib_a_OBJECTS = lib_a-setjmp.$(OBJEXT) lib_a-memcpy.$(OBJEXT) \ lib_a-strncat.$(OBJEXT) lib_a-strncmp.$(OBJEXT) \ lib_a-strncpy.$(OBJEXT) lib_a-strpbrk.$(OBJEXT) \ lib_a-strrchr.$(OBJEXT) lib_a-strspn.$(OBJEXT) \ - lib_a-strxfrm.$(OBJEXT) lib_a-printf.$(OBJEXT) \ - lib_a-perror.$(OBJEXT) lib_a-putchar.$(OBJEXT) \ - lib_a-puts.$(OBJEXT) lib_a-vsnprintf.$(OBJEXT) \ - lib_a-vprintf.$(OBJEXT) lib_a-vsprintf.$(OBJEXT) + lib_a-strxfrm.$(OBJEXT) lib_a-stdio.$(OBJEXT) \ + lib_a-clearerr.$(OBJEXT) lib_a-feof.$(OBJEXT) \ + lib_a-ferror.$(OBJEXT) lib_a-fileno.$(OBJEXT) \ + lib_a-fopen.$(OBJEXT) lib_a-fclose.$(OBJEXT) \ + lib_a-freopen.$(OBJEXT) lib_a-fflush.$(OBJEXT) \ + lib_a-fseek.$(OBJEXT) lib_a-ftell.$(OBJEXT) \ + lib_a-rewind.$(OBJEXT) lib_a-fgetpos.$(OBJEXT) \ + lib_a-fsetpos.$(OBJEXT) lib_a-fread.$(OBJEXT) \ + lib_a-fwrite.$(OBJEXT) lib_a-getc.$(OBJEXT) \ + lib_a-putc.$(OBJEXT) lib_a-fgetc.$(OBJEXT) \ + lib_a-fgets.$(OBJEXT) lib_a-fputc.$(OBJEXT) \ + lib_a-fputs.$(OBJEXT) lib_a-ungetc.$(OBJEXT) \ + lib_a-fprintf.$(OBJEXT) lib_a-fscanf.$(OBJEXT) \ + lib_a-vfprintf.$(OBJEXT) lib_a-vfscanf.$(OBJEXT) \ + lib_a-perror.$(OBJEXT) lib_a-gets.$(OBJEXT) \ + lib_a-getchar.$(OBJEXT) lib_a-putchar.$(OBJEXT) \ + lib_a-puts.$(OBJEXT) lib_a-printf.$(OBJEXT) \ + lib_a-scanf.$(OBJEXT) lib_a-vprintf.$(OBJEXT) \ + lib_a-vscanf.$(OBJEXT) lib_a-setbuf.$(OBJEXT) \ + lib_a-setvbuf.$(OBJEXT) lib_a-tmpfile.$(OBJEXT) \ + lib_a-vsnprintf.$(OBJEXT) lib_a-vsprintf.$(OBJEXT) lib_a_OBJECTS = $(am_lib_a_OBJECTS) DEFAULT_INCLUDES = -I. -I$(srcdir) depcomp = @@ -202,11 +236,19 @@ AUTOMAKE_OPTIONS = cygnus INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) noinst_LIBRARIES = lib.a AM_CCASFLAGS = $(INCLUDES) -lib_a_SOURCES = setjmp.S memcpy.c memmove.c memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c printf.c perror.c putchar.c puts.c vsnprintf.c vprintf.c vsprintf.c +lib_a_SOURCES = setjmp.S memcpy.c memmove.c memset.c strcat.c strchr.c strcmp.c strcpy.c strcspn.c strlen.c strncat.c strncmp.c strncpy.c strpbrk.c strrchr.c strspn.c strxfrm.c \ + stdio.c clearerr.c feof.c ferror.c fileno.c fopen.c fclose.c freopen.c \ + fflush.c fseek.c ftell.c rewind.c fgetpos.c fsetpos.c fread.c fwrite.c \ + getc.c putc.c fgetc.c fgets.c fputc.c fputs.c ungetc.c \ + fprintf.c fscanf.c vfprintf.c vfscanf.c \ + perror.c gets.c getchar.c putchar.c puts.c \ + printf.c scanf.c vprintf.c vscanf.c \ + setbuf.c setvbuf.c tmpfile.c \ + vsnprintf.c vsprintf.c + lib_a_CCASFLAGS = $(AM_CCASFLAGS) lib_a_CFLAGS = $(AM_CFLAGS) ACLOCAL_AMFLAGS = -I ../../.. -AM_CFLAGS = -I $(srcdir)/../../stdio -I $(srcdir)/../../stdlib CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -373,11 +415,167 @@ lib_a-strxfrm.o: strxfrm.c lib_a-strxfrm.obj: strxfrm.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strxfrm.obj `if test -f 'strxfrm.c'; then $(CYGPATH_W) 'strxfrm.c'; else $(CYGPATH_W) '$(srcdir)/strxfrm.c'; fi` -lib_a-printf.o: printf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-printf.o `test -f 'printf.c' || echo '$(srcdir)/'`printf.c +lib_a-stdio.o: stdio.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stdio.o `test -f 'stdio.c' || echo '$(srcdir)/'`stdio.c -lib_a-printf.obj: printf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-printf.obj `if test -f 'printf.c'; then $(CYGPATH_W) 'printf.c'; else $(CYGPATH_W) '$(srcdir)/printf.c'; fi` +lib_a-stdio.obj: stdio.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stdio.obj `if test -f 'stdio.c'; then $(CYGPATH_W) 'stdio.c'; else $(CYGPATH_W) '$(srcdir)/stdio.c'; fi` + +lib_a-clearerr.o: clearerr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-clearerr.o `test -f 'clearerr.c' || echo '$(srcdir)/'`clearerr.c + +lib_a-clearerr.obj: clearerr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-clearerr.obj `if test -f 'clearerr.c'; then $(CYGPATH_W) 'clearerr.c'; else $(CYGPATH_W) '$(srcdir)/clearerr.c'; fi` + +lib_a-feof.o: feof.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feof.o `test -f 'feof.c' || echo '$(srcdir)/'`feof.c + +lib_a-feof.obj: feof.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-feof.obj `if test -f 'feof.c'; then $(CYGPATH_W) 'feof.c'; else $(CYGPATH_W) '$(srcdir)/feof.c'; fi` + +lib_a-ferror.o: ferror.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ferror.o `test -f 'ferror.c' || echo '$(srcdir)/'`ferror.c + +lib_a-ferror.obj: ferror.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ferror.obj `if test -f 'ferror.c'; then $(CYGPATH_W) 'ferror.c'; else $(CYGPATH_W) '$(srcdir)/ferror.c'; fi` + +lib_a-fileno.o: fileno.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fileno.o `test -f 'fileno.c' || echo '$(srcdir)/'`fileno.c + +lib_a-fileno.obj: fileno.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fileno.obj `if test -f 'fileno.c'; then $(CYGPATH_W) 'fileno.c'; else $(CYGPATH_W) '$(srcdir)/fileno.c'; fi` + +lib_a-fopen.o: fopen.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fopen.o `test -f 'fopen.c' || echo '$(srcdir)/'`fopen.c + +lib_a-fopen.obj: fopen.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fopen.obj `if test -f 'fopen.c'; then $(CYGPATH_W) 'fopen.c'; else $(CYGPATH_W) '$(srcdir)/fopen.c'; fi` + +lib_a-fclose.o: fclose.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fclose.o `test -f 'fclose.c' || echo '$(srcdir)/'`fclose.c + +lib_a-fclose.obj: fclose.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fclose.obj `if test -f 'fclose.c'; then $(CYGPATH_W) 'fclose.c'; else $(CYGPATH_W) '$(srcdir)/fclose.c'; fi` + +lib_a-freopen.o: freopen.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-freopen.o `test -f 'freopen.c' || echo '$(srcdir)/'`freopen.c + +lib_a-freopen.obj: freopen.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-freopen.obj `if test -f 'freopen.c'; then $(CYGPATH_W) 'freopen.c'; else $(CYGPATH_W) '$(srcdir)/freopen.c'; fi` + +lib_a-fflush.o: fflush.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fflush.o `test -f 'fflush.c' || echo '$(srcdir)/'`fflush.c + +lib_a-fflush.obj: fflush.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fflush.obj `if test -f 'fflush.c'; then $(CYGPATH_W) 'fflush.c'; else $(CYGPATH_W) '$(srcdir)/fflush.c'; fi` + +lib_a-fseek.o: fseek.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fseek.o `test -f 'fseek.c' || echo '$(srcdir)/'`fseek.c + +lib_a-fseek.obj: fseek.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fseek.obj `if test -f 'fseek.c'; then $(CYGPATH_W) 'fseek.c'; else $(CYGPATH_W) '$(srcdir)/fseek.c'; fi` + +lib_a-ftell.o: ftell.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ftell.o `test -f 'ftell.c' || echo '$(srcdir)/'`ftell.c + +lib_a-ftell.obj: ftell.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ftell.obj `if test -f 'ftell.c'; then $(CYGPATH_W) 'ftell.c'; else $(CYGPATH_W) '$(srcdir)/ftell.c'; fi` + +lib_a-rewind.o: rewind.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rewind.o `test -f 'rewind.c' || echo '$(srcdir)/'`rewind.c + +lib_a-rewind.obj: rewind.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-rewind.obj `if test -f 'rewind.c'; then $(CYGPATH_W) 'rewind.c'; else $(CYGPATH_W) '$(srcdir)/rewind.c'; fi` + +lib_a-fgetpos.o: fgetpos.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fgetpos.o `test -f 'fgetpos.c' || echo '$(srcdir)/'`fgetpos.c + +lib_a-fgetpos.obj: fgetpos.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fgetpos.obj `if test -f 'fgetpos.c'; then $(CYGPATH_W) 'fgetpos.c'; else $(CYGPATH_W) '$(srcdir)/fgetpos.c'; fi` + +lib_a-fsetpos.o: fsetpos.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fsetpos.o `test -f 'fsetpos.c' || echo '$(srcdir)/'`fsetpos.c + +lib_a-fsetpos.obj: fsetpos.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fsetpos.obj `if test -f 'fsetpos.c'; then $(CYGPATH_W) 'fsetpos.c'; else $(CYGPATH_W) '$(srcdir)/fsetpos.c'; fi` + +lib_a-fread.o: fread.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fread.o `test -f 'fread.c' || echo '$(srcdir)/'`fread.c + +lib_a-fread.obj: fread.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fread.obj `if test -f 'fread.c'; then $(CYGPATH_W) 'fread.c'; else $(CYGPATH_W) '$(srcdir)/fread.c'; fi` + +lib_a-fwrite.o: fwrite.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fwrite.o `test -f 'fwrite.c' || echo '$(srcdir)/'`fwrite.c + +lib_a-fwrite.obj: fwrite.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fwrite.obj `if test -f 'fwrite.c'; then $(CYGPATH_W) 'fwrite.c'; else $(CYGPATH_W) '$(srcdir)/fwrite.c'; fi` + +lib_a-getc.o: getc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getc.o `test -f 'getc.c' || echo '$(srcdir)/'`getc.c + +lib_a-getc.obj: getc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getc.obj `if test -f 'getc.c'; then $(CYGPATH_W) 'getc.c'; else $(CYGPATH_W) '$(srcdir)/getc.c'; fi` + +lib_a-putc.o: putc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-putc.o `test -f 'putc.c' || echo '$(srcdir)/'`putc.c + +lib_a-putc.obj: putc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-putc.obj `if test -f 'putc.c'; then $(CYGPATH_W) 'putc.c'; else $(CYGPATH_W) '$(srcdir)/putc.c'; fi` + +lib_a-fgetc.o: fgetc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fgetc.o `test -f 'fgetc.c' || echo '$(srcdir)/'`fgetc.c + +lib_a-fgetc.obj: fgetc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fgetc.obj `if test -f 'fgetc.c'; then $(CYGPATH_W) 'fgetc.c'; else $(CYGPATH_W) '$(srcdir)/fgetc.c'; fi` + +lib_a-fgets.o: fgets.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fgets.o `test -f 'fgets.c' || echo '$(srcdir)/'`fgets.c + +lib_a-fgets.obj: fgets.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fgets.obj `if test -f 'fgets.c'; then $(CYGPATH_W) 'fgets.c'; else $(CYGPATH_W) '$(srcdir)/fgets.c'; fi` + +lib_a-fputc.o: fputc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.o `test -f 'fputc.c' || echo '$(srcdir)/'`fputc.c + +lib_a-fputc.obj: fputc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputc.obj `if test -f 'fputc.c'; then $(CYGPATH_W) 'fputc.c'; else $(CYGPATH_W) '$(srcdir)/fputc.c'; fi` + +lib_a-fputs.o: fputs.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputs.o `test -f 'fputs.c' || echo '$(srcdir)/'`fputs.c + +lib_a-fputs.obj: fputs.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fputs.obj `if test -f 'fputs.c'; then $(CYGPATH_W) 'fputs.c'; else $(CYGPATH_W) '$(srcdir)/fputs.c'; fi` + +lib_a-ungetc.o: ungetc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ungetc.o `test -f 'ungetc.c' || echo '$(srcdir)/'`ungetc.c + +lib_a-ungetc.obj: ungetc.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-ungetc.obj `if test -f 'ungetc.c'; then $(CYGPATH_W) 'ungetc.c'; else $(CYGPATH_W) '$(srcdir)/ungetc.c'; fi` + +lib_a-fprintf.o: fprintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.o `test -f 'fprintf.c' || echo '$(srcdir)/'`fprintf.c + +lib_a-fprintf.obj: fprintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fprintf.obj `if test -f 'fprintf.c'; then $(CYGPATH_W) 'fprintf.c'; else $(CYGPATH_W) '$(srcdir)/fprintf.c'; fi` + +lib_a-fscanf.o: fscanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fscanf.o `test -f 'fscanf.c' || echo '$(srcdir)/'`fscanf.c + +lib_a-fscanf.obj: fscanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-fscanf.obj `if test -f 'fscanf.c'; then $(CYGPATH_W) 'fscanf.c'; else $(CYGPATH_W) '$(srcdir)/fscanf.c'; fi` + +lib_a-vfprintf.o: vfprintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vfprintf.o `test -f 'vfprintf.c' || echo '$(srcdir)/'`vfprintf.c + +lib_a-vfprintf.obj: vfprintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vfprintf.obj `if test -f 'vfprintf.c'; then $(CYGPATH_W) 'vfprintf.c'; else $(CYGPATH_W) '$(srcdir)/vfprintf.c'; fi` + +lib_a-vfscanf.o: vfscanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vfscanf.o `test -f 'vfscanf.c' || echo '$(srcdir)/'`vfscanf.c + +lib_a-vfscanf.obj: vfscanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vfscanf.obj `if test -f 'vfscanf.c'; then $(CYGPATH_W) 'vfscanf.c'; else $(CYGPATH_W) '$(srcdir)/vfscanf.c'; fi` lib_a-perror.o: perror.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-perror.o `test -f 'perror.c' || echo '$(srcdir)/'`perror.c @@ -385,6 +583,18 @@ lib_a-perror.o: perror.c lib_a-perror.obj: perror.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-perror.obj `if test -f 'perror.c'; then $(CYGPATH_W) 'perror.c'; else $(CYGPATH_W) '$(srcdir)/perror.c'; fi` +lib_a-gets.o: gets.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gets.o `test -f 'gets.c' || echo '$(srcdir)/'`gets.c + +lib_a-gets.obj: gets.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gets.obj `if test -f 'gets.c'; then $(CYGPATH_W) 'gets.c'; else $(CYGPATH_W) '$(srcdir)/gets.c'; fi` + +lib_a-getchar.o: getchar.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getchar.o `test -f 'getchar.c' || echo '$(srcdir)/'`getchar.c + +lib_a-getchar.obj: getchar.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-getchar.obj `if test -f 'getchar.c'; then $(CYGPATH_W) 'getchar.c'; else $(CYGPATH_W) '$(srcdir)/getchar.c'; fi` + lib_a-putchar.o: putchar.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-putchar.o `test -f 'putchar.c' || echo '$(srcdir)/'`putchar.c @@ -397,11 +607,17 @@ lib_a-puts.o: puts.c lib_a-puts.obj: puts.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-puts.obj `if test -f 'puts.c'; then $(CYGPATH_W) 'puts.c'; else $(CYGPATH_W) '$(srcdir)/puts.c'; fi` -lib_a-vsnprintf.o: vsnprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsnprintf.o `test -f 'vsnprintf.c' || echo '$(srcdir)/'`vsnprintf.c +lib_a-printf.o: printf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-printf.o `test -f 'printf.c' || echo '$(srcdir)/'`printf.c -lib_a-vsnprintf.obj: vsnprintf.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsnprintf.obj `if test -f 'vsnprintf.c'; then $(CYGPATH_W) 'vsnprintf.c'; else $(CYGPATH_W) '$(srcdir)/vsnprintf.c'; fi` +lib_a-printf.obj: printf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-printf.obj `if test -f 'printf.c'; then $(CYGPATH_W) 'printf.c'; else $(CYGPATH_W) '$(srcdir)/printf.c'; fi` + +lib_a-scanf.o: scanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scanf.o `test -f 'scanf.c' || echo '$(srcdir)/'`scanf.c + +lib_a-scanf.obj: scanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-scanf.obj `if test -f 'scanf.c'; then $(CYGPATH_W) 'scanf.c'; else $(CYGPATH_W) '$(srcdir)/scanf.c'; fi` lib_a-vprintf.o: vprintf.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vprintf.o `test -f 'vprintf.c' || echo '$(srcdir)/'`vprintf.c @@ -409,6 +625,36 @@ lib_a-vprintf.o: vprintf.c lib_a-vprintf.obj: vprintf.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vprintf.obj `if test -f 'vprintf.c'; then $(CYGPATH_W) 'vprintf.c'; else $(CYGPATH_W) '$(srcdir)/vprintf.c'; fi` +lib_a-vscanf.o: vscanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vscanf.o `test -f 'vscanf.c' || echo '$(srcdir)/'`vscanf.c + +lib_a-vscanf.obj: vscanf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vscanf.obj `if test -f 'vscanf.c'; then $(CYGPATH_W) 'vscanf.c'; else $(CYGPATH_W) '$(srcdir)/vscanf.c'; fi` + +lib_a-setbuf.o: setbuf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-setbuf.o `test -f 'setbuf.c' || echo '$(srcdir)/'`setbuf.c + +lib_a-setbuf.obj: setbuf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-setbuf.obj `if test -f 'setbuf.c'; then $(CYGPATH_W) 'setbuf.c'; else $(CYGPATH_W) '$(srcdir)/setbuf.c'; fi` + +lib_a-setvbuf.o: setvbuf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-setvbuf.o `test -f 'setvbuf.c' || echo '$(srcdir)/'`setvbuf.c + +lib_a-setvbuf.obj: setvbuf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-setvbuf.obj `if test -f 'setvbuf.c'; then $(CYGPATH_W) 'setvbuf.c'; else $(CYGPATH_W) '$(srcdir)/setvbuf.c'; fi` + +lib_a-tmpfile.o: tmpfile.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-tmpfile.o `test -f 'tmpfile.c' || echo '$(srcdir)/'`tmpfile.c + +lib_a-tmpfile.obj: tmpfile.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-tmpfile.obj `if test -f 'tmpfile.c'; then $(CYGPATH_W) 'tmpfile.c'; else $(CYGPATH_W) '$(srcdir)/tmpfile.c'; fi` + +lib_a-vsnprintf.o: vsnprintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsnprintf.o `test -f 'vsnprintf.c' || echo '$(srcdir)/'`vsnprintf.c + +lib_a-vsnprintf.obj: vsnprintf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsnprintf.obj `if test -f 'vsnprintf.c'; then $(CYGPATH_W) 'vsnprintf.c'; else $(CYGPATH_W) '$(srcdir)/vsnprintf.c'; fi` + lib_a-vsprintf.o: vsprintf.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsprintf.o `test -f 'vsprintf.c' || echo '$(srcdir)/'`vsprintf.c diff --git a/newlib/libc/machine/spu/c99ppe.h b/newlib/libc/machine/spu/c99ppe.h index 8ae9893c9..6d2dab690 100644 --- a/newlib/libc/machine/spu/c99ppe.h +++ b/newlib/libc/machine/spu/c99ppe.h @@ -87,8 +87,7 @@ enum { #define SPE_STDIN 1 #define SPE_STDOUT 2 #define SPE_STDERR 3 -#define SPE_FOPEN_MAX (FOPEN_MAX+1) -#define SPE_FOPEN_MIN 4 +#define SPE_FOPEN_MAX FOPEN_MAX struct spe_reg128{ unsigned int slot[4]; @@ -114,3 +113,12 @@ send_to_ppe(int signalcode, int opcode, void *data) errno = ret->slot[3]; return; } + +void _EXFUN(__sinit,(struct _reent *)); +FILE *_EXFUN(__sfp,(struct _reent *)); +#define __sfp_free(fp) ( (fp)->_fp = 0 ) + +#define CHECK_INIT(ptr) \ + do { if ((ptr) && !(ptr)->__sdidinit) __sinit (ptr); } while (0) +#define CHECK_STD_INIT(ptr) /* currently, do nothing */ +#define CHECK_STR_INIT(ptr) /* currently, do nothing */ diff --git a/newlib/libc/machine/spu/clearerr.c b/newlib/libc/machine/spu/clearerr.c new file mode 100644 index 000000000..57b995237 --- /dev/null +++ b/newlib/libc/machine/spu/clearerr.c @@ -0,0 +1,54 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +_VOID +_DEFUN (clearerr, (fp), + FILE * fp) + +{ + int ret; + + CHECK_INIT(_REENT); + + ret = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_CLEARERR, &ret); + + return; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fclose.c b/newlib/libc/machine/spu/fclose.c new file mode 100644 index 000000000..cc61f62c0 --- /dev/null +++ b/newlib/libc/machine/spu/fclose.c @@ -0,0 +1,55 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY +int +_DEFUN (fclose, (fp), + FILE * fp) +{ + int ret; + + CHECK_INIT(_REENT); + + ret = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FCLOSE, &ret); + + __sfp_free(fp); + + return ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/feof.c b/newlib/libc/machine/spu/feof.c new file mode 100644 index 000000000..fe77224ac --- /dev/null +++ b/newlib/libc/machine/spu/feof.c @@ -0,0 +1,54 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +int +_DEFUN (feof, (fp), + FILE * fp) +{ + int result; + + CHECK_INIT(_REENT); + + result = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FEOF, &result); + + + return result; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/ferror.c b/newlib/libc/machine/spu/ferror.c new file mode 100644 index 000000000..5416f5cdf --- /dev/null +++ b/newlib/libc/machine/spu/ferror.c @@ -0,0 +1,54 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +int +_DEFUN (ferror, (fp), + FILE * fp) +{ + int result; + + CHECK_INIT(_REENT); + + result = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FERROR, &result); + + + return result; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fflush.c b/newlib/libc/machine/spu/fflush.c new file mode 100644 index 000000000..f14f59d5a --- /dev/null +++ b/newlib/libc/machine/spu/fflush.c @@ -0,0 +1,53 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY +int +_DEFUN (fflush, (fp), + FILE * fp) +{ + int result; + + CHECK_INIT(_REENT); + + result = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FFLUSH, &result); + + + return result; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fgetc.c b/newlib/libc/machine/spu/fgetc.c new file mode 100644 index 000000000..73b4aa2c0 --- /dev/null +++ b/newlib/libc/machine/spu/fgetc.c @@ -0,0 +1,53 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +int +_DEFUN (fgetc, (fp), + FILE * fp) +{ + int result; + + CHECK_INIT(_REENT); + + result = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETC, &result); + + return result; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fgetpos.c b/newlib/libc/machine/spu/fgetpos.c new file mode 100644 index 000000000..1768f0725 --- /dev/null +++ b/newlib/libc/machine/spu/fgetpos.c @@ -0,0 +1,66 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + _fpos_t * pos; +} c99_fgetpos_t; + +#ifndef _REENT_ONLY + +int +_DEFUN (fgetpos, (fp, pos), + FILE * fp _AND + _fpos_t * pos) +{ + c99_fgetpos_t arg; + int* result; + + CHECK_INIT(_REENT); + + result = (int*)&arg; + + arg.fp = fp->_fp; + arg.pos = pos; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETPOS, &arg); + + + return *result; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fgets.c b/newlib/libc/machine/spu/fgets.c new file mode 100644 index 000000000..01e32a5fc --- /dev/null +++ b/newlib/libc/machine/spu/fgets.c @@ -0,0 +1,68 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +typedef struct +{ + char *buf; + unsigned int pad0[3]; + int n; + unsigned int pad1[3]; + int fp; +} c99_fgets_t; + +#ifndef _REENT_ONLY + +char * +_DEFUN (fgets, (buf, n, fp), + char *buf _AND + int n _AND + FILE * fp) +{ + char** ret; + c99_fgets_t args; + + CHECK_INIT(_REENT); + + args.buf = buf; + args.n = n; + args.fp = fp->_fp; + ret = (char**) &args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FGETS, &args); + + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fileno.c b/newlib/libc/machine/spu/fileno.c new file mode 100644 index 000000000..9d850fe28 --- /dev/null +++ b/newlib/libc/machine/spu/fileno.c @@ -0,0 +1,54 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +int +_DEFUN (fileno, (fp), + FILE *fp) + +{ + int ret; + + CHECK_INIT(_REENT); + + ret = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FILENO, &ret); + + return ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fopen.c b/newlib/libc/machine/spu/fopen.c new file mode 100644 index 000000000..33cdbca58 --- /dev/null +++ b/newlib/libc/machine/spu/fopen.c @@ -0,0 +1,79 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + _CONST char* file; + unsigned int pad0[ 3 ]; + _CONST char* mode; + unsigned int pad1[ 3 ]; +} c99_fopen_t; + +#ifndef _REENT_ONLY +FILE * +_DEFUN (fopen, (file, mode), + _CONST char *file _AND + _CONST char *mode) +{ + int *ret; + c99_fopen_t args; + FILE *fp; + struct _reent *ptr = _REENT; + + CHECK_INIT(ptr); + + fp = __sfp(ptr); + if (!fp) { + return NULL; + } + + args.file = file; + args.mode = mode; + ret = (int *) &args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FOPEN, &args); + + if (*ret) { + fp->_fp = *ret; + return fp; + } + else { + __sfp_free(fp); + return NULL; + } +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fprintf.c b/newlib/libc/machine/spu/fprintf.c new file mode 100644 index 000000000..66d37aa56 --- /dev/null +++ b/newlib/libc/machine/spu/fprintf.c @@ -0,0 +1,79 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +#ifdef _HAVE_STDC +#include +#else +#include +#endif + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + _CONST char* fmt; + unsigned int pad1[ 3 ]; + va_list ap; +} c99_fprintf_t; + +#ifndef _REENT_ONLY + +int +fprintf(FILE * fp, _CONST char *fmt,...) +{ + int* ret; + c99_fprintf_t args; + + CHECK_INIT(_REENT); + + ret = (int*) &args; + + args.fp = fp->_fp; + args.fmt = (char*) fmt; + +#ifdef _HAVE_STDC + va_start (args.ap, fmt); +#else + va_start (args.ap); +#endif + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args); + + va_end (args.ap); + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fputc.c b/newlib/libc/machine/spu/fputc.c new file mode 100644 index 000000000..71126c69e --- /dev/null +++ b/newlib/libc/machine/spu/fputc.c @@ -0,0 +1,66 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + int ch; + unsigned int pad0[ 3 ]; + int fp; + unsigned int pad1[ 3 ]; +} c99_fputc_t; + +#ifndef _REENT_ONLY + +int +fputc (c, fp) + int c; + register FILE *fp; +{ + int* ret; + c99_fputc_t args; + + CHECK_INIT(_REENT); + + args.ch = c; + args.fp = fp->_fp; + ret = (int*)&args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTC, &args); + + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fputs.c b/newlib/libc/machine/spu/fputs.c new file mode 100644 index 000000000..7fea082af --- /dev/null +++ b/newlib/libc/machine/spu/fputs.c @@ -0,0 +1,66 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + _CONST char* s; + unsigned int pad0[ 3 ]; + int fp; + unsigned int pad1[ 3 ]; +} c99_fputs_t; + +#ifndef _REENT_ONLY + +int +_DEFUN (fputs, (s, fp), + char _CONST * s _AND + FILE * fp) +{ + int* ret; + c99_fputs_t args; + + CHECK_INIT(_REENT); + + args.s = s; + args.fp = fp->_fp; + ret = (int*)&args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FPUTS, &args); + + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fread.c b/newlib/libc/machine/spu/fread.c new file mode 100644 index 000000000..6ff9bd69b --- /dev/null +++ b/newlib/libc/machine/spu/fread.c @@ -0,0 +1,73 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + char* buf; + unsigned int pad0[ 3 ]; + size_t size; + unsigned int pad1[ 3 ]; + size_t count; + unsigned int pad2[ 3 ]; + int fp; +} c99_fread_t; + +#ifndef _REENT_ONLY + +size_t +_DEFUN (fread, (buf, size, count, fp), + _PTR buf _AND + size_t size _AND + size_t count _AND + FILE * fp) +{ + size_t* ret; + c99_fread_t args; + + CHECK_INIT(_REENT); + + args.buf = buf; + args.size = size; + args.count = count; + args.fp = fp->_fp; + ret = (size_t*) &args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREAD, &args); + + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/freopen.c b/newlib/libc/machine/spu/freopen.c new file mode 100644 index 000000000..57fbbbd0f --- /dev/null +++ b/newlib/libc/machine/spu/freopen.c @@ -0,0 +1,76 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + _CONST char *file; + unsigned int pad0[ 3 ]; + _CONST char *mode; + unsigned int pad1[ 3 ]; + int fp; +} c99_freopen_t; + +#ifndef _REENT_ONLY + +FILE * +_DEFUN (freopen, (file, mode, fp), + const char *file _AND + const char *mode _AND + FILE *fp) +{ + int *ret; + c99_freopen_t args; + + CHECK_INIT(_REENT); + + args.file = file; + args.mode = mode; + args.fp = fp->_fp; + ret = (int *) &args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FREOPEN, &args); + + if (*ret) { + fp->_fp = *ret; + return fp; + } + else { + __sfp_free(fp); + return NULL; + } +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fscanf.c b/newlib/libc/machine/spu/fscanf.c new file mode 100644 index 000000000..4b37cb8da --- /dev/null +++ b/newlib/libc/machine/spu/fscanf.c @@ -0,0 +1,78 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +#ifdef _HAVE_STDC +#include +#else +#include +#endif + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + _CONST char* fmt; + unsigned int pad1[ 3 ]; + va_list ap; +} c99_vfscanf_t; + +#ifndef _REENT_ONLY + +fscanf(FILE *fp, _CONST char *fmt, ...) +{ + int* ret; + c99_vfscanf_t args; + + CHECK_INIT(_REENT); + + ret = (int*) &args; + + args.fp = fp->_fp; + args.fmt = (char*) fmt; +#ifdef _HAVE_STDC + va_start (args.ap, fmt); +#else + va_start (args.ap); +#endif + + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args); + + va_end (args.ap); + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fseek.c b/newlib/libc/machine/spu/fseek.c new file mode 100644 index 000000000..14b175c39 --- /dev/null +++ b/newlib/libc/machine/spu/fseek.c @@ -0,0 +1,69 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + long offset; + unsigned int pad1[ 3 ]; + int whence; +} c99_fseek_t; + +#ifndef _REENT_ONLY + +int +_DEFUN (fseek, (fp, offset, whence), + register FILE *fp _AND + long offset _AND + int whence) +{ + int* ret; + c99_fseek_t args; + + CHECK_INIT(_REENT); + + args.fp = fp->_fp; + args.offset = offset; + args.whence = whence; + ret = (int*)&args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSEEK, &args); + + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fsetpos.c b/newlib/libc/machine/spu/fsetpos.c new file mode 100644 index 000000000..6627c335f --- /dev/null +++ b/newlib/libc/machine/spu/fsetpos.c @@ -0,0 +1,65 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + _CONST _fpos_t *pos; +} c99_fsetpos_t; + +#ifndef _REENT_ONLY + +int +_DEFUN (fsetpos, (iop, pos), + FILE * iop _AND + _CONST _fpos_t * pos) +{ + int* ret; + c99_fsetpos_t args; + + CHECK_INIT(_REENT); + + args.fp = iop->_fp; + args.pos = pos; + ret = (int*)&args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FSETPOS, &args); + + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/ftell.c b/newlib/libc/machine/spu/ftell.c new file mode 100644 index 000000000..b633aecba --- /dev/null +++ b/newlib/libc/machine/spu/ftell.c @@ -0,0 +1,54 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + + +#ifndef _REENT_ONLY + +long +_DEFUN (ftell, (fp), + FILE * fp) +{ + long ret; + + CHECK_INIT(_REENT); + + ret = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FTELL, &ret); + + return ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/fwrite.c b/newlib/libc/machine/spu/fwrite.c new file mode 100644 index 000000000..9c18d07c4 --- /dev/null +++ b/newlib/libc/machine/spu/fwrite.c @@ -0,0 +1,73 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +typedef struct +{ + _CONST char* buf; + unsigned int pad0[ 3 ]; + size_t size; + unsigned int pad1[ 3 ]; + size_t count; + unsigned int pad2[ 3 ]; + int fp; +} c99_fwrite_t; + +size_t +_DEFUN (fwrite, (buf, size, count, fp), + _CONST _PTR buf _AND + size_t size _AND + size_t count _AND + FILE * fp) +{ + size_t* ret; + c99_fwrite_t args; + + CHECK_INIT(_REENT); + + args.buf = buf; + args.size = size; + args.count = count; + args.fp = fp->_fp; + ret = (size_t*) &args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_FWRITE, &args); + + return *ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/getc.c b/newlib/libc/machine/spu/getc.c new file mode 100644 index 000000000..df66709f2 --- /dev/null +++ b/newlib/libc/machine/spu/getc.c @@ -0,0 +1,56 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" +/* + * A subroutine version of the macro getc. + */ + +#ifndef _REENT_ONLY + +int +getc (fp) + FILE *fp; +{ + int ret; + + CHECK_INIT(_REENT); + + ret = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETC, &ret); + + return ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/getchar.c b/newlib/libc/machine/spu/getchar.c new file mode 100644 index 000000000..4667792f2 --- /dev/null +++ b/newlib/libc/machine/spu/getchar.c @@ -0,0 +1,52 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#undef getchar + +#ifndef _REENT_ONLY + +int +getchar () +{ + int ret; + + CHECK_STD_INIT(_REENT); + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETCHAR, &ret); + + return ret; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/gets.c b/newlib/libc/machine/spu/gets.c new file mode 100644 index 000000000..4917d724c --- /dev/null +++ b/newlib/libc/machine/spu/gets.c @@ -0,0 +1,51 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +char * +gets (buf) + char *buf; +{ + CHECK_STD_INIT(_REENT); + + /* The return value gets written over buf + */ + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_GETS, &buf); + + return buf; +} +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/perror.c b/newlib/libc/machine/spu/perror.c index ad79a48db..28598c85d 100644 --- a/newlib/libc/machine/spu/perror.c +++ b/newlib/libc/machine/spu/perror.c @@ -2,13 +2,17 @@ #include "c99ppe.h" +#ifndef _REENT_ONLY + void _DEFUN (perror, (s), _CONST char *s) { + CHECK_STD_INIT(_REENT); + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PERROR, &s); return; } - +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/printf.c b/newlib/libc/machine/spu/printf.c index 695bb5a15..5783b80e6 100644 --- a/newlib/libc/machine/spu/printf.c +++ b/newlib/libc/machine/spu/printf.c @@ -11,7 +11,7 @@ typedef struct { - char* fmt; + _CONST char* fmt; unsigned int pad0[ 3 ]; va_list ap; } c99_printf_t; @@ -33,6 +33,9 @@ printf (fmt, va_alist) { int* ret; c99_printf_t args; + + CHECK_STD_INIT(_REENT); + ret = (int*) &args; args.fmt = fmt; diff --git a/newlib/libc/machine/spu/putc.c b/newlib/libc/machine/spu/putc.c new file mode 100644 index 000000000..3dbf87372 --- /dev/null +++ b/newlib/libc/machine/spu/putc.c @@ -0,0 +1,67 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + int ch; + unsigned int pad0[ 3 ]; + int fp; + unsigned int pad1[ 3 ]; +} c99_putc_t; + +#ifndef _REENT_ONLY + +int +putc (c, fp) + int c; + register FILE *fp; +{ + int* ret; + c99_putc_t args; + + CHECK_INIT(_REENT); + + args.ch = c; + args.fp = fp->_fp; + ret = (int*)&args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTC, &args); + + return *ret; +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/putchar.c b/newlib/libc/machine/spu/putchar.c index 0b6709d7f..9751879df 100644 --- a/newlib/libc/machine/spu/putchar.c +++ b/newlib/libc/machine/spu/putchar.c @@ -4,10 +4,14 @@ #undef putchar +#ifndef _REENT_ONLY + int putchar (c) int c; { + CHECK_STD_INIT(_REENT); + /* c gets overwritten before return */ send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_PUTCHAR, &c); @@ -15,3 +19,4 @@ putchar (c) return c; } +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/puts.c b/newlib/libc/machine/spu/puts.c index f060494dd..e8e2f8bcb 100644 --- a/newlib/libc/machine/spu/puts.c +++ b/newlib/libc/machine/spu/puts.c @@ -2,10 +2,13 @@ #include "c99ppe.h" +#ifndef _REENT_ONLY + int _DEFUN (puts, (s), char _CONST * s) { + CHECK_STD_INIT(_REENT); /* The return value gets written over s */ @@ -14,3 +17,4 @@ _DEFUN (puts, (s), return (int)s; } +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/rewind.c b/newlib/libc/machine/spu/rewind.c new file mode 100644 index 000000000..cdeb41eac --- /dev/null +++ b/newlib/libc/machine/spu/rewind.c @@ -0,0 +1,54 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +void +_DEFUN (rewind, (fp), + FILE * fp) +{ + int ret; + + CHECK_INIT(_REENT); + + ret = fp->_fp; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_REWIND, &ret); + + return; +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/scanf.c b/newlib/libc/machine/spu/scanf.c new file mode 100644 index 000000000..0f4817d90 --- /dev/null +++ b/newlib/libc/machine/spu/scanf.c @@ -0,0 +1,76 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +#ifdef _HAVE_STDC +#include +#else +#include +#endif + +typedef struct +{ + _CONST char* fmt; + unsigned int pad0[ 3 ]; + va_list ap; +} c99_vscanf_t; + +#ifndef _REENT_ONLY + +scanf(_CONST char *fmt, ...) +{ + int* ret; + c99_vscanf_t args; + + CHECK_STD_INIT(_REENT); + + ret = (int*) &args; + + args.fmt = (char*) fmt; +#ifdef _HAVE_STDC + va_start (args.ap, fmt); +#else + va_start (args.ap); +#endif + + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args); + + va_end (args.ap); + return *ret; +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/setbuf.c b/newlib/libc/machine/spu/setbuf.c new file mode 100644 index 000000000..d2ffebec4 --- /dev/null +++ b/newlib/libc/machine/spu/setbuf.c @@ -0,0 +1,65 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + char *buf; + unsigned int pad1[ 3 ]; +} c99_setbuf_t; + +#ifndef _REENT_ONLY + +void +_DEFUN (setbuf, (fp, buf), + FILE * fp _AND + char *buf) +{ + c99_setbuf_t args; + + CHECK_INIT(_REENT); + + args.fp = fp->_fp; + args.buf = buf; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_SETBUF, &args); + + return; +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/setvbuf.c b/newlib/libc/machine/spu/setvbuf.c new file mode 100644 index 000000000..7c6bf54aa --- /dev/null +++ b/newlib/libc/machine/spu/setvbuf.c @@ -0,0 +1,75 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + char *buf; + unsigned int pad1[ 3 ]; + int mode; + unsigned int pad2[ 3 ]; + size_t size; + unsigned int pad3[ 3 ]; +} c99_setvbuf_t; + +#ifndef _REENT_ONLY + +int +_DEFUN (setvbuf, (fp, buf, mode, size), + FILE * fp _AND + char *buf _AND + int mode _AND + size_t size) +{ + int* ret; + c99_setvbuf_t args; + + CHECK_INIT(_REENT); + + args.fp = fp->_fp; + args.buf = buf; + args.mode = mode; + args.size = size; + ret = (int*)&args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_SETVBUF, &args); + + return *ret; +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/stdio.c b/newlib/libc/machine/spu/stdio.c new file mode 100644 index 000000000..13addad26 --- /dev/null +++ b/newlib/libc/machine/spu/stdio.c @@ -0,0 +1,82 @@ +/* +Copyright (C) 2007 Sony Computer Entertainment Inc. +Copyright 2007 Sony Corp. + +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. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the names of the copyright holders nor the names of their + 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. + +Author: Kazunori Asayama +*/ + +#include + +#include "c99ppe.h" + + +static FILE __fp[SPE_FOPEN_MAX]; + +FILE * +_DEFUN (__sfp, (d), + struct _reent *d) +{ + int i; + for (i = 0; i < SPE_FOPEN_MAX; i++) { + if (!__fp[i]._fp) { + return &__fp[i]; + } + } + d->_errno = EMFILE; + return NULL; +} + +static _VOID +_DEFUN (__cleanup, (s), + struct _reent *s) +{ + int i; + for (i = 0; i < SPE_FOPEN_MAX; i++) { + if (__fp[i]._fp) { + fclose(&__fp[i]); + } + } +} + +_VOID +_DEFUN (__sinit, (s), + struct _reent *s) +{ + s->__cleanup = __cleanup; + s->__sdidinit = 1; + + s->_stdin = &s->__sf[0]; + s->_stdin->_fp = SPE_STDIN; + + s->_stdout = &s->__sf[1]; + s->_stdout->_fp = SPE_STDOUT; + + s->_stderr = &s->__sf[2]; + s->_stderr->_fp = SPE_STDERR; +} diff --git a/newlib/libc/machine/spu/sys/custom_file.h b/newlib/libc/machine/spu/sys/custom_file.h new file mode 100644 index 000000000..60c0d2309 --- /dev/null +++ b/newlib/libc/machine/spu/sys/custom_file.h @@ -0,0 +1,13 @@ +#ifndef __CUSTOM_FILE_H__ +#define __CUSTOM_FILE_H__ 1 + +/* + * Cell SPE support + */ +struct __sFILE_spu { + int _fp; /* pseudo FILE pointer on PPE */ +}; +typedef struct __sFILE_spu __FILE; + +#endif /* __CUSTOM_FILE_H__ */ + diff --git a/newlib/libc/machine/spu/tmpfile.c b/newlib/libc/machine/spu/tmpfile.c new file mode 100644 index 000000000..0d8d40699 --- /dev/null +++ b/newlib/libc/machine/spu/tmpfile.c @@ -0,0 +1,65 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include + +#include "c99ppe.h" + +#ifndef _REENT_ONLY + +FILE * +_DEFUN_VOID (tmpfile) +{ + int ret; + FILE* fp; + struct _reent *ptr = _REENT; + + CHECK_INIT(ptr); + + fp = __sfp(ptr); + if (!fp) { + return NULL; + } + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_TMPFILE, &ret); + + if (ret) { + fp->_fp = ret; + return fp; + } + else { + __sfp_free(fp); + return NULL; + } +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/ungetc.c b/newlib/libc/machine/spu/ungetc.c new file mode 100644 index 000000000..1383d01d4 --- /dev/null +++ b/newlib/libc/machine/spu/ungetc.c @@ -0,0 +1,67 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +typedef struct +{ + int c; + unsigned int pad0[ 3 ]; + int fp; + unsigned int pad1[ 3 ]; +} c99_ungetc_t; + +#ifndef _REENT_ONLY + +int +ungetc (c, fp) + int c; + register FILE *fp; +{ + int* ret; + c99_ungetc_t args; + + CHECK_INIT(_REENT); + + args.c = c; + args.fp = fp->_fp; + ret = (int*)&args; + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_UNGETC, &args); + + return *ret; +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/vfprintf.c b/newlib/libc/machine/spu/vfprintf.c new file mode 100644 index 000000000..579f23bba --- /dev/null +++ b/newlib/libc/machine/spu/vfprintf.c @@ -0,0 +1,77 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +#ifdef _HAVE_STDC +#include +#else +#include +#endif + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + char* fmt; + unsigned int pad1[ 3 ]; + va_list ap; +} c99_vfprintf_t; + +#ifndef _REENT_ONLY + +int +_DEFUN (vfprintf, (fp, fmt0, ap), + FILE * fp _AND + _CONST char *fmt0 _AND + va_list ap) +{ + int* ret; + c99_vfprintf_t args; + + CHECK_INIT(_REENT); + + ret = (int*) &args; + + args.fp = fp->_fp; + args.fmt = (char*) fmt0; + va_copy(args.ap,ap); + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFPRINTF, &args); + + return *ret; +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/vfscanf.c b/newlib/libc/machine/spu/vfscanf.c new file mode 100644 index 000000000..ac84951de --- /dev/null +++ b/newlib/libc/machine/spu/vfscanf.c @@ -0,0 +1,77 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +#ifdef _HAVE_STDC +#include +#else +#include +#endif + +typedef struct +{ + int fp; + unsigned int pad0[ 3 ]; + char* fmt; + unsigned int pad1[ 3 ]; + va_list ap; +} c99_vfscanf_t; + +#ifndef _REENT_ONLY + +int +_DEFUN (vfscanf, (fp, fmt, ap), + FILE *fp _AND + _CONST char *fmt _AND + va_list ap) +{ + int* ret; + c99_vfscanf_t args; + + CHECK_INIT(_REENT); + + ret = (int*) &args; + + args.fp = fp->_fp; + args.fmt = (char*) fmt; + va_copy(args.ap,ap); + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VFSCANF, &args); + + return *ret; +} + +#endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/machine/spu/vprintf.c b/newlib/libc/machine/spu/vprintf.c index 26dfb84ab..ca578e630 100644 --- a/newlib/libc/machine/spu/vprintf.c +++ b/newlib/libc/machine/spu/vprintf.c @@ -1,4 +1,3 @@ - #include <_ansi.h> #include @@ -12,7 +11,7 @@ typedef struct { - char* fmt; + _CONST char* fmt; unsigned int pad0[ 3 ]; va_list ap; } c99_vprintf_t; @@ -26,9 +25,12 @@ _DEFUN (vprintf, (fmt, ap), { int* ret; c99_vprintf_t args; + + CHECK_STD_INIT(_REENT); + ret = (int*) &args; - args.fmt = (char*) fmt; + args.fmt = fmt; va_copy(args.ap,ap); send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VPRINTF, &args); diff --git a/newlib/libc/machine/spu/vscanf.c b/newlib/libc/machine/spu/vscanf.c new file mode 100644 index 000000000..9abd007b8 --- /dev/null +++ b/newlib/libc/machine/spu/vscanf.c @@ -0,0 +1,73 @@ +/* +(C) Copyright IBM Corp. 2006 + +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. + * Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + * Neither the name of IBM nor the names of its 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. + +Author: Joel Schopp +*/ + +#include <_ansi.h> +#include + +#include "c99ppe.h" + +#ifdef _HAVE_STDC +#include +#else +#include +#endif + +typedef struct +{ + char* fmt; + unsigned int pad0[ 3 ]; + va_list ap; +} c99_vscanf_t; + +#ifndef _REENT_ONLY + +int +_DEFUN (vscanf, (fmt, ap), + _CONST char *fmt _AND + va_list ap) +{ + int* ret; + c99_vscanf_t args; + + CHECK_STD_INIT(_REENT); + + ret = (int*) &args; + + args.fmt = (char*) fmt; + va_copy(args.ap,ap); + + send_to_ppe(SPE_C99_SIGNALCODE, SPE_C99_VSCANF, &args); + + return *ret; +} + +#endif /* ! _REENT_ONLY */