build msvcrt and crtdll from same source via lib\crt
fix problem with scanf/printf reading/printing doubles
Modified: trunk/reactos/lib/msvcrt/Makefile
Deleted: trunk/reactos/lib/msvcrt/README.txt
Deleted: trunk/reactos/lib/msvcrt/conio/
Deleted: trunk/reactos/lib/msvcrt/ctype/
Deleted: trunk/reactos/lib/msvcrt/direct/
Added: trunk/reactos/lib/msvcrt/dllmain.c
Deleted: trunk/reactos/lib/msvcrt/except/
Deleted: trunk/reactos/lib/msvcrt/float/
Deleted: trunk/reactos/lib/msvcrt/io/
Deleted: trunk/reactos/lib/msvcrt/locale/
Deleted: trunk/reactos/lib/msvcrt/math/
Deleted: trunk/reactos/lib/msvcrt/mbstring/
Deleted: trunk/reactos/lib/msvcrt/misc/
Modified: trunk/reactos/lib/msvcrt/msvcrt.def
Deleted: trunk/reactos/lib/msvcrt/process/
Deleted: trunk/reactos/lib/msvcrt/search/
Deleted: trunk/reactos/lib/msvcrt/setjmp/
Deleted: trunk/reactos/lib/msvcrt/signal/
Deleted: trunk/reactos/lib/msvcrt/stdio/
Deleted: trunk/reactos/lib/msvcrt/stdlib/
Deleted: trunk/reactos/lib/msvcrt/string/
Deleted: trunk/reactos/lib/msvcrt/sys_stat/
Deleted: trunk/reactos/lib/msvcrt/time/
Deleted: trunk/reactos/lib/msvcrt/wine/
Deleted: trunk/reactos/lib/msvcrt/wstring/
_____
Modified: trunk/reactos/lib/msvcrt/Makefile
--- trunk/reactos/lib/msvcrt/Makefile 2005-01-27 21:12:05 UTC (rev
13339)
+++ trunk/reactos/lib/msvcrt/Makefile 2005-01-27 21:16:41 UTC (rev
13340)
@@ -15,9 +15,9 @@
# don't remove @nn from exported symbols - needed so dlltool doesn't
mess up mangled c++ exports
RM_AT_FROM_SYMBOLS = no
-TARGET_LFLAGS = -nostartfiles --enable-stdcall-fixup
+TARGET_LFLAGS = -nostartfiles -nostdlib --enable-stdcall-fixup
-TARGET_SDKLIBS = wine.a string.a kernel32.a ntdll.a
+TARGET_SDKLIBS = crt.a string.a kernel32.a ntdll.a wine.a
TARGET_GCCLIBS = gcc
@@ -35,473 +35,17 @@
TARGET_OBJECTS = $(TARGET_NAME).o
-TARGET_CLEAN = \
- conio/*.o \
- ctype/*.o \
- direct/*.o \
- except/*.o \
- float/*.o \
- io/*.o \
- locale/*.o \
- math/*.o \
- mbstring/*.o \
- misc/*.o \
- process/*.o \
- search/*.o \
- setjmp/*.o \
- setjmp/i386/*.o \
- signal/*.o \
- stdio/*.o \
- stdlib/*.o \
- string/*.o \
- sys_stat/*.o \
- time/*.o \
- wine/*.o \
- wstring/*.o
+TARGET_CLEAN = dllmain.o
-
include $(PATH_TO_TOP)/rules.mak
include $(TOOLS_PATH)/helper.mk
-CONIO_OBJECTS = \
- conio/cgets.o \
- conio/cprintf.o \
- conio/cputs.o \
- conio/cscanf.o \
- conio/getch.o \
- conio/getche.o \
- conio/kbhit.o \
- conio/putch.o \
- conio/ungetch.o
-CTYPE_OBJECTS = \
- ctype/ctype.o \
- ctype/isalnum.o \
- ctype/isalpha.o \
- ctype/isascii.o \
- ctype/iscntrl.o \
- ctype/isdigit.o \
- ctype/isgraph.o \
- ctype/islower.o \
- ctype/isprint.o \
- ctype/ispunct.o \
- ctype/isspace.o \
- ctype/isupper.o \
- ctype/isxdigit.o \
- ctype/toascii.o \
- ctype/tolower.o \
- ctype/toupper.o \
- ctype/iscsym.o \
- ctype/isctype.o
-DIRECT_OBJECTS = \
- direct/chdir.o \
- direct/chdrive.o \
- direct/getcwd.o \
- direct/getdcwd.o \
- direct/getdfree.o \
- direct/getdrive.o \
- direct/mkdir.o \
- direct/rmdir.o \
- direct/wchdir.o \
- direct/wgetcwd.o \
- direct/wgetdcwd.o \
- direct/wmkdir.o \
- direct/wrmdir.o
+OBJECTS = dllmain.o
-EXCEPT_OBJECTS = \
- except/seh.o \
- except/abnorter.o \
- except/exhand2.o \
- except/matherr.o \
- except/unwind.o \
- except/xcptfil.o
-
-FLOAT_OBJECTS = \
- float/chgsign.o \
- float/clearfp.o \
- float/cntrlfp.o \
- float/copysign.o \
- float/fpclass.o \
- float/fpecode.o \
- float/fpreset.o \
- float/isnan.o \
- float/logb.o \
- float/nafter.o \
- float/scalb.o \
- float/statfp.o
-
-IO_OBJECTS = \
- io/access.o \
- io/chmod.o \
- io/chsize.o \
- io/close.o \
- io/commit.o \
- io/create.o \
- io/dup.o \
- io/dup2.o \
- io/eof.o \
- io/filelen.o \
- io/fileleni.o \
- io/find.o \
- io/fmode.o \
- io/isatty.o \
- io/locking.o \
- io/lseek.o \
- io/lseeki64.o \
- io/mktemp.o \
- io/open.o \
- io/pipe.o \
- io/read.o \
- io/setmode.o \
- io/sopen.o \
- io/stubs.o \
- io/tell.o \
- io/telli64.o \
- io/umask.o \
- io/unlink.o \
- io/utime.o \
- io/waccess.o \
- io/wchmod.o \
- io/wcreate.o \
- io/wfind.o \
- io/wmktemp.o \
- io/wopen.o \
- io/write.o \
- io/wunlink.o \
- io/wutime.o
-
-LOCALE_OBJECTS = \
- locale/locale.o
-
-MATH_OBJECTS = \
- math/acos.o \
- math/adjust.o \
- math/asin.o \
- math/atan.o \
- math/atan2.o \
- math/cabs.o \
- math/ceil.o \
- math/cos.o \
- math/cosh.o \
- math/exp.o \
- math/fabs.o \
- math/floor.o \
- math/fmod.o \
- math/frexp.o \
- math/huge_val.o \
- math/hypot.o \
- math/j0_y0.o \
- math/j1_y1.o \
- math/jn_yn.o \
- math/ldexp.o \
- math/log.o \
- math/log10.o \
- math/modf.o \
- math/pow.o \
- math/sin.o \
- math/sinh.o \
- math/sqrt.o \
- math/stubs.o \
- math/tan.o \
- math/tanh.o
-
-MBSTRING_OBJECTS = \
- mbstring/hanzen.o \
- mbstring/ischira.o \
- mbstring/iskana.o \
- mbstring/iskpun.o \
- mbstring/islead.o \
- mbstring/islwr.o \
- mbstring/ismbal.o \
- mbstring/ismbaln.o \
- mbstring/ismbc.o \
- mbstring/ismbgra.o \
- mbstring/ismbkaln.o \
- mbstring/ismblead.o \
- mbstring/ismbpri.o \
- mbstring/ismbpun.o \
- mbstring/ismbtrl.o \
- mbstring/isuppr.o \
- mbstring/jistojms.o \
- mbstring/jmstojis.o \
- mbstring/mbbtype.o \
- mbstring/mbccpy.o \
- mbstring/mbclen.o \
- mbstring/mbscat.o \
- mbstring/mbschr.o \
- mbstring/mbscmp.o \
- mbstring/mbscoll.o \
- mbstring/mbscpy.o \
- mbstring/mbscspn.o \
- mbstring/mbsdec.o \
- mbstring/mbsdup.o \
- mbstring/mbsicmp.o \
- mbstring/mbsicoll.o \
- mbstring/mbsinc.o \
- mbstring/mbslen.o \
- mbstring/mbslwr.o \
- mbstring/mbsncat.o \
- mbstring/mbsnccnt.o \
- mbstring/mbsncmp.o \
- mbstring/mbsncoll.o \
- mbstring/mbsncpy.o \
- mbstring/mbsnextc.o \
- mbstring/mbsnicmp.o \
- mbstring/mbsnicoll.o \
- mbstring/mbsninc.o \
- mbstring/mbsnset.o \
- mbstring/mbspbrk.o \
- mbstring/mbsrchr.o \
- mbstring/mbsrev.o \
- mbstring/mbsset.o \
- mbstring/mbsspn.o \
- mbstring/mbsspnp.o \
- mbstring/mbsstr.o \
- mbstring/mbstok.o \
- mbstring/mbstrlen.o \
- mbstring/mbsupr.o
-
-MISC_OBJECTS = \
- misc/amsg.o \
- misc/assert.o \
- misc/crtmain.o \
- misc/dllmain.o \
- misc/environ.o \
- misc/getargs.o \
- misc/initterm.o \
- misc/lock.o \
- misc/purecall.o \
- misc/stubs.o \
- misc/tls.o
-
-PROCESS_OBJECTS = \
- process/_cwait.o \
- process/_system.o \
- process/dll.o \
- process/process.o \
- process/procid.o \
- process/thread.o \
- process/threadid.o \
- process/threadx.o
-
-SEARCH_OBJECTS = \
- search/lfind.o \
- search/lsearch.o
-
-SETJMP_OBJECTS = \
- setjmp/i386/setjmp.o
-
-SIGNAL_OBJECTS = \
- signal/signal.o
-
-STDIO_OBJECTS = \
- stdio/allocfil.o \
- stdio/clearerr.o \
- stdio/fclose.o \
- stdio/fdopen.o \
- stdio/feof.o \
- stdio/ferror.o \
- stdio/fflush.o \
- stdio/fgetc.o \
- stdio/fgetchar.o \
- stdio/fgetpos.o \
- stdio/fgets.o \
- stdio/fgetws.o \
- stdio/filbuf.o \
- stdio/fileno.o \
- stdio/flsbuf.o \
- stdio/fopen.o \
- stdio/fprintf.o \
- stdio/fputc.o \
- stdio/fputchar.o \
- stdio/fputs.o \
- stdio/fread.o \
- stdio/freopen.o \
- stdio/fscanf.o \
- stdio/fseek.o \
- stdio/fsetpos.o \
- stdio/fsopen.o \
- stdio/ftell.o \
- stdio/fwalk.o \
- stdio/fwrite.o \
- stdio/getc.o \
- stdio/getchar.o \
- stdio/gets.o \
- stdio/getw.o \
- stdio/perror.o \
- stdio/popen.o \
- stdio/printf.o \
- stdio/putc.o \
- stdio/putchar.o \
- stdio/puts.o \
- stdio/putw.o \
- stdio/remove.o \
- stdio/rename.o \
- stdio/rewind.o \
- stdio/rmtmp.o \
- stdio/scanf.o \
- stdio/setbuf.o \
- stdio/setvbuf.o \
- stdio/sprintf.o \
- stdio/sscanf.o \
- stdio/stdhnd.o \
- stdio/tempnam.o \
- stdio/tmpfile.o \
- stdio/tmpnam.o \
- stdio/ungetc.o \
- stdio/vfprintf.o \
- stdio/vfscanf.o \
- stdio/vfwprint.o \
- stdio/vprintf.o \
- stdio/vscanf.o \
- stdio/vsprintf.o \
- stdio/vsscanf.o \
- stdio/wfdopen.o \
- stdio/wrename.o \
- stdio/wtempnam.o \
- stdio/wtmpnam.o
-
-STDLIB_OBJECTS = \
- stdlib/_exit.o \
- stdlib/abort.o \
- stdlib/abs.o \
- stdlib/atexit.o \
- stdlib/atof.o \
- stdlib/atoi.o \
- stdlib/atoi64.o \
- stdlib/atol.o \
- stdlib/bsearch.o \
- stdlib/div.o \
- stdlib/ecvt.o \
- stdlib/ecvtbuf.o \
- stdlib/errno.o \
- stdlib/fcvt.o \
- stdlib/fcvtbuf.o \
- stdlib/fullpath.o \
- stdlib/gcvt.o \
- stdlib/getenv.o \
- stdlib/itoa.o \
- stdlib/itow.o \
- stdlib/labs.o \
- stdlib/ldiv.o \
- stdlib/makepath.o \
- stdlib/malloc.o \
- stdlib/mbstowcs.o \
- stdlib/mbtowc.o \
- stdlib/obsol.o \
- stdlib/putenv.o \
- stdlib/qsort.o \
- stdlib/rand.o \
- stdlib/rot.o \
- stdlib/senv.o \
- stdlib/splitp.o \
- stdlib/strtod.o \
- stdlib/strtol.o \
- stdlib/strtoul.o \
- stdlib/swab.o \
- stdlib/wcstod.o \
- stdlib/wcstol.o \
- stdlib/wcstombs.o \
- stdlib/wcstoul.o \
- stdlib/wctomb.o \
- stdlib/wfulpath.o \
- stdlib/witoa.o \
- stdlib/witow.o \
- stdlib/wputenv.o \
- stdlib/wsenv.o \
- stdlib/wsplitp.o \
- stdlib/wmakpath.o \
- stdlib/wtoi.o \
- stdlib/wtoi64.o
-
-STRING_OBJECTS = \
- string/lasttok.o \
- string/memicmp.o \
- string/strcoll.o \
- string/strdup.o \
- string/strerror.o \
- string/stricmp.o \
- string/strlwr.o \
- string/strncoll.o \
- string/strnicmp.o \
- string/strpbrk.o \
- string/strrev.o\
- string/strset.o \
- string/strstr.o \
- string/strtok.o \
- string/strupr.o \
- string/strxfrm.o
-
-SYS_STAT_OBJECTS = \
- sys_stat/fstat.o \
- sys_stat/fstati64.o \
- sys_stat/futime.o \
- sys_stat/stat.o \
- sys_stat/wstat.o
-
-TIME_OBJECTS = \
- time/clock.o \
- time/ctime.o \
- time/difftime.o \
- time/ftime.o \
- time/strdate.o \
- time/strftime.o \
- time/strtime.o \
- time/time.o \
- time/tz_vars.o \
- time/wctime.o \
- time/wstrdate.o \
- time/wstrtime.o
-
-WINE_OBJECTS = \
- wine/cpp.o \
- wine/cppexcept.o \
- wine/heap.o \
- wine/thread.o
-
-WSTRING_OBJECTS = \
- wstring/wcscoll.o \
- wstring/wcscspn.o \
- wstring/wcsdup.o \
- wstring/wcsicmp.o \
- wstring/wcslwr.o \
- wstring/wcsnicmp.o \
- wstring/wcspbrk.o \
- wstring/wcsrev.o \
- wstring/wcsset.o \
- wstring/wcsspn.o \
- wstring/wcsstr.o \
- wstring/wcstok.o \
- wstring/wcsupr.o \
- wstring/wcsxfrm.o \
- wstring/wlasttok.o
-
-OBJECTS = \
- $(CONIO_OBJECTS) \
- $(CTYPE_OBJECTS) \
- $(DIRECT_OBJECTS) \
- $(EXCEPT_OBJECTS) \
- $(FLOAT_OBJECTS) \
- $(IO_OBJECTS) \
- $(LOCALE_OBJECTS) \
- $(MATH_OBJECTS) \
- $(MBSTRING_OBJECTS) \
- $(MISC_OBJECTS) \
- $(PROCESS_OBJECTS) \
- $(SEARCH_OBJECTS) \
- $(SETJMP_OBJECTS) \
- $(SIGNAL_OBJECTS) \
- $(STDIO_OBJECTS) \
- $(STDLIB_OBJECTS) \
- $(STRING_OBJECTS) \
- $(SYS_STAT_OBJECTS) \
- $(TIME_OBJECTS) \
- $(WINE_OBJECTS) \
- $(WSTRING_OBJECTS)
-
$(TARGET_NAME).o: $(OBJECTS)
$(LD) -r $(OBJECTS) -o $(TARGET_NAME).o
_____
Deleted: trunk/reactos/lib/msvcrt/README.txt
--- trunk/reactos/lib/msvcrt/README.txt 2005-01-27 21:12:05 UTC (rev
13339)
+++ trunk/reactos/lib/msvcrt/README.txt 2005-01-27 21:16:41 UTC (rev
13340)
@@ -1,13 +0,0 @@
-This file contains information about the status the MSVCRT runtime in
ReactOS.
-
-Please note that all of the MSVCRT.DLL runtime sources are license GPL
unless
-otherwise noted. The sources from WINE are dual licensed GPL/LGPL.
-If you update a function in the ~/wine directory please send a patch to
wine-patches(a)winehq.com
-
-TODO List:
-Implement the remaining functions that are commented out in the .def
file
-Update source code headers for the license information.
-Compleate the W32API conversion for all source files.
-Write a decent regression test suite.
-Convert all C++ style comments to C style comments.
-????
_____
Copied: trunk/reactos/lib/msvcrt/dllmain.c (from rev 13290,
trunk/reactos/lib/msvcrt/misc/dllmain.c)
--- trunk/reactos/lib/msvcrt/misc/dllmain.c 2005-01-25 22:58:47 UTC
(rev 13290)
+++ trunk/reactos/lib/msvcrt/dllmain.c 2005-01-27 21:16:41 UTC (rev
13340)
@@ -0,0 +1,140 @@
+/* $Id$
+ *
+ * dllmain.c
+ *
+ * ReactOS MSVCRT.DLL Compatibility Library
+ *
+ * THIS SOFTWARE IS NOT COPYRIGHTED
+ *
+ * This source code is offered for use in the public domain. You may
+ * use, modify or distribute it freely.
+ *
+ * This code is distributed in the hope that it will be useful but
+ * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
+ * DISCLAMED. This includes but is not limited to warrenties of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * $Revision: 1.24 $
+ * $Author$
+ * $Date$
+ *
+ */
+
+#include "precomp.h"
+#include <msvcrt/internal/tls.h>
+#include <msvcrt/stdlib.h>
+#include <msvcrt/wine/msvcrt.h>
+
+#define NDEBUG
+#include <msvcrt/msvcrtdbg.h>
+
+
+/* EXTERNAL PROTOTYPES
********************************************************/
+
+//void __fileno_init(void);
+extern BOOL __fileno_init(void);
+extern int BlockEnvToEnvironA(void);
+extern int BlockEnvToEnvironW(void);
+extern void FreeEnvironment(char **environment);
+
+extern unsigned int _osver;
+extern unsigned int _winminor;
+extern unsigned int _winmajor;
+extern unsigned int _winver;
+
+extern char* _acmdln; /* pointer to ascii command line */
+extern wchar_t* _wcmdln; /* pointer to wide character command line
*/
+#undef _environ
+extern char** _environ; /* pointer to environment block */
+extern char** __initenv; /* pointer to initial environment block */
+extern wchar_t** _wenviron; /* pointer to environment block */
+extern wchar_t** __winitenv; /* pointer to initial environment block */
+
+
+/* LIBRARY GLOBAL VARIABLES
***************************************************/
+
+HANDLE hHeap = NULL; /* handle for heap */
+
+
+/* LIBRARY ENTRY POINT
********************************************************/
+
+BOOL
+STDCALL
+DllMain(PVOID hinstDll, ULONG dwReason, PVOID reserved)
+{
+ switch (dwReason)
+ {
+ case DLL_PROCESS_ATTACH://1
+ /* initialize version info */
+ DPRINT("Attach %d\n", nAttachCount);
+ _osver = GetVersion();
+ _winmajor = (_osver >> 8) & 0xFF;
+ _winminor = _osver & 0xFF;
+ _winver = (_winmajor << 8) + _winminor;
+ _osver = (_osver >> 16) & 0xFFFF;
+ hHeap = HeapCreate(0, 100000, 0);
+ if (hHeap == NULL)
+ return FALSE;
+ if (!__fileno_init())
+ return FALSE;
+
+ /* create tls stuff */
+ if (!CreateThreadData())
+ return FALSE;
+
+ if (BlockEnvToEnvironA() < 0)
+ return FALSE;
+
+ if (BlockEnvToEnvironW() < 0)
+ {
+ FreeEnvironment((char**)_wenviron);
+ return FALSE;
+ }
+
+ _acmdln = _strdup(GetCommandLineA());
+ _wcmdln = _wcsdup(GetCommandLineW());
+
+ /* FIXME: more initializations... */
+
+ /* FIXME: Initialization of the WINE code */
+ msvcrt_init_mt_locks();
+
+ DPRINT("Attach done\n");
+ break;
+
+ case DLL_THREAD_ATTACH://2
+ break;
+
+ case DLL_THREAD_DETACH://4
+ FreeThreadData(NULL);
+ break;
+
+ case DLL_PROCESS_DETACH://0
+ DPRINT("Detach %d\n", nAttachCount);
+ /* FIXME: more cleanup... */
+ _fcloseall();
+
+ /* destroy tls stuff */
+ DestroyThreadData();
+
+ if (__winitenv && __winitenv != _wenviron)
+ FreeEnvironment((char**)__winitenv);
+ if (_wenviron)
+ FreeEnvironment((char**)_wenviron);
+
+ if (__initenv && __initenv != _environ)
+ FreeEnvironment(__initenv);
+ if (_environ)
+ FreeEnvironment(_environ);
+
+ /* destroy heap */
+ HeapDestroy(hHeap);
+
+ DPRINT("Detach done\n");
+ break;
+ }
+
+ return TRUE;
+}
+
+/* EOF */
_____
Modified: trunk/reactos/lib/msvcrt/msvcrt.def
--- trunk/reactos/lib/msvcrt/msvcrt.def 2005-01-27 21:12:05 UTC (rev
13339)
+++ trunk/reactos/lib/msvcrt/msvcrt.def 2005-01-27 21:16:41 UTC (rev
13340)
@@ -108,7 +108,7 @@
__argc DATA
__argv DATA
__badioinfo DATA
-__crtCompareStringA ;=NTDLL.RtlCompareString
+;__crtCompareStringA ;=NTDLL.RtlCompareString
;__crtGetLocaleInfoW
__crtLCMapStringA
__dllonexit
@@ -126,7 +126,7 @@
__mb_cur_max DATA
__p___argc
__p___argv
-__p___wargv
+;__p___wargv
__p___initenv
__p___mb_cur_max
__p___winitenv
@@ -154,14 +154,14 @@
__p__winver
;__p__wpgmptr
__pioinfo
-;__pxcptinfoptrs
+__pxcptinfoptrs
__set_app_type
__setlc_active DATA
__setusermatherr
__threadhandle
__threadid
__toascii
-__unDName
+;__unDName
;__unDNameEx
__unguarded_readlc_active DATA
__wargv
@@ -281,7 +281,7 @@
_finite
_flsbuf
_flushall
-_fmode DATA
+_fmode=__fmode DATA
_fpclass
_fpieee_flt
_fpreset
@@ -311,7 +311,7 @@
;_getmaxstdio
;_getmbcp
_getpid
-;_getsystime
+_getsystime
_getw
;_getwch
;_getwche
@@ -481,7 +481,7 @@
;_scprintf
;_scwprintf
_searchenv
-_seh_longjmp_unwind
+_seh_longjmp_unwind@4
;_set_error_mode
;_set_SSE2_enable
;_set_sbh_threshold
@@ -491,7 +491,7 @@
;_setmaxstdio
_setmbcp
_setmode
-;_setsystime
+_setsystime
_sleep
_snprintf
;_snscanf