Author: fireball Date: Fri Jun 6 07:20:28 2008 New Revision: 33865
URL: http://svn.reactos.org/svn/reactos?rev=33865&view=rev Log: - Move scanf.c into strings, it belongs there. - Move thread.c to process, and remove outdated/duplicated copy. - Sync threadx with Wine. - Update README.WINE accordingly.
Added: trunk/reactos/lib/sdk/crt/process/thread.c - copied, changed from r33859, trunk/reactos/lib/sdk/crt/wine/thread.c trunk/reactos/lib/sdk/crt/string/scanf.c - copied unchanged from r33859, trunk/reactos/lib/sdk/crt/wine/scanf.c trunk/reactos/lib/sdk/crt/string/scanf.h - copied unchanged from r33859, trunk/reactos/lib/sdk/crt/wine/scanf.h Removed: trunk/reactos/lib/sdk/crt/wine/scanf.c trunk/reactos/lib/sdk/crt/wine/scanf.h trunk/reactos/lib/sdk/crt/wine/thread.c Modified: trunk/reactos/lib/sdk/crt/crt.rbuild trunk/reactos/lib/sdk/crt/libcntpr.rbuild trunk/reactos/lib/sdk/crt/process/threadx.c trunk/reactos/media/doc/README.WINE
Modified: trunk/reactos/lib/sdk/crt/crt.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/crt.rbuild?rev=... ============================================================================== --- trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/crt.rbuild [iso-8859-1] Fri Jun 6 07:20:28 2008 @@ -421,6 +421,7 @@ <file>atof.c</file> <file>ctype.c</file> <file>lasttok.c</file> + <file>scanf.c</file> <file>strcoll.c</file> <file>strdup.c</file> <file>strerror.c</file> @@ -484,8 +485,6 @@ </directory> <directory name="wine"> <file>heap.c</file> - <file>scanf.c</file> - <file>thread.c</file> <file>undname.c</file> </directory> </module>
Modified: trunk/reactos/lib/sdk/crt/libcntpr.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/libcntpr.rbuild... ============================================================================== --- trunk/reactos/lib/sdk/crt/libcntpr.rbuild [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/libcntpr.rbuild [iso-8859-1] Fri Jun 6 07:20:28 2008 @@ -131,6 +131,7 @@ <file>wcsrchr.c</file> </ifnot> <file>ctype.c</file> + <file>scanf.c</file> <file>strcspn.c</file> <file>stricmp.c</file> <file>strnicmp.c</file> @@ -159,10 +160,6 @@ <file>wtol.c</file> </directory>
- <directory name="wine"> - <file>scanf.c</file> - </directory> - <directory name="wstring"> <file>wcsicmp.c</file> <file>wcslwr.c</file>
Copied: trunk/reactos/lib/sdk/crt/process/thread.c (from r33859, trunk/reactos/lib/sdk/crt/wine/thread.c) URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/process/thread.... ============================================================================== --- trunk/reactos/lib/sdk/crt/wine/thread.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/process/thread.c [iso-8859-1] Fri Jun 6 07:20:28 2008 @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
#include <precomp.h> @@ -53,15 +53,14 @@ if (!(ptr = TlsGetValue( MSVCRT_tls_index ))) { if (!(ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ptr) ))) - _amsg_exit( _RT_THREAD ); - if (!TlsSetValue( MSVCRT_tls_index, ptr )) - _amsg_exit( _RT_THREAD ); - if (!TlsSetValue( MSVCRT_tls_index, ptr )) - _amsg_exit( _RT_THREAD ); + _amsg_exit( _RT_THREAD ); + if (!TlsSetValue( MSVCRT_tls_index, ptr )) _amsg_exit( _RT_THREAD ); + ptr->random_seed = 1; } SetLastError( err ); return ptr; } +
/********************************************************************* * _beginthread_trampoline @@ -104,3 +103,15 @@ return (unsigned long)CreateThread(NULL, stack_size, _beginthread_trampoline, trampoline, 0, NULL); } + +/********************************************************************* + * _endthread (MSVCRT.@) + */ +void CDECL _endthread(void) +{ + DPRINT("(void)\n"); + + /* FIXME */ + ExitThread(0); +} +
Modified: trunk/reactos/lib/sdk/crt/process/threadx.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/process/threadx... ============================================================================== --- trunk/reactos/lib/sdk/crt/process/threadx.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/process/threadx.c [iso-8859-1] Fri Jun 6 07:20:28 2008 @@ -3,7 +3,7 @@ /* * @unimplemented */ -unsigned long _beginthreadex( +unsigned long CDECL _beginthreadex( void* security, unsigned stack_size, unsigned (__stdcall *start_address)(void*), @@ -32,7 +32,7 @@ /* * @implemented */ -void _endthreadex(unsigned retval) +void CDECL _endthreadex(unsigned retval) { /* * Just call the API function. Any CRT specific processing is done in
Removed: trunk/reactos/lib/sdk/crt/wine/scanf.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/wine/scanf.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/wine/scanf.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/wine/scanf.c (removed) @@ -1,196 +1,0 @@ -/* - * general implementation of scanf used by scanf, sscanf, fscanf, - * _cscanf, wscanf, swscanf and fwscanf - * - * Copyright 1996,1998 Marcus Meissner - * Copyright 1996 Jukka Iivonen - * Copyright 1997,2000 Uwe Bonnes - * Copyright 2000 Jon Griffiths - * Copyright 2002 Daniel Gudbjartsson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include <precomp.h> - -#include <wchar.h> -#include <ctype.h> - -#define NDEBUG -#include <internal/debug.h> - -#define WARN DPRINT1 - -extern FILE _iob[]; - -/* helper function for *scanf. Returns the value of character c in the - * given base, or -1 if the given character is not a digit of the base. - */ -static int char2digit(char c, int base) { - if ((c>='0') && (c<='9') && (c<='0'+base-1)) return (c-'0'); - if (base<=10) return -1; - if ((c>='A') && (c<='Z') && (c<='A'+base-11)) return (c-'A'+10); - if ((c>='a') && (c<='z') && (c<='a'+base-11)) return (c-'a'+10); - return -1; -} - -/* helper function for *wscanf. Returns the value of character c in the - * given base, or -1 if the given character is not a digit of the base. - */ -static int wchar2digit(wchar_t c, int base) { - if ((c>=L'0') && (c<=L'9') && (c<=L'0'+base-1)) return (c-L'0'); - if (base<=10) return -1; - if ((c>=L'A') && (c<=L'Z') && (c<=L'A'+base-11)) return (c-L'A'+10); - if ((c>=L'a') && (c<=L'z') && (c<=L'a'+base-11)) return (c-L'a'+10); - return -1; -} - -#ifndef _LIBCNT_ -/* vfscanf */ -#undef WIDE_SCANF -#undef CONSOLE -#undef STRING -#include "scanf.h" - -/* vfwscanf */ -#define WIDE_SCANF 1 -#undef CONSOLE -#undef STRING -#include "scanf.h" -#endif - -/* vsscanf */ -#undef WIDE_SCANF -#undef CONSOLE -#define STRING 1 -#include "scanf.h" - -/* vswscanf */ -#define WIDE_SCANF 1 -#undef CONSOLE -#define STRING 1 -#include "scanf.h" - -#ifndef _LIBCNT_ -/* vcscanf */ -#undef WIDE_SCANF -#define CONSOLE 1 -#undef STRING -#include "scanf.h" - - -/********************************************************************* - * fscanf (MSVCRT.@) - */ -int fscanf(FILE *file, const char *format, ...) -{ - va_list valist; - int res; - - va_start(valist, format); - res = vfscanf(file, format, valist); - va_end(valist); - return res; -} - -/********************************************************************* - * scanf (MSVCRT.@) - */ -int scanf(const char *format, ...) -{ - va_list valist; - int res; - - va_start(valist, format); - res = vfscanf(stdin, format, valist); - va_end(valist); - return res; -} - -/********************************************************************* - * fwscanf (MSVCRT.@) - */ -int fwscanf(FILE *file, const wchar_t *format, ...) -{ - va_list valist; - int res; - - va_start(valist, format); - res = vfwscanf(file, format, valist); - va_end(valist); - return res; -} - - -/********************************************************************* - * wscanf (MSVCRT.@) - */ -int wscanf(const wchar_t *format, ...) -{ - va_list valist; - int res; - - va_start(valist, format); - res = vfwscanf(stdin, format, valist); - va_end(valist); - return res; -} -#endif - - -/********************************************************************* - * sscanf (MSVCRT.@) - */ -int sscanf(const char *str, const char *format, ...) -{ - va_list valist; - int res; - - va_start(valist, format); - res = vsscanf(str, format, valist); - va_end(valist); - return res; -} - - -/********************************************************************* - * swscanf (MSVCRT.@) - */ -int swscanf(const wchar_t *str, const wchar_t *format, ...) -{ - va_list valist; - int res; - - va_start(valist, format); - res = vswscanf(str, format, valist); - va_end(valist); - return res; -} - -#ifndef _LIBCNT_ -/********************************************************************* - * _cscanf (MSVCRT.@) - */ -int _cscanf(/*const*/ char *format, ...) -{ - va_list valist; - int res; - - va_start(valist, format); - res = vcscanf(format, valist); - va_end(valist); - return res; -} -#endif
Removed: trunk/reactos/lib/sdk/crt/wine/scanf.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/wine/scanf.h?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/wine/scanf.h [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/wine/scanf.h (removed) @@ -1,539 +1,0 @@ -/* - * general implementation of scanf used by scanf, sscanf, fscanf, - * _cscanf, wscanf, swscanf and fwscanf - * - * Copyright 1996,1998 Marcus Meissner - * Copyright 1996 Jukka Iivonen - * Copyright 1997,2000, 2003 Uwe Bonnes - * Copyright 2000 Jon Griffiths - * Copyright 2002 Daniel Gudbjartsson - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifdef WIDE_SCANF -#define _CHAR_ wchar_t -#define _EOF_ WEOF -#define _EOF_RET WEOF -#define _ISSPACE_(c) iswspace(c) -#define _ISDIGIT_(c) iswdigit(c) -#define _WIDE2SUPPORTED_(c) c /* No conversion needed (wide to wide) */ -#define _CHAR2SUPPORTED_(c) c /* FIXME: convert char to wide char */ -#define _CHAR2DIGIT_(c, base) wchar2digit((c), (base)) -#define _BITMAPSIZE_ 256*256 -#else /* WIDE_SCANF */ -#define _CHAR_ char -#define _EOF_ EOF -#define _EOF_RET EOF -#define _ISSPACE_(c) isspace(c) -#define _ISDIGIT_(c) isdigit(c) -#define _WIDE2SUPPORTED_(c) c /* FIXME: convert wide char to char */ -#define _CHAR2SUPPORTED_(c) c /* No conversion needed (char to char) */ -#define _CHAR2DIGIT_(c, base) char2digit((c), (base)) -#define _BITMAPSIZE_ 256 -#endif /* WIDE_SCANF */ - -#ifdef CONSOLE -#define _GETC_(file) (consumed++, _getch()) -#define _UNGETC_(nch, file) do { _ungetch(nch); consumed--; } while(0) -#define _FUNCTION_ int vcscanf(const char *format, va_list ap) -#else -#ifdef STRING -#undef _EOF_ -#define _EOF_ 0 -#define _GETC_(file) (consumed++, *file++) -#define _UNGETC_(nch, file) do { file--; consumed--; } while(0) -#ifdef WIDE_SCANF -#define _FUNCTION_ int vswscanf(const wchar_t *file, const wchar_t *format, va_list ap) -#else /* WIDE_SCANF */ -#define _FUNCTION_ int vsscanf(const char *file, const char *format, va_list ap) -#endif /* WIDE_SCANF */ -#else /* STRING */ -#ifdef WIDE_SCANF -#define _GETC_(file) (consumed++, fgetwc(file)) -#define _UNGETC_(nch, file) do { ungetwc(nch, file); consumed--; } while(0) -#define _FUNCTION_ int vfwscanf(FILE* file, const wchar_t *format, va_list ap) -#else /* WIDE_SCANF */ -#define _GETC_(file) (consumed++, fgetc(file)) -#define _UNGETC_(nch, file) do { ungetc(nch, file); consumed--; } while(0) -#define _FUNCTION_ int vfscanf(FILE* file, const char *format, va_list ap) -#endif /* WIDE_SCANF */ -#endif /* STRING */ -#endif /* CONSOLE */ - -_FUNCTION_ { - int rd = 0, consumed = 0; - int nch; - if (!*format) return 0; -#ifndef WIDE_SCANF -#ifdef CONSOLE - TRACE("(%s): \n", debugstr_a(format)); -#else /* CONSOLE */ -#ifdef STRING - TRACE("%s (%s)\n", file, debugstr_a(format)); -#else /* STRING */ - TRACE("%p (%s)\n", file, debugstr_a(format)); -#endif /* STRING */ -#endif /* CONSOLE */ -#endif /* WIDE_SCANF */ - nch = _GETC_(file); - if (nch == _EOF_) return _EOF_RET; - - while (*format) { - /* a whitespace character in the format string causes scanf to read, - * but not store, all consecutive white-space characters in the input - * up to the next non-white-space character. One white space character - * in the input matches any number (including zero) and combination of - * white-space characters in the input. */ - if (_ISSPACE_(*format)) { - /* skip whitespace */ - while ((nch!=_EOF_) && _ISSPACE_(nch)) - nch = _GETC_(file); - } - /* a format specification causes scanf to read and convert characters - * in the input into values of a specified type. The value is assigned - * to an argument in the argument list. Format specifications have - * the form %[*][width][{h | l | I64 | L}]type */ - else if (*format == '%') { - int st = 0; int suppress = 0; int width = 0; - int base; - int h_prefix = 0; - int l_prefix = 0; - int L_prefix = 0; - int w_prefix = 0; - int prefix_finished = 0; - int I64_prefix = 0; - format++; - /* look for leading asterisk, which means 'suppress assignment of - * this field'. */ - if (*format=='*') { - format++; - suppress=1; - } - /* look for width specification */ - while (_ISDIGIT_(*format)) { - width*=10; - width+=*format++ - '0'; - } - if (width==0) width=-1; /* no width spec seen */ - /* read prefix (if any) */ - while (!prefix_finished) { - switch(*format) { - case 'h': h_prefix = 1; break; - case 'l': l_prefix = 1; break; - case 'w': w_prefix = 1; break; - case 'L': L_prefix = 1; break; - case 'I': - if (*(format + 1) == '6' && - *(format + 2) == '4') { - I64_prefix = 1; - format += 2; - } - break; - default: - prefix_finished = 1; - } - if (!prefix_finished) format++; - } - /* read type */ - switch(*format) { - case 'x': - case 'X': /* hexadecimal integer. */ - base = 16; - goto number; - case 'o': /* octal integer */ - base = 8; - goto number; - case 'u': /* unsigned decimal integer */ - base = 10; - goto number; - case 'd': /* signed decimal integer */ - base = 10; - goto number; - case 'i': /* generic integer */ - base = 0; - number: { - /* read an integer */ - ULONGLONG cur = 0; - int negative = 0; - int seendigit=0; - /* skip initial whitespace */ - while ((nch!=_EOF_) && _ISSPACE_(nch)) - nch = _GETC_(file); - /* get sign */ - if (nch == '-' || nch == '+') { - negative = (nch=='-'); - nch = _GETC_(file); - if (width>0) width--; - } - /* look for leading indication of base */ - if (width!=0 && nch == '0') { - nch = _GETC_(file); - if (width>0) width--; - seendigit=1; - if (width!=0 && (nch=='x' || nch=='X')) { - if (base==0) - base=16; - if (base==16) { - nch = _GETC_(file); - if (width>0) width--; - seendigit=0; - } - } else if (base==0) - base = 8; - } - /* format %i without indication of base */ - if (base==0) - base = 10; - /* throw away leading zeros */ - while (width!=0 && nch=='0') { - nch = _GETC_(file); - if (width>0) width--; - seendigit=1; - } - if (width!=0 && _CHAR2DIGIT_(nch, base)!=-1) { - cur = _CHAR2DIGIT_(nch, base); - nch = _GETC_(file); - if (width>0) width--; - seendigit=1; - } - /* read until no more digits */ - while (width!=0 && (nch!=_EOF_) && _CHAR2DIGIT_(nch, base)!=-1) { - cur = cur*base + _CHAR2DIGIT_(nch, base); - nch = _GETC_(file); - if (width>0) width--; - seendigit=1; - } - /* okay, done! */ - if (!seendigit) break; /* not a valid number */ - st = 1; - if (!suppress) { -#define _SET_NUMBER_(type) *va_arg(ap, type*) = negative ? -cur : cur - if (I64_prefix) _SET_NUMBER_(LONGLONG); - else if (l_prefix) _SET_NUMBER_(long int); - else if (h_prefix) _SET_NUMBER_(short int); - else _SET_NUMBER_(int); - } - } - break; - case 'e': - case 'E': - case 'f': - case 'g': - case 'G': { /* read a float */ - long double cur = 0; - int negative = 0; - /* skip initial whitespace */ - while ((nch!=_EOF_) && _ISSPACE_(nch)) - nch = _GETC_(file); - /* get sign. */ - if (nch == '-' || nch == '+') { - negative = (nch=='-'); - if (width>0) width--; - if (width==0) break; - nch = _GETC_(file); - } - /* get first digit. */ - if ('.' != nch) { - if (!_ISDIGIT_(nch)) break; - cur = (nch - '0'); - nch = _GETC_(file); - if (width>0) width--; - /* read until no more digits */ - while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) { - cur = cur*10 + (nch - '0'); - nch = _GETC_(file); - if (width>0) width--; - } - } else { - cur = 0; /* MaxPayneDemo Fix: .8 -> 0.8 */ - } - /* handle decimals */ - if (width!=0 && nch == '.') { - float dec = 1; - nch = _GETC_(file); - if (width>0) width--; - while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) { - dec /= 10; - cur += dec * (nch - '0'); - nch = _GETC_(file); - if (width>0) width--; - } - } - /* handle exponent */ - if (width!=0 && (nch == 'e' || nch == 'E')) { - int exponent = 0, negexp = 0; - float expcnt; - nch = _GETC_(file); - if (width>0) width--; - /* possible sign on the exponent */ - if (width!=0 && (nch=='+' || nch=='-')) { - negexp = (nch=='-'); - nch = _GETC_(file); - if (width>0) width--; - } - /* exponent digits */ - while (width!=0 && (nch!=_EOF_) && _ISDIGIT_(nch)) { - exponent *= 10; - exponent += (nch - '0'); - nch = _GETC_(file); - if (width>0) width--; - } - /* update 'cur' with this exponent. */ - expcnt = negexp ? .1 : 10; - while (exponent!=0) { - if (exponent&1) - cur*=expcnt; - exponent/=2; - expcnt=expcnt*expcnt; - } - } - st = 1; - if (!suppress) { - if (L_prefix) _SET_NUMBER_(long double); - else if (l_prefix) _SET_NUMBER_(double); - else _SET_NUMBER_(float); - } - } - break; - /* According to msdn, - * 's' reads a character string in a call to fscanf - * and 'S' a wide character string and vice versa in a - * call to fwscanf. The 'h', 'w' and 'l' prefixes override - * this behaviour. 'h' forces reading char * but 'l' and 'w' - * force reading WCHAR. */ - case 's': - if (w_prefix || l_prefix) goto widecharstring; - else if (h_prefix) goto charstring; -#ifdef WIDE_SCANF - else goto widecharstring; -#else /* WIDE_SCANF */ - else goto charstring; -#endif /* WIDE_SCANF */ - case 'S': - if (w_prefix || l_prefix) goto widecharstring; - else if (h_prefix) goto charstring; -#ifdef WIDE_SCANF - else goto charstring; -#else /* WIDE_SCANF */ - else goto widecharstring; -#endif /* WIDE_SCANF */ - charstring: { /* read a word into a char */ - char *sptr = suppress ? NULL : va_arg(ap, char*); - /* skip initial whitespace */ - while ((nch!=_EOF_) && _ISSPACE_(nch)) - nch = _GETC_(file); - /* read until whitespace */ - while (width!=0 && (nch!=_EOF_) && !_ISSPACE_(nch)) { - if (!suppress) *sptr++ = _CHAR2SUPPORTED_(nch); - st++; - nch = _GETC_(file); - if (width>0) width--; - } - /* terminate */ - if (!suppress) *sptr = 0; - } - break; - widecharstring: { /* read a word into a wchar_t* */ - wchar_t *sptr = suppress ? NULL : va_arg(ap, wchar_t*); - /* skip initial whitespace */ - while ((nch!=_EOF_) && _ISSPACE_(nch)) - nch = _GETC_(file); - /* read until whitespace */ - while (width!=0 && (nch!=_EOF_) && !_ISSPACE_(nch)) { - if (!suppress) *sptr++ = _WIDE2SUPPORTED_(nch); - st++; - nch = _GETC_(file); - if (width>0) width--; - } - /* terminate */ - if (!suppress) *sptr = 0; - } - break; - /* 'c' and 'C work analogously to 's' and 'S' as described - * above */ - case 'c': - if (w_prefix || l_prefix) goto widecharacter; - else if (h_prefix) goto character; -#ifdef WIDE_SCANF - else goto widecharacter; -#else /* WIDE_SCANF */ - else goto character; -#endif /* WIDE_SCANF */ - case 'C': - if (w_prefix || l_prefix) goto widecharacter; - else if (h_prefix) goto character; -#ifdef WIDE_SCANF - else goto character; -#else /* WIDE_SCANF */ - else goto widecharacter; -#endif /* WIDE_SCANF */ - character: { /* read single character into char */ - char *str = suppress ? NULL : va_arg(ap, char*); - if (width == -1) width = 1; - while ((width != 0) && (nch != _EOF_)) - { - if (!suppress) *str++ = _CHAR2SUPPORTED_(nch); - st++; - width--; - nch = _GETC_(file); - } - } - break; - widecharacter: { /* read single character into a wchar_t */ - wchar_t *str = suppress ? NULL : va_arg(ap, wchar_t*); - if (width == -1) width = 1; - while ((width != 0) && (nch != _EOF_)) - { - if (!suppress) *str++ = _WIDE2SUPPORTED_(nch); - st++; - width--; - nch = _GETC_(file); - } - } - break; - case 'n': { - if (!suppress) { - int*n = va_arg(ap, int*); - *n = consumed - 1; - } - /* This is an odd one: according to the standard, - * "Execution of a %n directive does not increment the - * assignment count returned at the completion of - * execution" even if it wasn't suppressed with the - * '*' flag. The Corrigendum to the standard seems - * to contradict this (comment out the assignment to - * suppress below if you want to implement these - * alternate semantics) but the windows program I'm - * looking at expects the behavior I've coded here - * (which happens to be what glibc does as well). - */ - suppress = 1; - st = 1; - } - break; - case '[': { - _CHAR_ *str = suppress ? NULL : va_arg(ap, _CHAR_*); - _CHAR_ *sptr = str; - RTL_BITMAP bitMask; - ULONG *Mask; - int invert = 0; /* Set if we are NOT to find the chars */ - - /* Init our bitmap */ -#ifdef _LIBCNT_ - Mask = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY, _BITMAPSIZE_/8); -#else - Mask = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, _BITMAPSIZE_/8); -#endif - RtlInitializeBitMap(&bitMask, Mask, _BITMAPSIZE_); - - /* Read the format */ - format++; - if(*format == '^') { - invert = 1; - format++; - } - if(*format == ']') { - RtlSetBits(&bitMask, ']', 1); - format++; - } - while(*format && (*format != ']')) { - /* According to msdn: - * "Note that %[a-z] and %[z-a] are interpreted as equivalent to %[abcde...z]." */ - if((*format == '-') && (*(format + 1) != ']')) { - if ((*(format - 1)) < *(format + 1)) - RtlSetBits(&bitMask, *(format - 1) +1 , *(format + 1) - *(format - 1)); - else - RtlSetBits(&bitMask, *(format + 1) , *(format - 1) - *(format + 1)); - format++; - } else - RtlSetBits(&bitMask, *format, 1); - format++; - } - /* read until char is not suitable */ - while ((width != 0) && (nch != _EOF_)) { - if(!invert) { - if(RtlAreBitsSet(&bitMask, nch, 1)) { - if (!suppress) *sptr++ = _CHAR2SUPPORTED_(nch); - } else - break; - } else { - if(RtlAreBitsClear(&bitMask, nch, 1)) { - if (!suppress) *sptr++ = _CHAR2SUPPORTED_(nch); - } else - break; - } - st++; - nch = _GETC_(file); - if (width>0) width--; - } - /* terminate */ - if (!suppress) *sptr = 0; -#ifdef _LIBCNT_ - RtlFreeHeap(RtlGetProcessHeap(), 0, Mask); -#else - HeapFree(GetProcessHeap(), 0, Mask); -#endif - } - break; - default: - /* From spec: "if a percent sign is followed by a character - * that has no meaning as a format-control character, that - * character and the following characters are treated as - * an ordinary sequence of characters, that is, a sequence - * of characters that must match the input. For example, - * to specify that a percent-sign character is to be input, - * use %%." */ - while ((nch!=_EOF_) && _ISSPACE_(nch)) - nch = _GETC_(file); - if (nch==*format) { - suppress = 1; /* whoops no field to be read */ - st = 1; /* but we got what we expected */ - nch = _GETC_(file); - } - break; - } - if (st && !suppress) rd++; - else if (!st) break; - } - /* a non-white-space character causes scanf to read, but not store, - * a matching non-white-space character. */ - else { - /* check for character match */ - if (nch == *format) { - nch = _GETC_(file); - } else break; - } - format++; - } - if (nch!=_EOF_) { - _UNGETC_(nch, file); - } - TRACE("returning %d\n", rd); - return rd; -} - -#undef _CHAR_ -#undef _EOF_ -#undef _EOF_RET -#undef _ISSPACE_ -#undef _ISDIGIT_ -#undef _CHAR2SUPPORTED_ -#undef _WIDE2SUPPORTED_ -#undef _CHAR2DIGIT_ -#undef _GETC_ -#undef _UNGETC_ -#undef _FUNCTION_ -#undef _BITMAPSIZE_
Removed: trunk/reactos/lib/sdk/crt/wine/thread.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/wine/thread.c?r... ============================================================================== --- trunk/reactos/lib/sdk/crt/wine/thread.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/wine/thread.c (removed) @@ -1,106 +1,0 @@ -/* - * msvcrt.dll thread functions - * - * Copyright 2000 Jon Griffiths - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <precomp.h> -#include <internal/wine/msvcrt.h> - -#include <malloc.h> -#include <process.h> - -#include <debug.h> - -void _amsg_exit (int errnum); -/* Index to TLS */ -DWORD MSVCRT_tls_index; - -typedef void (*_beginthread_start_routine_t)(void *); -typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *); - -/********************************************************************/ - -typedef struct { - _beginthread_start_routine_t start_address; - void *arglist; -} _beginthread_trampoline_t; - -/********************************************************************* - * msvcrt_get_thread_data - * - * Return the thread local storage structure. - */ -MSVCRT_thread_data *msvcrt_get_thread_data(void) -{ - MSVCRT_thread_data *ptr; - DWORD err = GetLastError(); /* need to preserve last error */ - - if (!(ptr = TlsGetValue( MSVCRT_tls_index ))) - { - if (!(ptr = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ptr) ))) - _amsg_exit( _RT_THREAD ); - if (!TlsSetValue( MSVCRT_tls_index, ptr )) - _amsg_exit( _RT_THREAD ); - if (!TlsSetValue( MSVCRT_tls_index, ptr )) - _amsg_exit( _RT_THREAD ); - } - SetLastError( err ); - return ptr; -} - -/********************************************************************* - * _beginthread_trampoline - */ -static DWORD CALLBACK _beginthread_trampoline(LPVOID arg) -{ - _beginthread_trampoline_t local_trampoline; - - /* Maybe it's just being paranoid, but freeing arg right - * away seems safer. - */ - memcpy(&local_trampoline,arg,sizeof(local_trampoline)); - free(arg); - - local_trampoline.start_address(local_trampoline.arglist); - return 0; -} - -/********************************************************************* - * _beginthread (MSVCRT.@) - */ -unsigned long _beginthread( - _beginthread_start_routine_t start_address, /* [in] Start address of routine that begins execution of new thread */ - unsigned int stack_size, /* [in] Stack size for new thread or 0 */ - void *arglist) /* [in] Argument list to be passed to new thread or NULL */ -{ - _beginthread_trampoline_t* trampoline; - - DPRINT("(%p, %d, %p)\n", start_address, stack_size, arglist); - - /* Allocate the trampoline here so that it is still valid when the thread - * starts... typically after this function has returned. - * _beginthread_trampoline is responsible for freeing the trampoline - */ - trampoline=malloc(sizeof(*trampoline)); - trampoline->start_address = start_address; - trampoline->arglist = arglist; - - /* FIXME */ - return (unsigned long)CreateThread(NULL, stack_size, _beginthread_trampoline, - trampoline, 0, NULL); -}
Modified: trunk/reactos/media/doc/README.WINE URL: http://svn.reactos.org/svn/reactos/trunk/reactos/media/doc/README.WINE?rev=3... ============================================================================== --- trunk/reactos/media/doc/README.WINE [iso-8859-1] (original) +++ trunk/reactos/media/doc/README.WINE [iso-8859-1] Fri Jun 6 07:20:28 2008 @@ -143,10 +143,12 @@ reactos/dll/win32/kernel32/misc/lcformat.c # Out of sync
msvcrt - - reactos/dll/win32/msvcrt/wine/*.c # Out of sync reactos/lib/sdk/crt/cpp.c # Synced at 20071111 reactos/lib/sdk/crt/cppexcept.c # Synced at 20071111 + reactos/lib/sdk/crt/strings/scanf.c/h # Synced at 20080604 + reactos/lib/sdk/crt/wine/heap.c # Synced at 20080529 reactos/lib/sdk/crt/wine # Synced at XXXXXXXX + reactos/lib/sdk/crt/thread/thread.c # Synced at 20080604
User32 - reactos/dll/win32/user32/controls/button.c # Synced at 20071022