* 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.
		
			
				
	
	
		
			44 lines
		
	
	
		
			1007 B
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			44 lines
		
	
	
		
			1007 B
		
	
	
	
		
			C
		
	
	
	
	
	
//  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;
 | 
						|
}
 |