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.
This commit is contained 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
|
||||
|
40
winsup/mingw/mingwex/stdio/vfscanf.c
Normal file
40
winsup/mingw/mingwex/stdio/vfscanf.c
Normal file
@@ -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;
|
||||
}
|
42
winsup/mingw/mingwex/stdio/vfwscanf.c
Normal file
42
winsup/mingw/mingwex/stdio/vfwscanf.c
Normal file
@@ -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;
|
||||
}
|
9
winsup/mingw/mingwex/stdio/vscanf.c
Normal file
9
winsup/mingw/mingwex/stdio/vscanf.c
Normal file
@@ -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);
|
||||
}
|
41
winsup/mingw/mingwex/stdio/vsscanf.c
Normal file
41
winsup/mingw/mingwex/stdio/vsscanf.c
Normal file
@@ -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;
|
||||
}
|
43
winsup/mingw/mingwex/stdio/vswscanf.c
Normal file
43
winsup/mingw/mingwex/stdio/vswscanf.c
Normal file
@@ -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;
|
||||
}
|
9
winsup/mingw/mingwex/stdio/vwscanf.c
Normal file
9
winsup/mingw/mingwex/stdio/vwscanf.c
Normal file
@@ -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);
|
||||
}
|
Reference in New Issue
Block a user