diff --git a/reactos/lib/crtdll/crtdll.def b/reactos/lib/crtdll/crtdll.def index 001cdfe4023..40cc3cfb512 100644 --- a/reactos/lib/crtdll/crtdll.def +++ b/reactos/lib/crtdll/crtdll.def @@ -19,9 +19,9 @@ ; DISCLAMED. This includes but is not limited to warrenties of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ; -; $Revision: 1.18 $ -; $Author: weiden $ -; $Date: 2003/08/26 12:28:53 $ +; $Revision: 1.19 $ +; $Author: ekohl $ +; $Date: 2004/02/26 12:23:29 $ ; ; These three functions appear to be name mangled in some way, so GCC is ; probably not going to be able to use them in any case. @@ -69,7 +69,7 @@ __argv_dll __dllonexit __doserrno __fpecode -__isascii=NTDLL.__isascii +__isascii __iscsym=NTDLL.__iscsym __iscsymf=NTDLL.__iscsymf __mb_cur_max_dll @@ -179,7 +179,7 @@ _hypot _initterm _iob _isatty -_isctype=MSVCRT._isctype +_isctype _ismbbalnum _ismbbalpha _ismbbgraph @@ -326,19 +326,19 @@ _statusfp _strcmpi=NTDLL._strcmpi _strdate _strdec -_strdup=MSVCRT._strdup -_strerror=MSVCRT._strerror +_strdup +_strerror _stricmp=NTDLL._stricmp -_stricoll=MSVCRT._stricoll +_stricoll _strinc _strlwr=NTDLL._strlwr _strncnt _strnextc _strnicmp=NTDLL._strnicmp _strninc -_strnset=MSVCRT._strnset -_strrev=MSVCRT._strrev -_strset=MSVCRT._strset +_strnset +_strrev +_strset _strspnp _strtime _strupr=NTDLL._strupr @@ -434,31 +434,31 @@ getchar getenv gets gmtime -is_wctype=MSVCRT.is_wctype -isalnum=NTDLL.isalnum +is_wctype +isalnum isalpha=NTDLL.isalpha -iscntrl=NTDLL.iscntrl +iscntrl isdigit=NTDLL.isdigit -isgraph=NTDLL.isgraph +isgraph isleadbyte islower=NTDLL.islower -isprint=NTDLL.isprint -ispunct=NTDLL.ispunct +isprint +ispunct isspace=NTDLL.isspace -isupper=NTDLL.isupper -iswalnum=MSVCRT.iswalnum +isupper +iswalnum iswalpha=NTDLL.iswalpha -iswascii=MSVCRT.iswascii -iswcntrl=MSVCRT.iswcntrl -iswctype=MSVCRT.iswctype -iswdigit=MSVCRT.iswdigit -iswgraph=MSVCRT.iswgraph -iswlower=MSVCRT.iswlower -iswprint=MSVCRT.iswprint -iswpunct=MSVCRT.iswpunct +iswascii +iswcntrl +iswctype +iswdigit +iswgraph +iswlower +iswprint +iswpunct iswspace=NTDLL.iswspace -iswupper=MSVCRT.iswupper -iswxdigit=MSVCRT.iswxdigit +iswupper +iswxdigit isxdigit=NTDLL.isxdigit labs ldexp @@ -506,10 +506,10 @@ sscanf strcat strchr strcmp -strcoll=MSVCRT.strcoll +strcoll strcpy strcspn -strerror=MSVCRT.strerror +strerror strftime strlen strncat @@ -523,7 +523,7 @@ strtod strtok strtol strtoul -strxfrm=MSVCRT.strxfrm +strxfrm swprintf swscanf system diff --git a/reactos/lib/crtdll/ctype/isctype.c b/reactos/lib/crtdll/ctype/isctype.c index 948889ef842..2629ccfb9b0 100644 --- a/reactos/lib/crtdll/ctype/isctype.c +++ b/reactos/lib/crtdll/ctype/isctype.c @@ -10,39 +10,26 @@ unsigned short *_pwctype_dll = _ctype + 1; /* * @implemented - * - * this function is now forwarded to MSVCRT._isctype to reduce code duplication */ -#if 0 int _isctype(unsigned int c, int ctypeFlags) { return (_pctype_dll[(unsigned char)(c & 0xFF)] & ctypeFlags); } -#endif /* * @implemented - * - * this function is now forwarded to MSVCRT.iswctype to reduce code duplication */ -#if 0 int iswctype(wint_t wc, wctype_t wctypeFlags) { return (_pwctype_dll[(unsigned char)(wc & 0xFF)] & wctypeFlags); } -#endif -// obsolete /* * @implemented - * - * this function is now forwarded to MSVCRT.is_wctype to reduce code duplication */ -#if 0 -int is_wctype(wint_t wc, wctype_t wctypeFlags) +int is_wctype(wint_t wc, wctype_t wctypeFlags) { return (_pwctype_dll[(unsigned char)(wc & 0xFF)] & wctypeFlags); } -#endif /* EOF */ diff --git a/reactos/lib/crtdll/makefile b/reactos/lib/crtdll/makefile index c1dd314e959..5c596be696d 100644 --- a/reactos/lib/crtdll/makefile +++ b/reactos/lib/crtdll/makefile @@ -1,4 +1,4 @@ -# $Id: makefile,v 1.62 2003/11/14 17:13:30 weiden Exp $ +# $Id: makefile,v 1.63 2004/02/26 12:23:29 ekohl Exp $ PATH_TO_TOP = ../.. @@ -12,7 +12,7 @@ TARGET_NAME = crtdll TARGET_BASE = 0x77630000 -TARGET_LFLAGS = -nostartfiles +TARGET_LFLAGS = -nostartfiles -nostdlib TARGET_CFLAGS = -D_MSVCRT_LIB_ -Werror -Wall @@ -21,6 +21,8 @@ TARGET_CFLAGS += -D_DISABLE_TIDENTS TARGET_SDKLIBS = string.a kernel32.a ntdll.a +TARGET_GCCLIBS = gcc + TARGET_OBJECTS = $(TARGET_NAME).o TARGET_CLEAN = \ @@ -68,21 +70,21 @@ CONIO_OBJECTS = \ CTYPE_OBJECTS = \ $(PATH_TO_MSVCRT)/ctype/ctype.o \ - ctype/isctype.o + $(PATH_TO_MSVCRT)/ctype/isalnum.o \ + $(PATH_TO_MSVCRT)/ctype/isascii.o \ + $(PATH_TO_MSVCRT)/ctype/iscntrl.o \ + ctype/isctype.o \ + $(PATH_TO_MSVCRT)/ctype/isgraph.o \ + $(PATH_TO_MSVCRT)/ctype/isprint.o \ + $(PATH_TO_MSVCRT)/ctype/ispunct.o \ + $(PATH_TO_MSVCRT)/ctype/isupper.o # REMOVED CTYPE ENTRIES: -# $(PATH_TO_MSVCRT)/ctype/isalnum.o \ # $(PATH_TO_MSVCRT)/ctype/isalpha.o \ -# $(PATH_TO_MSVCRT)/ctype/isascii.o \ -# $(PATH_TO_MSVCRT)/ctype/iscntrl.o \ # $(PATH_TO_MSVCRT)/ctype/iscsym.o \ # $(PATH_TO_MSVCRT)/ctype/isdigit.o \ -# $(PATH_TO_MSVCRT)/ctype/isgraph.o \ # $(PATH_TO_MSVCRT)/ctype/islower.o \ -# $(PATH_TO_MSVCRT)/ctype/isprint.o \ -# $(PATH_TO_MSVCRT)/ctype/ispunct.o \ # $(PATH_TO_MSVCRT)/ctype/isspace.o \ -# $(PATH_TO_MSVCRT)/ctype/isupper.o \ # $(PATH_TO_MSVCRT)/ctype/isxdigit.o \ # $(PATH_TO_MSVCRT)/ctype/toascii.o \ # $(PATH_TO_MSVCRT)/ctype/tolower.o \ @@ -397,26 +399,27 @@ STDLIB_OBJECTS = \ $(PATH_TO_MSVCRT)/stdlib/strtol.o \ $(PATH_TO_MSVCRT)/stdlib/strtoul.o \ $(PATH_TO_MSVCRT)/stdlib/swab.o \ - $(PATH_TO_MSVCRT)/stdlib/wcstomb.o \ - + $(PATH_TO_MSVCRT)/stdlib/wcstod.o \ + stdlib/wcstomb.o + STRING_OBJECTS = \ string/lasttok.o \ - $(PATH_TO_MSVCRT)/string/strtok.o \ - string/str_old.o \ + $(PATH_TO_MSVCRT)/string/strcoll.o \ + $(PATH_TO_MSVCRT)/string/strdup.o \ string/strerror.o \ + $(PATH_TO_MSVCRT)/string/strrev.o \ + $(PATH_TO_MSVCRT)/string/strset.o \ + $(PATH_TO_MSVCRT)/string/strtok.o \ + $(PATH_TO_MSVCRT)/string/strxfrm.o +# string/str_old.o \ # $(PATH_TO_MSVCRT)/string/memicmp.o \ -# $(PATH_TO_MSVCRT)/string/strcoll.o \ -# $(PATH_TO_MSVCRT)/string/strdup.o \ # $(PATH_TO_MSVCRT)/string/stricmp.o \ # $(PATH_TO_MSVCRT)/string/strlwr.o \ # $(PATH_TO_MSVCRT)/string/strnicmp.o \ # $(PATH_TO_MSVCRT)/string/strpbrk.o \ -# $(PATH_TO_MSVCRT)/string/strrev.o \ -# $(PATH_TO_MSVCRT)/string/strset.o \ # $(PATH_TO_MSVCRT)/string/strstr.o \ # $(PATH_TO_MSVCRT)/string/strupr.o \ -# $(PATH_TO_MSVCRT)/string/strxfrm.o SYS_STAT_OBJECTS = \ sys_stat/fstat.o \ @@ -441,28 +444,28 @@ TIME_OBJECTS = \ $(PATH_TO_MSVCRT)/time/strdate.o \ $(PATH_TO_MSVCRT)/time/strftime.o \ $(PATH_TO_MSVCRT)/time/strtime.o \ - time/tz_vars.o \ + time/tz_vars.o WSTRING_OBJECTS = \ + wchar/wlasttok.o \ + wchar/wcscoll.o \ + $(PATH_TO_MSVCRT)/wstring/wcsdup.o \ + $(PATH_TO_MSVCRT)/wstring/wcsrev.o \ + $(PATH_TO_MSVCRT)/wstring/wcsset.o \ $(PATH_TO_MSVCRT)/wstring/wcstok.o \ - wchar/wlasttok.o + $(PATH_TO_MSVCRT)/wstring/wcsxfrm.o -# wchar/wcscoll.o \ # wchar/wcstod.o \ # wchar/wcstok.o \ # wchar/wcstol.o \ # wchar/wtoi.o \ # $(PATH_TO_MSVCRT)/wstring/wcscspn.o \ -# $(PATH_TO_MSVCRT)/wstring/wcsdup.o \ # $(PATH_TO_MSVCRT)/wstring/wcsicmp.o \ # $(PATH_TO_MSVCRT)/wstring/wcslwr.o \ # $(PATH_TO_MSVCRT)/wstring/wcspbrk.o \ -# $(PATH_TO_MSVCRT)/wstring/wcsrev.o \ -# $(PATH_TO_MSVCRT)/wstring/wcsset.o \ # $(PATH_TO_MSVCRT)/wstring/wcsspn.o \ # $(PATH_TO_MSVCRT)/wstring/wcsstr.o \ # $(PATH_TO_MSVCRT)/wstring/wcsupr.o \ -# $(PATH_TO_MSVCRT)/wstring/wcsxfrm.o \ # wchar/wcstombs.o \ # $(PATH_TO_MSVCRT)/wstring/wcsnicmp.o diff --git a/reactos/lib/crtdll/misc/GetArgs.c b/reactos/lib/crtdll/misc/GetArgs.c index 10fcaf92fee..d48f4ad58e0 100644 --- a/reactos/lib/crtdll/misc/GetArgs.c +++ b/reactos/lib/crtdll/misc/GetArgs.c @@ -4,11 +4,11 @@ char *_pgmptr_dll; -char *_acmdln_dll; -unsigned int _commode_dll; -unsigned int _winmajor_dll; +char *_acmdln_dll; +unsigned int _commode_dll; +unsigned int _winmajor_dll; unsigned int _winminor_dll; -unsigned int _winver_dll; +unsigned int _winver_dll; unsigned int _osmajor_dll; @@ -28,21 +28,22 @@ char *xargv[1024]; char **__argv = xargv; int __argc = 0; -int *__argc_dll = &__argc; -char ***__argv_dll = &__argv; +int *__argc_dll = &__argc; +char ***__argv_dll = &__argv; #undef _environ char **_environ; #undef _environ_dll -char *** _environ_dll = &_environ; +char *** _environ_dll = &_environ; static int envAlloced = 0; - - -int BlockEnvToEnviron() + + +int BlockEnvToEnviron(void) { -char * ptr; -int i; + char * ptr; + int i; + if (!envAlloced) { envAlloced = 50; @@ -90,13 +91,13 @@ int __GetMainArgs(int *argc,char ***argv,char ***env,int flag) afterlastspace=0; __argc=0; - while (_acmdln_dll[i]) + while (_acmdln_dll[i]) { - if (_acmdln_dll[i]==' ') + if (_acmdln_dll[i]==' ') { __argc++; _acmdln_dll[i]='\0'; - __argv[__argc-1] = strdup(_acmdln_dll + afterlastspace); + __argv[__argc-1] = _strdup(_acmdln_dll + afterlastspace); _acmdln_dll[i]=' '; i++; while (_acmdln_dll[i]==' ') @@ -113,19 +114,19 @@ int __GetMainArgs(int *argc,char ***argv,char ***env,int flag) { __argc++; _acmdln_dll[i]='\0'; - __argv[__argc-1] = strdup(_acmdln_dll+afterlastspace); + __argv[__argc-1] = _strdup(_acmdln_dll+afterlastspace); } HeapValidate(GetProcessHeap(),0,NULL); if( BlockEnvToEnviron() ) return FALSE; - _environ_dll = &_environ; - + _environ_dll = &_environ; + *argc = __argc; *argv = __argv; *env = _environ; - - _pgmptr_dll = strdup((char *)argv[0]); + + _pgmptr_dll = _strdup((char *)argv[0]); return 0; } diff --git a/reactos/lib/crtdll/misc/amsg.c b/reactos/lib/crtdll/misc/amsg.c index b024c6e5c73..1b4a7b7588d 100644 --- a/reactos/lib/crtdll/misc/amsg.c +++ b/reactos/lib/crtdll/misc/amsg.c @@ -16,7 +16,7 @@ */ int _aexit_rtn_dll(int exitcode) { - _exit(exitcode); + _exit(exitcode); } /* @@ -24,7 +24,7 @@ int _aexit_rtn_dll(int exitcode) */ void _amsg_exit(int errnum) { - fprintf(stderr,strerror(errnum)); - _aexit_rtn_dll(-1); + fprintf(stderr,strerror(errnum)); + _aexit_rtn_dll(-1); } diff --git a/reactos/lib/crtdll/stdlib/wcstomb.c b/reactos/lib/crtdll/stdlib/wcstomb.c index 92462e0facf..41eab0a08d4 100644 --- a/reactos/lib/crtdll/stdlib/wcstomb.c +++ b/reactos/lib/crtdll/stdlib/wcstomb.c @@ -21,7 +21,8 @@ #include #include -#include + +#include "libc/file.h" #ifndef EILSEQ #define EILSEQ EINVAL @@ -79,22 +80,12 @@ __wcrtomb (char *s, wchar_t wc) char fake[1]; size_t written = 0; - - if (s == NULL) { s = fake; wc = L'\0'; } - /* Store the UTF8 representation of WC. */ - if (wc < 0 || wc > 0x7fffffff) - { - /* This is no correct ISO 10646 character. */ - __set_errno (EILSEQ); - return (size_t) -1; - } - if (wc < 0x80) { /* It's a one byte sequence. */ diff --git a/reactos/lib/crtdll/string/strerror.c b/reactos/lib/crtdll/string/strerror.c index b4cc6a7e904..30830f7295b 100644 --- a/reactos/lib/crtdll/string/strerror.c +++ b/reactos/lib/crtdll/string/strerror.c @@ -63,9 +63,7 @@ int* _sys_nerr_dll = &__sys_nerr; /* * @implemented * - * this function is now forwarded to MSVCRT.strerror to reduce code duplication */ -#if 0 char *strerror(int errnum) { static char ebuf[40]; /* 64-bit number + slop */ @@ -96,14 +94,11 @@ char *strerror(int errnum) return ebuf; } -#endif /* * @implemented * - * this function is now forwarded to MSVCRT._strerror to reduce code duplication */ -#if 0 char *_strerror(const char *s) { if ( s == NULL ) @@ -111,4 +106,3 @@ char *_strerror(const char *s) return strerror(atoi(s)); } -#endif