diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2003-03-02 10:00:48 +0300 |
---|---|---|
committer | Danny Smith <dannysmith@users.sourceforge.net> | 2003-03-02 10:00:48 +0300 |
commit | 4aa3feb8991e4d1ecf1c4915d25ab88863e84ef6 (patch) | |
tree | db4e5cdc43924d9733fcf116704e1da554902e7d /winsup/mingw/mingwex | |
parent | 408e9b2fd4082dbc5bbfc581f5e6167924de399e (diff) |
2003-03-02 Danny Smith <dannysmith@users.sourceforge.net>
* include/stdio.h (vscanf): Add prototype.
(vfscanf): Ditto.
(vsscanf): Ditto.
(vwscanf): Ditto.
(vfwscanf): Ditto.
(vswscanf): Ditto.
* include/wchar.h (vwscanf): Add prototype.
(vfwscanf): Ditto.
(vswscanf): Ditto.
* mingwex/snprintf.c: Move to mingwex/stdio.
* mingwex/vsnprintf.c: Ditto.
* mingwex/snwprintf.c: Ditto.
* mingwex/vsnwprintf.c: Ditto.
* mingwex/Makefile.in (VPATH): Add $(srcdir)/stdio
(STDIO_DISTFILES): Add.
(DISTFILES): Adjust.
(STDIO_STUB_OBJS): Rename to STDIO_OBJS and add v*scanf objects.
(LIB_OBJS): Adjust.
(dist): Adjust.
2003-03-02 Aaron W LaFramboise <AWLaFramboise@aol.com>
* mingwex/stdio: New directory
* mingwex/stdio/vfscanf.c: New file.
* mingwex/stdio/vfwscanf.c: New file.
* mingwex/stdio/vscanf.c: New file.
* mingwex/stdio/vsscanf.c: New file.
* mingwex/stdio/vswscanf.c: New file.
* mingwex/stdio/vwscanf.c: New file.
Diffstat (limited to 'winsup/mingw/mingwex')
-rw-r--r-- | winsup/mingw/mingwex/Makefile.in | 28 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/snprintf.c (renamed from winsup/mingw/mingwex/snprintf.c) | 0 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/snwprintf.c (renamed from winsup/mingw/mingwex/snwprintf.c) | 0 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/vfscanf.c | 40 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/vfwscanf.c | 42 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/vscanf.c | 9 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/vsnprintf.c (renamed from winsup/mingw/mingwex/vsnprintf.c) | 0 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/vsnwprintf.c (renamed from winsup/mingw/mingwex/vsnwprintf.c) | 0 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/vsscanf.c | 41 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/vswscanf.c | 43 | ||||
-rw-r--r-- | winsup/mingw/mingwex/stdio/vwscanf.c | 9 |
11 files changed, 203 insertions, 9 deletions
diff --git a/winsup/mingw/mingwex/Makefile.in b/winsup/mingw/mingwex/Makefile.in index bb96cac71..07fca1e36 100644 --- a/winsup/mingw/mingwex/Makefile.in +++ b/winsup/mingw/mingwex/Makefile.in @@ -4,7 +4,7 @@ # This makefile requires GNU make. srcdir = @srcdir@ -VPATH = $(srcdir):$(srcdir)/math +VPATH = $(srcdir):$(srcdir)/math:$(srcdir)/stdio objdir = . target_alias = @target_alias@ @@ -30,11 +30,12 @@ DISTFILES = Makefile.in configure configure.in \ fegetexceptflag.c fegetround.c feholdexcept.c feraiseexcept.c \ fesetenv.c fesetexceptflag.c fesetround.c fetestexcept.c \ feupdateenv.c fwide.c imaxabs.c imaxdiv.c ldtoa.c lltoa.c lltow.c \ - mbsinit.c mingw-fseek.c sitest.c snprintf.c snwprintf.c \ + mbsinit.c mingw-fseek.c sitest.c \ strtof.c strtoimax.c strtold.c strtoumax.c testwmem.c \ - ulltoa.c ulltow.c vsnprintf.c vsnwprintf.c wcstof.c \ + ulltoa.c ulltow.c wcstof.c \ wcstoimax.c wcstold.c wcstoumax.c wdirent.c wmemchr.c \ wmemcmp.c wmemcpy.c wmemmove.c wmemset.c wtoll.c + MATH_DISTFILES = \ acosf.c acosl.c asinf.c asinl.c atan2f.c atan2l.c \ atanf.c atanl.c cbrt.c cbrtf.c cbrtl.c ceilf.S ceill.S \ @@ -61,6 +62,10 @@ MATH_DISTFILES = \ sqrtf.c sqrtl.c tanf.S tanhf.c tanhl.c tanl.S tgamma.c \ tgammaf.c tgammal.c trunc.c truncf.c truncl.c +STDIO_DISTFILES = \ + snprintf.c snwprintf.c vsnprintf.c vsnwprintf.c \ + vfscanf.c vfwscanf.c vscanf.c vsscanf.c vswscanf.c vwscanf.c + CC = @CC@ # FIXME: Which is it, CC or CC_FOR_TARGET? CC_FOR_TARGET = $(CC) @@ -104,8 +109,9 @@ STDLIB_STUB_OBJS = \ atoll.o wtoll.o \ strtof.o wcstof.o \ _Exit.o -STDIO_STUB_OBJS = \ - snprintf.o vsnprintf.o snwprintf.o vsnwprintf.o +STDIO_OBJS = \ + snprintf.o vsnprintf.o snwprintf.o vsnwprintf.o \ + vfscanf.o vfwscanf.o vscanf.o vsscanf.o vswscanf.o vwscanf.o MATH_OBJS = \ acosf.o acosl.o asinf.o asinl.o atan2f.o atan2l.o \ atanf.o atanl.o cbrt.o cbrtf.o cbrtl.o ceilf.o ceill.o \ @@ -141,8 +147,8 @@ REPLACE_OBJS = \ mingw-fseek.o LIB_OBJS = $(Q8_OBJS) $(STDLIB_OBJS) $(STDLIB_STUB_OBJS) \ - $(STDIO_STUB_OBJS) $(MATH_OBJS) $(FENV_OBJS) $(POSIX_OBJS) \ - $(REPLACE_OBJS) + $(STDIO_OBJS) $(MATH_OBJS) $(FENV_OBJS) \ + $(POSIX_OBJS) $(REPLACE_OBJS) LIBS = $(LIBMINGWEX_A) DLLS = @@ -203,8 +209,12 @@ dist: cp -p $(srcdir)/$$i $(distdir)/mingwex/$$i ; \ done mkdir $(distdir)/mingwex/math - chmod 755 $(distdir)//mingwex/math + chmod 755 $(distdir)/mingwex/math @for i in $(MATH_DISTFILES); do\ cp -p $(srcdir)/math/$$i $(distdir)/mingwex/math/$$i ; \ done - + mkdir $(distdir)/mingwex/stdio + chmod 755 $(distdir)/mingwex/stdio + @for i in $(STDIO_DISTFILES); do\ + cp -p $(srcdir)/stdio/$$i $(distdir)/mingwex/stdio/$$i ; \ + done diff --git a/winsup/mingw/mingwex/snprintf.c b/winsup/mingw/mingwex/stdio/snprintf.c index c8d2a7b20..c8d2a7b20 100644 --- a/winsup/mingw/mingwex/snprintf.c +++ b/winsup/mingw/mingwex/stdio/snprintf.c diff --git a/winsup/mingw/mingwex/snwprintf.c b/winsup/mingw/mingwex/stdio/snwprintf.c index 42b05b292..42b05b292 100644 --- a/winsup/mingw/mingwex/snwprintf.c +++ b/winsup/mingw/mingwex/stdio/snwprintf.c diff --git a/winsup/mingw/mingwex/stdio/vfscanf.c b/winsup/mingw/mingwex/stdio/vfscanf.c new file mode 100644 index 000000000..41549f9e4 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vfscanf.c @@ -0,0 +1,40 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt +// Public domain: all copyrights disclaimed, absolutely no warranties */ + +#include <stdarg.h> +#include <stdio.h> + +int vfscanf(FILE * __restrict__ stream, const char * __restrict__ format, va_list arg) { + int ret; + + __asm__( + + /* allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) */ + "movl %%esp, %%ebx\n\t" + "lea 0xFFFFFFEC(%%esp, %6), %%esp\n\t" + "subl %5, %%esp\n\t" + + // set up stack + "movl %1, 0xC(%%esp)\n\t" // stream + "movl %2, 0x10(%%esp)\n\t" // format + "lea 0x14(%%esp), %%edi\n\t" + "movl %%edi, (%%esp)\n\t" // memcpy dest + "movl %5, 0x4(%%esp)\n\t" // memcpy src + "movl %5, 0x8(%%esp)\n\t" + "subl %6, 0x8(%%esp)\n\t" // memcpy len + "call _memcpy\n\t" + "addl $12, %%esp\n\t" + + // call fscanf + "call _fscanf\n\t" + + // restore stack + "movl %%ebx, %%esp\n\t" + + : "=a"(ret), "=c"(stream), "=d"(format) + : "1"(stream), "2"(format), "S"(arg), + "a"(&ret) + : "ebx"); + + return ret; +} diff --git a/winsup/mingw/mingwex/stdio/vfwscanf.c b/winsup/mingw/mingwex/stdio/vfwscanf.c new file mode 100644 index 000000000..8fa33376e --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vfwscanf.c @@ -0,0 +1,42 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt. +// Public domain: all copyrights disclaimed, absolutely no warranties. + +#include <stdarg.h> +#include <wchar.h> + +int vfwscanf(FILE * __restrict__ stream, const wchar_t * __restrict__ format, + va_list arg) { + + int ret; + + __asm__( + + // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) + "movl %%esp, %%ebx\n\t" + "lea 0xFFFFFFEC(%%esp, %6), %%esp\n\t" + "subl %5, %%esp\n\t" + + // set up stack + "movl %1, 0xC(%%esp)\n\t" // stream + "movl %2, 0x10(%%esp)\n\t" // format + "lea 0x14(%%esp), %%edi\n\t" + "movl %%edi, (%%esp)\n\t" // memcpy dest + "movl %5, 0x4(%%esp)\n\t" // memcpy src + "movl %5, 0x8(%%esp)\n\t" + "subl %6, 0x8(%%esp)\n\t" // memcpy len + "call _memcpy\n\t" + "addl $12, %%esp\n\t" + + // call fscanf + "call _fwscanf\n\t" + + // restore stack + "movl %%ebx, %%esp\n\t" + + : "=a"(ret), "=c"(stream), "=d"(format) + : "1"(stream), "2"(format), "S"(arg), + "a"(&ret) + : "ebx"); + + return ret; +} diff --git a/winsup/mingw/mingwex/stdio/vscanf.c b/winsup/mingw/mingwex/stdio/vscanf.c new file mode 100644 index 000000000..53f543442 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vscanf.c @@ -0,0 +1,9 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt +// Public domain: all copyrights disclaimed, absolutely no warranties + +#include <stdarg.h> +#include <stdio.h> + +int vscanf(const char * __restrict__ format, va_list arg) { + return vfscanf(stdin, format, arg); +} diff --git a/winsup/mingw/mingwex/vsnprintf.c b/winsup/mingw/mingwex/stdio/vsnprintf.c index f3dce5b67..f3dce5b67 100644 --- a/winsup/mingw/mingwex/vsnprintf.c +++ b/winsup/mingw/mingwex/stdio/vsnprintf.c diff --git a/winsup/mingw/mingwex/vsnwprintf.c b/winsup/mingw/mingwex/stdio/vsnwprintf.c index 1b59a078b..1b59a078b 100644 --- a/winsup/mingw/mingwex/vsnwprintf.c +++ b/winsup/mingw/mingwex/stdio/vsnwprintf.c diff --git a/winsup/mingw/mingwex/stdio/vsscanf.c b/winsup/mingw/mingwex/stdio/vsscanf.c new file mode 100644 index 000000000..33fd333ae --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vsscanf.c @@ -0,0 +1,41 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt. +// Public domain: all copyrights disclaimed, absolutely no warranties. + +#include <stdarg.h> +#include <stdio.h> + + +int vsscanf(const char * __restrict__ s, const char * __restrict__ format, va_list arg) { + int ret; + + __asm__( + + // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) + "movl %%esp, %%ebx\n\t" + "lea 0xFFFFFFEC(%%esp, %6), %%esp\n\t" + "subl %5, %%esp\n\t" + + // set up stack + "movl %1, 0xC(%%esp)\n\t" // s + "movl %2, 0x10(%%esp)\n\t" // format + "lea 0x14(%%esp), %%edi\n\t" + "movl %%edi, (%%esp)\n\t" // memcpy dest + "movl %5, 0x4(%%esp)\n\t" // memcpy src + "movl %5, 0x8(%%esp)\n\t" + "subl %6, 0x8(%%esp)\n\t" // memcpy len + "call _memcpy\n\t" + "addl $12, %%esp\n\t" + + // call sscanf + "call _sscanf\n\t" + + // restore stack + "movl %%ebx, %%esp\n\t" + + : "=a"(ret), "=c"(s), "=d"(format) + : "1"(s), "2"(format), "S"(arg), + "a"(&ret) + : "ebx"); + + return ret; +} diff --git a/winsup/mingw/mingwex/stdio/vswscanf.c b/winsup/mingw/mingwex/stdio/vswscanf.c new file mode 100644 index 000000000..20a0f85f5 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vswscanf.c @@ -0,0 +1,43 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt +// Public domain: all copyrights disclaimed, absolutely no warranties */ + +#include <stdarg.h> +#include <wchar.h> + + +int vswscanf(const wchar_t * __restrict__ s, const wchar_t * __restrict__ format, + va_list arg) { + + int ret; + + __asm__( + + // allocate stack (esp += frame - arg3 - (8[arg1,2] + 12)) + "movl %%esp, %%ebx\n\t" + "lea 0xFFFFFFEC(%%esp, %6), %%esp\n\t" + "subl %5, %%esp\n\t" + + // set up stack + "movl %1, 0xC(%%esp)\n\t" // s + "movl %2, 0x10(%%esp)\n\t" // format + "lea 0x14(%%esp), %%edi\n\t" + "movl %%edi, (%%esp)\n\t" // memcpy dest + "movl %5, 0x4(%%esp)\n\t" // memcpy src + "movl %5, 0x8(%%esp)\n\t" + "subl %6, 0x8(%%esp)\n\t" // memcpy len + "call _memcpy\n\t" + "addl $12, %%esp\n\t" + + // call sscanf + "call _swscanf\n\t" + + // restore stack + "movl %%ebx, %%esp\n\t" + + : "=a"(ret), "=c"(s), "=d"(format) + : "1"(s), "2"(format), "S"(arg), + "a"(&ret) + : "ebx"); + + return ret; +} diff --git a/winsup/mingw/mingwex/stdio/vwscanf.c b/winsup/mingw/mingwex/stdio/vwscanf.c new file mode 100644 index 000000000..c8f53eef2 --- /dev/null +++ b/winsup/mingw/mingwex/stdio/vwscanf.c @@ -0,0 +1,9 @@ +// By aaronwl 2003-01-28 for mingw-msvcrt. +// Public domain: all copyrights disclaimed, absolutely no warranties. + +#include <stdarg.h> +#include <wchar.h> + +int vwscanf(const wchar_t * __restrict__ format, va_list arg) { + return vfwscanf(stdin, format, arg); +} |