Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2003-03-02 10:00:48 +0300
committerDanny Smith <dannysmith@users.sourceforge.net>2003-03-02 10:00:48 +0300
commit4aa3feb8991e4d1ecf1c4915d25ab88863e84ef6 (patch)
treedb4e5cdc43924d9733fcf116704e1da554902e7d
parent408e9b2fd4082dbc5bbfc581f5e6167924de399e (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.
-rw-r--r--winsup/mingw/ChangeLog34
-rw-r--r--winsup/mingw/include/stdio.h17
-rw-r--r--winsup/mingw/include/wchar.h13
-rw-r--r--winsup/mingw/mingwex/Makefile.in28
-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.c40
-rw-r--r--winsup/mingw/mingwex/stdio/vfwscanf.c42
-rw-r--r--winsup/mingw/mingwex/stdio/vscanf.c9
-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.c41
-rw-r--r--winsup/mingw/mingwex/stdio/vswscanf.c43
-rw-r--r--winsup/mingw/mingwex/stdio/vwscanf.c9
14 files changed, 259 insertions, 17 deletions
diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog
index 66f8f3486..91f923925 100644
--- a/winsup/mingw/ChangeLog
+++ b/winsup/mingw/ChangeLog
@@ -1,3 +1,35 @@
+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.
+
2003-02-25 Earnie Boyd <earnie@users.sf.net>
* Makefile.in (libmsvcrt20.a): Remove target and dependencies.
@@ -201,7 +233,7 @@
2002-10-30 Guido Serassio <serassio@libero.it>
- * include/stdio.h (_getmaxstdio): Add prototype.
+ * include/stdio.h (_getmaxstdio): Add prototype.
(_setmaxstdio): Likewise.
2002-10-19 Kang Li <rubylith@users.sourceforge.net>
diff --git a/winsup/mingw/include/stdio.h b/winsup/mingw/include/stdio.h
index 6fad92c88..1bf445052 100644
--- a/winsup/mingw/include/stdio.h
+++ b/winsup/mingw/include/stdio.h
@@ -222,9 +222,14 @@ _CRTIMP int __cdecl _vsnprintf (char*, size_t, const char*, __VALIST);
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
int __cdecl snprintf(char* s, size_t n, const char* format, ...);
-extern __inline__ int __cdecl vsnprintf (char* s, size_t n, const char* format,
- __VALIST arg)
+extern __inline__ int __cdecl
+vsnprintf (char* s, size_t n, const char* format, __VALIST arg)
{ return _vsnprintf ( s, n, format, arg); }
+int __cdecl vscanf (const char * __restrict__, __VALIST);
+int __cdecl vfscanf (FILE * __restrict__, const char * __restrict__,
+ __VALIST);
+int __cdecl vsscanf (const char * __restrict__,
+ const char * __restrict__, __VALIST);
#endif
/*
@@ -358,6 +363,7 @@ _CRTIMP int __cdecl swscanf (const wchar_t*, const wchar_t*, ...);
_CRTIMP wint_t __cdecl fgetwc (FILE*);
_CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*);
_CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*);
+
#ifdef __MSVCRT__
_CRTIMP wchar_t* __cdecl fgetws (wchar_t*, int, FILE*);
_CRTIMP int __cdecl fputws (const wchar_t*, FILE*);
@@ -380,10 +386,15 @@ _CRTIMP FILE* __cdecl _wpopen (const wchar_t*, const wchar_t*);
#endif /* __MSVCRT__ */
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
-int __cdecl snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
+int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...);
extern __inline__ int __cdecl
vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
{ return _vsnwprintf ( s, n, format, arg);}
+int __cdecl vwscanf (const wchar_t * __restrict__, __VALIST);
+int __cdecl vfwscanf (FILE * __restrict__,
+ const wchar_t * __restrict__, __VALIST);
+int __cdecl vswscanf (const wchar_t * __restrict__,
+ const wchar_t * __restrict__, __VALIST);
#endif
#define _WSTDIO_DEFINED
diff --git a/winsup/mingw/include/wchar.h b/winsup/mingw/include/wchar.h
index 90bb82726..58e241ab1 100644
--- a/winsup/mingw/include/wchar.h
+++ b/winsup/mingw/include/wchar.h
@@ -118,10 +118,15 @@ _CRTIMP wint_t __cdecl fputwc (wchar_t, FILE*);
_CRTIMP wint_t __cdecl ungetwc (wchar_t, FILE*);
#ifndef __NO_ISOCEXT /* externs in libmingwex.a */
-int __cdecl snwprintf(wchar_t* s, size_t n, const wchar_t* format, ...);
-extern __inline__ int __cdecl vsnwprintf (wchar_t* s, size_t n, const wchar_t* format,
- __VA_LIST arg)
- { return _vsnwprintf ( s, n, format, arg); }
+int __cdecl snwprintf (wchar_t* s, size_t n, const wchar_t* format, ...);
+extern __inline__ int __cdecl
+vsnwprintf (wchar_t* s, size_t n, const wchar_t* format, __VALIST arg)
+ { return _vsnwprintf ( s, n, format, arg);}
+int __cdecl vwscanf (const wchar_t * __restrict__, __VALIST);
+int __cdecl vfwscanf (FILE * __restrict__,
+ const wchar_t * __restrict__, __VALIST);
+int __cdecl vswscanf (const wchar_t * __restrict__,
+ const wchar_t * __restrict__, __VALIST);
#endif
#ifdef __MSVCRT__
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);
+}