summaryrefslogtreecommitdiffstats
path: root/private/crtlib
diff options
context:
space:
mode:
authorAdam <you@example.com>2020-05-17 05:51:50 +0200
committerAdam <you@example.com>2020-05-17 05:51:50 +0200
commite611b132f9b8abe35b362e5870b74bce94a1e58e (patch)
treea5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crtlib
downloadNT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst
NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip
Diffstat (limited to 'private/crtlib')
-rw-r--r--private/crtlib/buildall.cmd62
-rw-r--r--private/crtlib/chkit.cmd9
-rw-r--r--private/crtlib/crtdll.rc33
-rw-r--r--private/crtlib/ghostall.cmd30
-rw-r--r--private/crtlib/ghostcrt.cmd183
-rw-r--r--private/crtlib/ghostfp.cmd38
-rw-r--r--private/crtlib/include/assert.h54
-rw-r--r--private/crtlib/include/conio.h73
-rw-r--r--private/crtlib/include/ctype.h226
-rw-r--r--private/crtlib/include/direct.h92
-rw-r--r--private/crtlib/include/dos.h131
-rw-r--r--private/crtlib/include/errno.h104
-rw-r--r--private/crtlib/include/excpt.h135
-rw-r--r--private/crtlib/include/fcntl.h71
-rw-r--r--private/crtlib/include/float.h294
-rw-r--r--private/crtlib/include/fpieee.h245
-rw-r--r--private/crtlib/include/fstream.h139
-rw-r--r--private/crtlib/include/io.h146
-rw-r--r--private/crtlib/include/iomanip.h128
-rw-r--r--private/crtlib/include/ios.h251
-rw-r--r--private/crtlib/include/iostream.h70
-rw-r--r--private/crtlib/include/istream.h152
-rw-r--r--private/crtlib/include/limits.h70
-rw-r--r--private/crtlib/include/locale.h100
-rw-r--r--private/crtlib/include/malloc.h101
-rw-r--r--private/crtlib/include/math.h226
-rw-r--r--private/crtlib/include/mbctype.h116
-rw-r--r--private/crtlib/include/mbstring.h139
-rw-r--r--private/crtlib/include/memory.h69
-rw-r--r--private/crtlib/include/new.h51
-rw-r--r--private/crtlib/include/ostream.h128
-rw-r--r--private/crtlib/include/process.h173
-rw-r--r--private/crtlib/include/search.h71
-rw-r--r--private/crtlib/include/setjmp.h253
-rw-r--r--private/crtlib/include/setjmpex.h36
-rw-r--r--private/crtlib/include/share.h27
-rw-r--r--private/crtlib/include/signal.h91
-rw-r--r--private/crtlib/include/stdarg.h125
-rw-r--r--private/crtlib/include/stddef.h102
-rw-r--r--private/crtlib/include/stdio.h347
-rw-r--r--private/crtlib/include/stdiostr.h55
-rw-r--r--private/crtlib/include/stdlib.h385
-rw-r--r--private/crtlib/include/streamb.h169
-rw-r--r--private/crtlib/include/string.h179
-rw-r--r--private/crtlib/include/strstrea.h89
-rw-r--r--private/crtlib/include/sys/locking.h30
-rw-r--r--private/crtlib/include/sys/stat.h115
-rw-r--r--private/crtlib/include/sys/timeb.h80
-rw-r--r--private/crtlib/include/sys/types.h48
-rw-r--r--private/crtlib/include/sys/utime.h80
-rw-r--r--private/crtlib/include/tchar.h555
-rw-r--r--private/crtlib/include/time.h192
-rw-r--r--private/crtlib/include/varargs.h136
-rw-r--r--private/crtlib/include/wchar.h300
-rw-r--r--private/crtlib/lib/alpha/crtdll.alp62
-rw-r--r--private/crtlib/lib/crtdll.def508
-rw-r--r--private/crtlib/lib/i386/crtdll.x8623
-rw-r--r--private/crtlib/lib/mips/crtdll.mip27
-rw-r--r--private/crtlib/lib/ppc/crtdll.ppc8
-rw-r--r--private/crtlib/makefile773
-rw-r--r--private/crtlib/ssyncall.cmd43
-rw-r--r--private/crtlib/statall.cmd45
62 files changed, 8793 insertions, 0 deletions
diff --git a/private/crtlib/buildall.cmd b/private/crtlib/buildall.cmd
new file mode 100644
index 000000000..18399e006
--- /dev/null
+++ b/private/crtlib/buildall.cmd
@@ -0,0 +1,62 @@
+setlocal
+@set _targetcpu=%PROCESSOR_ARCHITECTURE%
+@if "%_targetcpu%" == "x86" set _targetcpu=386
+@if "%_targetcpu%" == "PPC" set _targetcpu=ppc
+@if "%_targetcpu%" == "MIPS" set _targetcpu=mips
+@if "%_targetcpu%" == "ALPHA" set _targetcpu=alpha
+echo Building %_targetcpu%
+@set _buildopts=-%_targetcpu% %1 %2 %3 %4 %5 %6 %7 %8 %9
+@cd ..\fp32nt
+@echo Building NT Subset of Single Thread C Floating Point Runtimes
+@call buildcrt nt %_buildopts%
+@cd ..\crt32nt
+@echo Building NT Subset of Single Thread C Runtimes (excluding FP)
+@call buildcrt nt %_buildopts%
+@cd ..\fp32st
+@echo Building Single Thread C Floating Point Runtimes
+@call buildcrt st %_buildopts%
+@cd ..\crt32st
+@echo Building Single Thread C Runtimes (excluding FP)
+@call buildcrt st %_buildopts%
+@cd ..\fp32
+@echo Building Multi-Thread C Floating Point Runtimes
+@call buildcrt mt %_buildopts%
+@cd ..\crt32
+@echo Building Multi-Thread C Runtimes (excluding FP)
+@call buildcrt mt %_buildopts%
+@cd ..\fp32dll
+@echo Building DLL C Floating Point Runtimes
+@call buildcrt dll %_buildopts%
+@cd ..\crt32dll
+@echo Building DLL C Runtimes (excluding FP)
+@call buildcrt dll %_buildopts%
+@cd ..\crt32psx
+@echo Building POSIX C Runtimes (excluding FP)
+@call buildcrt posix %_buildopts%
+:buildlibs
+@if "%_targetcpu%" == "mips" goto linkmips
+@if "%_targetcpu%" == "alpha" goto linkalpha
+@if "%_targetcpu%" == "ppc" goto linkppc
+@cd ..\crtlib
+@echo Building libcnt.lib libc.lib libcmt.lib libcpsx.lib crtdll.lib crtdll.dll for i386
+@nmake 386=1
+@goto done
+:linkmips
+@cd ..\crtlib
+@echo Building libcnt.lib libc.lib libcmt.lib libcpsx.lib crtdll.lib crtdll.dll for MIPS
+@nmake MIPS=1
+@goto done
+:linkalpha
+@cd ..\crtlib
+@echo Building libcnt.lib libc.lib libcmt.lib libcpsx.lib crtdll.lib crtdll.dll for ALPHA
+@nmake ALPHA=1
+@goto done
+:linkppc
+@cd ..\crtlib
+@echo Building libcnt.lib libc.lib libcmt.lib libcpsx.lib crtdll.lib crtdll.dll for PPC
+@nmake PPC=1
+@goto done
+:bogus
+@echo Usage: BUILDALL (386 or MIPS or ALPHA or PPC) [BuildOptions]
+:done
+@endlocal
diff --git a/private/crtlib/chkit.cmd b/private/crtlib/chkit.cmd
new file mode 100644
index 000000000..d0fa6dc6d
--- /dev/null
+++ b/private/crtlib/chkit.cmd
@@ -0,0 +1,9 @@
+@if EXIST \nt\private\crt32nt\build.err type \nt\private\crt32nt\build.err
+@if EXIST \nt\private\crt32st\build.err type \nt\private\crt32st\build.err
+@if EXIST \nt\private\crt32\build.err type \nt\private\crt32\build.err
+@if EXIST \nt\private\crt32dll\build.err type \nt\private\crt32dll\build.err
+@if EXIST \nt\private\crt32psx\build.err type \nt\private\crt32psx\build.err
+@if EXIST \nt\private\fp32nt\build.err type \nt\private\fp32nt\build.err
+@if EXIST \nt\private\fp32st\build.err type \nt\private\fp32st\build.err
+@if EXIST \nt\private\fp32\build.err type \nt\private\fp32\build.err
+@if EXIST \nt\private\fp32dll\build.err type \nt\private\fp32dll\build.err
diff --git a/private/crtlib/crtdll.rc b/private/crtlib/crtdll.rc
new file mode 100644
index 000000000..3ef2e14ae
--- /dev/null
+++ b/private/crtlib/crtdll.rc
@@ -0,0 +1,33 @@
+/*
+** Template for version resources. Place this in your .rc file,
+** editing the values for VER_FILETYPE, VER_FILESUBTYPE,
+** VER_FILEDESCRIPTION_STR and VER_INTERNALNAME_STR as needed.
+** See winver.h for possible values.
+**
+** Ntverp.h defines several global values that don't need to be
+** changed except for official releases such as betas, sdk updates, etc.
+**
+** Common.ver has the actual version resource structure that all these
+** #defines eventually initialize.
+*/
+
+#include <windows.h>
+#include <ntverp.h>
+
+/*-----------------------------------------------*/
+/* the following lines are specific to this file */
+/*-----------------------------------------------*/
+
+/* VER_FILETYPE, VER_FILESUBTYPE, VER_FILEDESCRIPTION_STR
+ * and VER_INTERNALNAME_STR must be defined before including COMMON.VER
+ * The strings don't need a '\0', since common.ver has them.
+ */
+#define VER_FILETYPE VFT_DLL
+
+#define VER_FILESUBTYPE VFT2_UNKNOWN
+
+#define VER_FILEDESCRIPTION_STR "Microsoft C Runtime Library"
+#define VER_INTERNALNAME_STR "CRTDLL.DLL"
+#define VER_ORIGINALFILENAME_STR "CRTDLL.DLL"
+
+#include "common.ver"
diff --git a/private/crtlib/ghostall.cmd b/private/crtlib/ghostall.cmd
new file mode 100644
index 000000000..175b92589
--- /dev/null
+++ b/private/crtlib/ghostall.cmd
@@ -0,0 +1,30 @@
+@echo off
+setlocal
+set _targetcpu=
+if "%1" == "-alpha" set _targetcpu=alpha
+if "%1" == "alpha" set _targetcpu=alpha
+if "%1" == "ALPHA" set _targetcpu=alpha
+if "%1" == "-mips" set _targetcpu=mips
+if "%1" == "mips" set _targetcpu=mips
+if "%1" == "MIPS" set _targetcpu=mips
+if "%1" == "-i386" set _targetcpu=386
+if "%1" == "-386" set _targetcpu=386
+if "%1" == "386" set _targetcpu=386
+if "%1" == "-ppc" set _targetcpu=ppc
+if "%1" == "ppc" set _targetcpu=ppc
+if "%1" == "PPC" set _targetcpu=ppc
+if "%_targetcpu%" == "" goto bogus
+call \nt\private\crtlib\ghostcrt.cmd mt %_targetcpu%
+call \nt\private\crtlib\ghostcrt.cmd nt %_targetcpu%
+call \nt\private\crtlib\ghostcrt.cmd st %_targetcpu%
+call \nt\private\crtlib\ghostcrt.cmd dll %_targetcpu%
+call \nt\private\crtlib\ghostcrt.cmd psx %_targetcpu%
+call \nt\private\crtlib\ghostfp.cmd mt %_targetcpu%
+call \nt\private\crtlib\ghostfp.cmd nt %_targetcpu%
+call \nt\private\crtlib\ghostfp.cmd st %_targetcpu%
+call \nt\private\crtlib\ghostfp.cmd dll %_targetcpu%
+goto done
+:bogus
+echo Usage: GHOSTALL [MB] (386 or MIPS or ALPHA or PPC)
+:done
+endlocal
diff --git a/private/crtlib/ghostcrt.cmd b/private/crtlib/ghostcrt.cmd
new file mode 100644
index 000000000..85142fa4c
--- /dev/null
+++ b/private/crtlib/ghostcrt.cmd
@@ -0,0 +1,183 @@
+@if "%1" == "dll" (set CRTDIRSUFFIX=DLL) && goto ghostdll
+@if "%1" == "psx" (set CRTDIRSUFFIX=PSX) && goto ghostpsx
+@if "%1" == "st" (set CRTDIRSUFFIX=ST) && goto ghostst
+@if "%1" == "nt" (set CRTDIRSUFFIX=NT) && goto ghostnt
+@if NOT "%1" == "mt" goto bogus
+@set CRTDIRSUFFIX=
+@cd \nt\private\crt32%CRTDIRSUFFIX%
+@ech Ghosting unneed directories in
+@cd
+@cd tools
+@ssync -vrg
+@delnode /q obj
+@cd ..\heap
+@ssync -vrg
+@delnode /q obj
+@cd ..\wstring
+@ssync -vrg
+@delnode /q obj
+@cd ..\hack
+@ssync -vrg
+@delnode /q obj
+@cd ..\linkopts
+@ssync -vrg
+@delnode /q obj
+@cd ..\oldnames
+@ssync -vrg
+@delnode /q obj
+@cd ..\dllstuff
+@ssync -vrg
+@delnode /q obj
+@cd ..\small
+@ssync -vrg
+@delnode /q obj
+@goto done
+
+:ghostst
+@cd \nt\private\crt32%CRTDIRSUFFIX%
+@ech Ghosting unneed directories in
+@cd
+@cd tools
+@ssync -vrg
+@delnode /q obj
+@cd ..\heap
+@ssync -vrg
+@delnode /q obj
+@cd ..\wstring
+@ssync -vrg
+@delnode /q obj
+@cd ..\hack
+@ssync -vrg
+@delnode /q obj
+@cd ..\oldnames
+@ssync -vrg
+@delnode /q obj
+@cd ..\dllstuff
+@ssync -vrg
+@delnode /q obj
+@if "%2" == "mips" goto skipsmall
+@cd ..\small
+@ssync -vrg
+@delnode /q obj
+:skipsmall
+@goto done
+
+:ghostdll
+@cd \nt\private\crt32%CRTDIRSUFFIX%
+@ech Ghosting unneed directories in
+@cd
+@cd tools
+@ssync -vrg
+@delnode /q obj
+@cd ..\heap
+@ssync -vrg
+@delnode /q obj
+@cd ..\wstring
+@ssync -vrg
+@delnode /q obj
+@cd ..\hack
+@ssync -vrg
+@delnode /q obj
+@cd ..\oldnames
+@ssync -vrg
+@delnode /q obj
+@cd ..\small
+@ssync -vrg
+@delnode /q obj
+@goto done
+
+:ghostpsx
+@cd \nt\private\crt32%CRTDIRSUFFIX%
+@ech Ghosting unneed directories in
+@cd
+@cd tools
+@ssync -vrg
+@delnode /q obj
+@cd ..\heap
+@ssync -vrg
+@delnode /q obj
+@cd ..\wstring
+@ssync -vrg
+@delnode /q obj
+@cd ..\hack
+@ssync -vrg
+@delnode /q obj
+@cd ..\oldnames
+@ssync -vrg
+@delnode /q obj
+@cd ..\dllstuff
+@ssync -vrg
+@delnode /q obj
+@cd ..\small
+@ssync -vrg
+@delnode /q obj
+@cd ..\direct
+@ssync -vrg
+@delnode /q obj
+@cd ..\dos
+@ssync -vrg
+@delnode /q obj
+@cd ..\exec
+@ssync -vrg
+@delnode /q obj
+@cd ..\iostream
+@ssync -vrg
+@delnode /q obj
+@cd ..\lowio
+@ssync -vrg
+@delnode /q obj
+@goto done
+
+:ghostnt
+@cd \nt\private\crt32%CRTDIRSUFFIX%
+@ech Ghosting unneed directories in
+@cd
+@delnode /q obj
+@cd tools
+@ssync -vrg
+@delnode /q obj
+@cd ..\heap
+@ssync -vrg
+@delnode /q obj
+@cd ..\wstring
+@ssync -vrg
+@delnode /q obj
+@cd ..\oldnames
+@ssync -vrg
+@delnode /q obj
+@cd ..\dllstuff
+@ssync -vrg
+@delnode /q obj
+@cd ..\small
+@ssync -vrg
+@delnode /q obj
+@cd ..\direct
+@ssync -vrg
+@delnode /q obj
+@cd ..\dos
+@ssync -vrg
+@delnode /q obj
+@cd ..\exec
+@ssync -vrg
+@delnode /q obj
+@cd ..\iostream
+@ssync -vrg
+@delnode /q obj
+@cd ..\lowio
+@ssync -vrg
+@delnode /q obj
+@cd ..\time
+@ssync -vrg
+@delnode /q obj
+@cd ..\winheap
+@ssync -vrg
+@delnode /q obj
+@cd ..\mbstring
+@ssync -vrg
+@delnode /q obj
+@goto done
+
+:bogus
+@echo Usage: GHOSTCRT (NT, ST, MT, DLL, or POSIX) (386 or MIPS or ALPHA or PPC)
+:done
+@set CRTDIRSUFFIX=
diff --git a/private/crtlib/ghostfp.cmd b/private/crtlib/ghostfp.cmd
new file mode 100644
index 000000000..977fc101a
--- /dev/null
+++ b/private/crtlib/ghostfp.cmd
@@ -0,0 +1,38 @@
+@if "%1" == "DLL" (set CRTDIRSUFFIX=DLL) && goto ghostdll
+@if "%1" == "Dll" (set CRTDIRSUFFIX=DLL) && goto ghostdll
+@if "%1" == "dll" (set CRTDIRSUFFIX=DLL) && goto ghostdll
+@if "%1" == "st" (set CRTDIRSUFFIX=ST) && goto ghostst
+@if "%1" == "ST" (set CRTDIRSUFFIX=ST) && goto ghostst
+@if "%1" == "St" (set CRTDIRSUFFIX=ST) && goto ghostst
+@if "%1" == "nt" (set CRTDIRSUFFIX=NT) && goto ghostnt
+@if "%1" == "NT" (set CRTDIRSUFFIX=NT) && goto ghostnt
+@if "%1" == "Nt" (set CRTDIRSUFFIX=NT) && goto ghostnt
+@if "%1" == "mt" set CRTDIRSUFFIX=
+@if "%1" == "MT" set CRTDIRSUFFIX=
+@if "%1" == "Mt" set CRTDIRSUFFIX=
+@if "%CRTLIBTYPE%" == "" goto bogus
+:ghostdll
+:ghostst
+@cd \nt\private\fp32%CRTDIRSUFFIX%
+@ech Ghosting unneed directories in
+@cd
+@cd tools.mak
+@ssync -vrg
+@delnode /q obj
+@goto done
+
+:ghostnt
+@cd \nt\private\fp32%CRTDIRSUFFIX%
+@ech Ghosting unneed directories in
+@cd
+@cd tools.mak
+@ssync -vrg
+@delnode /q obj
+@cd ..\conv
+@ssync -vrg
+@delnode /q obj
+@goto done
+
+:bogus
+@echo Usage: GHOSTFP (NT, ST, MT, or DLL) [BuildOptions]
+:done
diff --git a/private/crtlib/include/assert.h b/private/crtlib/include/assert.h
new file mode 100644
index 000000000..6049b0f90
--- /dev/null
+++ b/private/crtlib/include/assert.h
@@ -0,0 +1,54 @@
+/***
+*assert.h - define the assert macro
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Defines the assert(exp) macro.
+* [ANSI/System V]
+*
+****/
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+#undef assert
+
+#ifdef NDEBUG
+
+#define assert(exp) ((void)0)
+
+#else
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void _CRTAPI1 _assert(void *, void *, unsigned);
+#ifdef __cplusplus
+}
+#endif
+
+#define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) )
+
+
+#endif /* NDEBUG */
diff --git a/private/crtlib/include/conio.h b/private/crtlib/include/conio.h
new file mode 100644
index 000000000..dce6d35b2
--- /dev/null
+++ b/private/crtlib/include/conio.h
@@ -0,0 +1,73 @@
+/***
+*conio.h - console and port I/O declarations
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This include file contains the function declarations for
+* the MS C V2.03 compatible console I/O routines.
+*
+****/
+
+#ifndef _INC_CONIO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/* function prototypes */
+
+char * _CRTAPI1 _cgets(char *);
+int _CRTAPI2 _cprintf(const char *, ...);
+int _CRTAPI1 _cputs(const char *);
+int _CRTAPI2 _cscanf(const char *, ...);
+int _CRTAPI1 _getch(void);
+int _CRTAPI1 _getche(void);
+int _CRTAPI1 _kbhit(void);
+int _CRTAPI1 _putch(int);
+int _CRTAPI1 _ungetch(int);
+
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define cgets _cgets
+#define cprintf _cprintf
+#define cputs _cputs
+#define cscanf _cscanf
+#define getch _getch
+#define getche _getche
+#define kbhit _kbhit
+#define putch _putch
+#define ungetch _ungetch
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_CONIO
+#endif /* _INC_CONIO */
diff --git a/private/crtlib/include/ctype.h b/private/crtlib/include/ctype.h
new file mode 100644
index 000000000..f85b3de9c
--- /dev/null
+++ b/private/crtlib/include/ctype.h
@@ -0,0 +1,226 @@
+/***
+*ctype.h - character conversion macros and ctype macros
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Defines macros for character classification/conversion.
+* [ANSI/System V]
+*
+****/
+
+#ifndef _INC_CTYPE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+#ifndef _WCTYPE_T_DEFINED
+typedef wchar_t wint_t;
+typedef wchar_t wctype_t;
+#define _WCTYPE_T_DEFINED
+#endif
+
+#ifndef WEOF
+#define WEOF (wint_t)(0xFFFF)
+#endif
+
+/*
+ * This declaration allows the user access to the ctype look-up
+ * array _ctype defined in ctype.obj by simply including ctype.h
+ */
+#ifndef _CTYPE_DISABLE_MACROS
+#ifdef _DLL
+
+extern unsigned short * _ctype;
+
+#define _pctype (*_pctype_dll)
+extern unsigned short **_pctype_dll;
+
+#define _pwctype (*_pwctype_dll)
+extern unsigned short **_pwctype_dll;
+
+#else /* _DLL */
+
+
+extern unsigned short _ctype[];
+extern unsigned short *_pctype;
+extern wctype_t *_pwctype;
+
+#endif /* _DLL */
+#endif /* _CTYPE_DISABLE_MACROS */
+
+/* set bit masks for the possible character types */
+
+#define _UPPER 0x1 /* upper case letter */
+#define _LOWER 0x2 /* lower case letter */
+#define _DIGIT 0x4 /* digit[0-9] */
+#define _SPACE 0x8 /* tab, carriage return, newline, */
+ /* vertical tab or form feed */
+#define _PUNCT 0x10 /* punctuation character */
+#define _CONTROL 0x20 /* control character */
+#define _BLANK 0x40 /* space char */
+#define _HEX 0x80 /* hexadecimal digit */
+
+#define _LEADBYTE 0x8000 /* multibyte leadbyte */
+#define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */
+
+
+/* character classification function prototypes */
+
+#ifndef _CTYPE_DEFINED
+int _CRTAPI1 isalpha(int);
+int _CRTAPI1 isupper(int);
+int _CRTAPI1 islower(int);
+int _CRTAPI1 isdigit(int);
+int _CRTAPI1 isxdigit(int);
+int _CRTAPI1 isspace(int);
+int _CRTAPI1 ispunct(int);
+int _CRTAPI1 isalnum(int);
+int _CRTAPI1 isprint(int);
+int _CRTAPI1 isgraph(int);
+int _CRTAPI1 iscntrl(int);
+int _CRTAPI1 toupper(int);
+int _CRTAPI1 tolower(int);
+int _CRTAPI1 _tolower(int);
+int _CRTAPI1 _toupper(int);
+int _CRTAPI1 __isascii(int);
+int _CRTAPI1 __toascii(int);
+int _CRTAPI1 __iscsymf(int);
+int _CRTAPI1 __iscsym(int);
+#define _CTYPE_DEFINED
+#endif
+
+#ifndef _WCTYPE_DEFINED
+
+/* character classification function prototypes */
+/* also defined in wchar.h */
+
+int _CRTAPI1 iswalpha(wint_t);
+int _CRTAPI1 iswupper(wint_t);
+int _CRTAPI1 iswlower(wint_t);
+int _CRTAPI1 iswdigit(wint_t);
+int _CRTAPI1 iswxdigit(wint_t);
+int _CRTAPI1 iswspace(wint_t);
+int _CRTAPI1 iswpunct(wint_t);
+int _CRTAPI1 iswalnum(wint_t);
+int _CRTAPI1 iswprint(wint_t);
+int _CRTAPI1 iswgraph(wint_t);
+int _CRTAPI1 iswcntrl(wint_t);
+int _CRTAPI1 iswascii(wint_t);
+int _CRTAPI1 isleadbyte(int);
+
+wchar_t _CRTAPI1 towupper(wchar_t);
+wchar_t _CRTAPI1 towlower(wchar_t);
+
+int _CRTAPI1 iswctype(wint_t, wctype_t);
+
+int _CRTAPI1 _isctype(int, int);
+
+#define _WCTYPE_DEFINED
+#endif
+
+/* the character classification macro definitions */
+
+#ifndef _CTYPE_DISABLE_MACROS
+
+
+#ifndef _MB_CUR_MAX_DEFINED
+/* max mb-len for current locale */
+/* also defined in stdlib.h */
+#ifdef _DLL
+#define __mb_cur_max (*__mb_cur_max_dll)
+#define MB_CUR_MAX (*__mb_cur_max_dll)
+extern unsigned short *__mb_cur_max_dll;
+#else
+#define MB_CUR_MAX __mb_cur_max
+extern unsigned short __mb_cur_max;
+#endif
+#define _MB_CUR_MAX_DEFINED
+#endif /* _MB_CUR_MAX_DEFINED */
+
+#define isalpha(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_ALPHA) : _pctype[_c] & _ALPHA)
+#define isupper(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_UPPER) : _pctype[_c] & _UPPER)
+#define islower(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_LOWER) : _pctype[_c] & _LOWER)
+#define isdigit(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_DIGIT) : _pctype[_c] & _DIGIT)
+#define isxdigit(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_HEX) : _pctype[_c] & _HEX)
+#define isspace(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_SPACE) : _pctype[_c] & _SPACE)
+#define ispunct(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_PUNCT) : _pctype[_c] & _PUNCT)
+#define isalnum(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_ALPHA|_DIGIT) : _pctype[_c] & (_ALPHA|_DIGIT))
+#define isprint(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) : _pctype[_c] & (_BLANK|_PUNCT|_ALPHA|_DIGIT))
+#define isgraph(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_PUNCT|_ALPHA|_DIGIT) : _pctype[_c] & (_PUNCT|_ALPHA|_DIGIT))
+#define iscntrl(_c) (MB_CUR_MAX > 1 ? _isctype(_c,_CONTROL) : _pctype[_c] & _CONTROL)
+
+#define _tolower(_c) ( (_c)-'A'+'a' )
+#define _toupper(_c) ( (_c)-'a'+'A' )
+
+#define __isascii(_c) ( (unsigned)(_c) < 0x80 )
+#define __toascii(_c) ( (_c) & 0x7f )
+
+#define iswalpha(_c) ( iswctype(_c,_ALPHA) )
+#define iswupper(_c) ( iswctype(_c,_UPPER) )
+#define iswlower(_c) ( iswctype(_c,_LOWER) )
+#define iswdigit(_c) ( iswctype(_c,_DIGIT) )
+#define iswxdigit(_c) ( iswctype(_c,_HEX) )
+#define iswspace(_c) ( iswctype(_c,_SPACE) )
+#define iswpunct(_c) ( iswctype(_c,_PUNCT) )
+#define iswalnum(_c) ( iswctype(_c,_ALPHA|_DIGIT) )
+#define iswprint(_c) ( iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) )
+#define iswgraph(_c) ( iswctype(_c,_PUNCT|_ALPHA|_DIGIT) )
+#define iswcntrl(_c) ( iswctype(_c,_CONTROL) )
+#define iswascii(_c) ( (unsigned)(_c) < 0x80 )
+
+/* note: MS-specific routine, may evaluate its arguments more than once */
+#define isleadbyte(_c) ((_c) < 256 ? _pctype[_c] & _LEADBYTE : 0)
+
+
+/* MS C version 2.0 extended ctype macros */
+
+#define __iscsymf(_c) (isalpha(_c) || ((_c) == '_'))
+#define __iscsym(_c) (isalnum(_c) || ((_c) == '_'))
+
+#endif /* _CTYPE_DISABLE_MACROS */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define isascii __isascii
+#define toascii __toascii
+#define iscsymf __iscsymf
+#define iscsym __iscsym
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_CTYPE
+#endif /* _INC_CTYPE */
diff --git a/private/crtlib/include/direct.h b/private/crtlib/include/direct.h
new file mode 100644
index 000000000..2c74bdbba
--- /dev/null
+++ b/private/crtlib/include/direct.h
@@ -0,0 +1,92 @@
+/***
+*direct.h - function declarations for directory handling/creation
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This include file contains the function declarations for the library
+* functions related to directory handling and creation.
+*
+****/
+
+#ifndef _INC_DIRECT
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+/* _getdiskfree structure for _getdiskfree() */
+
+#ifndef _DISKFREE_T_DEFINED
+
+struct _diskfree_t {
+ unsigned total_clusters;
+ unsigned avail_clusters;
+ unsigned sectors_per_cluster;
+ unsigned bytes_per_sector;
+ };
+
+#define _DISKFREE_T_DEFINED
+
+#endif
+
+/* function prototypes */
+
+int _CRTAPI1 _chdir(const char *);
+int _CRTAPI1 _chdrive(int);
+char * _CRTAPI1 _getcwd(char *, int);
+char * _CRTAPI1 _getdcwd(int, char *, int);
+int _CRTAPI1 _getdrive(void);
+int _CRTAPI1 _mkdir(const char *);
+int _CRTAPI1 _rmdir(const char *);
+unsigned _CRTAPI1 _getdiskfree(unsigned, struct _diskfree_t *);
+unsigned long _CRTAPI1 _getdrives(void);
+
+
+
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define chdir _chdir
+#define getcwd _getcwd
+#define mkdir _mkdir
+#define rmdir _rmdir
+#define diskfree_t _diskfree_t
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_DIRECT
+#endif /* _INC_DIRECT */
diff --git a/private/crtlib/include/dos.h b/private/crtlib/include/dos.h
new file mode 100644
index 000000000..2f70f3e33
--- /dev/null
+++ b/private/crtlib/include/dos.h
@@ -0,0 +1,131 @@
+/***
+*dos.h - definitions for MS-DOS interface routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Defines the structs and unions used for the direct DOS interface
+* routines; includes macros to access the segment and offset
+* values of far pointers, so that they may be used by the routines; and
+* provides function prototypes for direct DOS interface functions.
+*
+****/
+
+#ifndef _INC_DOS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+
+
+/* _getdiskfree structure (duplicated in DIRECT.H) */
+
+#ifndef _DISKFREE_T_DEFINED
+
+struct _diskfree_t {
+ unsigned total_clusters;
+ unsigned avail_clusters;
+ unsigned sectors_per_cluster;
+ unsigned bytes_per_sector;
+ };
+
+#define _DISKFREE_T_DEFINED
+
+#endif
+
+
+
+/* File attribute constants */
+
+#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
+#define _A_RDONLY 0x01 /* Read only file */
+#define _A_HIDDEN 0x02 /* Hidden file */
+#define _A_SYSTEM 0x04 /* System file */
+#define _A_SUBDIR 0x10 /* Subdirectory */
+#define _A_ARCH 0x20 /* Archive file */
+
+/* external variable declarations */
+
+#if defined(_WIN32_) || defined(_POSIX_)
+
+#ifdef _DLL
+
+#define _osversion (*_osversion_dll)
+#define _osmajor (*_osmajor_dll)
+#define _osminor (*_osminor_dll)
+#define _baseversion (*_baseversion_dll)
+#define _basemajor (*_basemajor_dll)
+#define _baseminor (*_baseminor_dll)
+#define _pgmptr (*_pgmptr_dll)
+
+extern unsigned int * _osversion_dll;
+extern unsigned int * _osmajor_dll;
+extern unsigned int * _osminor_dll;
+extern unsigned int * _baseversion_dll;
+extern unsigned int * _basemajor_dll;
+extern unsigned int * _baseminor_dll;
+extern char ** _pgmptr_dll;
+
+#else
+
+
+extern unsigned int _osversion;
+extern unsigned int _osmajor;
+extern unsigned int _osminor;
+extern unsigned int _baseversion;
+extern unsigned int _basemajor;
+extern unsigned int _baseminor;
+extern char * _pgmptr;
+
+#endif
+
+#else /* ndef (_WIN32_ || _POSIX_) */
+
+extern unsigned int _osversion;
+
+#endif /* _WIN32_ */
+
+
+/* function prototypes */
+
+unsigned _CRTAPI1 _getdiskfree(unsigned, struct _diskfree_t *);
+
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define diskfree_t _diskfree_t
+#endif /* __STDC__ */
+
+/* restore default alignment */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_DOS
+#endif /* _INC_DOS */
diff --git a/private/crtlib/include/errno.h b/private/crtlib/include/errno.h
new file mode 100644
index 000000000..5b892f5a8
--- /dev/null
+++ b/private/crtlib/include/errno.h
@@ -0,0 +1,104 @@
+/***
+*errno.h - system wide error numbers (set by system calls)
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the system-wide error numbers (set by
+* system calls). Conforms to the XENIX standard. Extended
+* for compatibility with Uniforum standard.
+* [System V]
+*
+****/
+
+#ifndef _INC_ERRNO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/* declare reference to errno */
+
+#ifdef _MT
+extern int * _CRTAPI1 _errno(void);
+#define errno (*_errno())
+#else
+extern int errno;
+#endif
+
+/* Error Codes */
+
+#define EPERM 1
+#define ENOENT 2
+#define ESRCH 3
+#define EINTR 4
+#define EIO 5
+#define ENXIO 6
+#define E2BIG 7
+#define ENOEXEC 8
+#define EBADF 9
+#define ECHILD 10
+#define EAGAIN 11
+#define ENOMEM 12
+#define EACCES 13
+#define EFAULT 14
+#define EBUSY 16
+#define EEXIST 17
+#define EXDEV 18
+#define ENODEV 19
+#define ENOTDIR 20
+#define EISDIR 21
+#define EINVAL 22
+#define ENFILE 23
+#define EMFILE 24
+#define ENOTTY 25
+#define EFBIG 27
+#define ENOSPC 28
+#define ESPIPE 29
+#define EROFS 30
+#define EMLINK 31
+#define EPIPE 32
+#define EDOM 33
+#define ERANGE 34
+#define EDEADLK 36
+#define ENAMETOOLONG 38
+#define ENOLCK 39
+#define ENOSYS 40
+#define ENOTEMPTY 41
+#define EILSEQ 42
+
+/*
+ * Support EDEADLOCK for compatibiity with older MS-C versions.
+ */
+#define EDEADLOCK EDEADLK
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_ERRNO
+#endif /* _INC_ERRNO */
diff --git a/private/crtlib/include/excpt.h b/private/crtlib/include/excpt.h
new file mode 100644
index 000000000..c52e38703
--- /dev/null
+++ b/private/crtlib/include/excpt.h
@@ -0,0 +1,135 @@
+/***
+*excpt.h - defines exception values, types and routines
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains the definitions and prototypes for the compiler-
+* dependent intrinsics, support functions and keywords which implement
+* the structured exception handling extensions.
+*
+****/
+
+#ifndef _INC_EXCPT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/*
+ * Exception disposition return values.
+ */
+typedef enum _EXCEPTION_DISPOSITION {
+ ExceptionContinueExecution,
+ ExceptionContinueSearch,
+ ExceptionNestedException,
+ ExceptionCollidedUnwind
+} EXCEPTION_DISPOSITION;
+
+
+/*
+ * Prototype for SEH support function.
+ */
+
+#ifdef _M_IX86
+
+/*
+ * Declarations to keep MS C 8 (386/486) compiler happy
+ */
+struct _EXCEPTION_RECORD;
+struct _CONTEXT;
+
+EXCEPTION_DISPOSITION _CRTAPI2 _except_handler (
+ struct _EXCEPTION_RECORD *ExceptionRecord,
+ void * EstablisherFrame,
+ struct _CONTEXT *ContextRecord,
+ void * DispatcherContext
+ );
+
+#elif defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
+
+/*
+ * Declarations to keep MIPS, ALPHA, and PPC compiler happy
+ */
+typedef struct _EXCEPTION_POINTERS *Exception_info_ptr;
+struct _EXCEPTION_RECORD;
+struct _CONTEXT;
+struct _DISPATCHER_CONTEXT;
+
+
+EXCEPTION_DISPOSITION __C_specific_handler (
+ struct _EXCEPTION_RECORD *ExceptionRecord,
+ void *EstablisherFrame,
+ struct _CONTEXT *ContextRecord,
+ struct _DISPATCHER_CONTEXT *DispatcherContext
+ );
+
+#endif
+
+
+/*
+ * Keywords and intrinsics for SEH
+ */
+
+#ifdef _MSC_VER
+
+#if !defined(__cplusplus)
+#define try __try
+#define except __except
+#define finally __finally
+#define leave __leave
+#endif
+#define GetExceptionCode() (_exception_code())
+#define exception_code() (_exception_code())
+#define GetExceptionInformation() ((struct _EXCEPTION_POINTERS *)_exception_info())
+#define exception_info() ((struct _EXCEPTION_POINTERS *)_exception_info())
+#define AbnormalTermination() (_abnormal_termination())
+#define abnormal_termination() (_abnormal_termination())
+
+unsigned long _CRTAPI1 _exception_code(void);
+void * _CRTAPI1 _exception_info(void);
+int _CRTAPI1 _abnormal_termination(void);
+
+#endif
+
+
+/*
+ * Legal values for expression in except().
+ */
+
+#define EXCEPTION_EXECUTE_HANDLER 1
+#define EXCEPTION_CONTINUE_SEARCH 0
+#define EXCEPTION_CONTINUE_EXECUTION -1
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_EXCPT
+#endif /* _INC_EXCPT */
diff --git a/private/crtlib/include/fcntl.h b/private/crtlib/include/fcntl.h
new file mode 100644
index 000000000..8e6ff76be
--- /dev/null
+++ b/private/crtlib/include/fcntl.h
@@ -0,0 +1,71 @@
+/***
+*fcntl.h - file control options used by open()
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines constants for the file control options used
+* by the _open() function.
+* [System V]
+*
+****/
+
+#ifndef _INC_FCNTL
+
+#define _O_RDONLY 0x0000 /* open for reading only */
+#define _O_WRONLY 0x0001 /* open for writing only */
+#define _O_RDWR 0x0002 /* open for reading and writing */
+#define _O_APPEND 0x0008 /* writes done at eof */
+
+#define _O_CREAT 0x0100 /* create and open file */
+#define _O_TRUNC 0x0200 /* open and truncate */
+#define _O_EXCL 0x0400 /* open only if file doesn't already exist */
+
+/* O_TEXT files have <cr><lf> sequences translated to <lf> on read()'s,
+** and <lf> sequences translated to <cr><lf> on write()'s
+*/
+
+#define _O_TEXT 0x4000 /* file mode is text (translated) */
+#define _O_BINARY 0x8000 /* file mode is binary (untranslated) */
+
+/* macro to translate the C 2.0 name used to force binary mode for files */
+
+#define _O_RAW _O_BINARY
+
+/* Open handle inherit bit */
+
+#define _O_NOINHERIT 0x0080 /* child process doesn't inherit file */
+
+/* Temporary file bit - file is deleted when last handle is closed */
+
+#define _O_TEMPORARY 0x0040 /* temporary file bit */
+
+/* temporary access hint */
+
+#define _O_SHORT_LIVED 0x1000 /* temporary storage file, try not to flush */
+
+/* sequential/random access hints */
+
+#define _O_SEQUENTIAL 0x0020 /* file access is primarily sequential */
+#define _O_RANDOM 0x0010 /* file access is primarily random */
+
+#if !__STDC__ || defined(_POSIX_)
+/* Non-ANSI names for compatibility */
+#define O_RDONLY _O_RDONLY
+#define O_WRONLY _O_WRONLY
+#define O_RDWR _O_RDWR
+#define O_APPEND _O_APPEND
+#define O_CREAT _O_CREAT
+#define O_TRUNC _O_TRUNC
+#define O_EXCL _O_EXCL
+#define O_TEXT _O_TEXT
+#define O_BINARY _O_BINARY
+#define O_RAW _O_BINARY
+#define O_TEMPORARY _O_TEMPORARY
+#define O_NOINHERIT _O_NOINHERIT
+#define O_SEQUENTIAL _O_SEQUENTIAL
+#define O_RANDOM _O_RANDOM
+#endif /* __STDC__ */
+
+#define _INC_FCNTL
+#endif /* _INC_FCNTL */
diff --git a/private/crtlib/include/float.h b/private/crtlib/include/float.h
new file mode 100644
index 000000000..c9bfc43ac
--- /dev/null
+++ b/private/crtlib/include/float.h
@@ -0,0 +1,294 @@
+/***
+*float.h - constants for floating point values
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains defines for a number of implementation dependent
+* values which are commonly used by sophisticated numerical (floating
+* point) programs.
+* [ANSI]
+*
+****/
+
+#ifndef _INC_FLOAT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#define DBL_DIG 15 /* # of decimal digits of precision */
+#define DBL_EPSILON 2.2204460492503131e-016 /* smallest such that 1.0+DBL_EPSILON != 1.0 */
+#define DBL_MANT_DIG 53 /* # of bits in mantissa */
+#define DBL_MAX 1.7976931348623158e+308 /* max value */
+#define DBL_MAX_10_EXP 308 /* max decimal exponent */
+#define DBL_MAX_EXP 1024 /* max binary exponent */
+#define DBL_MIN 2.2250738585072014e-308 /* min positive value */
+#define DBL_MIN_10_EXP (-307) /* min decimal exponent */
+#define DBL_MIN_EXP (-1021) /* min binary exponent */
+#define _DBL_RADIX 2 /* exponent radix */
+#define _DBL_ROUNDS 1 /* addition rounding: near */
+
+#define FLT_DIG 6 /* # of decimal digits of precision */
+#define FLT_EPSILON 1.192092896e-07F /* smallest such that 1.0+FLT_EPSILON != 1.0 */
+#define FLT_GUARD 0
+#define FLT_MANT_DIG 24 /* # of bits in mantissa */
+#define FLT_MAX 3.402823466e+38F /* max value */
+#define FLT_MAX_10_EXP 38 /* max decimal exponent */
+#define FLT_MAX_EXP 128 /* max binary exponent */
+#define FLT_MIN 1.175494351e-38F /* min positive value */
+#define FLT_MIN_10_EXP (-37) /* min decimal exponent */
+#define FLT_MIN_EXP (-125) /* min binary exponent */
+#define FLT_NORMALIZE 0
+#define FLT_RADIX 2 /* exponent radix */
+#define FLT_ROUNDS 1 /* addition rounding: near */
+
+#define LDBL_DIG DBL_DIG /* # of decimal digits of precision */
+#define LDBL_EPSILON DBL_EPSILON /* smallest such that 1.0+LDBL_EPSILON != 1.0 */
+#define LDBL_MANT_DIG DBL_MANT_DIG /* # of bits in mantissa */
+#define LDBL_MAX DBL_MAX /* max value */
+#define LDBL_MAX_10_EXP DBL_MAX_10_EXP /* max decimal exponent */
+#define LDBL_MAX_EXP DBL_MAX_EXP /* max binary exponent */
+#define LDBL_MIN DBL_MIN /* min positive value */
+#define LDBL_MIN_10_EXP DBL_MIN_10_EXP /* min decimal exponent */
+#define LDBL_MIN_EXP DBL_MIN_EXP /* min binary exponent */
+#define _LDBL_RADIX DBL_RADIX /* exponent radix */
+#define _LDBL_ROUNDS DBL_ROUNDS /* addition rounding: near */
+
+
+
+
+/* function prototypes */
+
+unsigned int _CRTAPI1 _clearfp(void);
+unsigned int _CRTAPI1 _controlfp(unsigned int,unsigned int);
+unsigned int _CRTAPI1 _statusfp(void);
+void _CRTAPI1 _fpreset(void);
+
+#define _clear87 _clearfp
+#define _status87 _statusfp
+
+/*
+ * Abstract User Control Word Mask and bit definitions
+ */
+
+#define _MCW_EM 0x0008001f /* interrupt Exception Masks */
+#define _EM_INEXACT 0x00000001 /* inexact (precision) */
+#define _EM_UNDERFLOW 0x00000002 /* underflow */
+#define _EM_OVERFLOW 0x00000004 /* overflow */
+#define _EM_ZERODIVIDE 0x00000008 /* zero divide */
+#define _EM_INVALID 0x00000010 /* invalid */
+
+#define _MCW_RC 0x00000300 /* Rounding Control */
+#define _RC_NEAR 0x00000000 /* near */
+#define _RC_DOWN 0x00000100 /* down */
+#define _RC_UP 0x00000200 /* up */
+#define _RC_CHOP 0x00000300 /* chop */
+
+/*
+ * Abstract User Status Word bit definitions
+ */
+
+#define _SW_INEXACT 0x00000001 /* inexact (precision) */
+#define _SW_UNDERFLOW 0x00000002 /* underflow */
+#define _SW_OVERFLOW 0x00000004 /* overflow */
+#define _SW_ZERODIVIDE 0x00000008 /* zero divide */
+#define _SW_INVALID 0x00000010 /* invalid */
+
+
+/*
+ * i386 specific definitions
+ */
+
+#define _MCW_PC 0x00030000 /* Precision Control */
+#define _PC_64 0x00000000 /* 64 bits */
+#define _PC_53 0x00010000 /* 53 bits */
+#define _PC_24 0x00020000 /* 24 bits */
+
+#define _MCW_IC 0x00040000 /* Infinity Control */
+#define _IC_AFFINE 0x00040000 /* affine */
+#define _IC_PROJECTIVE 0x00000000 /* projective */
+
+#define _EM_DENORMAL 0x00080000 /* denormal exception mask (_control87 only) */
+
+#define _SW_DENORMAL 0x00080000 /* denormal status bit */
+
+
+unsigned int _CRTAPI1 _control87(unsigned int,unsigned int);
+
+
+/*
+ * MIPS R4000 specific definitions
+ */
+
+#define _MCW_DN 0x01000000 /* Denormal Control (R4000) */
+#define _DN_FLUSH 0x01000000 /* flush to zero */
+#define _DN_SAVE 0x00000000 /* save */
+
+
+/* initial Control Word value */
+
+#ifdef _M_IX86
+
+#define _CW_DEFAULT ( _RC_NEAR + _PC_64 + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT )
+
+#elif defined(_M_MRX000) || defined (_M_ALPHA) || defined(_M_PPC)
+
+#define _CW_DEFAULT ( _RC_NEAR + _DN_FLUSH + _EM_INVALID + _EM_ZERODIVIDE + _EM_OVERFLOW + _EM_UNDERFLOW + _EM_INEXACT )
+
+#endif
+
+/* Global variable holding floating point error code */
+
+#ifdef _MT
+extern int * _CRTAPI1 __fpecode(void);
+#define _fpecode (*__fpecode())
+#else
+extern int _fpecode;
+#endif
+
+/* invalid subconditions (_SW_INVALID also set) */
+
+#define _SW_UNEMULATED 0x0040 /* unemulated instruction */
+#define _SW_SQRTNEG 0x0080 /* square root of a neg number */
+#define _SW_STACKOVERFLOW 0x0200 /* FP stack overflow */
+#define _SW_STACKUNDERFLOW 0x0400 /* FP stack underflow */
+
+/* Floating point error signals and return codes */
+
+#define _FPE_INVALID 0x81
+#define _FPE_DENORMAL 0x82
+#define _FPE_ZERODIVIDE 0x83
+#define _FPE_OVERFLOW 0x84
+#define _FPE_UNDERFLOW 0x85
+#define _FPE_INEXACT 0x86
+
+#define _FPE_UNEMULATED 0x87
+#define _FPE_SQRTNEG 0x88
+#define _FPE_STACKOVERFLOW 0x8a
+#define _FPE_STACKUNDERFLOW 0x8b
+
+#define _FPE_EXPLICITGEN 0x8c /* raise( SIGFPE ); */
+
+
+/* IEEE recommended functions */
+
+double _CRTAPI1 _copysign (double, double);
+double _CRTAPI1 _chgsign (double);
+double _CRTAPI1 _scalb(double, long);
+double _CRTAPI1 _logb(double);
+double _CRTAPI1 _nextafter(double, double);
+int _CRTAPI1 _finite(double);
+int _CRTAPI1 _isnan(double);
+int _CRTAPI1 _fpclass(double);
+
+#define _FPCLASS_SNAN 0x0001 /* signaling NaN */
+#define _FPCLASS_QNAN 0x0002 /* quiet NaN */
+#define _FPCLASS_NINF 0x0004 /* negative infinity */
+#define _FPCLASS_NN 0x0008 /* negative normal */
+#define _FPCLASS_ND 0x0010 /* negative denormal */
+#define _FPCLASS_NZ 0x0020 /* -0 */
+#define _FPCLASS_PZ 0x0040 /* +0 */
+#define _FPCLASS_PD 0x0080 /* positive denormal */
+#define _FPCLASS_PN 0x0100 /* positive normal */
+#define _FPCLASS_PINF 0x0200 /* positive infinity */
+
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+
+#define clear87 _clear87
+#define status87 _status87
+#define control87 _control87
+#define fpreset _fpreset
+
+#define DBL_RADIX _DBL_RADIX
+#define DBL_ROUNDS _DBL_ROUNDS
+
+#define LDBL_RADIX _LDBL_RADIX
+#define LDBL_ROUNDS _LDBL_ROUNDS
+
+#define MCW_EM _MCW_EM
+#define EM_INVALID _EM_INVALID
+#define EM_DENORMAL _EM_DENORMAL
+#define EM_ZERODIVIDE _EM_ZERODIVIDE
+#define EM_OVERFLOW _EM_OVERFLOW
+#define EM_UNDERFLOW _EM_UNDERFLOW
+#define EM_INEXACT _EM_INEXACT
+
+#define MCW_IC _MCW_IC
+#define IC_AFFINE _IC_AFFINE
+#define IC_PROJECTIVE _IC_PROJECTIVE
+
+#define MCW_RC _MCW_RC
+#define RC_CHOP _RC_CHOP
+#define RC_UP _RC_UP
+#define RC_DOWN _RC_DOWN
+#define RC_NEAR _RC_NEAR
+
+#define MCW_PC _MCW_PC
+#define PC_24 _PC_24
+#define PC_53 _PC_53
+#define PC_64 _PC_64
+
+#define CW_DEFAULT _CW_DEFAULT
+
+#define SW_INVALID _SW_INVALID
+#define SW_DENORMAL _SW_DENORMAL
+#define SW_ZERODIVIDE _SW_ZERODIVIDE
+#define SW_OVERFLOW _SW_OVERFLOW
+#define SW_UNDERFLOW _SW_UNDERFLOW
+#define SW_INEXACT _SW_INEXACT
+
+#define SW_UNEMULATED _SW_UNEMULATED
+#define SW_SQRTNEG _SW_SQRTNEG
+#define SW_STACKOVERFLOW _SW_STACKOVERFLOW
+#define SW_STACKUNDERFLOW _SW_STACKUNDERFLOW
+
+#define FPE_INVALID _FPE_INVALID
+#define FPE_DENORMAL _FPE_DENORMAL
+#define FPE_ZERODIVIDE _FPE_ZERODIVIDE
+#define FPE_OVERFLOW _FPE_OVERFLOW
+#define FPE_UNDERFLOW _FPE_UNDERFLOW
+#define FPE_INEXACT _FPE_INEXACT
+
+#define FPE_UNEMULATED _FPE_UNEMULATED
+#define FPE_SQRTNEG _FPE_SQRTNEG
+#define FPE_STACKOVERFLOW _FPE_STACKOVERFLOW
+#define FPE_STACKUNDERFLOW _FPE_STACKUNDERFLOW
+
+#define FPE_EXPLICITGEN _FPE_EXPLICITGEN
+
+
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_FLOAT
+#endif /* _INC_FLOAT */
diff --git a/private/crtlib/include/fpieee.h b/private/crtlib/include/fpieee.h
new file mode 100644
index 000000000..92c5688a6
--- /dev/null
+++ b/private/crtlib/include/fpieee.h
@@ -0,0 +1,245 @@
+/***
+* fpieee.h - Definitions for floating point IEEE exception handling
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains constant and type definitions for handling
+* floating point exceptions [ANSI/IEEE std. 754]
+*
+*******************************************************************************/
+
+#ifndef _INC_FPIEEE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+/*
+ * Define floating point IEEE compare result values.
+ */
+
+typedef enum {
+ _FpCompareEqual,
+ _FpCompareGreater,
+ _FpCompareLess,
+ _FpCompareUnordered
+} _FPIEEE_COMPARE_RESULT;
+
+/*
+ * Define floating point format and result precision values.
+ */
+
+typedef enum {
+ _FpFormatFp32,
+ _FpFormatFp64,
+ _FpFormatFp80,
+ _FpFormatFp128,
+ _FpFormatI16,
+ _FpFormatI32,
+ _FpFormatI64,
+ _FpFormatU16,
+ _FpFormatU32,
+ _FpFormatU64,
+ _FpFormatBcd80,
+ _FpFormatCompare,
+ _FpFormatString
+} _FPIEEE_FORMAT;
+
+/*
+ * Define operation code values.
+ *
+ * NOTE: If you change this enum, change the #defines below for assembler!
+ */
+
+typedef enum {
+ _FpCodeUnspecified,
+ _FpCodeAdd,
+ _FpCodeSubtract,
+ _FpCodeMultiply,
+ _FpCodeDivide,
+ _FpCodeSquareRoot,
+ _FpCodeRemainder,
+ _FpCodeCompare,
+ _FpCodeConvert,
+ _FpCodeRound,
+ _FpCodeTruncate,
+ _FpCodeFloor,
+ _FpCodeCeil,
+ _FpCodeAcos,
+ _FpCodeAsin,
+ _FpCodeAtan,
+ _FpCodeAtan2,
+ _FpCodeCabs,
+ _FpCodeCos,
+ _FpCodeCosh,
+ _FpCodeExp,
+ _FpCodeFabs,
+ _FpCodeFmod,
+ _FpCodeFrexp,
+ _FpCodeHypot,
+ _FpCodeLdexp,
+ _FpCodeLog,
+ _FpCodeLog10,
+ _FpCodeModf,
+ _FpCodePow,
+ _FpCodeSin,
+ _FpCodeSinh,
+ _FpCodeTan,
+ _FpCodeTanh,
+ _FpCodeY0,
+ _FpCodeY1,
+ _FpCodeYn,
+ _FpCodeLogb,
+ _FpCodeNextafter,
+ _FpCodeNegate
+
+} _FP_OPERATION_CODE;
+
+#endif /* _LANGUAGE_ASSEMBLY */
+
+
+
+
+/*
+ * Define rounding modes.
+ */
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+typedef enum {
+ _FpRoundNearest,
+ _FpRoundMinusInfinity,
+ _FpRoundPlusInfinity,
+ _FpRoundChopped
+} _FPIEEE_ROUNDING_MODE;
+
+typedef enum {
+ _FpPrecisionFull,
+ _FpPrecision53,
+ _FpPrecision24
+} _FPIEEE_PRECISION;
+
+
+/*
+ * Define floating point context record
+ */
+
+typedef float _FP32;
+typedef double _FP64;
+typedef short _I16;
+typedef int _I32;
+typedef unsigned short _U16;
+typedef unsigned int _U32;
+
+
+typedef struct {
+ unsigned short W[5];
+} _FP80;
+
+typedef struct {
+ unsigned long W[4];
+} _FP128;
+
+typedef struct {
+ unsigned long W[2];
+} _I64;
+
+typedef struct {
+ unsigned long W[2];
+} _U64;
+
+typedef struct {
+ unsigned short W[5];
+} _BCD80;
+
+
+typedef struct {
+ union {
+ _FP32 Fp32Value;
+ _FP64 Fp64Value;
+ _FP80 Fp80Value;
+ _FP128 Fp128Value;
+ _I16 I16Value;
+ _I32 I32Value;
+ _I64 I64Value;
+ _U16 U16Value;
+ _U32 U32Value;
+ _U64 U64Value;
+ _BCD80 Bcd80Value;
+ char *StringValue;
+ int CompareValue;
+ } Value;
+
+ unsigned int OperandValid : 1;
+ unsigned int Format : 4;
+
+} _FPIEEE_VALUE;
+
+
+typedef struct {
+ unsigned int Inexact : 1;
+ unsigned int Underflow : 1;
+ unsigned int Overflow : 1;
+ unsigned int ZeroDivide : 1;
+ unsigned int InvalidOperation : 1;
+} _FPIEEE_EXCEPTION_FLAGS;
+
+
+typedef struct {
+ unsigned int RoundingMode : 2;
+ unsigned int Precision : 3;
+ unsigned int Operation :12;
+ _FPIEEE_EXCEPTION_FLAGS Cause;
+ _FPIEEE_EXCEPTION_FLAGS Enable;
+ _FPIEEE_EXCEPTION_FLAGS Status;
+ _FPIEEE_VALUE Operand1;
+ _FPIEEE_VALUE Operand2;
+ _FPIEEE_VALUE Result;
+} _FPIEEE_RECORD;
+
+
+struct _EXCEPTION_POINTERS;
+
+/*
+ * Floating point IEEE exception filter routine
+ */
+
+int _CRTAPI1 _fpieee_flt(unsigned long code,
+ struct _EXCEPTION_POINTERS *p,
+ int handler(_FPIEEE_RECORD *));
+
+#endif /* _LANGUAGE_ASSEMBLY */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_FPIEEE
+#endif /* _INC_FPIEEE */
diff --git a/private/crtlib/include/fstream.h b/private/crtlib/include/fstream.h
new file mode 100644
index 000000000..aaa2fb8d9
--- /dev/null
+++ b/private/crtlib/include/fstream.h
@@ -0,0 +1,139 @@
+/***
+*fstream.h - definitions/declarations for filebuf and fstream classes
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the filebuf and fstream classes.
+* [AT&T C++]
+*
+****/
+
+#ifndef _INC_FSTREAM
+#define _INC_FSTREAM
+
+#include <iostream.h>
+
+// C4505: "unreferenced local function has been removed"
+#pragma warning(disable:4505) // disable C4505 warning
+// #pragma warning(default:4505) // use this to reenable, if desired
+
+// C4103 : "used #pragma pack to change alignment"
+#pragma warning(disable:4103) // disable C4103 warning
+// #pragma warning(default:4103) // use this to reenable, if desired
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+typedef int filedesc;
+
+class filebuf : public streambuf {
+public:
+static const int openprot; // default share/prot mode for open
+
+// optional share values for 3rd argument (prot) of open or constructor
+static const int sh_none; // exclusive mode no sharing
+static const int sh_read; // allow read sharing
+static const int sh_write; // allow write sharing
+// use (sh_read | sh_write) to allow both read and write sharing
+
+// options for setmode member function
+static const int binary;
+static const int text;
+
+ filebuf();
+ filebuf(filedesc);
+ filebuf(filedesc, char *, int);
+ ~filebuf();
+
+ filebuf* attach(filedesc);
+ filedesc fd() const { return (x_fd==-1) ? EOF : x_fd; }
+ int is_open() const { return (x_fd!=-1); }
+ filebuf* open(const char *, int, int = filebuf::openprot);
+ filebuf* close();
+ int setmode(int = filebuf::text);
+
+virtual int overflow(int=EOF);
+virtual int underflow();
+
+virtual streambuf* setbuf(char *, int);
+virtual streampos seekoff(streamoff, ios::seek_dir, int);
+// virtual streampos seekpos(streampos, int);
+virtual int sync();
+
+private:
+ filedesc x_fd;
+ int x_fOpened;
+};
+
+class ifstream : public istream {
+public:
+ ifstream();
+ ifstream(const char *, int =ios::in, int = filebuf::openprot);
+ ifstream(filedesc);
+ ifstream(filedesc, char *, int);
+ ~ifstream();
+
+ streambuf * setbuf(char *, int);
+ filebuf* rdbuf() const { return (filebuf*) ios::rdbuf(); }
+
+ void attach(filedesc);
+ filedesc fd() const { return rdbuf()->fd(); }
+
+ int is_open() const { return rdbuf()->is_open(); }
+ void open(const char *, int =ios::in, int = filebuf::openprot);
+ void close();
+ int setmode(int mode = filebuf::text) { return rdbuf()->setmode(mode); }
+};
+
+class ofstream : public ostream {
+public:
+ ofstream();
+ ofstream(const char *, int =ios::out, int = filebuf::openprot);
+ ofstream(filedesc);
+ ofstream(filedesc, char *, int);
+ ~ofstream();
+
+ streambuf * setbuf(char *, int);
+ filebuf* rdbuf() const { return (filebuf*) ios::rdbuf(); }
+
+ void attach(filedesc);
+ filedesc fd() const { return rdbuf()->fd(); }
+
+ int is_open() const { return rdbuf()->is_open(); }
+ void open(const char *, int =ios::out, int = filebuf::openprot);
+ void close();
+ int setmode(int mode = filebuf::text) { return rdbuf()->setmode(mode); }
+};
+
+class fstream : public iostream {
+public:
+ fstream();
+ fstream(const char *, int, int = filebuf::openprot);
+ fstream(filedesc);
+ fstream(filedesc, char *, int);
+ ~fstream();
+
+ streambuf * setbuf(char *, int);
+ filebuf* rdbuf() const { return (filebuf*) ostream::rdbuf(); }
+
+ void attach(filedesc);
+ filedesc fd() const { return rdbuf()->fd(); }
+
+ int is_open() const { return rdbuf()->is_open(); }
+ void open(const char *, int, int = filebuf::openprot);
+ void close();
+ int setmode(int mode = filebuf::text) { return rdbuf()->setmode(mode); }
+};
+
+// manipulators to dynamically change file access mode (filebufs only)
+inline ios& binary(ios& _fstrm) \
+ { ((filebuf*)_fstrm.rdbuf())->setmode(filebuf::binary); return _fstrm; }
+inline ios& text(ios& _fstrm) \
+ { ((filebuf*)_fstrm.rdbuf())->setmode(filebuf::text); return _fstrm; }
+
+// Restore default packing
+#pragma pack()
+
+#endif // !_INC_FSTREAM
diff --git a/private/crtlib/include/io.h b/private/crtlib/include/io.h
new file mode 100644
index 000000000..a938e939a
--- /dev/null
+++ b/private/crtlib/include/io.h
@@ -0,0 +1,146 @@
+/***
+*io.h - declarations for low-level file handling and I/O functions
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains the function declarations for the low-level
+* file handling and I/O functions.
+*
+****/
+
+#ifndef _INC_IO
+
+#ifndef _POSIX_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t; /* time value */
+#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
+#endif
+
+#ifndef _FSIZE_T_DEFINED
+typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
+#define _FSIZE_T_DEFINED
+#endif
+
+#ifndef _FINDDATA_T_DEFINED
+
+struct _finddata_t {
+ unsigned attrib;
+ time_t time_create; /* -1 for FAT file systems */
+ time_t time_access; /* -1 for FAT file systems */
+ time_t time_write;
+ _fsize_t size;
+ char name[260];
+};
+
+#define _FINDDATA_T_DEFINED
+
+#endif
+
+/* File attribute constants for _findfirst() */
+
+#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */
+#define _A_RDONLY 0x01 /* Read only file */
+#define _A_HIDDEN 0x02 /* Hidden file */
+#define _A_SYSTEM 0x04 /* System file */
+#define _A_SUBDIR 0x10 /* Subdirectory */
+#define _A_ARCH 0x20 /* Archive file */
+
+/* function prototypes */
+
+int _CRTAPI1 _access(const char *, int);
+int _CRTAPI1 _chmod(const char *, int);
+int _CRTAPI1 _chsize(int, long);
+int _CRTAPI1 _close(int);
+int _CRTAPI1 _commit(int);
+int _CRTAPI1 _creat(const char *, int);
+int _CRTAPI1 _dup(int);
+int _CRTAPI1 _dup2(int, int);
+int _CRTAPI1 _eof(int);
+long _CRTAPI1 _filelength(int);
+long _CRTAPI1 _findfirst(char *, struct _finddata_t *);
+int _CRTAPI1 _findnext(long, struct _finddata_t *);
+int _CRTAPI1 _findclose(long);
+int _CRTAPI1 _isatty(int);
+int _CRTAPI1 _locking(int, int, long);
+long _CRTAPI1 _lseek(int, long, int);
+char * _CRTAPI1 _mktemp(char *);
+int _CRTAPI2 _open(const char *, int, ...);
+int _CRTAPI1 _pipe(int *, unsigned int, int);
+int _CRTAPI1 _read(int, void *, unsigned int);
+int _CRTAPI1 remove(const char *);
+int _CRTAPI1 rename(const char *, const char *);
+int _CRTAPI1 _setmode(int, int);
+int _CRTAPI2 _sopen(const char *, int, int, ...);
+long _CRTAPI1 _tell(int);
+int _CRTAPI1 _umask(int);
+int _CRTAPI1 _unlink(const char *);
+int _CRTAPI1 _write(int, const void *, unsigned int);
+
+
+long _CRTAPI1 _get_osfhandle(int);
+int _CRTAPI1 _open_osfhandle(long, int);
+
+#if !(__STDC__ || defined(__cplusplus))
+/* Non-ANSI names for compatibility */
+#define access _access
+#define chmod _chmod
+#define chsize _chsize
+#define close _close
+#define creat _creat
+#define dup _dup
+#define dup2 _dup2
+#define eof _eof
+#define filelength _filelength
+#define isatty _isatty
+#define locking _locking
+#define lseek _lseek
+#define mktemp _mktemp
+#define open _open
+#define read _read
+#define setmode _setmode
+#define sopen _sopen
+#define tell _tell
+#define umask _umask
+#define unlink _unlink
+#define write _write
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* _POSIX_ */
+
+#define _INC_IO
+#endif /* _INC_IO */
diff --git a/private/crtlib/include/iomanip.h b/private/crtlib/include/iomanip.h
new file mode 100644
index 000000000..3ece0fe16
--- /dev/null
+++ b/private/crtlib/include/iomanip.h
@@ -0,0 +1,128 @@
+/***
+*iomanip.h - definitions/declarations for iostream's parameterized manipulators
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the iostream classes' paramterized manipulators.
+* [AT&T C++]
+*
+****/
+
+#ifndef _INC_IOMANIP
+#define _INC_IOMANIP
+#include <iostream.h>
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+#pragma warning(disable:4505) // disable unwanted /W4 warning
+// #pragma warning(default:4505) // use this to reenable, if necessary
+
+// CONSIDER: use macro to define these
+// #define __MKMANIP(X) \#define X##(T) __##X##_ \#\# T
+// __MKMANIP(SMANIP);
+// __MKMANIP(SAPP);
+// __MKMANIP(IMANIP);
+// __MKMANIP(IAPP);
+// __MKMANIP(OMANIP);
+// __MKMANIP(OAPP);
+// __MKMANIP(IOMANIP);
+// __MKMANIP(IOAPP);
+
+#define SMANIP(T) __SMANIP_##T
+#define SAPP(T) __SAPP_##T
+#define IMANIP(T) __IMANIP_##T
+#define IAPP(T) __IAPP_##T
+#define OMANIP(T) __OMANIP_##T
+#define OAPP(T) __OAPP_##T
+#define IOMANIP(T) __IOMANIP_##T
+#define IOAPP(T) __IOAPP_##T
+
+#define IOMANIPdeclare(T) \
+class SMANIP(T) { \
+public: \
+ SMANIP(T)(ios& (*f)(ios&,T), T t) { _fp = f; _tp = t; } \
+ friend istream& operator>>(istream& s, const SMANIP(T) & sm) { (*(sm._fp))(s,sm._tp); return s; } \
+ friend ostream& operator<<(ostream& s, const SMANIP(T) & sm) { (*(sm._fp))(s,sm._tp); return s; } \
+private: \
+ ios& (* _fp)(ios&,T); \
+ T _tp; \
+}; \
+class SAPP(T) { \
+public: \
+ SAPP(T)( ios& (*f)(ios&,T)) { _fp = f; } \
+ SMANIP(T) operator()(T t) { return SMANIP(T)(_fp,t); } \
+private: \
+ ios& (* _fp)(ios&,T); \
+}; \
+class IMANIP(T) { \
+public: \
+ IMANIP(T)(istream& (*f)(istream&,T), T t) { _fp = f; _tp = t; } \
+ friend istream& operator>>(istream& s, IMANIP(T) & sm) { (*sm._fp)(s,sm._tp); return s; } \
+private: \
+ istream& (* _fp)(istream&,T); \
+ T _tp; \
+}; \
+class IAPP(T) { \
+public: \
+ IAPP(T)( istream& (*f)(istream&,T)) { _fp = f; } \
+ IMANIP(T) operator()(T t) { return IMANIP(T)(_fp,t); } \
+private: \
+ istream& (* _fp)(istream&,T); \
+}; \
+class OMANIP(T) { \
+public: \
+ OMANIP(T)(ostream& (*f)(ostream&,T), T t) { _fp = f; _tp = t; } \
+ friend ostream& operator<<(ostream& s, OMANIP(T) & sm) { (*sm._fp)(s,sm._tp); return s; } \
+private: \
+ ostream& (* _fp)(ostream&,T); \
+ T _tp; \
+}; \
+class OAPP(T) { \
+public: \
+ OAPP(T)(ostream& (*f)(ostream&,T)) { _fp = f; } \
+ OMANIP(T) operator()(T t) { return OMANIP(T)(_fp,t); } \
+private: \
+ ostream& (* _fp)(ostream&,T); \
+}; \
+\
+class IOMANIP(T) { \
+public: \
+ IOMANIP(T)(iostream& (*f)(iostream&,T), T t) { _fp = f; _tp = t; } \
+ friend istream& operator>>(iostream& s, IOMANIP(T) & sm) { (*sm._fp)(s,sm._tp); return s; } \
+ friend ostream& operator<<(iostream& s, IOMANIP(T) & sm) { (*sm._fp)(s,sm._tp); return s; } \
+private: \
+ iostream& (* _fp)(iostream&,T); \
+ T _tp; \
+}; \
+class IOAPP(T) { \
+public: \
+ IOAPP(T)( iostream& (*f)(iostream&,T)) { _fp = f; } \
+ IOMANIP(T) operator()(T t) { return IOMANIP(T)(_fp,t); } \
+private: \
+ iostream& (* _fp)(iostream&,T); \
+}; \
+
+
+IOMANIPdeclare(int)
+
+IOMANIPdeclare(long)
+
+inline ios& __resetiosflags(ios& s, long _flg) { s.setf(0,_flg); return s; }
+inline ios& __setfill(ios& s, int _fc) { s.fill((char)_fc); return s; }
+inline ios& __setiosflags(ios& s, long _flg) { s.setf(_flg); return s; }
+inline ios& __setprecision(ios& s, int _pre) { s.precision(_pre); return s; }
+inline ios& __setw(ios& s, int _wid) { s.width(_wid); return s; }
+
+inline SMANIP(long) resetiosflags(long _l) { return SMANIP(long)(__resetiosflags, _l); }
+inline SMANIP(int) setfill(int _m) {return SMANIP(int)(__setfill, _m); }
+inline SMANIP(long) setiosflags(long _l) {return SMANIP(long)(__setiosflags, _l); }
+inline SMANIP(int) setprecision(int _p) {return SMANIP(int)(__setprecision, _p); }
+inline SMANIP(int) setw(int _w) { return SMANIP(int)(__setw, _w); }
+
+// Restore default packing
+#pragma pack()
+
+#endif // !_INC_IOMANIP
diff --git a/private/crtlib/include/ios.h b/private/crtlib/include/ios.h
new file mode 100644
index 000000000..d9622a49c
--- /dev/null
+++ b/private/crtlib/include/ios.h
@@ -0,0 +1,251 @@
+/***
+*ios.h - definitions/declarations for the ios class.
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the ios class.
+* [AT&T C++]
+*
+****/
+
+#ifndef _INC_IOS
+#define _INC_IOS
+
+
+#ifdef _MT
+#include <windows.h> // critical section declarations
+
+extern "C" {
+void _mtlockinit(PRTL_CRITICAL_SECTION);
+void _mtlock(PRTL_CRITICAL_SECTION);
+void _mtunlock(PRTL_CRITICAL_SECTION);
+}
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef EOF
+#define EOF (-1)
+#endif
+
+// C4505: "unreferenced local function has been removed"
+#pragma warning(disable:4505) // disable C4505 warning
+// #pragma warning(default:4505) // use this to reenable, if desired
+
+// C4103 : "used #pragma pack to change alignment"
+#pragma warning(disable:4103) // disable C4103 warning
+// #pragma warning(default:4103) // use this to reenable, if desired
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+class streambuf;
+class ostream;
+
+class ios {
+
+public:
+ enum io_state { goodbit = 0x00,
+ eofbit = 0x01,
+ failbit = 0x02,
+ badbit = 0x04 };
+
+ enum open_mode { in = 0x01,
+ out = 0x02,
+ ate = 0x04,
+ app = 0x08,
+ trunc = 0x10,
+ nocreate = 0x20,
+ noreplace = 0x40,
+ binary = 0x80 }; // CONSIDER: not in latest spec.
+
+ enum seek_dir { beg=0, cur=1, end=2 };
+
+ enum { skipws = 0x0001,
+ left = 0x0002,
+ right = 0x0004,
+ internal = 0x0008,
+ dec = 0x0010,
+ oct = 0x0020,
+ hex = 0x0040,
+ showbase = 0x0080,
+ showpoint = 0x0100,
+ uppercase = 0x0200,
+ showpos = 0x0400,
+ scientific = 0x0800,
+ fixed = 0x1000,
+ unitbuf = 0x2000,
+ stdio = 0x4000
+ };
+
+ static const long basefield; // dec | oct | hex
+ static const long adjustfield; // left | right | internal
+ static const long floatfield; // scientific | fixed
+
+ ios(streambuf*); // differs from ANSI
+ virtual ~ios();
+
+ inline long flags() const;
+ inline long flags(long _l);
+
+ inline long setf(long _f,long _m);
+ inline long setf(long _l);
+ inline long unsetf(long _l);
+
+ inline int width() const;
+ inline int width(int _i);
+
+ inline ostream* tie(ostream* _os);
+ inline ostream* tie() const;
+
+ inline char fill() const;
+ inline char fill(char _c);
+
+ inline int precision(int _i);
+ inline int precision() const;
+
+ inline int rdstate() const;
+ inline void clear(int _i = 0);
+
+// inline operator void*() const;
+ operator void *() const { if(state&(badbit|failbit) ) return 0; return (void *)this; }
+ inline int operator!() const;
+
+ inline int good() const;
+ inline int eof() const;
+ inline int fail() const;
+ inline int bad() const;
+
+ inline streambuf* rdbuf() const;
+
+ inline long & iword(int) const;
+ inline void * & pword(int) const;
+
+ static long bitalloc();
+ static int xalloc();
+ static void sync_with_stdio();
+
+#ifdef _MT
+ inline void setlock();
+ inline void clrlock();
+ void lock() { if (LockFlg<0) _mtlock(lockptr()); };
+ void unlock() { if (LockFlg<0) _mtunlock(lockptr()); }
+ inline void lockbuf();
+ inline void unlockbuf();
+#else
+ void lock() { }
+ void unlock() { }
+ void lockbuf() { }
+ void unlockbuf() { }
+#endif
+
+protected:
+ ios();
+ ios(const ios&); // treat as private
+ ios& operator=(const ios&);
+ void init(streambuf*);
+
+ enum { skipping, tied };
+ streambuf* bp;
+
+ int state;
+ int ispecial; // not used
+ int ospecial; // not used
+ int isfx_special; // not used
+ int osfx_special; // not used
+ int x_delbuf; // if set, rdbuf() deleted by ~ios
+
+ ostream* x_tie;
+ long x_flags;
+ int x_precision;
+ char x_fill;
+ int x_width;
+
+ static void (*stdioflush)(); // not used
+
+#ifdef _MT
+ static void lockc() { _mtlock(& x_lockc); }
+ static void unlockc() { _mtunlock( & x_lockc); }
+ PRTL_CRITICAL_SECTION lockptr() { return & x_lock; }
+#else
+ static void lockc() { }
+ static void unlockc() { }
+#endif
+
+public:
+ int delbuf() const { return x_delbuf; }
+ void delbuf(int _i) { x_delbuf = _i; }
+
+private:
+ static long x_maxbit;
+ static int x_curindex;
+// consider: make interal static to ios::sync_with_stdio()
+ static int sunk_with_stdio; // make sure sync_with done only once
+#ifdef _MT
+#define MAXINDEX 7
+ static long x_statebuf[MAXINDEX+1]; // used by xalloc()
+ static int fLockcInit; // used to see if x_lockc initialized
+ static RTL_CRITICAL_SECTION x_lockc; // used to lock static (class) data members
+// consider: make pointer and allocate elsewhere
+ int LockFlg; // enable locking flag
+ RTL_CRITICAL_SECTION x_lock; // used for multi-thread lock on object
+#else
+ static long * x_statebuf; // used by xalloc()
+#endif
+};
+
+#include <streamb.h>
+
+inline ios& dec(ios& _strm) { _strm.setf(ios::dec,ios::basefield); return _strm; }
+inline ios& hex(ios& _strm) { _strm.setf(ios::hex,ios::basefield); return _strm; }
+inline ios& oct(ios& _strm) { _strm.setf(ios::oct,ios::basefield); return _strm; }
+
+inline long ios::flags() const { return x_flags; }
+inline long ios::flags(long _l){ long _lO; _lO = x_flags; x_flags = _l; return _lO; }
+
+inline long ios::setf(long _l,long _m){ long _lO; lock(); _lO = x_flags; x_flags = (_l&_m) | (x_flags&(~_m)); unlock(); return _lO; }
+inline long ios::setf(long _l){ long _lO; lock(); _lO = x_flags; x_flags |= _l; unlock(); return _lO; }
+inline long ios::unsetf(long _l){ long _lO; lock(); _lO = x_flags; x_flags &= (~_l); unlock(); return _lO; }
+
+inline int ios::width() const { return x_width; }
+inline int ios::width(int _i){ int _iO; _iO = (int)x_width; x_width = _i; return _iO; }
+
+inline ostream* ios::tie(ostream* _os){ ostream* _osO; _osO = x_tie; x_tie = _os; return _osO; }
+inline ostream* ios::tie() const { return x_tie; }
+inline char ios::fill() const { return x_fill; }
+inline char ios::fill(char _c){ char _cO; _cO = x_fill; x_fill = _c; return _cO; }
+inline int ios::precision(int _i){ int _iO; _iO = (int)x_precision; x_precision = _i; return _iO; }
+inline int ios::precision() const { return x_precision; }
+
+inline int ios::rdstate() const { return state; }
+
+// inline ios::operator void *() const { if(state&(badbit|failbit) ) return 0; return (void *)this; }
+inline int ios::operator!() const { return state&(badbit|failbit); }
+
+inline int ios::bad() const { return state & badbit; }
+// consider: are locks needed on clear() ?
+inline void ios::clear(int _i){ lock(); state = _i; unlock(); }
+inline int ios::eof() const { return state & eofbit; }
+inline int ios::fail() const { return state & (badbit | failbit); }
+inline int ios::good() const { return state == 0; }
+
+inline streambuf* ios::rdbuf() const { return bp; }
+
+inline long & ios::iword(int _i) const { return x_statebuf[_i] ; }
+inline void * & ios::pword(int _i) const { return (void * &)x_statebuf[_i]; }
+
+#ifdef _MT
+ inline void ios::setlock() { LockFlg--; if (bp) bp->setlock(); }
+ inline void ios::clrlock() { if (LockFlg <= 0) LockFlg++; if (bp) bp->clrlock(); }
+ inline void ios::lockbuf() { bp->lock(); }
+ inline void ios::unlockbuf() { bp->unlock(); }
+#endif
+
+// Restore default packing
+#pragma pack()
+
+#endif // !_INC_IOS
diff --git a/private/crtlib/include/iostream.h b/private/crtlib/include/iostream.h
new file mode 100644
index 000000000..ec62fe7ce
--- /dev/null
+++ b/private/crtlib/include/iostream.h
@@ -0,0 +1,70 @@
+/***
+*iostream.h - definitions/declarations for iostream classes
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the iostream classes.
+* [AT&T C++]
+*
+****/
+
+#ifndef _INC_IOSTREAM
+#define _INC_IOSTREAM
+
+typedef long streamoff, streampos;
+
+#include <ios.h> // Define ios.
+
+#include <streamb.h> // Define streambuf.
+
+#include <istream.h> // Define istream.
+
+#include <ostream.h> // Define ostream.
+
+// C4505: "unreferenced local function has been removed"
+#pragma warning(disable:4505) // disable C4505 warning
+// #pragma warning(default:4505) // use this to reenable, if desired
+
+// C4103 : "used #pragma pack to change alignment"
+#pragma warning(disable:4103) // disable C4103 warning
+// #pragma warning(default:4103) // use this to reenable, if desired
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+class iostream : public istream, public ostream {
+public:
+ iostream(streambuf*);
+ virtual ~iostream();
+protected:
+// consider: make private??
+ iostream();
+ iostream(const iostream&);
+inline iostream& operator=(streambuf*);
+inline iostream& operator=(iostream&);
+private:
+ iostream(ios&);
+ iostream(istream&);
+ iostream(ostream&);
+};
+
+inline iostream& iostream::operator=(streambuf* _sb) { istream::operator=(_sb); ostream::operator=(_sb); return *this; }
+
+inline iostream& iostream::operator=(iostream& _strm) { return operator=(_strm.rdbuf()); }
+
+class Iostream_init {
+public:
+ Iostream_init();
+ Iostream_init(ios &, int =0); // treat as private
+ ~Iostream_init();
+};
+
+// used internally
+// static Iostream_init __iostreaminit; // initializes cin/cout/cerr/clog
+
+// Restore default packing
+#pragma pack()
+
+#endif /* !_INC_IOSTREAM */
diff --git a/private/crtlib/include/istream.h b/private/crtlib/include/istream.h
new file mode 100644
index 000000000..626a79e49
--- /dev/null
+++ b/private/crtlib/include/istream.h
@@ -0,0 +1,152 @@
+/***
+*istream.h - definitions/declarations for the istream class
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the istream class.
+* [AT&T C++]
+*
+****/
+
+#ifndef _INC_ISTREAM
+#define _INC_ISTREAM
+
+#include <ios.h>
+
+// C4069: "long double != double"
+#pragma warning(disable:4069) // disable C4069 warning
+// #pragma warning(default:4069) // use this to reenable, if desired
+
+// C4505: "unreferenced local function has been removed"
+#pragma warning(disable:4505) // disable C4505 warning
+// #pragma warning(default:4505) // use this to reenable, if desired
+
+// C4103 : "used #pragma pack to change alignment"
+#pragma warning(disable:4103) // disable C4103 warning
+// #pragma warning(default:4103) // use this to reenable, if desired
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+
+typedef long streamoff, streampos;
+
+class istream : virtual public ios {
+
+public:
+ istream(streambuf*);
+ virtual ~istream();
+
+ int ipfx(int =0);
+ void isfx() { unlockbuf(); unlock(); }
+
+ inline istream& operator>>(istream& (*_f)(istream&));
+ inline istream& operator>>(ios& (*_f)(ios&));
+ istream& operator>>(char *);
+ inline istream& operator>>(unsigned char *);
+ inline istream& operator>>(signed char *);
+ istream& operator>>(char &);
+ inline istream& operator>>(unsigned char &);
+ inline istream& operator>>(signed char &);
+ istream& operator>>(short &);
+ istream& operator>>(unsigned short &);
+ istream& operator>>(int &);
+ istream& operator>>(unsigned int &);
+ istream& operator>>(long &);
+ istream& operator>>(unsigned long &);
+ istream& operator>>(float &);
+ istream& operator>>(double &);
+ istream& operator>>(long double &);
+ istream& operator>>(streambuf*);
+
+ int get();
+ istream& get(char *,int,char ='\n');
+ inline istream& get(unsigned char *,int,char ='\n');
+ inline istream& get(signed char *,int,char ='\n');
+ istream& get(char &);
+ inline istream& get(unsigned char &);
+ inline istream& get(signed char &);
+ istream& get(streambuf&,char ='\n');
+ inline istream& getline(char *,int,char ='\n');
+ inline istream& getline(unsigned char *,int,char ='\n');
+ inline istream& getline(signed char *,int,char ='\n');
+
+ inline istream& ignore(int =1,int =EOF);
+ istream& read(char *,int);
+ inline istream& read(unsigned char *,int);
+ inline istream& read(signed char *,int);
+
+ int gcount() const { return x_gcount; }
+ int peek();
+ istream& putback(char);
+ int sync();
+
+ istream& seekg(streampos);
+ istream& seekg(streamoff,ios::seek_dir);
+ streampos tellg();
+
+ void eatwhite(); // consider: protect and friend with manipulator ws
+protected:
+ istream();
+ istream(const istream&); // treat as private
+ istream& operator=(streambuf* _isb); // treat as private
+ istream& operator=(const istream& _is) { return operator=(_is.rdbuf()); }
+ int do_ipfx(int);
+
+private:
+ istream(ios&);
+ int getint(char *);
+ int getdouble(char *, int);
+ int _fGline;
+ int x_gcount;
+};
+
+ inline istream& istream::operator>>(istream& (*_f)(istream&)) { (*_f)(*this); return *this; }
+ inline istream& istream::operator>>(ios& (*_f)(ios&)) { (*_f)(*this); return *this; }
+
+ inline istream& istream::operator>>(unsigned char * _s) { return operator>>((char *)_s); }
+ inline istream& istream::operator>>(signed char * _s) { return operator>>((char *)_s); }
+
+ inline istream& istream::operator>>(unsigned char & _c) { return operator>>((char &) _c); }
+ inline istream& istream::operator>>(signed char & _c) { return operator>>((char &) _c); }
+
+ inline istream& istream::get(unsigned char * b, int lim ,char delim) { return get((char *)b, lim, delim); }
+ inline istream& istream::get(signed char * b, int lim, char delim) { return get((char *)b, lim, delim); }
+
+ inline istream& istream::get(unsigned char & _c) { return get((char &)_c); }
+ inline istream& istream::get(signed char & _c) { return get((char &)_c); }
+
+ inline istream& istream::getline(char * _b,int _lim,char _delim) { lock(); _fGline++; get(_b, _lim, _delim); unlock(); return *this; }
+ inline istream& istream::getline(unsigned char * _b,int _lim,char _delim) { lock(); _fGline++; get((char *)_b, _lim, _delim); unlock(); return *this; }
+ inline istream& istream::getline(signed char * _b,int _lim,char _delim) { lock(); _fGline++; get((char *)_b, _lim, _delim); unlock(); return *this; }
+
+ inline istream& istream::ignore(int _n,int delim) { lock(); _fGline++; return get((char *)0, _n+1, (char)delim); unlock(); return *this; }
+
+ inline istream& istream::read(unsigned char * _ptr, int _n) { return read((char *) _ptr, _n); }
+ inline istream& istream::read(signed char * _ptr, int _n) { return read((char *) _ptr, _n); }
+
+class istream_withassign : public istream {
+ public:
+ istream_withassign();
+ istream_withassign(streambuf*);
+ ~istream_withassign();
+ istream& operator=(const istream& _is) { return istream::operator=(_is); }
+ istream& operator=(streambuf* _isb) { return istream::operator=(_isb); }
+};
+
+#ifndef _WINDLL // Warning! Not available under Windows without QuickWin:
+extern istream_withassign cin;
+#endif
+
+inline istream& ws(istream& _ins) { _ins.eatwhite(); return _ins; }
+
+ios& dec(ios&);
+ios& hex(ios&);
+ios& oct(ios&);
+
+// Restore default packing
+#pragma pack()
+
+#endif // !_INC_ISTREAM
diff --git a/private/crtlib/include/limits.h b/private/crtlib/include/limits.h
new file mode 100644
index 000000000..1af2da107
--- /dev/null
+++ b/private/crtlib/include/limits.h
@@ -0,0 +1,70 @@
+/***
+*limits.h - implementation dependent values
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains defines for a number of implementation dependent values
+* which are commonly used in C programs.
+* [ANSI]
+*
+****/
+
+#ifndef _INC_LIMITS
+
+#define CHAR_BIT 8 /* number of bits in a char */
+#define SCHAR_MIN (-128) /* minimum signed char value */
+#define SCHAR_MAX 127 /* maximum signed char value */
+#define UCHAR_MAX 0xff /* maximum unsigned char value */
+
+#ifndef _CHAR_UNSIGNED
+#define CHAR_MIN SCHAR_MIN /* mimimum char value */
+#define CHAR_MAX SCHAR_MAX /* maximum char value */
+#else
+#define CHAR_MIN 0
+#define CHAR_MAX UCHAR_MAX
+#endif /* _CHAR_UNSIGNED */
+
+#define MB_LEN_MAX 2 /* max. # bytes in multibyte char */
+#define SHRT_MIN (-32768) /* minimum (signed) short value */
+#define SHRT_MAX 32767 /* maximum (signed) short value */
+#define USHRT_MAX 0xffff /* maximum unsigned short value */
+#define INT_MIN (-2147483647 - 1) /* minimum (signed) int value */
+#define INT_MAX 2147483647 /* maximum (signed) int value */
+#define UINT_MAX 0xffffffff /* maximum unsigned int value */
+#define LONG_MIN (-2147483647 - 1) /* minimum (signed) long value */
+#define LONG_MAX 2147483647 /* maximum (signed) long value */
+#define ULONG_MAX 0xffffffff /* maximum unsigned long value */
+
+#ifdef _POSIX_
+
+#define _POSIX_ARG_MAX 4096
+#define _POSIX_CHILD_MAX 6
+#define _POSIX_LINK_MAX 8
+#define _POSIX_MAX_CANON 255
+#define _POSIX_MAX_INPUT 255
+#define _POSIX_NAME_MAX 14
+#define _POSIX_NGROUPS_MAX 0
+#define _POSIX_OPEN_MAX 16
+#define _POSIX_PATH_MAX 255
+#define _POSIX_PIPE_BUF 512
+#define _POSIX_SSIZE_MAX 32767
+#define _POSIX_STREAM_MAX 8
+#define _POSIX_TZNAME_MAX 3
+
+#define ARG_MAX 14500 /* 16k heap, minus overhead */
+#define MAX_CANON _POSIX_MAX_CANON
+#define MAX_INPUT _POSIX_MAX_INPUT
+#define NAME_MAX 255
+#define NGROUPS_MAX 16
+#define OPEN_MAX 32
+#define PATH_MAX 512
+#define PIPE_BUF _POSIX_PIPE_BUF
+#define SSIZE_MAX _POSIX_SSIZE_MAX
+#define STREAM_MAX 20
+#define TZNAME_MAX 10
+
+#endif /* POSIX */
+
+#define _INC_LIMITS
+#endif /* _INC_LIMITS */
diff --git a/private/crtlib/include/locale.h b/private/crtlib/include/locale.h
new file mode 100644
index 000000000..ad3a5a5f3
--- /dev/null
+++ b/private/crtlib/include/locale.h
@@ -0,0 +1,100 @@
+/***
+*locale.h - definitions/declarations for localization routines
+*
+* Copyright (c) 1988-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the structures, values, macros, and functions
+* used by the localization routines.
+*
+****/
+
+#ifndef _INC_LOCALE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/* define NULL pointer value */
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+/* Locale categories */
+
+#define LC_ALL 0
+#define LC_COLLATE 1
+#define LC_CTYPE 2
+#define LC_MONETARY 3
+#define LC_NUMERIC 4
+#define LC_TIME 5
+
+#define LC_MIN LC_ALL
+#define LC_MAX LC_TIME
+
+/* Locale convention structure */
+
+#ifndef _LCONV_DEFINED
+struct lconv {
+ char *decimal_point;
+ char *thousands_sep;
+ char *grouping;
+ char *int_curr_symbol;
+ char *currency_symbol;
+ char *mon_decimal_point;
+ char *mon_thousands_sep;
+ char *mon_grouping;
+ char *positive_sign;
+ char *negative_sign;
+ char int_frac_digits;
+ char frac_digits;
+ char p_cs_precedes;
+ char p_sep_by_space;
+ char n_cs_precedes;
+ char n_sep_by_space;
+ char p_sign_posn;
+ char n_sign_posn;
+ };
+#define _LCONV_DEFINED
+#endif
+
+/* function prototypes */
+
+char * _CRTAPI1 setlocale(int, const char *);
+struct lconv * _CRTAPI1 localeconv(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_LOCALE
+#endif /* _INC_LOCALE */
diff --git a/private/crtlib/include/malloc.h b/private/crtlib/include/malloc.h
new file mode 100644
index 000000000..d199ba6fd
--- /dev/null
+++ b/private/crtlib/include/malloc.h
@@ -0,0 +1,101 @@
+/***
+*malloc.h - declarations and definitions for memory allocation functions
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains the function declarations for memory allocation functions;
+* also defines manifest constants and types used by the heap routines.
+* [System V]
+*
+****/
+
+#ifndef _INC_MALLOC
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+/* maximum heap request that can ever be honored */
+#define _HEAP_MAXREQ 0xFFFFFFD8
+
+/* constants for _heapchk/_heapset/_heapwalk routines */
+#define _HEAPEMPTY (-1)
+#define _HEAPOK (-2)
+#define _HEAPBADBEGIN (-3)
+#define _HEAPBADNODE (-4)
+#define _HEAPEND (-5)
+#define _HEAPBADPTR (-6)
+#define _FREEENTRY 0
+#define _USEDENTRY 1
+
+#ifndef _HEAPINFO_DEFINED
+typedef struct _heapinfo {
+ int * _pentry;
+ size_t _size;
+ int _useflag;
+ } _HEAPINFO;
+#define _HEAPINFO_DEFINED
+#endif
+
+
+/* function prototypes */
+void * _CRTAPI1 calloc(size_t, size_t);
+void _CRTAPI1 free(void *);
+void * _CRTAPI1 malloc(size_t);
+void * _CRTAPI1 realloc(void *, size_t);
+
+#ifndef _POSIX_
+void * _CRTAPI1 _alloca(size_t);
+void * _CRTAPI1 _expand(void *, size_t);
+int _CRTAPI1 _heapchk(void);
+int _CRTAPI1 _heapmin(void);
+int _CRTAPI1 _heapset(unsigned int);
+int _CRTAPI1 _heapwalk(_HEAPINFO *);
+size_t _CRTAPI1 _msize(void *);
+#endif /* !_POSIX_ */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define alloca _alloca
+#endif /* __STDC__*/
+
+#if defined(_M_MRX000) || defined(_M_PPC)
+#pragma intrinsic(_alloca)
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_MALLOC
+#endif /* _INC_MALLOC */
diff --git a/private/crtlib/include/math.h b/private/crtlib/include/math.h
new file mode 100644
index 000000000..221ea5421
--- /dev/null
+++ b/private/crtlib/include/math.h
@@ -0,0 +1,226 @@
+/***
+*math.h - definitions and declarations for math library
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains constant definitions and external subroutine
+* declarations for the math subroutine library.
+* [ANSI/System V]
+*
+****/
+
+#ifndef _INC_MATH
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/* definition of _exception struct - this struct is passed to the matherr
+ * routine when a floating point exception is detected
+ */
+
+#ifndef _EXCEPTION_DEFINED
+struct _exception {
+ int type; /* exception type - see below */
+ char *name; /* name of function where error occured */
+ double arg1; /* first argument to function */
+ double arg2; /* second argument (if any) to function */
+ double retval; /* value to be returned by function */
+ } ;
+
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define exception _exception
+#endif
+
+#define _EXCEPTION_DEFINED
+#endif
+
+
+/* definition of a _complex struct to be used by those who use cabs and
+ * want type checking on their argument
+ */
+
+#ifndef _COMPLEX_DEFINED
+struct _complex {
+ double x,y; /* real and imaginary parts */
+ } ;
+
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define complex _complex
+#endif
+
+#define _COMPLEX_DEFINED
+#endif
+
+#endif /* _LANGUAGE_ASSEMBLY */
+
+
+/* Constant definitions for the exception type passed in the _exception struct
+ */
+
+#define _DOMAIN 1 /* argument domain error */
+#define _SING 2 /* argument singularity */
+#define _OVERFLOW 3 /* overflow range error */
+#define _UNDERFLOW 4 /* underflow range error */
+#define _TLOSS 5 /* total loss of precision */
+#define _PLOSS 6 /* partial loss of precision */
+
+#define EDOM 33
+#define ERANGE 34
+
+
+/* definitions of _HUGE and HUGE_VAL - respectively the XENIX and ANSI names
+ * for a value returned in case of error by a number of the floating point
+ * math routines
+ */
+#ifndef _LANGUAGE_ASSEMBLY
+#ifdef _DLL
+#define _HUGE (*_HUGE_dll)
+extern double * _HUGE_dll;
+#else
+extern double _HUGE;
+#endif
+#endif /* _LANGUAGE_ASSEMBLY */
+
+#define HUGE_VAL _HUGE
+
+/* function prototypes */
+
+#ifndef _LANGUAGE_ASSEMBLY
+int _CRTAPI1 abs(int);
+double _CRTAPI1 acos(double);
+double _CRTAPI1 asin(double);
+double _CRTAPI1 atan(double);
+double _CRTAPI1 atan2(double, double);
+double _CRTAPI1 atof(const char *);
+double _CRTAPI1 _cabs(struct _complex);
+double _CRTAPI1 ceil(double);
+double _CRTAPI1 cos(double);
+double _CRTAPI1 cosh(double);
+double _CRTAPI1 exp(double);
+double _CRTAPI1 fabs(double);
+double _CRTAPI1 floor(double);
+double _CRTAPI1 fmod(double, double);
+double _CRTAPI1 frexp(double, int *);
+double _CRTAPI1 _hypot(double, double);
+double _CRTAPI1 _j0(double);
+double _CRTAPI1 _j1(double);
+double _CRTAPI1 _jn(int, double);
+long _CRTAPI1 labs(long);
+double _CRTAPI1 ldexp(double, int);
+double _CRTAPI1 log(double);
+double _CRTAPI1 log10(double);
+int _CRTAPI1 _matherr(struct _exception *);
+double _CRTAPI1 modf(double, double *);
+double _CRTAPI1 pow(double, double);
+double _CRTAPI1 sin(double);
+double _CRTAPI1 sinh(double);
+double _CRTAPI1 sqrt(double);
+double _CRTAPI1 tan(double);
+double _CRTAPI1 tanh(double);
+double _CRTAPI1 _y0(double);
+double _CRTAPI1 _y1(double);
+double _CRTAPI1 _yn(int, double);
+#ifdef _M_MRX000
+
+/* MIPS fast prototypes for float */
+/* ANSI C, 4.5 Mathematics */
+
+/* 4.5.2 Trigonometric functions */
+
+float __cdecl acosf( float );
+float __cdecl asinf( float );
+float __cdecl atanf( float );
+float __cdecl atan2f( float , float );
+float __cdecl cosf( float );
+float __cdecl sinf( float );
+float __cdecl tanf( float );
+
+/* 4.5.3 Hyperbolic functions */
+float __cdecl coshf( float );
+float __cdecl sinhf( float );
+float __cdecl tanhf( float );
+
+/* 4.5.4 Exponential and logarithmic functions */
+float __cdecl expf( float );
+float __cdecl logf( float );
+float __cdecl log10f( float );
+float __cdecl modff( float , float* );
+
+/* 4.5.5 Power functions */
+float __cdecl powf( float , float );
+float __cdecl sqrtf( float );
+
+/* 4.5.6 Nearest integer, absolute value, and remainder functions */
+float __cdecl ceilf( float );
+float __cdecl fabsf( float );
+float __cdecl floorf( float );
+float __cdecl fmodf( float , float );
+
+#endif /* _M_MRX000 */
+
+#endif /* _LANGUAGE_ASSEMBLY */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+
+#define DOMAIN _DOMAIN
+#define SING _SING
+#define OVERFLOW _OVERFLOW
+#define UNDERFLOW _UNDERFLOW
+#define TLOSS _TLOSS
+#define PLOSS _PLOSS
+
+#define matherr _matherr
+
+#define HUGE _HUGE
+
+#define cabs _cabs
+#define hypot _hypot
+#define j0 _j0
+#define j1 _j1
+#define jn _jn
+#define matherr _matherr
+#define y0 _y0
+#define y1 _y1
+#define yn _yn
+
+#define cabsl _cabsl
+#define hypotl _hypotl
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_MATH
+#endif /* _INC_MATH */
diff --git a/private/crtlib/include/mbctype.h b/private/crtlib/include/mbctype.h
new file mode 100644
index 000000000..490eccad5
--- /dev/null
+++ b/private/crtlib/include/mbctype.h
@@ -0,0 +1,116 @@
+/***
+*mbctype.h - MBCS character conversion macros
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Defines macros for MBCS character classification/conversion.
+*
+*******************************************************************************/
+
+/* include the standard ctype.h header file */
+
+#include <ctype.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/*
+ * MBCS - Multi-Byte Character Set
+ */
+
+/*
+ * This declaration allows the user access the _mbctype[] look-up array.
+ */
+
+#ifdef _DLL
+extern unsigned char * _mbctype;
+#else
+extern unsigned char _mbctype[];
+#endif
+
+/* bit masks for MBCS character types */
+
+#define _MS 0x01 /* MBCS single-byte symbol */
+#define _MP 0x02 /* MBCS punct */
+#define _M1 0x04 /* MBCS 1st (lead) byte */
+#define _M2 0x08 /* MBCS 2nd byte*/
+
+/* byte types */
+
+#define _MBC_SINGLE 0 /* valid single byte char */
+#define _MBC_LEAD 1 /* lead byte */
+#define _MBC_TRAIL 2 /* trailing byte */
+#define _MBC_ILLEGAL (-1) /* illegal byte */
+
+
+/* MBCS character classification function prototypes */
+
+#ifndef _MBCTYPE_DEFINED
+
+/* byte routines */
+int _CRTAPI1 _ismbbkalnum( unsigned int );
+int _CRTAPI1 _ismbbkana( unsigned int );
+int _CRTAPI1 _ismbbkpunct( unsigned int );
+int _CRTAPI1 _ismbbalpha( unsigned int );
+int _CRTAPI1 _ismbbpunct( unsigned int );
+int _CRTAPI1 _ismbbalnum( unsigned int );
+int _CRTAPI1 _ismbbprint( unsigned int );
+int _CRTAPI1 _ismbbgraph( unsigned int );
+
+#ifndef _MBLEADTRAIL_DEFINED
+int _CRTAPI1 _ismbblead( unsigned int );
+int _CRTAPI1 _ismbbtrail( unsigned int );
+int _CRTAPI1 _ismbslead( const unsigned char *, const unsigned char *);
+int _CRTAPI1 _ismbstrail( const unsigned char *, const unsigned char *);
+#define _MBLEADTRAIL_DEFINED
+#endif
+
+#define _MBCTYPE_DEFINED
+#endif
+
+/*
+ * char byte classification macros
+ */
+
+#define _ismbbkana(_c) ((_mbctype+1)[(unsigned char)(_c)] & (_MS|_MP))
+#define _ismbbkpunct(_c) ((_mbctype+1)[(unsigned char)(_c)] & _MP)
+#define _ismbbkalnum(_c) ((_mbctype+1)[(unsigned char)(_c)] & _MS)
+#define _ismbbalpha(_c) (((_ctype+1)[(unsigned char)(_c)] & (_UPPER|_LOWER))||_ismbbkalnum(_c))
+#define _ismbbpunct(_c) (((_ctype+1)[(unsigned char)(_c)] & _PUNCT)||_ismbbkpunct(_c))
+#define _ismbbalnum(_c) (((_ctype+1)[(unsigned char)(_c)] & (_UPPER|_LOWER|_DIGIT))||_ismbbkalnum(_c))
+#define _ismbbprint(_c) (((_ctype+1)[(unsigned char)(_c)] & (_BLANK|_PUNCT|_UPPER|_LOWER|_DIGIT))||_ismbbkana(_c))
+#define _ismbbgraph(_c) (((_ctype+1)[(unsigned char)(_c)] & (_PUNCT|_UPPER|_LOWER|_DIGIT))||_ismbbkana(_c))
+
+#define _ismbblead(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M1)
+#define _ismbbtrail(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M2)
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/private/crtlib/include/mbstring.h b/private/crtlib/include/mbstring.h
new file mode 100644
index 000000000..380672b2d
--- /dev/null
+++ b/private/crtlib/include/mbstring.h
@@ -0,0 +1,139 @@
+/***
+* mbstring.h - MBCS string manipulation macros and functions
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains macros and function declarations for the MBCS
+* string manipulation functions.
+*
+*******************************************************************************/
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+/*
+ * MBCS - Multi-Byte Character Set
+ */
+
+#ifndef _MBSTRING_DEFINED
+
+/* function prototypes */
+
+unsigned int _CRTAPI1 _mbbtombc(unsigned int);
+int _CRTAPI1 _mbbtype(unsigned char, int);
+unsigned int _CRTAPI1 _mbctombb(unsigned int);
+int _CRTAPI1 _mbsbtype(const unsigned char *, size_t);
+unsigned char * _CRTAPI1 _mbscat(unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbschr(const unsigned char *, unsigned int);
+int _CRTAPI1 _mbscmp(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbscpy(unsigned char *, const unsigned char *);
+size_t _CRTAPI1 _mbscspn(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbsdec(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbsdup(const unsigned char *);
+int _CRTAPI1 _mbsicmp(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbsinc(const unsigned char *);
+size_t _CRTAPI1 _mbslen(const unsigned char *);
+unsigned char * _CRTAPI1 _mbslwr(unsigned char *);
+unsigned char * _CRTAPI1 _mbsnbcat(unsigned char *, const unsigned char *, size_t);
+int _CRTAPI1 _mbsnbcmp(const unsigned char *, const unsigned char *, size_t);
+size_t _CRTAPI1 _mbsnbcnt(const unsigned char *, size_t);
+unsigned char * _CRTAPI1 _mbsnbcpy(unsigned char *, const unsigned char *, size_t);
+int _CRTAPI1 _mbsnbicmp(const unsigned char *, const unsigned char *, size_t);
+unsigned char * _CRTAPI1 _mbsnbset(unsigned char *, unsigned int, size_t);
+unsigned char * _CRTAPI1 _mbsncat(unsigned char *, const unsigned char *, size_t);
+size_t _CRTAPI1 _mbsnccnt(const unsigned char *, size_t);
+int _CRTAPI1 _mbsncmp(const unsigned char *, const unsigned char *, size_t);
+unsigned char * _CRTAPI1 _mbsncpy(unsigned char *, const unsigned char *, size_t);
+unsigned int _CRTAPI1 _mbsnextc (const unsigned char *);
+int _CRTAPI1 _mbsnicmp(const unsigned char *, const unsigned char *, size_t);
+unsigned char * _CRTAPI1 _mbsninc(const unsigned char *, size_t);
+unsigned char * _CRTAPI1 _mbsnset(unsigned char *, unsigned int, size_t);
+unsigned char * _CRTAPI1 _mbspbrk(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbsrchr(const unsigned char *, unsigned int);
+unsigned char * _CRTAPI1 _mbsrev(unsigned char *);
+unsigned char * _CRTAPI1 _mbsset(unsigned char *, unsigned int);
+size_t _CRTAPI1 _mbsspn(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbsspnp(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbsstr(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbstok(unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _mbsupr(unsigned char *);
+
+size_t _CRTAPI1 _mbclen(const unsigned char *);
+void _CRTAPI1 _mbccpy(unsigned char *, const unsigned char *);
+#define _mbccmp(_cpc1, _cpc2) _mbsncmp((_cpc1),(_cpc2),1)
+
+/* character routines */
+
+int _CRTAPI1 _ismbcalpha(unsigned int);
+int _CRTAPI1 _ismbcdigit(unsigned int);
+int _CRTAPI1 _ismbclegal(unsigned int);
+int _CRTAPI1 _ismbclower(unsigned int);
+int _CRTAPI1 _ismbcprint(unsigned int);
+int _CRTAPI1 _ismbcspace(unsigned int);
+int _CRTAPI1 _ismbcupper(unsigned int);
+
+unsigned int _CRTAPI1 _mbctolower(unsigned int);
+unsigned int _CRTAPI1 _mbctoupper(unsigned int);
+
+#define _MBSTRING_DEFINED
+#endif
+
+#ifndef _MBLEADTRAIL_DEFINED
+int _CRTAPI1 _ismbblead( unsigned int );
+int _CRTAPI1 _ismbbtrail( unsigned int );
+int _CRTAPI1 _ismbslead( const unsigned char *, const unsigned char *);
+int _CRTAPI1 _ismbstrail( const unsigned char *, const unsigned char *);
+#define _MBLEADTRAIL_DEFINED
+#endif
+
+
+/* Kanji specific prototypes. */
+
+int _CRTAPI1 _ismbchira(unsigned int);
+int _CRTAPI1 _ismbckata(unsigned int);
+int _CRTAPI1 _ismbcsymbol(unsigned int);
+int _CRTAPI1 _ismbcl0(unsigned int);
+int _CRTAPI1 _ismbcl1(unsigned int);
+int _CRTAPI1 _ismbcl2(unsigned int);
+unsigned int _CRTAPI1 _mbcjistojms(unsigned int);
+unsigned int _CRTAPI1 _mbcjmstojis(unsigned int);
+unsigned int _CRTAPI1 _mbctohira(unsigned int);
+unsigned int _CRTAPI1 _mbctokata(unsigned int);
+
+
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/private/crtlib/include/memory.h b/private/crtlib/include/memory.h
new file mode 100644
index 000000000..aa61f0e3b
--- /dev/null
+++ b/private/crtlib/include/memory.h
@@ -0,0 +1,69 @@
+/***
+*memory.h - declarations for buffer (memory) manipulation routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This include file contains the function declarations for the
+* buffer (memory) manipulation routines.
+* [System V]
+*
+****/
+
+#ifndef _INC_MEMORY
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+
+/* function prototypes */
+
+void * _CRTAPI1 _memccpy(void *, const void *, int, unsigned int);
+void * _CRTAPI1 memchr(const void *, int, size_t);
+int _CRTAPI1 memcmp(const void *, const void *, size_t);
+void * _CRTAPI1 memcpy(void *, const void *, size_t);
+int _CRTAPI1 _memicmp(const void *, const void *, unsigned int);
+void * _CRTAPI1 memset(void *, int, size_t);
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define memccpy _memccpy
+#define memicmp _memicmp
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_MEMORY
+#endif /* _INC_MEMORY */
diff --git a/private/crtlib/include/new.h b/private/crtlib/include/new.h
new file mode 100644
index 000000000..831e10837
--- /dev/null
+++ b/private/crtlib/include/new.h
@@ -0,0 +1,51 @@
+/***
+*new.h - declarations and definitions for C++ memory allocation functions
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains the declarations for C++ memory allocation functions.
+*
+****/
+
+#ifndef __INC_NEW
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/* types and structures */
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+typedef int (_CRTAPI1 * _PNH)( size_t );
+
+/* function prototypes */
+
+_PNH _CRTAPI1 _set_new_handler( _PNH );
+
+#define __INC_NEW
+#endif
diff --git a/private/crtlib/include/ostream.h b/private/crtlib/include/ostream.h
new file mode 100644
index 000000000..c7add21ab
--- /dev/null
+++ b/private/crtlib/include/ostream.h
@@ -0,0 +1,128 @@
+/***
+*ostream.h - definitions/declarations for the ostream class
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the ostream class.
+* [AT&T C++]
+*
+****/
+
+#ifndef _INC_OSTREAM
+#define _INC_OSTREAM
+
+#include <ios.h>
+
+// C4505: "unreferenced local function has been removed"
+#pragma warning(disable:4505) // disable C4505 warning
+// #pragma warning(default:4505) // use this to reenable, if desired
+
+// C4103 : "used #pragma pack to change alignment"
+#pragma warning(disable:4103) // disable C4103 warning
+// #pragma warning(default:4103) // use this to reenable, if desired
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+typedef long streamoff, streampos;
+
+class ostream : virtual public ios {
+
+public:
+ ostream(streambuf*);
+ virtual ~ostream();
+
+ ostream& flush();
+ int opfx();
+ void osfx();
+
+inline ostream& operator<<(ostream& (*f)(ostream&));
+inline ostream& operator<<(ios& (*f)(ios&));
+ ostream& operator<<(const char *);
+inline ostream& operator<<(const unsigned char *);
+inline ostream& operator<<(const signed char *);
+inline ostream& operator<<(char);
+ ostream& operator<<(unsigned char);
+inline ostream& operator<<(signed char);
+ ostream& operator<<(short);
+ ostream& operator<<(unsigned short);
+ ostream& operator<<(int);
+ ostream& operator<<(unsigned int);
+ ostream& operator<<(long);
+ ostream& operator<<(unsigned long);
+inline ostream& operator<<(float);
+ ostream& operator<<(double);
+ ostream& operator<<(long double);
+ ostream& operator<<(const void *);
+ ostream& operator<<(streambuf*);
+inline ostream& put(char);
+ ostream& put(unsigned char);
+inline ostream& put(signed char);
+ ostream& write(const char *,int);
+inline ostream& write(const unsigned char *,int);
+inline ostream& write(const signed char *,int);
+ ostream& seekp(streampos);
+ ostream& seekp(streamoff,ios::seek_dir);
+ streampos tellp();
+
+protected:
+ ostream();
+ ostream(const ostream&); // treat as private
+ ostream& operator=(streambuf*); // treat as private
+ ostream& operator=(const ostream& _os) {return operator=(_os.rdbuf()); }
+ int do_opfx(int); // not used
+ void do_osfx(); // not used
+
+private:
+ ostream(ios&);
+ ostream& writepad(const char *, const char *);
+ int x_floatused;
+};
+
+inline ostream& ostream::operator<<(ostream& (*f)(ostream&)) { (*f)(*this); return *this; }
+inline ostream& ostream::operator<<(ios& (*f)(ios& )) { (*f)(*this); return *this; }
+
+inline ostream& ostream::operator<<(char c) { return operator<<((unsigned char) c); }
+inline ostream& ostream::operator<<(signed char c) { return operator<<((unsigned char) c); }
+
+inline ostream& ostream::operator<<(const unsigned char * s) { return operator<<((const char *) s); }
+inline ostream& ostream::operator<<(const signed char * s) { return operator<<((const char *) s); }
+
+inline ostream& ostream::operator<<(float f) { x_floatused = 1; return operator<<((double) f); }
+
+inline ostream& ostream::put(char c) { return put((unsigned char) c); }
+inline ostream& ostream::put(signed char c) { return put((unsigned char) c); }
+
+inline ostream& ostream::write(const unsigned char * s, int n) { return write((char *) s, n); }
+inline ostream& ostream::write(const signed char * s, int n) { return write((char *) s, n); }
+
+
+class ostream_withassign : public ostream {
+ public:
+ ostream_withassign();
+ ostream_withassign(streambuf* _is);
+ ~ostream_withassign();
+ ostream& operator=(const ostream& _os) { return ostream::operator=(_os.rdbuf()); }
+ ostream& operator=(streambuf* _sb) { return ostream::operator=(_sb); }
+};
+
+#ifndef _WINDLL // Warning! Not available under Windows without QuickWin:
+extern ostream_withassign cout;
+extern ostream_withassign cerr;
+extern ostream_withassign clog;
+#endif
+
+inline ostream& flush(ostream& _outs) { return _outs.flush(); }
+inline ostream& endl(ostream& _outs) { return _outs << '\n' << flush; }
+inline ostream& ends(ostream& _outs) { return _outs << char('\0'); }
+
+ios& dec(ios&);
+ios& hex(ios&);
+ios& oct(ios&);
+
+// Restore default packing
+#pragma pack()
+
+#endif // !_INC_OSTREAM
diff --git a/private/crtlib/include/process.h b/private/crtlib/include/process.h
new file mode 100644
index 000000000..97d7930bc
--- /dev/null
+++ b/private/crtlib/include/process.h
@@ -0,0 +1,173 @@
+/***
+*process.h - definition and declarations for process control functions
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the modeflag values for spawnxx calls.
+* Only P_WAIT and P_OVERLAY are currently implemented on MS-DOS.
+* Also contains the function argument declarations for all
+* process control related routines.
+*
+****/
+
+#ifndef _INC_PROCESS
+
+#ifndef _POSIX_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/* modeflag values for _spawnxx routines */
+
+#ifndef _MT
+extern int _p_overlay;
+#endif
+
+#define _P_WAIT 0
+#define _P_NOWAIT 1
+#ifdef _MT
+#define _P_OVERLAY 2
+#else
+#define _P_OVERLAY _p_overlay
+#endif
+#define _OLD_P_OVERLAY 2
+#define _P_NOWAITO 3
+#define _P_DETACH 4
+
+
+/* Action codes for _cwait(). The action code argument to _cwait is ignored
+ on Win32 though it is accepted for compatibilty with OS/2 */
+
+#define _WAIT_CHILD 0
+#define _WAIT_GRANDCHILD 1
+
+
+/* function prototypes */
+
+#ifdef _MT
+unsigned long _CRTAPI1 _beginthread (void (_CRTAPI1 *) (void *),
+ unsigned, void *);
+void _CRTAPI1 _endthread(void);
+#endif
+void _CRTAPI1 abort(void);
+void _CRTAPI1 _cexit(void);
+void _CRTAPI1 _c_exit(void);
+int _CRTAPI1 _cwait(int *, int, int);
+int _CRTAPI2 _execl(const char *, const char *, ...);
+int _CRTAPI2 _execle(const char *, const char *, ...);
+int _CRTAPI2 _execlp(const char *, const char *, ...);
+int _CRTAPI2 _execlpe(const char *, const char *, ...);
+int _CRTAPI1 _execv(const char *, const char * const *);
+int _CRTAPI1 _execve(const char *, const char * const *, const char * const *);
+int _CRTAPI1 _execvp(const char *, const char * const *);
+int _CRTAPI1 _execvpe(const char *, const char * const *, const char * const *);
+void _CRTAPI1 exit(int);
+void _CRTAPI1 _exit(int);
+int _CRTAPI1 _getpid(void);
+int _CRTAPI2 _spawnl(int, const char *, const char *, ...);
+int _CRTAPI2 _spawnle(int, const char *, const char *, ...);
+int _CRTAPI2 _spawnlp(int, const char *, const char *, ...);
+int _CRTAPI2 _spawnlpe(int, const char *, const char *, ...);
+int _CRTAPI1 _spawnv(int, const char *, const char * const *);
+int _CRTAPI1 _spawnve(int, const char *, const char * const *,
+ const char * const *);
+int _CRTAPI1 _spawnvp(int, const char *, const char * const *);
+int _CRTAPI1 _spawnvpe(int, const char *, const char * const *,
+ const char * const *);
+int _CRTAPI1 system(const char *);
+int _CRTAPI1 _loaddll(char *);
+int _CRTAPI1 _unloaddll(int);
+int (_CRTAPI1 * _CRTAPI1 _getdllprocaddr(int, char *, int))();
+
+#ifdef _DECL_DLLMAIN
+/*
+ * Declare DLL notification (initialization/termination) routines
+ * The preferred method is for the user to provide DllMain() which will
+ * be called automatically by the DLL entry point defined by the C run-
+ * time library code. If the user wants to define the DLL entry point
+ * routine, the user's entry point must call _CRT_INIT on all types of
+ * notifications, as the very first thing on attach notifications and
+ * as the very last thing on detach notifications.
+ */
+#ifdef _WINDOWS_ /* Use types from WINDOWS.H */
+BOOL WINAPI DllMain(HANDLE, DWORD, LPVOID);
+BOOL WINAPI _CRT_INIT(HANDLE, DWORD, LPVOID);
+#else
+#ifdef _M_IX86
+int __stdcall DllMain(void *, unsigned, void *);
+int __stdcall _CRT_INIT(void *, unsigned, void *);
+#else
+int DllMain(void *, unsigned, void *);
+int _CRT_INIT(void *, unsigned, void *);
+#endif
+#endif /* _WINDOWS_ */
+#endif /* _DECL_DLLMAIN */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+
+#define P_WAIT _P_WAIT
+#define P_NOWAIT _P_NOWAIT
+#define P_OVERLAY _P_OVERLAY
+#define OLD_P_OVERLAY _OLD_P_OVERLAY
+#define P_NOWAITO _P_NOWAITO
+#define P_DETACH _P_DETACH
+
+#define WAIT_CHILD _WAIT_CHILD
+#define WAIT_GRANDCHILD _WAIT_GRANDCHILD
+
+#define cwait _cwait
+#define execl _execl
+#define execle _execle
+#define execlp _execlp
+#define execlpe _execlpe
+#define execv _execv
+#define execve _execve
+#define execvp _execvp
+#define execvpe _execvpe
+#define getpid _getpid
+#define spawnl _spawnl
+#define spawnle _spawnle
+#define spawnlp _spawnlp
+#define spawnlpe _spawnlpe
+#define spawnv _spawnv
+#define spawnve _spawnve
+#define spawnvp _spawnvp
+#define spawnvpe _spawnvpe
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _POSIX_ */
+
+#define _INC_PROCESS
+#endif /* _INC_PROCESS */
diff --git a/private/crtlib/include/search.h b/private/crtlib/include/search.h
new file mode 100644
index 000000000..f62031a79
--- /dev/null
+++ b/private/crtlib/include/search.h
@@ -0,0 +1,71 @@
+/***
+*search.h - declarations for searcing/sorting routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains the declarations for the sorting and
+* searching routines.
+* [System V]
+*
+****/
+
+#ifndef _INC_SEARCH
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+
+/* function prototypes */
+
+void * _CRTAPI1 bsearch(const void *, const void *, size_t, size_t,
+ int (_CRTAPI1 *)(const void *, const void *));
+void * _CRTAPI1 _lfind(const void *, const void *, unsigned int *, unsigned int,
+ int (_CRTAPI1 *)(const void *, const void *));
+void * _CRTAPI1 _lsearch(const void *, void *, unsigned int *, unsigned int,
+ int (_CRTAPI1 *)(const void *, const void *));
+void _CRTAPI1 qsort(void *, size_t, size_t, int (_CRTAPI1 *)(const void *,
+ const void *));
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define lfind _lfind
+#define lsearch _lsearch
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_SEARCH
+#endif /* _INC_SEARCH */
diff --git a/private/crtlib/include/setjmp.h b/private/crtlib/include/setjmp.h
new file mode 100644
index 000000000..85bbd40e1
--- /dev/null
+++ b/private/crtlib/include/setjmp.h
@@ -0,0 +1,253 @@
+/***
+*setjmp.h - definitions/declarations for setjmp/longjmp routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the machine-dependent buffer used by
+* setjmp/longjmp to save and restore the program state, and
+* declarations for those routines.
+* [ANSI/System V]
+*
+****/
+
+#ifndef _INC_SETJMP
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/*
+ * Definitions specific to particular setjmp implementations.
+ */
+#if defined(_M_IX86)
+
+/*
+ * MS C8-32 or older MS C6-386 compilers
+ */
+#ifndef _INC_SETJMPEX
+#define setjmp _setjmp
+#endif
+#define _JBLEN 16
+#define _JBTYPE int
+
+/*
+ * Define jump buffer layout for x86 setjmp/longjmp.
+ */
+
+typedef struct __JUMP_BUFFER {
+ unsigned long Ebp;
+ unsigned long Ebx;
+ unsigned long Edi;
+ unsigned long Esi;
+ unsigned long Esp;
+ unsigned long Eip;
+ unsigned long Registration;
+ unsigned long TryLevel;
+ unsigned long Cookie;
+ unsigned long UnwindFunc;
+ unsigned long UnwindData[6];
+} _JUMP_BUFFER;
+
+#elif defined(_M_MRX000)
+
+/*
+ * All MIPS implementations need _JBLEN of 16
+ */
+#define _JBLEN 16
+#define _JBTYPE double
+#define _setjmp setjmp
+
+/*
+ * Define jump buffer layout for MIPS setjmp/longjmp.
+ */
+
+typedef struct __JUMP_BUFFER {
+ unsigned long FltF20;
+ unsigned long FltF21;
+ unsigned long FltF22;
+ unsigned long FltF23;
+ unsigned long FltF24;
+ unsigned long FltF25;
+ unsigned long FltF26;
+ unsigned long FltF27;
+ unsigned long FltF28;
+ unsigned long FltF29;
+ unsigned long FltF30;
+ unsigned long FltF31;
+ unsigned long IntS0;
+ unsigned long IntS1;
+ unsigned long IntS2;
+ unsigned long IntS3;
+ unsigned long IntS4;
+ unsigned long IntS5;
+ unsigned long IntS6;
+ unsigned long IntS7;
+ unsigned long IntS8;
+ unsigned long IntSp;
+ unsigned long Type;
+ unsigned long Fir;
+} _JUMP_BUFFER;
+
+#elif defined(_M_ALPHA)
+
+/*
+ * The Alpha C8/GEM C compiler uses an intrinsic _setjmp.
+ * The Alpha acc compiler implements setjmp as a function.
+ */
+
+#define _setjmp setjmp
+
+#ifdef _MSC_VER
+#ifndef _INC_SETJMPEX
+#undef _setjmp
+#define setjmp _setjmp
+#endif
+#endif
+
+/*
+ * Alpha implementations use a _JBLEN of 24 quadwords.
+ * A double is used only to obtain quadword size and alignment.
+ */
+
+#define _JBLEN 24
+#define _JBTYPE double
+
+/*
+ * Define jump buffer layout for Alpha setjmp/longjmp.
+ * A double is used only to obtain quadword size and alignment.
+ */
+
+typedef struct __JUMP_BUFFER {
+ unsigned long Fp;
+ unsigned long Pc;
+ unsigned long Seb;
+ unsigned long Type;
+ double FltF2;
+ double FltF3;
+ double FltF4;
+ double FltF5;
+ double FltF6;
+ double FltF7;
+ double FltF8;
+ double FltF9;
+ double IntS0;
+ double IntS1;
+ double IntS2;
+ double IntS3;
+ double IntS4;
+ double IntS5;
+ double IntS6;
+ double IntSp;
+ double Fir;
+ double Fill[5];
+} _JUMP_BUFFER;
+
+#elif defined(_M_PPC)
+
+/*
+ * Min length is 240 bytes; round to 256 bytes.
+ * Since this is allocated as an array of "double", the
+ * number of entries required is 32.
+ *
+ * All PPC implementations need _JBLEN of 32
+ */
+
+#define _JBLEN 32
+#define _JBTYPE double
+#define _setjmp setjmp
+
+/*
+ * Define jump buffer layout for PowerPC setjmp/longjmp.
+ */
+
+typedef struct __JUMP_BUFFER {
+ double Fpr14;
+ double Fpr15;
+ double Fpr16;
+ double Fpr17;
+ double Fpr18;
+ double Fpr19;
+ double Fpr20;
+ double Fpr21;
+ double Fpr22;
+ double Fpr23;
+ double Fpr24;
+ double Fpr25;
+ double Fpr26;
+ double Fpr27;
+ double Fpr28;
+ double Fpr29;
+ double Fpr30;
+ double Fpr31;
+ unsigned long Gpr1;
+ unsigned long Gpr2;
+ unsigned long Gpr13;
+ unsigned long Gpr14;
+ unsigned long Gpr15;
+ unsigned long Gpr16;
+ unsigned long Gpr17;
+ unsigned long Gpr18;
+ unsigned long Gpr19;
+ unsigned long Gpr20;
+ unsigned long Gpr21;
+ unsigned long Gpr22;
+ unsigned long Gpr23;
+ unsigned long Gpr24;
+ unsigned long Gpr25;
+ unsigned long Gpr26;
+ unsigned long Gpr27;
+ unsigned long Gpr28;
+ unsigned long Gpr29;
+ unsigned long Gpr30;
+ unsigned long Gpr31;
+ unsigned long Cr;
+ unsigned long Iar;
+ unsigned long Type;
+} _JUMP_BUFFER;
+
+#endif
+
+/* define the buffer type for holding the state information */
+
+#ifndef _JMP_BUF_DEFINED
+typedef _JBTYPE jmp_buf[_JBLEN];
+#define _JMP_BUF_DEFINED
+#endif
+
+
+/* function prototypes */
+
+int _CRTAPI1 setjmp(jmp_buf);
+void _CRTAPI1 longjmp(jmp_buf, int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_SETJMP
+#endif /* _INC_SETJMP */
diff --git a/private/crtlib/include/setjmpex.h b/private/crtlib/include/setjmpex.h
new file mode 100644
index 000000000..1cac16a73
--- /dev/null
+++ b/private/crtlib/include/setjmpex.h
@@ -0,0 +1,36 @@
+/***
+*setjmpex.h - definitions/declarations for setjmp/longjmp routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file causes _setjmpex to be called which will enable safe
+* setjmp/longjmp that work correctly with try/except/finally.
+*
+****/
+
+#ifndef _INC_SETJMPEX
+#define _INC_SETJMPEX
+
+/*
+ * Definitions specific to particular setjmp implementations.
+ */
+
+#if defined(_M_IX86)
+
+/*
+ * MS compiler for x86
+ */
+
+#define setjmp _setjmp
+#define longjmp _longjmpex
+
+#else
+
+#define setjmp _setjmpex
+
+#endif
+
+#include <setjmp.h>
+
+#endif /* _INC_SETJMPEX */
diff --git a/private/crtlib/include/share.h b/private/crtlib/include/share.h
new file mode 100644
index 000000000..4504cbc59
--- /dev/null
+++ b/private/crtlib/include/share.h
@@ -0,0 +1,27 @@
+/***
+*share.h - defines file sharing modes for sopen
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the file sharing modes for sopen().
+*
+****/
+
+#ifndef _INC_SHARE
+
+#define _SH_DENYRW 0x10 /* deny read/write mode */
+#define _SH_DENYWR 0x20 /* deny write mode */
+#define _SH_DENYRD 0x30 /* deny read mode */
+#define _SH_DENYNO 0x40 /* deny none mode */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define SH_DENYRW _SH_DENYRW
+#define SH_DENYWR _SH_DENYWR
+#define SH_DENYRD _SH_DENYRD
+#define SH_DENYNO _SH_DENYNO
+#endif
+
+#define _INC_SHARE
+#endif /* _INC_SHARE */
diff --git a/private/crtlib/include/signal.h b/private/crtlib/include/signal.h
new file mode 100644
index 000000000..05727faeb
--- /dev/null
+++ b/private/crtlib/include/signal.h
@@ -0,0 +1,91 @@
+/***
+*signal.h - defines signal values and routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the signal values and declares the signal functions.
+* [ANSI/System V]
+*
+****/
+
+#ifndef _INC_SIGNAL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIG_ATOMIC_T_DEFINED
+typedef int sig_atomic_t;
+#define _SIG_ATOMIC_T_DEFINED
+#endif
+
+#define NSIG 23 /* maximum signal number + 1 */
+
+/* signal types */
+
+#define SIGINT 2 /* interrupt */
+#define SIGILL 4 /* illegal instruction - invalid function image */
+#define SIGFPE 8 /* floating point exception */
+#define SIGSEGV 11 /* segment violation */
+#define SIGTERM 15 /* Software termination signal from kill */
+#define SIGBREAK 21 /* Ctrl-Break sequence */
+#define SIGABRT 22 /* abnormal termination triggered by abort call */
+
+
+/* signal action codes */
+
+#define SIG_DFL (void (_CRTAPI1 *)(int))0 /* default signal action */
+#define SIG_IGN (void (_CRTAPI1 *)(int))1 /* ignore signal */
+#define SIG_SGE (void (_CRTAPI1 *)(int))3 /* signal gets error */
+#define SIG_ACK (void (_CRTAPI1 *)(int))4 /* acknowledge */
+
+
+/* signal error value (returned by signal call on error) */
+
+#define SIG_ERR (void (_CRTAPI1 *)(int))-1 /* signal error value */
+
+/* pointer to exception information pointers structure */
+
+#ifdef _MT
+extern void * * _CRTAPI1 __pxcptinfoptrs(void);
+#define _pxcptinfoptrs (*__pxcptinfoptrs())
+#else
+extern void * _pxcptinfoptrs;
+#endif
+
+/* function prototypes */
+
+void (_CRTAPI1 * _CRTAPI1 signal(int, void (_CRTAPI1 *)(int)))(int);
+int _CRTAPI1 raise(int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_SIGNAL
+#endif /* _INC_SIGNAL */
diff --git a/private/crtlib/include/stdarg.h b/private/crtlib/include/stdarg.h
new file mode 100644
index 000000000..91cc920cd
--- /dev/null
+++ b/private/crtlib/include/stdarg.h
@@ -0,0 +1,125 @@
+/***
+*stdarg.h - defines ANSI-style macros for variable argument functions
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines ANSI-style macros for accessing arguments
+* of functions which take a variable number of arguments.
+* [ANSI]
+*
+****/
+
+#ifndef _INC_STDARG
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#ifndef _VA_LIST_DEFINED
+#ifdef _M_ALPHA
+typedef struct {
+ char *a0; /* pointer to first homed integer argument */
+ int offset; /* byte offset of next parameter */
+} va_list;
+#else
+typedef char * va_list;
+#endif
+#define _VA_LIST_DEFINED
+#endif
+
+#if defined(_M_IX86)
+
+/* Use these types and definitions if generating code for x86 */
+
+#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
+
+#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
+#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
+#define va_end(ap) ( ap = (va_list)0 )
+
+#elif defined(_M_MRX000)
+
+/* Use these types and definitions if generating code for MIPS */
+
+#define va_start(ap,v) ap = (va_list)&v + sizeof(v)
+#define va_end(list)
+#define va_arg(list, mode) ((mode *)(list =\
+ (char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
+ (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]
+
+/* +++++++++++++++++++++++++++++++++++++++++++
+ Because of parameter passing conventions in C:
+ use mode=int for char, and short types
+ use mode=double for float types
+ use a pointer for array types
+ +++++++++++++++++++++++++++++++++++++++++++ */
+
+
+#elif defined(_M_ALPHA)
+
+
+/* Use these types and definitions if generating code for ALPHA */
+
+/*
+ * The Alpha compiler supports two builtin functions that are used to
+ * implement stdarg/varargs. The __builtin_va_start function is used
+ * by va_start to initialize the data structure that locates the next
+ * argument. The __builtin_isfloat function is used by va_arg to pick
+ * which part of the home area a given register argument is stored in.
+ * The home area is where up to six integer and/or six floating point
+ * register arguments are stored down (so they can also be referenced
+ * by a pointer like any arguments passed on the stack).
+ */
+
+extern void * __builtin_va_start(va_list, ...);
+
+#ifdef _CFRONT
+#define __builtin_isfloat(a) __builtin_alignof(a)
+#endif
+
+#define va_start(list, v) __builtin_va_start(list, v, 1)
+#define va_end(list)
+#define va_arg(list, mode) \
+ ( *( ((list).offset += ((int)sizeof(mode) + 7) & -8) , \
+ (mode *)((list).a0 + (list).offset - \
+ ((__builtin_isfloat(mode) && (list).offset <= (6 * 8)) ? \
+ (6 * 8) + 8 : ((int)sizeof(mode) + 7) & -8) \
+ ) \
+ ) \
+ )
+
+#elif defined(_M_PPC)
+
+/* Microsoft C8 front end (used in Motorola Merged compiler) */
+/* bytes that a type occupies in the argument list */
+#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
+/* return 'ap' adjusted for type 't' in arglist */
+#define _ALIGNIT(ap,t) \
+ ((((int)(ap))+(sizeof(t)<8?3:7)) & (sizeof(t)<8?~3:~7))
+
+#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
+#define va_arg(ap,t) ( *(t *)((ap = (char *) (_ALIGNIT(ap, t) + _INTSIZEOF(t))) - _INTSIZEOF(t)) )
+#define va_end(ap) ( ap = (va_list)0 )
+
+#else
+
+/* A guess at the proper definitions for other platforms */
+
+#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
+
+#define va_start(ap,v) ( ap = (va_list)&v + _INTSIZEOF(v) )
+#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
+#define va_end(ap) ( ap = (va_list)0 )
+
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STDARG
+#endif /* _INC_STDARG */
diff --git a/private/crtlib/include/stddef.h b/private/crtlib/include/stddef.h
new file mode 100644
index 000000000..a9cfb39e3
--- /dev/null
+++ b/private/crtlib/include/stddef.h
@@ -0,0 +1,102 @@
+/***
+*stddef.h - definitions/declarations for common constants, types, variables
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains definitions and declarations for some commonly
+* used constants, types, and variables.
+* [ANSI]
+*
+****/
+
+#ifndef _INC_STDDEF
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+/* define NULL pointer value and the offset() macro */
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+
+#define offsetof(s,m) (size_t)&(((s *)0)->m)
+
+
+/* declare reference to errno */
+
+#ifdef _MT
+extern int * _CRTAPI1 _errno(void);
+#define errno (*_errno())
+#else
+extern int errno;
+#endif
+
+
+/* define the implementation dependent size types */
+
+#ifndef _PTRDIFF_T_DEFINED
+typedef int ptrdiff_t;
+#define _PTRDIFF_T_DEFINED
+#endif
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+
+#ifdef _MT
+
+
+
+extern unsigned long _CRTAPI1 __threadid(void);
+#define _threadid (__threadid())
+extern unsigned long _CRTAPI1 __threadhandle(void);
+
+
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STDDEF
+#endif /* _INC_STDDEF */
diff --git a/private/crtlib/include/stdio.h b/private/crtlib/include/stdio.h
new file mode 100644
index 000000000..444ea215b
--- /dev/null
+++ b/private/crtlib/include/stdio.h
@@ -0,0 +1,347 @@
+/***
+*stdio.h - definitions/declarations for standard I/O routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the structures, values, macros, and functions
+* used by the level 2 I/O ("standard I/O") routines.
+* [ANSI/System V]
+*
+****/
+
+#ifndef _INC_STDIO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+#ifndef _WCTYPE_T_DEFINED
+typedef wchar_t wint_t;
+typedef wchar_t wctype_t;
+#define _WCTYPE_T_DEFINED
+#endif
+
+#ifndef _VA_LIST_DEFINED
+#ifdef _M_ALPHA
+typedef struct {
+ char *a0; /* pointer to first homed integer argument */
+ int offset; /* byte offset of next parameter */
+} va_list;
+#else
+typedef char * va_list;
+#endif
+#define _VA_LIST_DEFINED
+#endif
+
+
+/* buffered I/O macros */
+
+#define BUFSIZ 512
+
+/*
+ * Number of supported streams. _NFILE is confusing and obsolete, but
+ * supported anyway for backwards compatibility.
+ */
+#define _NFILE _NSTREAM_
+#ifdef _MT
+#define _NSTREAM_ 40
+#else
+#define _NSTREAM_ 20
+#endif
+
+
+#define EOF (-1)
+
+#ifndef _FILE_DEFINED
+struct _iobuf {
+ char *_ptr;
+ int _cnt;
+ char *_base;
+ int _flag;
+ int _file;
+ int _charbuf;
+ int _bufsiz;
+ char *_tmpfname;
+ };
+typedef struct _iobuf FILE;
+#define _FILE_DEFINED
+#endif
+
+/* Directory where temporary files may be created. */
+#ifdef _POSIX_
+#define _P_tmpdir "/"
+#else
+#define _P_tmpdir "\\"
+#endif
+
+/* L_tmpnam = size of P_tmpdir
+ * + 1 (in case P_tmpdir does not end in "/")
+ * + 12 (for the filename string)
+ * + 1 (for the null terminator)
+ */
+#define L_tmpnam sizeof(_P_tmpdir)+12
+
+
+#ifdef _POSIX_
+#define L_ctermid 9
+#define L_cuserid 32
+#endif
+
+#define SEEK_CUR 1
+#define SEEK_END 2
+#define SEEK_SET 0
+
+#define FILENAME_MAX 260
+#define FOPEN_MAX 20
+#define _SYS_OPEN 20
+#define TMP_MAX 32767
+
+
+/* define NULL pointer value */
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+
+/* declare _iob[] array */
+
+#ifndef _STDIO_DEFINED
+#ifdef _DLL
+extern FILE * _iob;
+#else
+extern FILE _iob[];
+#endif
+#endif
+
+
+/* define file position type */
+
+#ifndef _FPOS_T_DEFINED
+typedef long fpos_t;
+#define _FPOS_T_DEFINED
+#endif
+
+
+#define stdin (&_iob[0])
+#define stdout (&_iob[1])
+#define stderr (&_iob[2])
+
+
+#define _IOREAD 0x0001
+#define _IOWRT 0x0002
+
+#define _IOFBF 0x0000
+#define _IOLBF 0x0040
+#define _IONBF 0x0004
+
+#define _IOMYBUF 0x0008
+#define _IOEOF 0x0010
+#define _IOERR 0x0020
+#define _IOSTRG 0x0040
+#define _IORW 0x0080
+#ifdef _POSIX_
+#define _IOAPPEND 0x0200
+#endif
+
+/* function prototypes */
+
+#ifndef _STDIO_DEFINED
+int _CRTAPI1 _filbuf(FILE *);
+int _CRTAPI1 _flsbuf(int, FILE *);
+
+#ifdef _POSIX_
+FILE * _CRTAPI1 _fsopen(const char *, const char *);
+#else
+FILE * _CRTAPI1 _fsopen(const char *, const char *, int);
+#endif
+
+void _CRTAPI1 clearerr(FILE *);
+int _CRTAPI1 fclose(FILE *);
+int _CRTAPI1 _fcloseall(void);
+#ifdef _POSIX_
+FILE * _CRTAPI1 fdopen(int, const char *);
+#else
+FILE * _CRTAPI1 _fdopen(int, const char *);
+#endif
+int _CRTAPI1 feof(FILE *);
+int _CRTAPI1 ferror(FILE *);
+int _CRTAPI1 fflush(FILE *);
+int _CRTAPI1 fgetc(FILE *);
+int _CRTAPI1 _fgetchar(void);
+int _CRTAPI1 fgetpos(FILE *, fpos_t *);
+char * _CRTAPI1 fgets(char *, int, FILE *);
+#ifdef _POSIX_
+int _CRTAPI1 fileno(FILE *);
+#else
+int _CRTAPI1 _fileno(FILE *);
+#endif
+int _CRTAPI1 _flushall(void);
+FILE * _CRTAPI1 fopen(const char *, const char *);
+int _CRTAPI2 fprintf(FILE *, const char *, ...);
+int _CRTAPI1 fputc(int, FILE *);
+int _CRTAPI1 _fputchar(int);
+int _CRTAPI1 fputs(const char *, FILE *);
+size_t _CRTAPI1 fread(void *, size_t, size_t, FILE *);
+FILE * _CRTAPI1 freopen(const char *, const char *, FILE *);
+int _CRTAPI2 fscanf(FILE *, const char *, ...);
+int _CRTAPI1 fsetpos(FILE *, const fpos_t *);
+int _CRTAPI1 fseek(FILE *, long, int);
+long _CRTAPI1 ftell(FILE *);
+size_t _CRTAPI1 fwrite(const void *, size_t, size_t, FILE *);
+int _CRTAPI1 getc(FILE *);
+int _CRTAPI1 getchar(void);
+char * _CRTAPI1 gets(char *);
+int _CRTAPI1 _getw(FILE *);
+void _CRTAPI1 perror(const char *);
+int _CRTAPI1 _pclose(FILE *);
+FILE * _CRTAPI1 _popen(const char *, const char *);
+int _CRTAPI2 printf(const char *, ...);
+int _CRTAPI1 putc(int, FILE *);
+int _CRTAPI1 putchar(int);
+int _CRTAPI1 puts(const char *);
+int _CRTAPI1 _putw(int, FILE *);
+int _CRTAPI1 remove(const char *);
+int _CRTAPI1 rename(const char *, const char *);
+void _CRTAPI1 rewind(FILE *);
+int _CRTAPI1 _rmtmp(void);
+int _CRTAPI2 scanf(const char *, ...);
+void _CRTAPI1 setbuf(FILE *, char *);
+int _CRTAPI1 setvbuf(FILE *, char *, int, size_t);
+int _CRTAPI2 _snprintf(char *, size_t, const char *, ...);
+int _CRTAPI2 sprintf(char *, const char *, ...);
+int _CRTAPI2 sscanf(const char *, const char *, ...);
+char * _CRTAPI1 _tempnam(char *, char *);
+FILE * _CRTAPI1 tmpfile(void);
+char * _CRTAPI1 tmpnam(char *);
+int _CRTAPI1 ungetc(int, FILE *);
+int _CRTAPI1 _unlink(const char *);
+int _CRTAPI1 vfprintf(FILE *, const char *, va_list);
+int _CRTAPI1 vprintf(const char *, va_list);
+int _CRTAPI1 _vsnprintf(char *, size_t, const char *, va_list);
+int _CRTAPI1 vsprintf(char *, const char *, va_list);
+
+#if !__STDC__
+#ifndef _WSTDIO_DEFINED
+
+/* declared in wchar.h, officially */
+wint_t _CRTAPI1 fgetwc(FILE *);
+wint_t _CRTAPI1 _fgetwchar(void);
+wint_t _CRTAPI1 fputwc(wint_t, FILE *);
+wint_t _CRTAPI1 _fputwchar(wint_t);
+wint_t _CRTAPI1 getwc(FILE *);
+wint_t _CRTAPI1 getwchar(void);
+wint_t _CRTAPI1 putwc(wint_t, FILE *);
+wint_t _CRTAPI1 putwchar(wint_t);
+wint_t _CRTAPI1 ungetwc(wint_t, FILE *);
+
+int _CRTAPI2 fwprintf(FILE *, const wchar_t *, ...);
+int _CRTAPI2 wprintf(const wchar_t *, ...);
+int _CRTAPI2 _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
+int _CRTAPI2 swprintf(wchar_t *, const wchar_t *, ...);
+int _CRTAPI1 vfwprintf(FILE *, const wchar_t *, va_list);
+int _CRTAPI1 vwprintf(const wchar_t *, va_list);
+int _CRTAPI1 _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
+int _CRTAPI1 vswprintf(wchar_t *, const wchar_t *, va_list);
+int _CRTAPI2 fwscanf(FILE *, const wchar_t *, ...);
+int _CRTAPI2 swscanf(const wchar_t *, const wchar_t *, ...);
+int _CRTAPI2 wscanf(const wchar_t *, ...);
+
+#define getwchar() fgetwc(stdin)
+#define putwchar(_c) fputwc((_c),stdout)
+#define getwc(_stm) fgetwc(_stm)
+#define putwc(_c,_stm) fputwc(_c,_stm)
+
+
+#define _WSTDIO_DEFINED
+#endif
+#endif /* !__STDC__ */
+#define _STDIO_DEFINED
+#endif
+
+
+/* macro definitions */
+
+#define feof(_stream) ((_stream)->_flag & _IOEOF)
+#define ferror(_stream) ((_stream)->_flag & _IOERR)
+#define _fileno(_stream) ((_stream)->_file)
+#define getc(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ \
+ : _filbuf(_stream))
+#define putc(_c,_stream) (--(_stream)->_cnt >= 0 \
+ ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
+#define getchar() getc(stdin)
+#define putchar(_c) putc((_c),stdout)
+
+
+#ifdef _MT
+#undef getc
+#undef putc
+#undef getchar
+#undef putchar
+#endif
+
+#if !__STDC__ && !defined(_POSIX_)
+/* Non-ANSI names for compatibility */
+
+#define P_tmpdir _P_tmpdir
+#define SYS_OPEN _SYS_OPEN
+
+#define fcloseall _fcloseall
+#define fdopen _fdopen
+#define fgetchar _fgetchar
+#define fileno _fileno
+#define flushall _flushall
+#define fputchar _fputchar
+#define getw _getw
+#define putw _putw
+#define rmtmp _rmtmp
+#define tempnam _tempnam
+#define unlink _unlink
+
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STDIO
+#endif /* _INC_STDIO */
diff --git a/private/crtlib/include/stdiostr.h b/private/crtlib/include/stdiostr.h
new file mode 100644
index 000000000..dbce244bd
--- /dev/null
+++ b/private/crtlib/include/stdiostr.h
@@ -0,0 +1,55 @@
+/***
+*stdiostr.h - definitions/declarations for stdiobuf, stdiostream
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the stdiostream and stdiobuf classes.
+* [AT&T C++]
+*
+****/
+
+#include <iostream.h>
+#include <stdio.h>
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+#pragma warning(disable:4505) // disable unwanted /W4 warning
+// #pragma warning(default:4505) // use this to reenable, if necessary
+
+#ifndef _INC_STDIOSTREAM
+#define _INC_STDIOSTREAM
+class stdiobuf : public streambuf {
+public:
+ stdiobuf(FILE* f);
+FILE * stdiofile() { return _str; }
+
+virtual int pbackfail(int c);
+virtual int overflow(int c = EOF);
+virtual int underflow();
+virtual streampos seekoff( streamoff, ios::seek_dir, int =ios::in|ios::out);
+virtual int sync();
+ ~stdiobuf();
+ int setrwbuf(int _rsize, int _wsize); // CONSIDER: move to ios::
+// protected:
+// virtual int doallocate();
+private:
+ FILE * _str;
+};
+
+// obsolescent
+class stdiostream : public iostream { // note: spec.'d as : public IOS...
+public:
+ stdiostream(FILE *);
+ ~stdiostream();
+ stdiobuf* rdbuf() const { return (stdiobuf*) ostream::rdbuf(); }
+
+private:
+};
+
+// Restore default packing
+#pragma pack()
+
+#endif // !_INC_STDIOSTREAM
diff --git a/private/crtlib/include/stdlib.h b/private/crtlib/include/stdlib.h
new file mode 100644
index 000000000..82a046267
--- /dev/null
+++ b/private/crtlib/include/stdlib.h
@@ -0,0 +1,385 @@
+/***
+*stdlib.h - declarations/definitions for commonly used library functions
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This include file contains the function declarations for
+* commonly used library functions which either don't fit somewhere
+* else, or, like toupper/tolower, can't be declared in the normal
+* place for other reasons.
+* [ANSI]
+*
+****/
+
+#ifndef _INC_STDLIB
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+
+/* define NULL pointer value */
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+
+/* definition of the return type for the onexit() function */
+
+#define EXIT_SUCCESS 0
+#define EXIT_FAILURE 1
+
+
+#ifndef _ONEXIT_T_DEFINED
+typedef int (_CRTAPI1 * _onexit_t)(void);
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define onexit_t _onexit_t
+#endif
+#define _ONEXIT_T_DEFINED
+#endif
+
+
+/* Data structure definitions for div and ldiv runtimes. */
+
+#ifndef _DIV_T_DEFINED
+
+typedef struct _div_t {
+ int quot;
+ int rem;
+} div_t;
+
+typedef struct _ldiv_t {
+ long quot;
+ long rem;
+} ldiv_t;
+
+#define _DIV_T_DEFINED
+#endif
+
+/* Maximum value that can be returned by the rand function. */
+
+#define RAND_MAX 0x7fff
+
+#ifndef _MB_CUR_MAX_DEFINED
+/* max mb-len for current locale */
+/* also defined in ctype.h */
+#ifdef _DLL
+#define __mb_cur_max (*__mb_cur_max_dll)
+#define MB_CUR_MAX (*__mb_cur_max_dll)
+extern unsigned short *__mb_cur_max_dll;
+#else
+#define MB_CUR_MAX __mb_cur_max
+extern unsigned short __mb_cur_max;
+#endif
+#define _MB_CUR_MAX_DEFINED
+#endif /* _MB_CUR_MAX_DEFINED */
+
+/* min and max macros */
+
+#define __max(a,b) (((a) > (b)) ? (a) : (b))
+#define __min(a,b) (((a) < (b)) ? (a) : (b))
+
+
+/* sizes for buffers used by the _makepath() and _splitpath() functions.
+ * note that the sizes include space for 0-terminator
+ */
+
+#define _MAX_PATH 260 /* max. length of full pathname */
+#define _MAX_DRIVE 3 /* max. length of drive component */
+#define _MAX_DIR 256 /* max. length of path component */
+#define _MAX_FNAME 256 /* max. length of file name component */
+#define _MAX_EXT 256 /* max. length of extension component */
+
+/* constants for _seterrormode() */
+#define _CRIT_ERROR_PROMPT 0
+#define _CRIT_ERROR_FAIL 1
+
+/* constants for _sleep() */
+#define _SLEEP_MINIMUM 0
+#define _SLEEP_FOREVER -1
+
+/* external variable declarations */
+
+#ifdef _MT
+extern int * _CRTAPI1 _errno(void);
+extern unsigned long * _CRTAPI1 __doserrno(void);
+#define errno (*_errno())
+#define _doserrno (*__doserrno())
+#else /* ndef _MT */
+extern int errno; /* XENIX style error number */
+extern unsigned long _doserrno; /* OS system error value */
+#endif /* _MT */
+
+#ifdef _DLL
+
+extern char ** _sys_errlist; /* perror error message table */
+
+#define _sys_nerr (*_sys_nerr_dll)
+#define __argc (*__argc_dll)
+#define __argv (*__argv_dll)
+#define _environ (*_environ_dll)
+#define _fmode (*_fmode_dll)
+#define _fileinfo (*_fileinfo_dll)
+
+extern int * _sys_nerr_dll; /* # of entries in sys_errlist table */
+extern int * __argc_dll; /* count of cmd line args */
+extern char *** __argv_dll; /* pointer to table of cmd line args */
+extern char *** _environ_dll; /* pointer to environment table */
+extern int * _fmode_dll; /* default file translation mode */
+extern int * _fileinfo_dll; /* open file info mode (for spawn) */
+
+#define _pgmptr (*_pgmptr_dll)
+
+#define _osver (*_osver_dll)
+#define _winver (*_winver_dll)
+#define _winmajor (*_winmajor_dll)
+#define _winminor (*_winminor_dll)
+
+extern char ** _pgmptr_dll;
+
+extern unsigned int * _osver_dll;
+extern unsigned int * _winver_dll;
+extern unsigned int * _winmajor_dll;
+extern unsigned int * _winminor_dll;
+
+/* --------- The following block is OBSOLETE --------- */
+
+/* DOS major/minor version numbers */
+
+#define _osmajor (*_osmajor_dll)
+#define _osminor (*_osminor_dll)
+
+extern unsigned int * _osmajor_dll;
+extern unsigned int * _osminor_dll;
+
+/* --------- The preceding block is OBSOLETE --------- */
+
+#else
+
+
+extern char * _sys_errlist[]; /* perror error message table */
+extern int _sys_nerr; /* # of entries in sys_errlist table */
+
+extern int __argc; /* count of cmd line args */
+extern char ** __argv; /* pointer to table of cmd line args */
+
+#ifdef _POSIX_
+extern char ** environ; /* pointer to environment table */
+#else
+extern char ** _environ; /* pointer to environment table */
+#endif
+
+extern int _fmode; /* default file translation mode */
+extern int _fileinfo; /* open file info mode (for spawn) */
+
+extern char * _pgmptr; /* points to the module (EXE) name */
+
+/* Windows major/minor and O.S. version numbers */
+
+extern unsigned int _osver;
+extern unsigned int _winver;
+extern unsigned int _winmajor;
+extern unsigned int _winminor;
+
+/* --------- The following block is OBSOLETE --------- */
+
+/* DOS major/minor version numbers */
+
+extern unsigned int _osmajor;
+extern unsigned int _osminor;
+
+/* --------- The preceding block is OBSOLETE --------- */
+
+#endif
+
+/* --------- The following block is OBSOLETE --------- */
+
+/* OS API mode */
+
+#define _DOS_MODE 0 /* DOS */
+#define _OS2_MODE 1 /* OS/2 */
+#define _WIN_MODE 2 /* Windows */
+#define _OS2_20_MODE 3 /* OS/2 2.0 */
+#define _DOSX32_MODE 4 /* DOSX32 */
+#define _POSIX_MODE_ 5 /* POSIX */
+
+#ifdef _DLL
+#define _osmode (*_osmode_dll)
+extern unsigned char * _osmode_dll;
+#else
+extern unsigned char _osmode;
+#endif
+
+/* CPU addressing mode */
+
+#define _REAL_MODE 0 /* real mode */
+#define _PROT_MODE 1 /* protect mode */
+#define _FLAT_MODE 2 /* flat mode */
+
+#ifdef _DLL
+#define _cpumode (*_cpumode_dll)
+extern unsigned char * _cpumode_dll;
+#else
+extern unsigned char _cpumode;
+#endif
+
+/* --------- The preceding block is OBSOLETE --------- */
+
+/* function prototypes */
+
+void _CRTAPI1 abort(void);
+int _CRTAPI1 abs(int);
+int _CRTAPI1 atexit(void (_CRTAPI1 *)(void));
+double _CRTAPI1 atof(const char *);
+int _CRTAPI1 atoi(const char *);
+long _CRTAPI1 atol(const char *);
+void * _CRTAPI1 bsearch(const void *, const void *, size_t, size_t,
+ int (_CRTAPI1 *)(const void *, const void *));
+void * _CRTAPI1 calloc(size_t, size_t);
+div_t _CRTAPI1 div(int, int);
+void _CRTAPI1 exit(int);
+void _CRTAPI1 free(void *);
+char * _CRTAPI1 getenv(const char *);
+char * _CRTAPI1 _itoa(int, char *, int);
+long _CRTAPI1 labs(long);
+ldiv_t _CRTAPI1 ldiv(long, long);
+char * _CRTAPI1 _ltoa(long, char *, int);
+void * _CRTAPI1 malloc(size_t);
+int _CRTAPI1 mblen(const char *, size_t);
+size_t _CRTAPI1 _mbstrlen(const char *s);
+int _CRTAPI1 mbtowc(wchar_t *, const char *, size_t);
+size_t _CRTAPI1 mbstowcs(wchar_t *, const char *, size_t);
+void _CRTAPI1 qsort(void *, size_t, size_t, int (_CRTAPI1 *)
+ (const void *, const void *));
+int _CRTAPI1 rand(void);
+void * _CRTAPI1 realloc(void *, size_t);
+void _CRTAPI1 srand(unsigned int);
+double _CRTAPI1 strtod(const char *, char **);
+long _CRTAPI1 strtol(const char *, char **, int);
+unsigned long _CRTAPI1 strtoul(const char *, char **, int);
+int _CRTAPI1 system(const char *);
+char * _CRTAPI1 _ultoa(unsigned long, char *, int);
+int _CRTAPI1 wctomb(char *, wchar_t);
+size_t _CRTAPI1 wcstombs(char *, const wchar_t *, size_t);
+#if !__STDC__
+#ifndef _WSTDLIB_DEFINED
+/* defined in wchar.h officially */
+double _CRTAPI1 wcstod(const wchar_t *, wchar_t **);
+long _CRTAPI1 wcstol(const wchar_t *, wchar_t **, int);
+unsigned long _CRTAPI1 wcstoul(const wchar_t *, wchar_t **, int);
+wchar_t * _CRTAPI1 _itow (int val, wchar_t *buf, int radix);
+wchar_t * _CRTAPI1 _ltow (long val, wchar_t *buf, int radix);
+wchar_t * _CRTAPI1 _ultow (unsigned long val, wchar_t *buf, int radix);
+long _CRTAPI1 _wtol(const wchar_t *nptr);
+int _CRTAPI1 _wtoi(const wchar_t *nptr);
+#define _WSTDLIB_DEFINED
+#endif
+#endif /* !__STDC__ */
+
+#ifndef _POSIX_
+char * _CRTAPI1 _ecvt(double, int, int *, int *);
+void _CRTAPI1 _exit(int);
+char * _CRTAPI1 _fcvt(double, int, int *, int *);
+char * _CRTAPI1 _fullpath(char *, const char *, size_t);
+char * _CRTAPI1 _gcvt(double, int, char *);
+unsigned long _CRTAPI1 _lrotl(unsigned long, int);
+unsigned long _CRTAPI1 _lrotr(unsigned long, int);
+void _CRTAPI1 _makepath(char *, const char *, const char *, const char *,
+ const char *);
+_onexit_t _CRTAPI1 _onexit(_onexit_t);
+void _CRTAPI1 perror(const char *);
+int _CRTAPI1 _putenv(const char *);
+unsigned int _CRTAPI1 _rotl(unsigned int, int);
+unsigned int _CRTAPI1 _rotr(unsigned int, int);
+void _CRTAPI1 _searchenv(const char *, const char *, char *);
+void _CRTAPI1 _splitpath(const char *, char *, char *, char *, char *);
+void _CRTAPI1 _swab(char *, char *, int);
+void _CRTAPI1 _seterrormode(int);
+void _CRTAPI1 _beep(unsigned, unsigned);
+void _CRTAPI1 _sleep(unsigned long);
+#endif
+
+#ifndef tolower /* tolower has been undefined - use function */
+int _CRTAPI1 tolower(int);
+#endif /* tolower */
+
+#ifndef toupper /* toupper has been undefined - use function */
+int _CRTAPI1 toupper(int);
+#endif /* toupper */
+
+
+#if (!__STDC__ && !defined(_POSIX_))
+/* Non-ANSI names for compatibility */
+
+#ifndef __cplusplus
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#endif
+
+#define sys_errlist _sys_errlist
+#define sys_nerr _sys_nerr
+#define environ _environ
+
+#define DOS_MODE _DOS_MODE
+#define OS2_MODE _OS2_MODE
+
+#define ecvt _ecvt
+#define fcvt _fcvt
+#define gcvt _gcvt
+#define itoa _itoa
+#define ltoa _ltoa
+#define onexit _onexit
+#define putenv _putenv
+#define swab _swab
+#define ultoa _ultoa
+
+#endif /* !__STDC__ && !_POSIX_ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STDLIB
+#endif /* _INC_STDLIB */
diff --git a/private/crtlib/include/streamb.h b/private/crtlib/include/streamb.h
new file mode 100644
index 000000000..63508f87f
--- /dev/null
+++ b/private/crtlib/include/streamb.h
@@ -0,0 +1,169 @@
+/***
+*streamb.h - definitions/declarations for the streambuf class
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the streambuf class.
+* [AT&T C++]
+*
+****/
+
+#ifndef _INC_STREAMB
+#define _INC_STREAMB
+
+
+#include <ios.h> // need ios::seek_dir definition
+#ifdef _MT // defined in ios.h
+extern "C" {
+void _mtlockinit(PRTL_CRITICAL_SECTION);
+void _mtlock(PRTL_CRITICAL_SECTION);
+void _mtunlock(PRTL_CRITICAL_SECTION);
+}
+#endif
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+#ifndef EOF
+#define EOF (-1)
+#endif
+
+// C4505: "unreferenced local function has been removed"
+#pragma warning(disable:4505) // disable C4505 warning
+// #pragma warning(default:4505) // use this to reenable, if desired
+
+// C4103 : "used #pragma pack to change alignment"
+#pragma warning(disable:4103) // disable C4103 warning
+// #pragma warning(default:4103) // use this to reenable, if desired
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+typedef long streampos, streamoff;
+
+class ios;
+
+class streambuf {
+public:
+
+ virtual ~streambuf();
+
+ inline int in_avail() const;
+ inline int out_waiting() const;
+ int sgetc();
+ int snextc();
+ int sbumpc();
+ void stossc();
+
+ inline int sputbackc(char);
+
+ inline int sputc(int);
+ inline int sputn(const char *,int);
+ inline int sgetn(char *,int);
+
+ virtual int sync();
+
+// enum seek_dir { beg=0, cur=1, end=2 }; // CONSIDER: needed ???
+
+ virtual streambuf* setbuf(char *, int);
+ virtual streampos seekoff(streamoff,ios::seek_dir,int =ios::in|ios::out);
+ virtual streampos seekpos(streampos,int =ios::in|ios::out);
+
+ virtual int xsputn(const char *,int);
+ virtual int xsgetn(char *,int);
+
+ virtual int overflow(int =EOF) = 0; // pure virtual function
+ virtual int underflow() = 0; // pure virtual function
+
+ virtual int pbackfail(int);
+
+ void dbp();
+
+#ifdef _MT
+ void setlock() { LockFlg--; } // <0 indicates lock required;
+ void clrlock() { if (LockFlg <= 0) LockFlg++; }
+ void lock() { if (LockFlg<0) _mtlock(lockptr()); };
+ void unlock() { if (LockFlg<0) _mtunlock(lockptr()); }
+#else
+ void lock() { }
+ void unlock() { }
+#endif
+
+protected:
+ streambuf();
+ streambuf(char *,int);
+
+ inline char * base() const;
+ inline char * ebuf() const;
+ inline char * pbase() const;
+ inline char * pptr() const;
+ inline char * epptr() const;
+ inline char * eback() const;
+ inline char * gptr() const;
+ inline char * egptr() const;
+ inline int blen() const;
+ inline void setp(char *,char *);
+ inline void setg(char *,char *,char *);
+ inline void pbump(int);
+ inline void gbump(int);
+
+ void setb(char *,char *,int =0);
+ inline int unbuffered() const;
+ inline void unbuffered(int);
+ int allocate();
+ virtual int doallocate();
+#ifdef _MT
+ PRTL_CRITICAL_SECTION lockptr() { return & x_lock; }
+#endif
+
+private:
+ int _fAlloc;
+ int _fUnbuf;
+ int x_lastc;
+ char * _base;
+ char * _ebuf;
+ char * _pbase;
+ char * _pptr;
+ char * _epptr;
+ char * _eback;
+ char * _gptr;
+ char * _egptr;
+#ifdef _MT
+ int LockFlg; // <0 indicates locking required
+ RTL_CRITICAL_SECTION x_lock; // lock needed only for multi-thread operation
+#endif
+};
+
+inline int streambuf::in_avail() const { return (gptr()<_egptr) ? (_egptr-gptr()) : 0; }
+inline int streambuf::out_waiting() const { return (_pptr>=_pbase) ? (_pptr-_pbase) : 0; }
+
+inline int streambuf::sputbackc(char _c){ return (_eback<gptr()) ? *(--_gptr)=_c : pbackfail(_c); }
+
+inline int streambuf::sputc(int _i){ return (_pptr<_epptr) ? (unsigned char)(*(_pptr++)=(char)_i) : overflow(_i); }
+
+inline int streambuf::sputn(const char * _str,int _n) { return xsputn(_str, _n); }
+inline int streambuf::sgetn(char * _str,int _n) { return xsgetn(_str, _n); }
+
+inline char * streambuf::base() const { return _base; }
+inline char * streambuf::ebuf() const { return _ebuf; }
+inline int streambuf::blen() const {return ((_ebuf > _base) ? (_ebuf-_base) : 0); }
+inline char * streambuf::pbase() const { return _pbase; }
+inline char * streambuf::pptr() const { return _pptr; }
+inline char * streambuf::epptr() const { return _epptr; }
+inline char * streambuf::eback() const { return _eback; }
+inline char * streambuf::gptr() const { return _gptr; }
+inline char * streambuf::egptr() const { return _egptr; }
+inline void streambuf::gbump(int n) { if (_egptr) _gptr += n; }
+inline void streambuf::pbump(int n) { if (_epptr) _pptr += n; }
+inline void streambuf::setg(char * eb, char * g, char * eg) {_eback=eb; _gptr=g; _egptr=eg; x_lastc=EOF; }
+inline void streambuf::setp(char * p, char * ep) {_pptr=_pbase=p; _epptr=ep; }
+inline int streambuf::unbuffered() const { return _fUnbuf; }
+inline void streambuf::unbuffered(int fUnbuf) { _fUnbuf = fUnbuf; }
+
+// Restore default packing
+#pragma pack()
+
+#endif /* !_INC_STREAMB */
diff --git a/private/crtlib/include/string.h b/private/crtlib/include/string.h
new file mode 100644
index 000000000..878382d1b
--- /dev/null
+++ b/private/crtlib/include/string.h
@@ -0,0 +1,179 @@
+/***
+*string.h - declarations for string manipulation functions
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains the function declarations for the string
+* manipulation functions.
+* [ANSI/System V]
+*
+****/
+
+#ifndef _INC_STRING
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+
+/* define NULL pointer value */
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+
+/* function prototypes */
+
+void * _CRTAPI1 _memccpy(void *, const void *, int, unsigned int);
+void * _CRTAPI1 memchr(const void *, int, size_t);
+int _CRTAPI1 memcmp(const void *, const void *, size_t);
+int _CRTAPI1 _memicmp(const void *, const void *, unsigned int);
+void * _CRTAPI1 memcpy(void *, const void *, size_t);
+void * _CRTAPI1 memmove(void *, const void *, size_t);
+void * _CRTAPI1 memset(void *, int, size_t);
+char * _CRTAPI1 strcat(char *, const char *);
+char * _CRTAPI1 strchr(const char *, int);
+int _CRTAPI1 strcmp(const char *, const char *);
+int _CRTAPI1 _strcmpi(const char *, const char *);
+int _CRTAPI1 _stricmp(const char *, const char *);
+int _CRTAPI1 strcoll(const char *, const char *);
+#ifdef _MAC_
+char * _CRTAPI1 _c2pstr(const char *);
+char * _CRTAPI1 _p2cstr(const char *);
+#endif
+int _CRTAPI1 _stricoll(const char *, const char *);
+char * _CRTAPI1 strcpy(char *, const char *);
+size_t _CRTAPI1 strcspn(const char *, const char *);
+char * _CRTAPI1 _strdup(const char *);
+char * _CRTAPI1 _strerror(const char *);
+char * _CRTAPI1 strerror(int);
+size_t _CRTAPI1 strlen(const char *);
+char * _CRTAPI1 _strlwr(char *);
+char * _CRTAPI1 strncat(char *, const char *, size_t);
+int _CRTAPI1 strncmp(const char *, const char *, size_t);
+int _CRTAPI1 _strnicmp(const char *, const char *, size_t);
+char * _CRTAPI1 strncpy(char *, const char *, size_t);
+char * _CRTAPI1 _strnset(char *, int, size_t);
+char * _CRTAPI1 strpbrk(const char *, const char *);
+char * _CRTAPI1 strrchr(const char *, int);
+char * _CRTAPI1 _strrev(char *);
+char * _CRTAPI1 _strset(char *, int);
+size_t _CRTAPI1 strspn(const char *, const char *);
+char * _CRTAPI1 strstr(const char *, const char *);
+char * _CRTAPI1 strtok(char *, const char *);
+char * _CRTAPI1 _strupr(char *);
+size_t _CRTAPI1 strxfrm (char *, const char *, size_t);
+
+#ifndef _WSTRING_DEFINED
+wchar_t * _CRTAPI1 wcscat(wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcschr(const wchar_t *, wchar_t);
+int _CRTAPI1 wcscmp(const wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcscpy(wchar_t *, const wchar_t *);
+size_t _CRTAPI1 wcscspn(const wchar_t *, const wchar_t *);
+size_t _CRTAPI1 wcslen(const wchar_t *);
+wchar_t * _CRTAPI1 wcsncat(wchar_t *, const wchar_t *, size_t);
+int _CRTAPI1 wcsncmp(const wchar_t *, const wchar_t *, size_t);
+wchar_t * _CRTAPI1 wcsncpy(wchar_t *, const wchar_t *, size_t);
+wchar_t * _CRTAPI1 wcspbrk(const wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcsrchr(const wchar_t *, wchar_t);
+size_t _CRTAPI1 wcsspn(const wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcsstr(const wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcstok(wchar_t *, const wchar_t *);
+
+wchar_t * _CRTAPI1 _wcsdup(const wchar_t *);
+int _CRTAPI1 _wcsicmp(const wchar_t *, const wchar_t *);
+int _CRTAPI1 _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
+wchar_t * _CRTAPI1 _wcsnset(wchar_t *, wchar_t, size_t);
+wchar_t * _CRTAPI1 _wcsrev(wchar_t *);
+wchar_t * _CRTAPI1 _wcsset(wchar_t *, wchar_t);
+
+wchar_t * _CRTAPI1 _wcslwr(wchar_t *);
+wchar_t * _CRTAPI1 _wcsupr(wchar_t *);
+size_t _CRTAPI1 wcsxfrm(wchar_t *, const wchar_t *, size_t);
+int _CRTAPI1 wcscoll(const wchar_t *, const wchar_t *);
+int _CRTAPI1 _wcsicoll(const wchar_t *, const wchar_t *);
+
+/* old names */
+#define wcswcs wcsstr
+
+#define _WSTRING_DEFINED
+#endif
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define memccpy _memccpy
+#define memicmp _memicmp
+#define strcmpi _strcmpi
+#define stricmp _stricmp
+#define strdup _strdup
+#define strlwr _strlwr
+#define strnicmp _strnicmp
+#define strnset _strnset
+#define strrev _strrev
+#define strset _strset
+#define strupr _strupr
+#define stricoll _stricoll
+
+#ifdef _MAC_
+#define c2pstr _c2pstr
+#define p2cstr _p2cstr
+#endif
+
+#define wcsdup _wcsdup
+#define wcsicmp _wcsicmp
+#define wcsnicmp _wcsnicmp
+#define wcsnset _wcsnset
+#define wcsrev _wcsrev
+#define wcsset _wcsset
+#define wcslwr _wcslwr
+#define wcsupr _wcsupr
+#define wcsicoll _wcsicoll
+#endif /* !__STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STRING
+#endif /* _INC_STRING */
diff --git a/private/crtlib/include/strstrea.h b/private/crtlib/include/strstrea.h
new file mode 100644
index 000000000..7eed5fead
--- /dev/null
+++ b/private/crtlib/include/strstrea.h
@@ -0,0 +1,89 @@
+/***
+*strstream.h - definitions/declarations for strstreambuf, strstream
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the classes, values, macros, and functions
+* used by the strstream and strstreambuf classes.
+* [AT&T C++]
+*
+****/
+
+#ifndef _INC_STRSTREAM
+#define _INC_STRSTREAM
+
+#include <iostream.h>
+
+// Force word packing to avoid possible -Zp override
+#pragma pack(4)
+
+#pragma warning(disable:4505) // disable unwanted /W4 warning
+// #pragma warning(default:4505) // use this to reenable, if necessary
+
+class strstreambuf : public streambuf {
+public:
+ strstreambuf();
+ strstreambuf(int);
+ strstreambuf(char *, int, char * = 0);
+ strstreambuf(unsigned char *, int, unsigned char * = 0);
+ strstreambuf(signed char *, int, signed char * = 0);
+ strstreambuf(void * (*a)(long), void (*f) (void *));
+ ~strstreambuf();
+
+ void freeze(int =1);
+ char * str();
+
+virtual int overflow(int);
+virtual int underflow();
+virtual streambuf* setbuf(char *, int);
+virtual streampos seekoff(streamoff, ios::seek_dir, int);
+virtual int sync(); // not in spec.
+
+protected:
+virtual int doallocate();
+private:
+ int x_dynamic;
+ int x_bufmin;
+ int _fAlloc;
+ int x_static;
+ void * (* x_alloc)(long);
+ void (* x_free)(void *);
+};
+
+class istrstream : public istream {
+public:
+ istrstream(char *);
+ istrstream(char *, int);
+ ~istrstream();
+
+inline strstreambuf* rdbuf() const { return (strstreambuf*) ios::rdbuf(); }
+inline char * str() { return rdbuf()->str(); }
+};
+
+class ostrstream : public ostream {
+public:
+ ostrstream();
+ ostrstream(char *, int, int = ios::out);
+ ~ostrstream();
+
+inline int pcount() const { return rdbuf()->out_waiting(); }
+inline strstreambuf* rdbuf() const { return (strstreambuf*) ios::rdbuf(); }
+inline char * str() { return rdbuf()->str(); }
+};
+
+class strstream : public iostream { // strstreambase ???
+public:
+ strstream();
+ strstream(char *, int, int);
+ ~strstream();
+
+inline int pcount() const { return rdbuf()->out_waiting(); } // not in spec.
+inline strstreambuf* rdbuf() const { return (strstreambuf*) ostream::rdbuf(); }
+inline char * str() { return rdbuf()->str(); }
+};
+
+// Restore default packing
+#pragma pack()
+
+#endif // !_INC_STRSTREAM
diff --git a/private/crtlib/include/sys/locking.h b/private/crtlib/include/sys/locking.h
new file mode 100644
index 000000000..dabb70ead
--- /dev/null
+++ b/private/crtlib/include/sys/locking.h
@@ -0,0 +1,30 @@
+/***
+*sys/locking.h - flags for locking() function
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the flags for the locking() function.
+* [System V]
+*
+****/
+
+#ifndef _INC_LOCKING
+
+#define _LK_UNLCK 0 /* unlock the file region */
+#define _LK_LOCK 1 /* lock the file region */
+#define _LK_NBLCK 2 /* non-blocking lock */
+#define _LK_RLCK 3 /* lock for writing */
+#define _LK_NBRLCK 4 /* non-blocking lock for writing */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define LK_UNLCK _LK_UNLCK
+#define LK_LOCK _LK_LOCK
+#define LK_NBLCK _LK_NBLCK
+#define LK_RLCK _LK_RLCK
+#define LK_NBRLCK _LK_NBRLCK
+#endif
+
+#define _INC_LOCKING
+#endif /* _INC_LOCKING */
diff --git a/private/crtlib/include/sys/stat.h b/private/crtlib/include/sys/stat.h
new file mode 100644
index 000000000..b5e795992
--- /dev/null
+++ b/private/crtlib/include/sys/stat.h
@@ -0,0 +1,115 @@
+/***
+*sys/stat.h - defines structure used by stat() and fstat()
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the structure used by the _stat() and _fstat()
+* routines.
+* [System V]
+*
+****/
+
+#ifndef _INC_STAT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#include <sys/types.h>
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t;
+#define _TIME_T_DEFINED
+#endif
+
+/* define structure for returning status information */
+
+#ifndef _STAT_DEFINED
+
+#ifdef _MSC_VER
+#include "pshpack4.h"
+#endif
+
+struct _stat {
+ _dev_t st_dev;
+ _ino_t st_ino;
+ unsigned short st_mode;
+ short st_nlink;
+ short st_uid;
+ short st_gid;
+ _dev_t st_rdev;
+ _off_t st_size;
+ time_t st_atime;
+ time_t st_mtime;
+ time_t st_ctime;
+ };
+
+#ifdef _MSC_VER
+#include "poppack.h"
+#endif
+
+#define _STAT_DEFINED
+#endif
+
+#define _S_IFMT 0170000 /* file type mask */
+#define _S_IFDIR 0040000 /* directory */
+#define _S_IFCHR 0020000 /* character special */
+#define _S_IFIFO 0010000 /* pipe */
+#define _S_IFREG 0100000 /* regular */
+#define _S_IREAD 0000400 /* read permission, owner */
+#define _S_IWRITE 0000200 /* write permission, owner */
+#define _S_IEXEC 0000100 /* execute/search permission, owner */
+
+
+/* function prototypes */
+
+int _CRTAPI1 _fstat(int, struct _stat *);
+int _CRTAPI1 _stat(const char *, struct _stat *);
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+
+#define S_IFMT _S_IFMT
+#define S_IFDIR _S_IFDIR
+#define S_IFCHR _S_IFCHR
+#define S_IFREG _S_IFREG
+#define S_IREAD _S_IREAD
+#define S_IWRITE _S_IWRITE
+#define S_IEXEC _S_IEXEC
+
+#define fstat _fstat
+#define stat _stat
+
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STAT
+#endif /* _INC_STAT */
diff --git a/private/crtlib/include/sys/timeb.h b/private/crtlib/include/sys/timeb.h
new file mode 100644
index 000000000..4fc5f9bc9
--- /dev/null
+++ b/private/crtlib/include/sys/timeb.h
@@ -0,0 +1,80 @@
+/***
+*sys/timeb.h - definition/declarations for _ftime()
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file define the _ftime() function and the types it uses.
+* [System V]
+*
+****/
+
+#ifndef _INC_TIMEB
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t;
+#define _TIME_T_DEFINED
+#endif
+
+/* structure returned by _ftime system call */
+
+#ifndef _TIMEB_DEFINED
+struct _timeb {
+ time_t time;
+ unsigned short millitm;
+ short timezone;
+ short dstflag;
+ };
+
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define timeb _timeb
+#endif
+
+#define _TIMEB_DEFINED
+#endif
+
+
+/* function prototypes */
+
+void _CRTAPI1 _ftime(struct _timeb *);
+
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define ftime _ftime
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_TIMEB
+#endif /* _INC_TIMEB */
diff --git a/private/crtlib/include/sys/types.h b/private/crtlib/include/sys/types.h
new file mode 100644
index 000000000..b9bbaedc6
--- /dev/null
+++ b/private/crtlib/include/sys/types.h
@@ -0,0 +1,48 @@
+/***
+*sys/types.h - types returned by system level calls for file and time info
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines types used in defining values returned by system
+* level calls for file status and time information.
+* [System V]
+*
+****/
+
+#ifndef _INC_TYPES
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t;
+#define _TIME_T_DEFINED
+#endif
+
+#ifndef _INO_T_DEFINED
+typedef unsigned short _ino_t; /* i-node number (not used on DOS) */
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define ino_t _ino_t
+#endif
+#define _INO_T_DEFINED
+#endif
+
+#ifndef _DEV_T_DEFINED
+typedef short _dev_t; /* device code */
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define dev_t _dev_t
+#endif
+#define _DEV_T_DEFINED
+#endif
+
+#ifndef _OFF_T_DEFINED
+typedef long _off_t; /* file offset value */
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define off_t _off_t
+#endif
+#define _OFF_T_DEFINED
+#endif
+
+#define _INC_TYPES
+#endif /* _INC_TYPES */
diff --git a/private/crtlib/include/sys/utime.h b/private/crtlib/include/sys/utime.h
new file mode 100644
index 000000000..744a611d0
--- /dev/null
+++ b/private/crtlib/include/sys/utime.h
@@ -0,0 +1,80 @@
+/***
+*sys/utime.h - definitions/declarations for utime()
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the structure used by the utime routine to set
+* new file access and modification times. NOTE - MS-DOS
+* does not recognize access time, so this field will
+* always be ignored and the modification time field will be
+* used to set the new time.
+*
+****/
+
+#ifndef _INC_UTIME
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t;
+#define _TIME_T_DEFINED
+#endif
+
+/* define struct used by _utime() function */
+
+#ifndef _UTIMBUF_DEFINED
+struct _utimbuf {
+ time_t actime; /* access time */
+ time_t modtime; /* modification time */
+ };
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define utimbuf _utimbuf
+#endif
+
+#define _UTIMBUF_DEFINED
+#endif
+
+/* function prototypes */
+
+int _CRTAPI1 _utime(char *, struct _utimbuf *);
+int _CRTAPI1 _futime(int, struct _utimbuf *);
+
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define utime _utime
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_UTIME
+#endif /* _INC_UTIME */
diff --git a/private/crtlib/include/tchar.h b/private/crtlib/include/tchar.h
new file mode 100644
index 000000000..8af064730
--- /dev/null
+++ b/private/crtlib/include/tchar.h
@@ -0,0 +1,555 @@
+/***
+*tchar.h - definitions for generic international text functions
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Definitions for generic international functions, mostly defines
+* which map string/formatted-io/ctype functions to char, wchar_t, or
+* MBCS versions. To be used for compatibility between single-byte,
+* multi-byte and Unicode text models.
+*
+*
+*
+****/
+
+#ifndef _INC_TCHAR
+
+#ifdef _MSC_VER
+#pragma warning(disable:4505) /* disable unwanted C++ /W4 warning */
+/* #pragma warning(default:4505) */ /* use this to reenable, if necessary */
+#endif /* _MSC_VER */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* No Model-independent functions under Win32 */
+
+#define __far
+
+
+/* Default for Win32 is no inlining. Define _USE_INLINING to overide */
+
+#ifndef _USE_INLINING
+#define _NO_INLINING
+#endif
+
+
+/* No model-independent string functions for Win32 */
+
+#define _ftcscat _tcscat
+#define _ftcschr _tcschr
+#define _ftcscmp _tcscmp
+#define _ftcscpy _tcscpy
+#define _ftcscspn _tcscspn
+#define _ftcslen _tcslen
+#define _ftcsncat _tcsncat
+#define _ftcsncmp _tcsncmp
+#define _ftcsncpy _tcsncpy
+#define _ftcspbrk _tcspbrk
+#define _ftcsrchr _tcsrchr
+#define _ftcsspn _tcsspn
+#define _ftcsstr _tcsstr
+#define _ftcstok _tcstok
+
+#define _ftcsdup _tcsdup
+#define _ftcsicmp _tcsicmp
+#define _ftcsnicmp _tcsnicmp
+#define _ftcsnset _tcsnset
+#define _ftcsrev _tcsrev
+#define _ftcsset _tcsset
+
+
+/* Redundant "logical-character" mappings */
+
+#define _ftcsclen _tcsclen
+#define _ftcsnccat _tcsnccat
+#define _ftcsnccpy _tcsnccpy
+#define _ftcsnccmp _tcsnccmp
+#define _ftcsncicmp _tcsncicmp
+#define _ftcsncset _tcsncset
+
+#define _ftcsdec _tcsdec
+#define _ftcsinc _tcsinc
+#define _ftcsnbcnt _tcsncnt
+#define _ftcsnccnt _tcsncnt
+#define _ftcsnextc _tcsnextc
+#define _ftcsninc _tcsninc
+#define _ftcsspnp _tcsspnp
+
+#define _ftcslwr _tcslwr
+#define _ftcsupr _tcsupr
+
+#define _ftclen _tclen
+#define _ftccpy _tccpy
+#define _ftccmp _tccmp
+
+
+#ifdef _UNICODE
+
+
+#ifndef _WCTYPE_T_DEFINED
+typedef wchar_t wint_t;
+typedef wchar_t wctype_t;
+#define _WCTYPE_T_DEFINED
+#endif
+
+#ifndef __TCHAR_DEFINED
+typedef wchar_t _TCHAR;
+typedef wint_t _TINT;
+#define __TCHAR_DEFINED
+#endif
+
+#ifndef _TCHAR_DEFINED
+#if !__STDC__
+typedef wchar_t TCHAR;
+#endif
+#define _TCHAR_DEFINED
+#endif
+
+#define _TEOF WEOF
+
+#define __T(x) L ## x
+
+
+/* Formatted i/o */
+
+#define _tprintf wprintf
+#define _ftprintf fwprintf
+#define _stprintf swprintf
+#define _sntprintf _snwprintf
+#define _vtprintf vwprintf
+#define _vftprintf vfwprintf
+#define _vstprintf vswprintf
+#define _vsntprintf _vsnwprintf
+#define _tscanf wscanf
+#define _ftscanf fwscanf
+#define _stscanf swscanf
+
+
+/* Unformatted i/o */
+
+#define _fgettc fgetwc
+#define _fgettchar _fgetwchar
+#define _fgetts fgetws
+#define _fputtc fputwc
+#define _fputtchar _fputwchar
+#define _fputts fputws
+#define _gettc getwc
+#define _gettchar getwchar
+#define _puttc putwc
+#define _puttchar putwchar
+#define _ungettc ungetwc
+
+
+/* String conversion functions */
+
+#define _tcstod wcstod
+#define _tcstol wcstol
+#define _tcstoul wcstoul
+
+
+/* String functions */
+
+#define _tcscat wcscat
+#define _tcschr wcschr
+#define _tcscmp wcscmp
+#define _tcscpy wcscpy
+#define _tcscspn wcscspn
+#define _tcslen wcslen
+#define _tcsncat wcsncat
+#define _tcsncmp wcsncmp
+#define _tcsncpy wcsncpy
+#define _tcspbrk wcspbrk
+#define _tcsrchr wcsrchr
+#define _tcsspn wcsspn
+#define _tcsstr wcsstr
+#define _tcstok wcstok
+
+#define _tcsdup _wcsdup
+#define _tcsicmp _wcsicmp
+#define _tcsnicmp _wcsnicmp
+#define _tcsnset _wcsnset
+#define _tcsrev _wcsrev
+#define _tcsset _wcsset
+
+
+/* Redundant "logical-character" mappings */
+
+#define _tcsclen wcslen
+#define _tcsnccat wcsncat
+#define _tcsnccpy wcsncpy
+#define _tcsnccmp wcsncmp
+#define _tcsncicmp _wcsnicmp
+#define _tcsncset _wcsnset
+
+#define _tcsdec _wcsdec
+#define _tcsinc _wcsinc
+#define _tcsnbcnt _wcsncnt
+#define _tcsnccnt _wcsncnt
+#define _tcsnextc _wcsnextc
+#define _tcsninc _wcsninc
+#define _tcsspnp _wcsspnp
+
+#define _tcslwr _wcslwr
+#define _tcsupr _wcsupr
+#define _tcsxfrm wcsxfrm
+#define _tcscoll wcscoll
+#define _tcsicoll _wcsicoll
+
+
+#if !__STDC__ || defined(_NO_INLINING)
+#define _tclen(_pc) (1)
+#define _tccpy(_pc1,_cpc2) ((*(_pc1) = *(_cpc2)))
+#define _tccmp(_cpc1,_cpc2) ((*(_cpc1))-(*(_cpc2)))
+#else
+__inline size_t _tclen(const wchar_t *_cpc) { return (_cpc,1); }
+__inline void _tccpy(wchar_t *_pc1, const wchar_t *_cpc2) { *_pc1 = (wchar_t)*_cpc2; }
+__inline int _tccmp(const wchar_t *_cpc1, const wchar_t *_cpc2) { return (int) ((*_cpc1)-(*_cpc2)); }
+#endif
+
+
+/* ctype functions */
+
+#define _istalpha iswalpha
+#define _istupper iswupper
+#define _istlower iswlower
+#define _istdigit iswdigit
+#define _istxdigit iswxdigit
+#define _istspace iswspace
+#define _istpunct iswpunct
+#define _istalnum iswalnum
+#define _istprint iswprint
+#define _istgraph iswgraph
+#define _istcntrl iswcntrl
+#define _istascii iswascii
+
+#define _totupper towupper
+#define _totlower towlower
+
+#define _istlegal (1)
+
+
+#if !__STDC__ || defined(_NO_INLINING)
+#define _wcsdec(_cpc, _pc) ((_pc)-1)
+#define _wcsinc(_pc) ((_pc)+1)
+#define _wcsnextc(_cpc) ((unsigned int) *(_cpc))
+#define _wcsninc(_pc, _sz) (((_pc)+(_sz)))
+#define _wcsncnt(_cpc, _sz) ((wcslen(_cpc)>_sz) ? _sz : wcslen(_cpc))
+#define _wcsspnp(_cpc1, _cpc2) ((*((_cpc1)+wcsspn(_cpc1,_cpc2))) ? ((_cpc1)+wcsspn(_cpc1,_cpc2)) : NULL)
+#else
+__inline wchar_t * _wcsdec(const wchar_t * _cpc, const wchar_t * _pc) { return (wchar_t *)(_cpc,(_pc-1)); }
+__inline wchar_t * _wcsinc(const wchar_t * _pc) { return (wchar_t *)(_pc+1); }
+__inline unsigned int _wcsnextc(const wchar_t * _cpc) { return (unsigned int)*_cpc; }
+__inline wchar_t * _wcsninc(const wchar_t * _pc, size_t _sz) { return (wchar_t *)(_pc+_sz); }
+__inline size_t _wcsncnt( const wchar_t * _cpc, size_t _sz) { size_t len; len = wcslen(_cpc); return (len>_sz) ? _sz : len; }
+__inline wchar_t * _wcsspnp( const wchar_t * _cpc1, const wchar_t * _cpc2) { return (*(_cpc1 += wcsspn(_cpc1,_cpc2))!='\0') ? (wchar_t*)_cpc1 : NULL; }
+#endif
+
+
+#else /* ndef _UNICODE */
+
+
+#if !defined(_CHAR_UNSIGNED) && !defined(_JWARNING_DEFINED)
+/* #pragma message("TCHAR.H: Warning: The /J option is recommended for international compilation") */
+#define _JWARNING_DEFINED
+#endif
+
+
+#include <string.h>
+
+
+#define __T(x) x
+
+
+/* Formatted i/o */
+
+#define _tprintf printf
+#define _ftprintf fprintf
+#define _stprintf sprintf
+#define _sntprintf _snprintf
+#define _vtprintf vprintf
+#define _vftprintf vfprintf
+#define _vstprintf vsprintf
+#define _vsntprintf _vsnprintf
+#define _tscanf scanf
+#define _ftscanf fscanf
+#define _stscanf sscanf
+
+
+/* Unformatted i/o */
+
+#define _fgettc(_f) (_TINT)fgetc((_f))
+#define _fgettchar (_TINT)_fgetchar
+#define _fgetts(_s,_i,_f) fgets((_s),(_i),(_f))
+#define _fputtc(_i,_f) (_TINT)fputc((int)(_i),(_f))
+#define _fputtchar(_i) (_TINT)_fputchar((int)(_i))
+#define _fputts(_s,_f) (_TINT)fputs((_s),(_f))
+#define _gettc(_f) (_TINT)getc((_f))
+#define _gettchar (_TINT)getchar
+#define _puttc(_i,_f) (_TINT)putc((int)(_i),(_f))
+#define _puttchar(_i) (_TINT)putchar((int)(_i))
+#define _ungettc(_i,_f) (_TINT)ungetc((int)(_i),(_f))
+
+
+/* String conversion functions */
+
+#define _tcstod strtod
+#define _tcstol strtol
+#define _tcstoul strtoul
+
+
+#ifdef _MBCS
+
+#ifndef __TCHAR_DEFINED
+typedef char _TCHAR;
+typedef unsigned int _TINT;
+#define __TCHAR_DEFINED
+#endif
+
+#ifndef _TCHAR_DEFINED
+#if !__STDC__
+typedef char TCHAR;
+#endif
+#define _TCHAR_DEFINED
+#endif
+
+#define _TEOF EOF
+
+
+#include <mbstring.h>
+
+
+/* Helper macros for MB casts */
+
+#define _MB(_s) ((unsigned char *)(_s))
+#define _CMB(_s) ((const unsigned char *)(_s))
+
+
+/* String functions */
+
+#define _tcscat(_s1,_s2) (_TCHAR*)_mbscat(_MB(_s1),_CMB(_s2))
+#define _tcschr(_s,_i) (_TCHAR*)_mbschr(_CMB(_s),(_i))
+#define _tcscmp(_s1,_s2) _mbscmp(_CMB(_s1),_CMB(_s2))
+#define _tcscpy(_s1,_s2) (_TCHAR*)_mbscpy(_MB(_s1),_CMB(_s2))
+#define _tcscspn(_s1,_s2) _mbscspn(_CMB(_s1),_CMB(_s2))
+#define _tcslen(_s) strlen((_s))
+#define _tcsncat(_s1,_s2,_n) (_TCHAR*)_mbsnbcat(_MB(_s1),_CMB(_s2),(_n))
+#define _tcsncmp(_s1,_s2,_n) _mbsnbcmp(_CMB(_s1),_CMB(_s2),(_n))
+#define _tcsncpy(_s1,_s2,_n) (_TCHAR*)_mbsnbcpy(_MB(_s1),_CMB(_s2),(_n))
+#define _tcspbrk(_s1,_s2) (_TCHAR*)_mbspbrk(_CMB(_s1),_CMB(_s2))
+#define _tcsrchr(_s,_i) (_TCHAR*)_mbsrchr(_CMB(_s),(_i))
+#define _tcsspn(_s1,_s2) _mbsspn(_CMB(_s1),_CMB(_s2))
+#define _tcsstr(_s1,_s2) (_TCHAR*)_mbsstr(_CMB(_s1),_CMB(_s2))
+#define _tcstok(_s1,_s2) (_TCHAR*)_mbstok(_MB(_s1),_CMB(_s2))
+
+#define _tcsdup(_s) (_TCHAR*)_mbsdup(_CMB(_s))
+#define _tcsicmp(_s1,_s2) _mbsicmp(_CMB(_s1),_CMB(_s2))
+#define _tcsnicmp(_s1,_s2,_n) _mbsnbicmp(_CMB(_s1),_CMB(_s2),(_n))
+#define _tcsnset(_s,_i,_n) (_TCHAR*)_mbsnbset(_MB(_s),(_i),(_n))
+#define _tcsrev(_s) (_TCHAR*)_mbsrev(_MB(_s))
+#define _tcsset(_s,_i) (_TCHAR*)_mbsset(_MB(_s),(_i))
+
+
+/* "logical-character" mappings */
+
+#define _tcsclen(_s) _mbslen(_MB(_s))
+#define _tcsnccat(_s1,_s2,_n) (_TCHAR*)_mbsncat(_MB(_s1),_CMB(_s2),(_n))
+#define _tcsnccpy(_s1,_s2,_n) (_TCHAR*)_mbsncpy(_MB(_s1),_CMB(_s2),(_n))
+#define _tcsnccmp(_s1,_s2,_n) _mbsncmp(_CMB(_s1),_CMB(_s2),(_n))
+#define _tcsncicmp(_s1,_s2,_n) _mbsnicmp(_CMB(_s1),_CMB(_s2),(_n))
+#define _tcsncset(_s,_i,_n) (_TCHAR*)_mbsnset(_MB(_s),(_i),(_n))
+
+
+/* MBCS-specific mappings */
+
+#define _tcsdec(_s1,_s2) (_TCHAR*)_mbsdec(_CMB(_s1),_CMB(_s2))
+#define _tcsinc(_s) (_TCHAR*)_mbsinc(_CMB(_s))
+#define _tcsnbcnt(_s,_n) _mbsnbcnt(_CMB(_s),(_n))
+#define _tcsnccnt(_s,_n) _mbsnccnt(_CMB(_s),(_n))
+#define _tcsnextc(_s) _mbsnextc(_CMB(_s))
+#define _tcsninc(_s,_n) (_TCHAR*)_mbsninc(_CMB(_s),(_n))
+#define _tcsspnp(_s1,_s2) (_TCHAR*)_mbsspnp(_CMB(_s1),_CMB(_s2))
+
+#define _tcslwr(_s) (_TCHAR*)_mbslwr(_MB(_s))
+#define _tcsupr(_s) (_TCHAR*)_mbsupr(_MB(_s))
+#define _tcsxfrm(_d,_s,_n) (strncpy((_d),(_s),(_n)),strlen((_s)))
+#define _tcscoll _tcscmp
+#define _tcsicoll _tcsicmp
+
+#define _tclen(_s) _mbclen(_CMB(_s))
+#define _tccpy(_s1,_s2) _mbccpy(_MB(_s1),_CMB(_s2))
+#define _tccmp(_s1,_s2) _tcsnccmp((_s1),(_s2),1)
+
+
+/* ctype functions */
+
+#define _istalpha _ismbcalpha
+#define _istupper _ismbcupper
+#define _istlower _ismbclower
+#define _istdigit _ismbcdigit
+#define _istxdigit _isxdigit
+#define _istspace _ismbcspace
+#define _istprint _ismbcprint
+#define _istcntrl _iscntrl
+#define _istascii _isascii
+
+#define _totupper _mbctoupper
+#define _totlower _mbctolower
+
+#define _istlegal _ismbclegal
+
+
+#else /* !_MBCS */
+
+
+#ifndef __TCHAR_DEFINED
+typedef char _TCHAR;
+typedef int _TINT;
+#define __TCHAR_DEFINED
+#endif
+
+#ifndef _TCHAR_DEFINED
+#if !__STDC__
+typedef char TCHAR;
+#endif
+#define _TCHAR_DEFINED
+#endif
+
+#define _TEOF EOF
+
+
+/* String functions */
+
+#define _tcscat strcat
+#define _tcschr strchr
+#define _tcscmp strcmp
+#define _tcscpy strcpy
+#define _tcscspn strcspn
+#define _tcslen strlen
+#define _tcsncat strncat
+#define _tcsncmp strncmp
+#define _tcsncpy strncpy
+#define _tcspbrk strpbrk
+#define _tcsrchr strrchr
+#define _tcsspn strspn
+#define _tcsstr strstr
+#define _tcstok strtok
+
+#define _tcsdup _strdup
+#define _tcsicmp _stricmp
+#define _tcsnicmp _strnicmp
+#define _tcsnset _strnset
+#define _tcsrev _strrev
+#define _tcsset _strset
+
+
+/* "logical-character" mappings */
+
+#define _tcsclen strlen
+#define _tcsnccat strncat
+#define _tcsnccpy strncpy
+#define _tcsnccmp strncmp
+#define _tcsncicmp _strnicmp
+#define _tcsncset _strnset
+
+
+/* MBCS-specific functions */
+
+#define _tcsdec _strdec
+#define _tcsinc _strinc
+#define _tcsnbcnt _strncnt
+#define _tcsnccnt _strncnt
+#define _tcsnextc _strnextc
+#define _tcsninc _strninc
+#define _tcsspnp _strspnp
+
+#define _tcslwr _strlwr
+#define _tcsupr _strupr
+#define _tcsxfrm strxfrm
+#define _tcscoll strcoll
+#define _tcsicoll _stricoll
+
+
+#if !__STDC__ || defined(_NO_INLINING)
+#define _tclen(_pc) (1)
+#define _tccpy(_pc1,_cpc2) (*(_pc1) = *(_cpc2))
+#define _tccmp(_cpc1,_cpc2) (((unsigned char)*(_cpc1))-((unsigned char)*(_cpc2)))
+#else
+__inline size_t _tclen(const char *_cpc) { return (_cpc,1); }
+__inline void _tccpy(char *_pc1, const char *_cpc2) { *_pc1 = *_cpc2; }
+__inline int _tccmp(const char *_cpc1, const char *_cpc2) { return (int) (((unsigned char)*_cpc1)-((unsigned char)*_cpc2)); }
+#endif
+
+
+/* ctype-functions */
+
+#define _istalpha isalpha
+#define _istupper isupper
+#define _istlower islower
+#define _istdigit isdigit
+#define _istxdigit isxdigit
+#define _istspace isspace
+#define _istpunct ispunct
+#define _istalnum isalnum
+#define _istprint isprint
+#define _istgraph isgraph
+#define _istcntrl iscntrl
+#define _istascii isascii
+
+#define _totupper toupper
+#define _totlower tolower
+
+#define _istlegal (1)
+
+
+/* the following is optional if functional versions are available */
+
+/* define NULL pointer value */
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+
+#if !__STDC__ || defined(_NO_INLINING)
+#define _strdec(_cpc, _pc) ((_pc)-1)
+#define _strinc(_pc) ((_pc)+1)
+#define _strnextc(_cpc) ((unsigned int) *(_cpc))
+#define _strninc(_pc, _sz) (((_pc)+(_sz)))
+#define _strncnt(_cpc, _sz) ((strlen(_cpc)>_sz) ? _sz : strlen(_cpc))
+#define _strspnp(_cpc1, _cpc2) ((*((_cpc1)+strspn(_cpc1,_cpc2))) ? ((_cpc1)+strspn(_cpc1,_cpc2)) : NULL)
+#else /* __STDC__ */
+__inline char * _strdec(const char * _cpc, const char * _pc) { return (char *)(_cpc,(_pc-1)); }
+__inline char * _strinc(const char * _pc) { return (char *)(_pc+1); }
+__inline unsigned int _strnextc(const char * _cpc) { return (unsigned int)*_cpc; }
+__inline char * _strninc(const char * _pc, size_t _sz) { return (char *)(_pc+_sz); }
+__inline size_t _strncnt( const char * _cpc, size_t _sz) { size_t len; len = strlen(_cpc); return (len>_sz) ? _sz : len; }
+__inline char * _strspnp( const char * _cpc1, const char * _cpc2) { return (*(_cpc1 += strspn(_cpc1,_cpc2))!='\0') ? (char*)_cpc1 : NULL; }
+#endif /* __STDC__ */
+
+
+#endif /* _MBCS */
+
+#endif /* _UNICODE */
+
+
+/* Generic text macros to be used with string literals and character constants.
+ Will also allow symbolic constants that resolve to same. */
+
+#define _T(x) __T(x)
+#define _TEXT(x) __T(x)
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_TCHAR
+#endif /* _INC_TCHAR */
diff --git a/private/crtlib/include/time.h b/private/crtlib/include/time.h
new file mode 100644
index 000000000..273070ab0
--- /dev/null
+++ b/private/crtlib/include/time.h
@@ -0,0 +1,192 @@
+/***
+*time.h - definitions/declarations for time routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file has declarations of time routines and defines
+* the structure returned by the localtime and gmtime routines and
+* used by asctime.
+* [ANSI/System V]
+*
+****/
+
+#ifndef _INC_TIME
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+/* define the implementation defined time type */
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t; /* time value */
+#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
+#endif
+
+#ifndef _CLOCK_T_DEFINED
+typedef long clock_t;
+#define _CLOCK_T_DEFINED
+#endif
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+
+/* define NULL pointer value */
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+
+#ifndef _TM_DEFINED
+struct tm {
+ int tm_sec; /* seconds after the minute - [0,59] */
+ int tm_min; /* minutes after the hour - [0,59] */
+ int tm_hour; /* hours since midnight - [0,23] */
+ int tm_mday; /* day of the month - [1,31] */
+ int tm_mon; /* months since January - [0,11] */
+ int tm_year; /* years since 1900 */
+ int tm_wday; /* days since Sunday - [0,6] */
+ int tm_yday; /* days since January 1 - [0,365] */
+ int tm_isdst; /* daylight savings time flag */
+ };
+#define _TM_DEFINED
+#endif
+
+
+/* clock ticks macro - ANSI version */
+
+#define CLOCKS_PER_SEC 1000
+
+
+/* extern declarations for the global variables used by the ctime family of
+ * routines.
+ */
+
+#ifdef _DLL
+
+#define _daylight (*_daylight_dll)
+#define _timezone (*_timezone_dll)
+
+/* non-zero if daylight savings time is used */
+extern int * _daylight_dll;
+
+/* difference in seconds between GMT and local time */
+extern long * _timezone_dll;
+
+/* standard/daylight savings time zone names */
+extern char ** _tzname;
+
+#else
+
+
+#ifdef _POSIX_
+extern char * _rule;
+#endif
+
+/* non-zero if daylight savings time is used */
+extern int _daylight;
+
+/* difference in seconds between GMT and local time */
+extern long _timezone;
+
+/* standard/daylight savings time zone names */
+#ifdef _POSIX_
+extern char * tzname[2];
+#else
+extern char * _tzname[2];
+#endif
+
+#endif
+
+/* function prototypes */
+
+char * _CRTAPI1 asctime(const struct tm *);
+char * _CRTAPI1 ctime(const time_t *);
+clock_t _CRTAPI1 clock(void);
+double _CRTAPI1 difftime(time_t, time_t);
+struct tm * _CRTAPI1 gmtime(const time_t *);
+struct tm * _CRTAPI1 localtime(const time_t *);
+time_t _CRTAPI1 mktime(struct tm *);
+size_t _CRTAPI1 strftime(char *, size_t, const char *, const struct tm *);
+char * _CRTAPI1 _strdate(char *);
+char * _CRTAPI1 _strtime(char *);
+time_t _CRTAPI1 time(time_t *);
+#ifdef _POSIX_
+void _CRTAPI1 tzset(void);
+#else
+void _CRTAPI1 _tzset(void);
+#endif
+unsigned _CRTAPI1 _getsystime(struct tm *);
+unsigned _CRTAPI1 _setsystime(struct tm *, unsigned);
+
+#if !__STDC__
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+#ifndef _WTIME_DEFINED
+size_t _CRTAPI1 wcsftime(wchar_t *, size_t, const char *, const struct tm *);
+#define _WTIME_DEFINED
+#endif
+#endif /* __STDC__ */
+
+#if !__STDC__ || defined(_POSIX_)
+/* Non-ANSI names for compatibility */
+
+#define CLK_TCK CLOCKS_PER_SEC
+
+#define daylight _daylight
+/* timezone cannot be #defined to _timezone because of <sys/timeb.h> */
+
+#ifndef _POSIX_
+#define tzname _tzname
+
+#define tzset _tzset
+#endif /* _POSIX_ */
+
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_TIME
+#endif /* _INC_TIME */
diff --git a/private/crtlib/include/varargs.h b/private/crtlib/include/varargs.h
new file mode 100644
index 000000000..b8f75cd2c
--- /dev/null
+++ b/private/crtlib/include/varargs.h
@@ -0,0 +1,136 @@
+/***
+*varargs.h - XENIX style macros for variable argument functions
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines XENIX style macros for accessing arguments of a
+* function which takes a variable number of arguments.
+* [System V]
+*
+****/
+
+#ifndef _INC_VARARGS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if __STDC__
+#error varargs.h incompatible with ANSI (use stdarg.h)
+#endif
+
+#ifndef _VA_LIST_DEFINED
+
+#ifdef _M_ALPHA
+typedef struct {
+ char *a0; /* pointer to first homed integer argument */
+ int offset; /* byte offset of next parameter */
+} va_list;
+#else
+typedef char *va_list;
+#endif
+
+#define _VA_LIST_DEFINED
+#endif
+
+#ifdef _M_ALPHA
+
+/*
+ * The Alpha compiler supports two builtin functions that are used to
+ * implement stdarg/varargs. The __builtin_va_start function is used
+ * by va_start to initialize the data structure that locates the next
+ * argument. The __builtin_isfloat function is used by va_arg to pick
+ * which part of the home area a given register argument is stored in.
+ * The home area is where up to six integer and/or six floating point
+ * register arguments are stored down (so they can also be referenced
+ * by a pointer like any arguments passed on the stack).
+ */
+
+#define va_dcl long va_alist;
+#define va_start(list) __builtin_va_start(list, va_alist, 0)
+#define va_end(list)
+#define va_arg(list, mode) \
+ ( *( ((list).offset += ((int)sizeof(mode) + 7) & -8) , \
+ (mode *)((list).a0 + (list).offset - \
+ ((__builtin_isfloat(mode) && (list).offset <= (6 * 8)) ? \
+ (6 * 8) + 8 : ((int)sizeof(mode) + 7) & -8) \
+ ) \
+ ) \
+ )
+
+#else
+
+
+#ifdef _M_IX86
+/*
+ * define a macro to compute the size of a type, variable or expression,
+ * rounded up to the nearest multiple of sizeof(int). This number is its
+ * size as function argument (Intel architecture). Note that the macro
+ * depends on sizeof(int) being a power of 2!
+ */
+#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
+
+#define va_dcl va_list va_alist;
+#define va_start(ap) ap = (va_list)&va_alist
+#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
+#define va_end(ap) ap = (va_list)0
+
+#elif defined(_M_MRX000)
+
+#define va_dcl int va_alist;
+#define va_start(list) list = (char *) &va_alist
+#define va_end(list)
+#define va_arg(list, mode) ((mode *)(list =\
+ (char *) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) &\
+ (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1]
+/* +++++++++++++++++++++++++++++++++++++++++++
+ Because of parameter passing conventions in C:
+ use mode=int for char, and short types
+ use mode=double for float types
+ use a pointer for array types
+ +++++++++++++++++++++++++++++++++++++++++++ */
+
+#elif defined(_M_PPC)
+
+/*
+ * define a macro to compute the size of a type, variable or expression,
+ * rounded up to the nearest multiple of sizeof(int). This number is its
+ * size as function argument (PPC architecture). Note that the macro
+ * depends on sizeof(int) being a power of 2!
+ */
+/* this is for LITTLE-ENDIAN PowerPC */
+
+/* bytes that a type occupies in the argument list */
+#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
+/* return 'ap' adjusted for type 't' in arglist */
+#define _ALIGNIT(ap,t) \
+ ((((int)(ap))+(sizeof(t)<8?3:7)) & (sizeof(t)<8?~3:~7))
+
+#define va_dcl va_list va_alist;
+#define va_start(ap) ap = (va_list)&va_alist
+#define va_arg(ap,t) ( *(t *)((ap = (char *) (_ALIGNIT(ap, t) + _INTSIZEOF(t))) - _INTSIZEOF(t)) )
+#define va_end(ap) ap = (va_list)0
+
+#else
+
+/* A guess at the proper definitions for other platforms */
+
+#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
+
+#define va_dcl va_list va_alist;
+#define va_start(ap) ap = (va_list)&va_alist
+#define va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
+#define va_end(ap) ap = (va_list)0
+
+#endif // MIPS/X86/PPC
+
+
+#endif /* _M_ALPHA */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_VARARGS
+#endif /* _INC_VARARGS */
diff --git a/private/crtlib/include/wchar.h b/private/crtlib/include/wchar.h
new file mode 100644
index 000000000..a80e2aaf7
--- /dev/null
+++ b/private/crtlib/include/wchar.h
@@ -0,0 +1,300 @@
+/***
+*wchar.h - declarations for wide character functions
+*
+* Copyright (c) 1992-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains the types, macros and function declarations for
+* all wide character-related functions. They may also be declared in
+* individual header files on a functional basis.
+* [ISO]
+*
+* Note: keep in sync with ctype.h, stdio.h, stdlib.h, string.h, time.h.
+*
+****/
+
+#ifndef _INC_WCHAR
+#define _INC_WCHAR
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+/*
+ * Conditional macro definition for function calling type and variable type
+ * qualifiers.
+ */
+#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
+
+/*
+ * Definitions for MS C8-32 (386/486) compiler
+ */
+#define _CRTAPI1 __cdecl
+#define _CRTAPI2 __cdecl
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+
+#endif
+
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+#ifndef _WCTYPE_T_DEFINED
+typedef wchar_t wint_t;
+typedef wchar_t wctype_t;
+#define _WCTYPE_T_DEFINED
+#endif
+
+#ifndef _VA_LIST_DEFINED
+#ifdef _M_ALPHA
+typedef struct {
+ char *a0; /* pointer to first homed integer argument */
+ int offset; /* byte offset of next parameter */
+} va_list;
+#else
+typedef char * va_list;
+#endif
+#define _VA_LIST_DEFINED
+#endif
+
+#ifndef WEOF
+#define WEOF (wint_t)(0xFFFF)
+#endif
+
+#ifndef _FILE_DEFINED
+struct _iobuf {
+ char *_ptr;
+ int _cnt;
+ char *_base;
+ int _flag;
+ int _file;
+ int _charbuf;
+ int _bufsiz;
+ char *_tmpfname;
+ };
+typedef struct _iobuf FILE;
+#define _FILE_DEFINED
+#endif
+
+/* define NULL pointer value */
+
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+/*
+ * This declaration allows the user access to the ctype look-up
+ * array _ctype defined in ctype.obj by simply including ctype.h
+ */
+
+#ifdef _DLL
+
+extern unsigned short * _ctype;
+
+#define _pctype (*_pctype_dll)
+extern unsigned short **_pctype_dll;
+
+#define _pwctype (*_pwctype_dll)
+extern unsigned short **_pwctype_dll;
+
+#else /* _DLL */
+
+
+extern unsigned short _ctype[];
+extern unsigned short *_pctype;
+extern wctype_t *_pwctype;
+
+#endif /* _DLL */
+
+/* set bit masks for the possible character types */
+
+#define _UPPER 0x1 /* upper case letter */
+#define _LOWER 0x2 /* lower case letter */
+#define _DIGIT 0x4 /* digit[0-9] */
+#define _SPACE 0x8 /* tab, carriage return, newline, */
+ /* vertical tab or form feed */
+#define _PUNCT 0x10 /* punctuation character */
+#define _CONTROL 0x20 /* control character */
+#define _BLANK 0x40 /* space char */
+#define _HEX 0x80 /* hexadecimal digit */
+
+#define _LEADBYTE 0x8000 /* multibyte leadbyte */
+#define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */
+
+
+/* function prototypes */
+
+#ifndef _WCTYPE_DEFINED
+
+/* character classification function prototypes */
+/* also defined in ctype.h */
+
+int _CRTAPI1 iswalpha(wint_t);
+int _CRTAPI1 iswupper(wint_t);
+int _CRTAPI1 iswlower(wint_t);
+int _CRTAPI1 iswdigit(wint_t);
+int _CRTAPI1 iswxdigit(wint_t);
+int _CRTAPI1 iswspace(wint_t);
+int _CRTAPI1 iswpunct(wint_t);
+int _CRTAPI1 iswalnum(wint_t);
+int _CRTAPI1 iswprint(wint_t);
+int _CRTAPI1 iswgraph(wint_t);
+int _CRTAPI1 iswcntrl(wint_t);
+int _CRTAPI1 iswascii(wint_t);
+int _CRTAPI1 isleadbyte(int);
+
+wchar_t _CRTAPI1 towupper(wchar_t);
+wchar_t _CRTAPI1 towlower(wchar_t);
+
+int _CRTAPI1 iswctype(wint_t, wctype_t);
+
+int _CRTAPI1 _isctype(int, int);
+
+#define _WCTYPE_DEFINED
+#endif
+
+#define iswalpha(_c) ( iswctype(_c,_ALPHA) )
+#define iswupper(_c) ( iswctype(_c,_UPPER) )
+#define iswlower(_c) ( iswctype(_c,_LOWER) )
+#define iswdigit(_c) ( iswctype(_c,_DIGIT) )
+#define iswxdigit(_c) ( iswctype(_c,_HEX) )
+#define iswspace(_c) ( iswctype(_c,_SPACE) )
+#define iswpunct(_c) ( iswctype(_c,_PUNCT) )
+#define iswalnum(_c) ( iswctype(_c,_ALPHA|_DIGIT) )
+#define iswprint(_c) ( iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT) )
+#define iswgraph(_c) ( iswctype(_c,_PUNCT|_ALPHA|_DIGIT) )
+#define iswcntrl(_c) ( iswctype(_c,_CONTROL) )
+#define iswascii(_c) ( (unsigned)(_c) < 0x80 )
+
+/* note: MS-specific routine, may evaluate its arguments more than once */
+#define isleadbyte(_c) ((_c) < 256 ? _pctype[_c] & _LEADBYTE : 0)
+
+
+#ifndef _WSTDIO_DEFINED
+
+wint_t _CRTAPI1 fgetwc(FILE *);
+wint_t _CRTAPI1 _fgetwchar(void);
+wint_t _CRTAPI1 fputwc(wint_t, FILE *);
+wint_t _CRTAPI1 _fputwchar(wint_t);
+wint_t _CRTAPI1 getwc(FILE *);
+wint_t _CRTAPI1 getwchar(void);
+wint_t _CRTAPI1 putwc(wint_t, FILE *);
+wint_t _CRTAPI1 putwchar(wint_t);
+wint_t _CRTAPI1 ungetwc(wint_t, FILE *);
+
+int _CRTAPI2 fwprintf(FILE *, const wchar_t *, ...);
+int _CRTAPI2 wprintf(const wchar_t *, ...);
+int _CRTAPI2 _snwprintf(wchar_t *, size_t, const wchar_t *, ...);
+int _CRTAPI2 swprintf(wchar_t *, const wchar_t *, ...);
+int _CRTAPI1 vfwprintf(FILE *, const wchar_t *, va_list);
+int _CRTAPI1 vwprintf(const wchar_t *, va_list);
+int _CRTAPI1 _vsnwprintf(wchar_t *, size_t, const wchar_t *, va_list);
+int _CRTAPI1 vswprintf(wchar_t *, const wchar_t *, va_list);
+int _CRTAPI2 fwscanf(FILE *, const wchar_t *, ...);
+int _CRTAPI2 swscanf(const wchar_t *, const wchar_t *, ...);
+int _CRTAPI2 wscanf(const wchar_t *, ...);
+
+#define getwchar() fgetwc(stdin)
+#define putwchar(_c) fputwc((_c),stdout)
+#define getwc(_stm) fgetwc(_stm)
+#define putwc(_c,_stm) fputwc(_c,_stm)
+
+
+#define _WSTDIO_DEFINED
+#endif
+
+
+#ifndef _WSTDLIB_DEFINED
+/* also defined in stdlib.h */
+double _CRTAPI1 wcstod(const wchar_t *, wchar_t **);
+long _CRTAPI1 wcstol(const wchar_t *, wchar_t **, int);
+unsigned long _CRTAPI1 wcstoul(const wchar_t *, wchar_t **, int);
+wchar_t * _CRTAPI1 _itow (int val, wchar_t *buf, int radix);
+wchar_t * _CRTAPI1 _ltow (long val, wchar_t *buf, int radix);
+wchar_t * _CRTAPI1 _ultow (unsigned long val, wchar_t *buf, int radix);
+long _CRTAPI1 _wtol(const wchar_t *nptr);
+int _CRTAPI1 _wtoi(const wchar_t *nptr);
+#define _WSTDLIB_DEFINED
+#endif
+
+
+#ifndef _WSTRING_DEFINED
+wchar_t * _CRTAPI1 wcscat(wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcschr(const wchar_t *, wchar_t);
+int _CRTAPI1 wcscmp(const wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcscpy(wchar_t *, const wchar_t *);
+size_t _CRTAPI1 wcscspn(const wchar_t *, const wchar_t *);
+size_t _CRTAPI1 wcslen(const wchar_t *);
+wchar_t * _CRTAPI1 wcsncat(wchar_t *, const wchar_t *, size_t);
+int _CRTAPI1 wcsncmp(const wchar_t *, const wchar_t *, size_t);
+wchar_t * _CRTAPI1 wcsncpy(wchar_t *, const wchar_t *, size_t);
+wchar_t * _CRTAPI1 wcspbrk(const wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcsrchr(const wchar_t *, wchar_t);
+size_t _CRTAPI1 wcsspn(const wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcsstr(const wchar_t *, const wchar_t *);
+wchar_t * _CRTAPI1 wcstok(wchar_t *, const wchar_t *);
+
+wchar_t * _CRTAPI1 _wcsdup(const wchar_t *);
+int _CRTAPI1 _wcsicmp(const wchar_t *, const wchar_t *);
+int _CRTAPI1 _wcsnicmp(const wchar_t *, const wchar_t *, size_t);
+wchar_t * _CRTAPI1 _wcsnset(wchar_t *, wchar_t, size_t);
+wchar_t * _CRTAPI1 _wcsrev(wchar_t *);
+wchar_t * _CRTAPI1 _wcsset(wchar_t *, wchar_t);
+
+wchar_t * _CRTAPI1 _wcslwr(wchar_t *);
+wchar_t * _CRTAPI1 _wcsupr(wchar_t *);
+size_t _CRTAPI1 wcsxfrm(wchar_t *, const wchar_t *, size_t);
+int _CRTAPI1 wcscoll(const wchar_t *, const wchar_t *);
+int _CRTAPI1 _wcsicoll(const wchar_t *, const wchar_t *);
+
+/* old names */
+#define wcswcs wcsstr
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#define wcsdup _wcsdup
+#define wcsicmp _wcsicmp
+#define wcsnicmp _wcsnicmp
+#define wcsnset _wcsnset
+#define wcsrev _wcsrev
+#define wcsset _wcsset
+#define wcslwr _wcslwr
+#define wcsupr _wcsupr
+#define wcsicoll _wcsicoll
+#endif
+
+#define _WSTRING_DEFINED
+#endif
+
+
+#ifndef _WTIME_DEFINED
+size_t _CRTAPI1 wcsftime(wchar_t *, size_t, const char *, const struct tm *);
+#define _WTIME_DEFINED
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _INC_WCHAR */
diff --git a/private/crtlib/lib/alpha/crtdll.alp b/private/crtlib/lib/alpha/crtdll.alp
new file mode 100644
index 000000000..336a85eb4
--- /dev/null
+++ b/private/crtlib/lib/alpha/crtdll.alp
@@ -0,0 +1,62 @@
+ __C_specific_handler
+ __2divl
+ __2divlu
+ __2divq
+ __2divqu
+ __2reml
+ __2remlu
+ __2remq
+ __2remqu
+ __jump_unwind
+ _OtsCSpecificHandler
+ _OtsDivide32
+ _OtsDivide32Overflow
+ _OtsDivide32Unsigned
+ _OtsDivide64
+ _OtsDivide64Overflow
+ _OtsDivide64Unsigned
+ _OtsFieldExtractSigned
+ _OtsFieldExtractSignedVolatile
+ _OtsFieldExtractUnsigned
+ _OtsFieldExtractUnsignedVolatile
+ _OtsFieldInsert
+ _OtsFieldInsertVolatile
+ _OtsFill
+ _OtsLocalFinallyUnwind
+ _OtsModulus32
+ _OtsModulus64
+ _OtsMove
+ _OtsMoveMinimum
+ _OtsRemainder32
+ _OtsRemainder32Unsigned
+ _OtsRemainder64
+ _OtsRemainder64Unsigned
+ _Otssetjmp3
+ _Otssetjmpex3
+ _Otsstrcmp
+ _Otsstrcpy
+ _Otsstrlen
+ _OtsStringCompareEql
+ _OtsStringCompareEqlPadded
+ _OtsStringCompareEqlSameLen
+ _OtsStringCompareLeq
+ _OtsStringCompareLeqPadded
+ _OtsStringCompareLeqSameLen
+ _OtsStringCompareLss
+ _OtsStringCompareLssPadded
+ _OtsStringCompareLssSameLen
+ _OtsStringIndex
+ _OtsStringIndexChar
+ _OtsStringSearch
+ _OtsStringSearchChar
+ _OtsStringSearchMask
+ _OtsStringTranslate
+ _OtsStringVerify
+ _OtsStringVerifyChar
+ _OtsStringVerifyMask
+ _OtsUnwindRfp
+ _OtsZero
+ setjmp
+ _setjmpex
+ strtoq
+ strtouq
diff --git a/private/crtlib/lib/crtdll.def b/private/crtlib/lib/crtdll.def
new file mode 100644
index 000000000..4b91e3037
--- /dev/null
+++ b/private/crtlib/lib/crtdll.def
@@ -0,0 +1,508 @@
+LIBRARY CRTDLL INITINSTANCE
+DESCRIPTION 'Microsoft Dynamically-linked C Run-Time Library For Win32'
+DATA MULTIPLE NONSHARED
+PROTMODE
+EXPORTS
+ abort
+ abs
+ _access
+ _acmdln_dll CONSTANT
+ acos
+ _aexit_rtn_dll CONSTANT
+ _amsg_exit
+ __argc_dll CONSTANT
+ __argv_dll CONSTANT
+ asctime
+ asin
+ _assert
+ atan
+ atan2
+ atexit
+ atof
+ atoi
+ atol
+ _baseversion_dll CONSTANT
+ _basemajor_dll CONSTANT
+ _baseminor_dll CONSTANT
+ _beep
+ _beginthread
+ bsearch
+ _cabs
+ calloc
+ ceil
+ _cexit
+ _c_exit
+ _cgets
+ _chdir
+ _chdrive
+ _chgsign
+ _chmod
+ _chsize
+ clearerr
+ _clearfp
+ clock
+ _close
+ _commit
+ _commode_dll CONSTANT
+ _controlfp
+ _copysign
+ cos
+ cosh
+ _cprintf
+ _cpumode_dll CONSTANT
+ _cputs
+ _creat
+ _cscanf
+ ctime
+ _ctype CONSTANT
+ _cwait
+ _daylight_dll CONSTANT
+ difftime
+ div
+ __dllonexit
+ __doserrno
+ _dup
+ _dup2
+ _ecvt
+ _endthread
+ _environ_dll CONSTANT
+ _eof
+ _errno
+ _execl
+ _execle
+ _execlp
+ _execlpe
+ _execv
+ _execve
+ _execvp
+ _execvpe
+ _exit
+ exit
+ exp
+ _expand
+ fabs
+ fclose
+ _fcloseall
+ _fcvt
+ _fdopen
+ feof
+ ferror
+ fflush
+ fgetc
+ fgetwc
+ _fgetchar
+ _fgetwchar
+ fgetpos
+ fgets
+ _filbuf
+ _fileinfo_dll CONSTANT
+ _filelength
+ _fileno
+ _findclose
+ _findfirst
+ _findnext
+ _finite
+ floor
+ _flushall
+ _flsbuf
+ fmod
+ _fmode_dll CONSTANT
+ fopen
+ _fpclass
+ __fpecode
+ _fpieee_flt
+ _fpreset
+ fprintf
+ fputc
+ fputwc
+ _fputchar
+ _fputwchar
+ fputs
+ fread
+ free
+ freopen
+ frexp
+ fscanf
+ fseek
+ fsetpos
+ _fsopen
+ _fstat
+ ftell
+ _ftime
+ _fullpath
+ _futime
+ fwprintf
+ fwrite
+ fwscanf
+ _gcvt
+ getc
+ _getch
+ getchar
+ _getche
+ _getcwd
+ _getdcwd
+ _getdiskfree
+ _getdllprocaddr
+ _getdrive
+ _getdrives
+ getenv
+ __GetMainArgs
+ _get_osfhandle
+ _getpid
+ gets
+ _getsystime
+ _getw
+ gmtime
+ _heapchk
+ _heapmin
+ _heapset
+ _heapwalk
+ _HUGE_dll CONSTANT
+ _hypot
+ _initterm
+ _iob CONSTANT
+ isalnum
+ isalpha
+ __isascii
+ _isatty
+ iscntrl
+ __iscsym
+ __iscsymf
+ _isctype
+ isdigit
+ isgraph
+ isleadbyte
+ islower
+ _ismbbalnum
+ _ismbbalpha
+ _ismbbgraph
+ _ismbbkalnum
+ _ismbbkana
+ _ismbbkpunct
+ _ismbblead
+ _ismbbprint
+ _ismbbpunct
+ _ismbbtrail
+ _ismbcalpha
+ _ismbcdigit
+ _ismbchira
+ _ismbckata
+ _ismbcl0
+ _ismbcl1
+ _ismbcl2
+ _ismbclegal
+ _ismbclower
+ _ismbcprint
+ _ismbcspace
+ _ismbcsymbol
+ _ismbslead
+ _ismbstrail
+ _ismbcupper
+ _isnan
+ isprint
+ ispunct
+ isspace
+ isupper
+ iswalnum
+ iswalpha
+ iswascii
+ iswcntrl
+ iswctype
+ is_wctype
+ iswdigit
+ iswgraph
+ iswlower
+ iswprint
+ iswpunct
+ iswspace
+ iswupper
+ iswxdigit
+ isxdigit
+ _itoa
+ _itow
+ _j0
+ _j1
+ _jn
+ _kbhit
+ labs
+ ldexp
+ ldiv
+ _lfind
+ _loaddll
+ localeconv
+ localtime
+ _locking
+ log
+ log10
+ _logb
+ longjmp
+ _lrotl
+ _lrotr
+ _lsearch
+ _lseek
+ _ltoa
+ _ltow
+ _makepath
+ malloc
+ _matherr
+ _mbbtombc
+ _mbbtype
+ _mbccpy
+ _mbcjistojms
+ _mbcjmstojis
+ _mbclen
+ _mbctohira
+ _mbctokata
+ _mbctolower
+ _mbctombb
+ _mbctoupper
+ _mbctype CONSTANT
+ __mb_cur_max_dll CONSTANT
+ mblen
+ _mbsbtype
+ _mbscat
+ _mbschr
+ _mbscmp
+ _mbscpy
+ _mbscspn
+ _mbsdec
+ _mbsdup
+ _mbsicmp
+ _mbsinc
+ _mbslen
+ _mbslwr
+ _mbsnbcat
+ _mbsnbcmp
+ _mbsnbcnt
+ _mbsnbcpy
+ _mbsnbicmp
+ _mbsnbset
+ _mbsncat
+ _mbsnccnt
+ _mbsncmp
+ _mbsncpy
+ _mbsnextc
+ _mbsnicmp
+ _mbsninc
+ _mbsnset
+ _mbspbrk
+ _mbsrchr
+ _mbsrev
+ _mbsset
+ _mbsspn
+ _mbsspnp
+ _mbsstr
+ _mbstok
+ mbstowcs
+ _mbstrlen
+ _mbsupr
+ mbtowc
+ _memccpy
+ memchr
+ memcmp
+ memcpy
+ _memicmp
+ memmove
+ memset
+ _mkdir
+ _mktemp
+ mktime
+ modf
+ _msize
+ _nextafter
+ _onexit
+ _open
+ _open_osfhandle
+ _osmajor_dll CONSTANT
+ _osminor_dll CONSTANT
+ _osmode_dll CONSTANT
+ _osver_dll CONSTANT
+ _osversion_dll CONSTANT
+ _pclose
+ _pctype_dll CONSTANT
+ _pwctype_dll CONSTANT
+ perror
+ _pgmptr_dll CONSTANT
+ _pipe
+ _popen
+ pow
+ printf
+ _purecall
+ putc
+ _putch
+ putchar
+ _putenv
+ puts
+ _putw
+ __pxcptinfoptrs
+ qsort
+ raise
+ rand
+ realloc
+ _read
+ remove
+ rename
+ rewind
+ _rmdir
+ _rmtmp
+ _rotl
+ _rotr
+ _scalb
+ scanf
+ _searchenv
+ setbuf
+ _seterrormode
+ setlocale
+ _setmode
+ _setsystime
+ setvbuf
+ signal
+ sin
+ sinh
+ _sleep
+ _snprintf
+ _snwprintf
+ _sopen
+ _spawnl
+ _spawnle
+ _spawnlp
+ _spawnlpe
+ _spawnv
+ _spawnve
+ _spawnvp
+ _spawnvpe
+ _splitpath
+ sprintf
+ sqrt
+ srand
+ sscanf
+ _stat
+ _statusfp
+ strcat
+ strchr
+ strcmp
+ _strcmpi
+ strcoll
+ strcpy
+ strcspn
+ _strdate
+ _strdec
+ _strdup
+ _strerror
+ strerror
+ strftime
+ _stricmp
+ _stricoll
+ _strinc
+ strlen
+ _strlwr
+ strncat
+ strncmp
+ _strncnt
+ strncpy
+ _strnextc
+ _strnicmp
+ _strninc
+ _strnset
+ strpbrk
+ strrchr
+ _strrev
+ _strset
+ strspn
+ _strspnp
+ strstr
+ _strtime
+ strtod
+ strtok
+ strtol
+ strtoul
+ _strupr
+ strxfrm
+ _swab
+ swprintf
+ swscanf
+ _sys_errlist CONSTANT
+ _sys_nerr_dll CONSTANT
+ system
+ tan
+ tanh
+ _tell
+ _tempnam
+ __threadhandle
+ __threadid
+ time
+ _timezone_dll CONSTANT
+ tmpfile
+ tmpnam
+ __toascii
+ _tolower
+ tolower
+ _toupper
+ toupper
+ towlower
+ towupper
+ _tzname CONSTANT
+ _tzset
+ _ultoa
+ _ultow
+ _umask
+ ungetc
+ ungetwc
+ _ungetch
+ _unloaddll
+ _unlink
+ _utime
+ vfprintf
+ vfwprintf
+ vprintf
+ _vsnprintf
+ _vsnwprintf
+ vsprintf
+ vswprintf
+ vwprintf
+ wcscat
+ wcschr
+ wcscmp
+ wcscoll
+ wcscpy
+ wcscspn
+ wcsftime
+ wcslen
+ wcsncat
+ wcsncmp
+ wcsncpy
+ wcspbrk
+ wcsrchr
+ wcsspn
+ wcsstr
+ wcstod
+ wcstok
+ wcstol
+ wcstombs
+ wcstoul
+ wcsxfrm
+ wctomb
+ _wcsdup
+ _wcsicmp
+ _wcsnicmp
+ _wcsnset
+ _wcsrev
+ _wcsset
+ _wcslwr
+ _wcsupr
+ _wcsicoll
+ _winver_dll CONSTANT
+ _winmajor_dll CONSTANT
+ _winminor_dll CONSTANT
+ wprintf
+ _write
+ wscanf
+ _wtoi
+ _wtol
+ _XcptFilter
+ _y0
+ _y1
+ _yn
+ ??2@YAPAXI@Z
+ ??3@YAXPAX@Z
+ ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z
diff --git a/private/crtlib/lib/i386/crtdll.x86 b/private/crtlib/lib/i386/crtdll.x86
new file mode 100644
index 000000000..1d196a736
--- /dev/null
+++ b/private/crtlib/lib/i386/crtdll.x86
@@ -0,0 +1,23 @@
+ _abnormal_termination
+ _CIacos
+ _CIasin
+ _CIatan
+ _CIatan2
+ _CIcos
+ _CIcosh
+ _CIexp
+ _CIfmod
+ _CIlog
+ _CIlog10
+ _CIpow
+ _CIsin
+ _CIsinh
+ _CIsqrt
+ _CItan
+ _CItanh
+ _control87
+ _except_handler2
+ _ftol
+ _global_unwind2
+ _local_unwind2
+ _setjmp
diff --git a/private/crtlib/lib/mips/crtdll.mip b/private/crtlib/lib/mips/crtdll.mip
new file mode 100644
index 000000000..bc519a8ab
--- /dev/null
+++ b/private/crtlib/lib/mips/crtdll.mip
@@ -0,0 +1,27 @@
+ __C_specific_handler
+ _dtoul
+ __jump_unwind
+ __d_to_ll
+ __d_to_ull
+ __dtoll
+ __f_to_ll
+ __f_to_ull
+ __ll_bit_extract
+ __ll_bit_insert
+ __ll_div
+ __ll_lshift
+ __ll_mod
+ __ll_mul
+ __ll_rem
+ __ll_rshift
+ __ll_to_d
+ __ll_to_f
+ __ull_div
+ __ull_divrem_5353
+ __ull_divrem_6416
+ __ull_rem
+ __ull_rshift
+ __ull_to_d
+ __ull_to_f
+ setjmp
+ _setjmpex
diff --git a/private/crtlib/lib/ppc/crtdll.ppc b/private/crtlib/lib/ppc/crtdll.ppc
new file mode 100644
index 000000000..0986be110
--- /dev/null
+++ b/private/crtlib/lib/ppc/crtdll.ppc
@@ -0,0 +1,8 @@
+ __C_specific_handler
+ _dtoul
+ _isnan
+ __jump_unwind
+ setjmp
+ _setjmpex
+ _uitrunc
+ __dllonexit
diff --git a/private/crtlib/makefile b/private/crtlib/makefile
new file mode 100644
index 000000000..f0594ae0a
--- /dev/null
+++ b/private/crtlib/makefile
@@ -0,0 +1,773 @@
+####
+#crtlib - release scheme for CRT projects
+#
+# Copyright (c) 1991-1992, Microsoft Corporation. All rights reserved.
+#
+#Purpose:
+# This makefile collects and creates all the various libs/objs/etc
+# that compose the C Run-Time (CRT) delivery files. Before building
+# this project, you must have built the following projects:
+#
+# crt32 = LIBC components
+# fp32 = floating-point math components
+#
+# This makefile is sensitive to the various CRT project names and
+# directory layout.
+#
+#Revision History:
+# 09-30-91 JCR Project created.
+# 01-25-92 GJF Added DLL support.
+# 02-27-92 GJF Fixed recursive macro def. Removed build of emulator.
+# 05-26-92 DJM POSIX support.
+#
+################################################################################
+
+!IFNDEF 386
+386=0
+!ENDIF
+!IFNDEF MIPS
+MIPS=0
+!ENDIF
+!IFNDEF ALPHA
+ALPHA=0
+!ENDIF
+!IFNDEF PPC
+PPC=0
+!ENDIF
+
+#
+# Default to building for i386 target, if no targets specified.
+#
+
+!IF !$(386)
+! IF !$(MIPS)
+! IF !$(PPC)
+! IFDEF NTMIPSDEFAULT
+MIPS=1
+! ELSE
+! IFDEF NTALPHADEFAULT
+ALPHA=1
+! ELSE
+! IFDEF NTPPCDEFAULT
+PPC=1
+! ELSE
+386=1
+! ENDIF
+! ENDIF
+! ENDIF
+! ENDIF
+! ENDIF
+!ENDIF
+
+#
+# component files from other directories
+#
+
+# single thread
+
+ROOT_SMALL=..\crt32st\small
+
+SRCDIR_SMALL=$(ROOT_SMALL)\obj\*
+
+COMPONENTS_SMALL=\
+ $(SRCDIR_SMALL)\small.lib
+
+ROOT_LIBC=..\crt32st
+ROOT_FP=..\fp32st
+
+SRCDIR_LIBC=$(ROOT_LIBC)\obj\*
+SRCDIR_FP=$(ROOT_FP)\obj\*
+
+COMPONENTS_LIBC=\
+ $(SRCDIR_LIBC)\libc.lib \
+ $(SRCDIR_FP)\conv.lib \
+ $(SRCDIR_FP)\tran.lib
+
+ROOT_CRTNT=..\crt32nt
+ROOT_FPNT=..\fp32nt
+
+SRCDIR_CRTNT=$(ROOT_CRTNT)\obj\*
+SRCDIR_FPNT=$(ROOT_FPNT)\obj\*
+
+COMPONENTS_CRTNT=\
+ $(SRCDIR_CRTNT)\libcnt.lib \
+ $(SRCDIR_FPNT)\trannt.lib
+
+# multi-thread
+
+ROOT_LIBCMT=..\crt32
+ROOT_FPMT=..\fp32
+
+SRCDIR_LIBCMT=$(ROOT_LIBCMT)\obj\*
+SRCDIR_FPMT=$(ROOT_FPMT)\obj\*
+
+COMPONENTS_LIBCMT=\
+ $(SRCDIR_LIBCMT)\libcmt.lib \
+ $(SRCDIR_FPMT)\convmt.lib \
+ $(SRCDIR_FPMT)\tranmt.lib
+
+
+# posix single thread
+
+ROOT_LIBCPSX=..\crt32psx
+ROOT_FPPSX=..\fp32st
+
+SRCDIR_LIBCPSX=$(ROOT_LIBCPSX)\obj\*
+SRCDIR_FPPSX=$(ROOT_FPPSX)\obj\*
+
+COMPONENTS_LIBCPSX=\
+ $(SRCDIR_LIBCPSX)\libcpsx.lib \
+ $(SRCDIR_FPPSX)\conv.lib \
+ $(SRCDIR_FPPSX)\tran.lib
+
+
+# optional objects for single- or multi-thread
+
+FILES_OBJECTS=binmode.obj commode.obj setargv.obj chkstk.obj
+
+COMPONENTS_OBJECTS=\
+ $(SRCDIR_LIBC)\binmode.obj \
+ $(SRCDIR_LIBC)\commode.obj \
+ $(SRCDIR_LIBC)\setargv.obj \
+ $(SRCDIR_LIBC)\chkstk.obj
+
+# dll
+
+ROOT_CRTDLL=..\crt32dll
+ROOT_FPDLL=..\fp32dll
+
+SRCDIR_CRTDLL=$(ROOT_CRTDLL)\obj\*
+SRCDIR_FPDLL=$(ROOT_FPDLL)\obj\*
+
+#COMPONENTS_CRTDLL=\
+# $(SRCDIR_CRTDLL)\libcdll.lib \
+# $(SRCDIR_FPMT)\convmt.lib \
+# $(SRCDIR_FPMT)\tranmt.lib
+
+!IF $(386)
+
+EXSUP_OBJECTS=\
+ $(ROOT_LIBCMT)\misc\obj\*\exsup.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\exsup2.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\exsup3.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\sehsupp.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\setjmp.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\setjmp3.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\setjmpex.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\longjmp.obj
+
+RELEASE_EXSUP=lib\*\exsup.lib
+
+COMPONENTS_SUPPOBJS=\
+ $(SRCDIR_CRTDLL)\crtexe.obj \
+ $(SRCDIR_CRTDLL)\crtexew.obj \
+ $(SRCDIR_CRTDLL)\crtdll.obj \
+ $(SRCDIR_CRTDLL)\dllargv.obj \
+ $(SRCDIR_CRTDLL)\dllmain.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\exsup3.obj \
+ $(ROOT_LIBCMT)\misc\obj\*\setjmp3.obj \
+ $(ROOT_LIBCMT)\lowio\obj\*\txtmode.obj \
+ $(ROOT_LIBCMT)\stdio\obj\*\ncommode.obj \
+ $(ROOT_LIBCMT)\startup\obj\*\tlssup.obj \
+ $(ROOT_LIBCMT)\startup\obj\*\atlssup.obj \
+ $(ROOT_CRTDLL)\dllstuff\obj\*\cinitexe.obj \
+ $(SRCDIR_CRTDLL)\dllsupp.obj \
+ lib\*\chkstk.obj
+
+!ELSEIF $(ALPHA) || $(MIPS)
+
+EXSUP_OBJECTS=
+RELEASE_EXSUP=
+
+COMPONENTS_SUPPOBJS=\
+ $(SRCDIR_CRTDLL)\crtexe.obj \
+ $(SRCDIR_CRTDLL)\crtexew.obj \
+ $(SRCDIR_CRTDLL)\crtdll.obj \
+ $(SRCDIR_CRTDLL)\dllargv.obj \
+ $(SRCDIR_CRTDLL)\dllmain.obj \
+ $(ROOT_LIBCMT)\lowio\obj\*\txtmode.obj \
+ $(ROOT_LIBCMT)\stdio\obj\*\ncommode.obj \
+ $(ROOT_LIBCMT)\startup\obj\*\tlssup.obj \
+ $(ROOT_CRTDLL)\dllstuff\obj\*\cinitexe.obj \
+ lib\*\chkstk.obj
+
+!ELSE
+
+EXSUP_OBJECTS=
+RELEASE_EXSUP=
+
+COMPONENTS_SUPPOBJS=\
+ $(SRCDIR_CRTDLL)\crtexe.obj \
+ $(SRCDIR_CRTDLL)\crtexew.obj \
+ $(SRCDIR_CRTDLL)\crtdll.obj \
+ $(SRCDIR_CRTDLL)\dllargv.obj \
+ $(SRCDIR_CRTDLL)\dllmain.obj \
+ $(ROOT_LIBCMT)\lowio\obj\*\txtmode.obj \
+ $(ROOT_LIBCMT)\stdio\obj\*\ncommode.obj \
+ $(ROOT_LIBCMT)\startup\obj\*\tlssup.obj \
+ $(ROOT_CRTDLL)\dllstuff\obj\*\cinitexe.obj \
+ $(ROOT_CRTDLL)\helper\obj\*\*.obj \
+ lib\*\chkstk.obj
+!ENDIF
+
+COMPONENTS_CRTDLL=\
+ $(SRCDIR_CRTDLL)\libcdll.lib \
+ $(SRCDIR_FPDLL)\convdll.lib \
+ $(SRCDIR_FPDLL)\trandll.lib
+
+# optional objects for crtdll
+
+
+# include files
+
+COMPONENTS_INCLUDES=\
+ $(ROOT_CRTDLL)\h\*.h \
+ $(ROOT_CRTDLL)\h\sys\*.h \
+
+COMPONENTS_DLLDEF=lib\*\crtdll.def
+
+# nt libs
+!IF "$(BASEDIR)" == ""
+NTLIBPATH=$(_NTDRIVE)\nt\public\sdk\lib\*
+!ELSE
+NTLIBPATH=$(BASEDIR)\public\sdk\lib\*
+!ENDIF
+
+LINKLIBS=$(NTLIBPATH)\kernel32.lib
+
+# include paths for rc
+
+RC_INCL=-I$(_NTDRIVE)\nt\public\oak\inc -I$(_NTDRIVE)\nt\public\sdk\inc \
+ -I$(_NTDRIVE)\nt\public\sdk\inc\crt
+
+# command-line defs for rc
+
+RCX86_DEFS=-D_X86_=1 -Di386=1 -DCONDITION_HANDLING=1 -DWIN32_LEAN_AND_MEAN=1 \
+ -DNT_UP=1 -DNT_INST=0 -DDBG=0 -DDEVL=1 -DNOFIREWALLS -DFPO=1 \
+ -DNDEBUG -D_WIN32_=1 -D_INTL
+
+RCMIPS_DEFS=-DMIPS=1 -D_MIPS_=1 -DNO_EXT_KEYS -DWIN32_LEAN_AND_MEAN=1 \
+ -DMIPSEL -DCONDITION_HANDLING=1 -DNT_INST=0 -DJAZZ -DNT_UP=1 \
+ -DR3000 -D_M_MRX000=3000 -DDBG=0 -DDEVL=1 -DNOFIREWALLS \
+ -DNDEBUG -D_WIN32_=1 -D__stdcall= -D__cdecl= -D_INTL
+
+RCPPC_DEFS=-D_PPC_=1 -DNO_EXT_KEYS -DWIN32_LEAN_AND_MEAN=1 \
+ -DPPCEL -DCONDITION_HANDLING=1 -DNT_INST=0 -DNT_UP=1 \
+ -D_M_PPC=601 -DDBG=0 -DDEVL=1 -DNOFIREWALLS \
+ -DNDEBUG -D_WIN32_=1 -D__stdcall= -D__cdecl= -D_INTL
+#
+# release targets
+#
+
+DSTDIR_CRT=lib\*
+DSTDIR_LIBC=lib\*
+DSTDIR_LIBCMT=lib\*
+DSTDIR_LIBCPSX=lib\*
+DSTDIR_OBJECTS=lib\*
+DSTDIR_CRTDLL=lib\*
+DSTDIR_INCLUDES=include\*
+
+RELEASE_CRTNT=\
+ $(DSTDIR_LIBC)\libcntpr.lib
+
+RELEASE_SMALL=\
+ $(DSTDIR_LIBC)\SMALL.lib
+
+# single-thread lib
+RELEASE_LIBC=\
+ $(DSTDIR_LIBC)\libc.lib
+
+# multi-thread lib
+RELEASE_LIBCMT=\
+ $(DSTDIR_LIBCMT)\libcmt.lib
+
+# posix single-thread lib
+RELEASE_LIBCPSX=\
+ $(DSTDIR_LIBCPSX)\libcpsx.lib
+
+
+# optional objects for single- and multi-thread
+RELEASE_OBJECTS=\
+ $(DSTDIR_OBJECTS)\binmode.obj \
+ $(DSTDIR_OBJECTS)\commode.obj \
+ $(DSTDIR_OBJECTS)\setargv.obj \
+ $(DSTDIR_OBJECTS)\chkstk.obj
+
+# dll
+RELEASE_DLL=\
+ $(DSTDIR_CRTDLL)\crtdll.dll
+
+# dll, imports lib and optional objects
+RELEASE_CRTDLL=\
+ $(RELEASE_DLL:.dll=.lib) \
+ $(RELEASE_DLL)
+
+# include files (all models)
+RELEASE_INCLUDES=\
+ $(DSTDIR_INCLUDES)\*.h \
+ $(DSTDIR_INCLUDES)\sys\*.h
+
+
+!IF $(386)
+TARGETLIBS=$(TARGETLIBS) \
+ $(RELEASE_OBJECTS:*=i386) \
+ $(RELEASE_CRTNT:*=i386) \
+ $(RELEASE_EXSUP:*=i386) \
+ $(RELEASE_LIBC:*=i386) \
+ $(RELEASE_LIBCMT:*=i386) \
+ $(RELEASE_LIBCPSX:*=i386) \
+ $(RELEASE_CRTDLL:*=i386)
+
+# TARGETLIBS=$(RELEASE_CRTDLL:*=i386)
+
+!ELSEIF $(MIPS)
+TARGETLIBS=$(TARGETLIBS) \
+ $(RELEASE_OBJECTS:*=mips) \
+ $(RELEASE_CRTNT:*=mips) \
+ $(RELEASE_SMALL:*=mips) \
+ $(RELEASE_LIBC:*=mips) \
+ $(RELEASE_LIBCMT:*=mips) \
+ $(RELEASE_LIBCPSX:*=mips) \
+ $(RELEASE_CRTDLL:*=mips)
+
+!ELSEIF $(ALPHA)
+TARGETLIBS=$(TARGETLIBS) \
+ $(RELEASE_OBJECTS:*=alpha) \
+ $(RELEASE_CRTNT:*=alpha) \
+ $(RELEASE_SMALL:*=alpha) \
+ $(RELEASE_LIBC:*=alpha) \
+ $(RELEASE_LIBCMT:*=alpha) \
+ $(RELEASE_LIBCPSX:*=alpha) \
+ $(RELEASE_CRTDLL:*=alpha)
+
+!ELSEIF $(PPC)
+TARGETLIBS=$(TARGETLIBS) \
+ $(RELEASE_OBJECTS:*=ppc) \
+ $(RELEASE_CRTNT:*=ppc) \
+ $(RELEASE_SMALL:*=ppc) \
+ $(RELEASE_LIBC:*=ppc) \
+ $(RELEASE_LIBCMT:*=ppc) \
+ $(RELEASE_LIBCPSX:*=ppc) \
+ $(RELEASE_CRTDLL:*=ppc)
+!ENDIF
+
+all: $(TARGETLIBS)
+!IF "$(BUILDMSG)" != ""
+ echo $(BUILDMSG)
+!ENDIF
+
+includes: $(RELEASE_INCLUDES)
+!IF "$(BUILDMSG)" != ""
+ echo $(BUILDMSG)
+!ENDIF
+
+clean: cleanlib all
+
+cleanlib:
+ -erase $(TARGETLIBS)
+
+in:
+ $(_NTDRIVE)
+ cd \nt\public\sdk\lib
+ in -c "Rebuilt from current sources" $(TARGETLIBS:lib\=)
+
+out:
+ $(_NTDRIVE)
+ cd \nt\public\sdk\lib
+ out -f $(TARGETLIBS:lib\=)
+
+outdel: out
+ del $(TARGETLIBS:lib\=)
+
+resync:
+ $(_NTDRIVE)
+ cd \nt\public\sdk\lib
+ in -vi $(TARGETLIBS:lib\=)
+ ssync $(TARGETLIBS:lib\=)
+
+!IF $(386)
+release:
+ -copy $(DSTDIR_OBJECTS:*=i386)\*.obj $(_NTDRIVE)\nt\public\sdk\lib\i386
+ -copy $(DSTDIR_OBJECTS:*=i386)\*.lib $(_NTDRIVE)\nt\public\sdk\lib\i386
+ -copy $(DSTDIR_OBJECTS:*=i386)\*.dll $(_NTDRIVE)\nt\public\sdk\lib\i386
+
+!ELSEIF $(MIPS)
+release:
+ -copy $(DSTDIR_OBJECTS:*=mips)\*.obj $(_NTDRIVE)\nt\public\sdk\lib\mips
+ -copy $(DSTDIR_OBJECTS:*=mips)\*.lib $(_NTDRIVE)\nt\public\sdk\lib\mips
+ -copy $(DSTDIR_OBJECTS:*=mips)\*.dll $(_NTDRIVE)\nt\public\sdk\lib\mips
+
+!ELSEIF $(ALPHA)
+release:
+ -copy $(DSTDIR_OBJECTS:*=alpha)\*.obj $(_NTDRIVE)\nt\public\sdk\lib\alpha
+ -copy $(DSTDIR_OBJECTS:*=alpha)\*.lib $(_NTDRIVE)\nt\public\sdk\lib\alpha
+ -copy $(DSTDIR_OBJECTS:*=alpha)\*.dll $(_NTDRIVE)\nt\public\sdk\lib\alpha
+
+!ELSEIF $(PPC)
+release:
+ -copy $(DSTDIR_OBJECTS:*=ppc)\*.obj $(_NTDRIVE)\nt\public\sdk\lib\ppc
+ -copy $(DSTDIR_OBJECTS:*=ppc)\*.lib $(_NTDRIVE)\nt\public\sdk\lib\ppc
+ -copy $(DSTDIR_OBJECTS:*=ppc)\*.dll $(_NTDRIVE)\nt\public\sdk\lib\ppc
+!ENDIF
+
+
+srcrel:
+ chmode -r $(TARGETLIBS:lib\=^%_NTDRIVE^%\nt\public\sdk\lib\)
+!IF $(386)
+ upd /anfe $(DSTDIR_OBJECTS:*=i386) $(_NTDRIVE)\nt\public\sdk\lib\i386$(TARGETLIBS:lib\i386\=)
+!ELSEIF $(MIPS)
+ upd /anfe $(DSTDIR_OBJECTS:*=mips) $(_NTDRIVE)\nt\public\sdk\lib\mips$(TARGETLIBS:lib\mips\=)
+!ELSEIF $(ALPHA)
+ upd /anfe $(DSTDIR_OBJECTS:*=alpha) $(_NTDRIVE)\nt\public\sdk\lib\alpha$(TARGETLIBS:lib\alpha\=)
+!ELSEIF $(PPC)
+ upd /anfe $(DSTDIR_OBJECTS:*=ppc) $(_NTDRIVE)\nt\public\sdk\lib\ppc$(TARGETLIBS:lib\ppc\=)
+!ENDIF
+ chmode +r $(TARGETLIBS:lib\=^%_NTDRIVE^%\nt\public\sdk\lib\)
+
+#
+# common targets
+#
+
+$(RELEASE_INCLUDES): $(COMPONENTS_INCLUDES)
+ set CRTDIR=$(ROOT_CRTDLL)
+ $(ROOT_CRTDLL)\tools\win32\relinc include
+
+#
+# i386 targets
+#
+
+$(RELEASE_CRTNT:*=i386): $(COMPONENTS_CRTNT:*=i386)
+ link -lib -out:$@ @<<
+$(COMPONENTS_CRTNT:*=i386)
+<<
+
+$(RELEASE_LIBC:*=i386): $(COMPONENTS_LIBC:*=i386)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBC:*=i386)
+<<
+
+$(RELEASE_LIBCMT:*=i386): $(COMPONENTS_LIBCMT:*=i386)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBCMT:*=i386)
+<<
+
+$(RELEASE_LIBCPSX:*=i386): $(COMPONENTS_LIBCPSX:*=i386)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBCPSX:*=i386)
+<<
+
+$(DSTDIR_OBJECTS:*=i386)\binmode.obj: $(SRCDIR_LIBC:*=i386)\binmode.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=i386)\commode.obj: $(SRCDIR_LIBC:*=i386)\commode.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=i386)\setargv.obj: $(SRCDIR_LIBC:*=i386)\setargv.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=i386)\chkstk.obj: $(SRCDIR_LIBC:*=i386)\chkstk.obj
+ copy $** $@
+
+386_DLL=$(RELEASE_DLL:*=i386)
+386_DLL=$(386_DLL: =)
+386_LIBCDLL=$(COMPONENTS_CRTDLL:*=i386)
+386_OBJECTS=$(COMPONENTS_SUPPOBJS:*=i386)
+386_DEF=$(COMPONENTS_DLLDEF:*=i386)
+386_LINKLIBS=$(LINKLIBS:*=i386)
+386_DLLBASE=0x10010000
+
+lib\i386\exsup.lib: $(EXSUP_OBJECTS:*=i386)
+ link -lib -out:$(@R).lib $(EXSUP_OBJECTS:*=i386)
+
+$(386_DEF): lib\crtdll.def $(386_DEF:.def=.x86)
+ copy lib\crtdll.def+$(386_DEF:.def=.x86) $(386_DEF)
+
+$(386_DLL:.dll=.exp) $(386_DLL:.dll=.lib): $(386_DEF) $(386_OBJECTS)
+ link -lib -out:$(@R).lib -machine:i386 -debugtype:cv -def:$(386_DEF) $(386_LIBCDLL)
+ ren $(386_DLL:.dll=.lib) tmp.lib
+ link -lib -out:$(@R).lib -machine:i386 $(@D)\tmp.lib $(386_OBJECTS)
+ del $(@D)\tmp.lib
+
+$(386_DLL): $(386_DLL:.dll=.lib) $(386_DLL:.dll=.exp) $(386_LIBCDLL) $(386_LINKLIBS) crtdll.rc
+ rc -l 409 -r -fo $(386_DLL:.dll=.tmp) $(RCX86_DEFS) -x $(RC_INCL) crtdll.rc
+ cvtres -machine:x86 $(386_DLL:.dll=.tmp) -readonly -out:$(386_DLL:.dll=.res)
+ link @<<
+-dll
+-out:$@
+-machine:i386
+-debugtype:both
+-debug:full
+-release
+-pdb:none
+-opt:ref
+-optidata
+-merge:.rdata=.text
+-subsystem:console,4.00
+-osversion:4.00
+-version:4.00
+-base:$(386_DLLBASE)
+-entry:_CRTDLL_INIT@12
+$(386_DLL:.dll=.res)
+$(386_DLL:.dll=.exp)
+$(386_LIBCDLL)
+$(386_LINKLIBS)
+<<
+
+#
+# mips targets
+#
+
+$(RELEASE_CRTNT:*=mips): $(COMPONENTS_CRTNT:*=mips)
+ link -lib -out:$@ @<<
+$(COMPONENTS_CRTNT:*=mips)
+<<
+
+$(RELEASE_SMALL:*=mips): $(COMPONENTS_SMALL:*=mips)
+ copy $** $@
+
+$(RELEASE_LIBC:*=mips): $(COMPONENTS_LIBC:*=mips)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBC:*=mips)
+<<
+
+$(RELEASE_LIBCMT:*=mips): $(COMPONENTS_LIBCMT:*=mips)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBCMT:*=mips)
+<<
+
+$(RELEASE_LIBCPSX:*=mips): $(COMPONENTS_LIBCPSX:*=mips)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBCPSX:*=mips)
+<<
+
+$(DSTDIR_OBJECTS:*=mips)\binmode.obj: $(SRCDIR_LIBC:*=mips)\binmode.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=mips)\commode.obj: $(SRCDIR_LIBC:*=mips)\commode.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=mips)\setargv.obj: $(SRCDIR_LIBC:*=mips)\setargv.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=mips)\chkstk.obj: $(SRCDIR_LIBC:*=mips)\chkstk.obj
+ copy $** $@
+
+
+MIPS_DLL=$(RELEASE_DLL:*=mips)
+MIPS_DLL=$(MIPS_DLL: =)
+MIPS_LIBCDLL=$(COMPONENTS_CRTDLL:*=mips)
+MIPS_OBJECTS=$(COMPONENTS_SUPPOBJS:*=mips)
+MIPS_DEF=$(COMPONENTS_DLLDEF:*=mips)
+MIPS_LINKLIBS=$(LINKLIBS:*=mips)
+MIPS_DLLBASE=0x10010000
+
+$(MIPS_DLL:.dll=.lib) $(MIPS_DLL:.dll=.exp): $(MIPS_DEF)
+ link -lib -out:$(@R).lib -machine:mips -debugtype:cv -def:$(MIPS_DEF)
+ ren $(MIPS_DLL:.dll=.lib) tmp.lib
+ link -lib -out:$(@R).lib -machine:mips $(@D)\tmp.lib $(MIPS_OBJECTS)
+ del $(@D)\tmp.lib
+
+$(MIPS_DEF): lib\crtdll.def $(MIPS_DEF:.def=.mip)
+ copy lib\crtdll.def+$(MIPS_DEF:.def=.mip) $(MIPS_DEF)
+
+$(MIPS_DLL): $(MIPS_DLL:.dll=.lib) $(MIPS_DLL:.dll=.exp) $(MIPS_LIBCDLL) $(MIPS_LINKLIBS) crtdll.rc
+ rc -l 409 -r -fo $(MIPS_DLL:.dll=.tmp) $(RCMIPS_DEFS) -x $(RC_INCL) crtdll.rc
+ cvtres -machine:mips $(MIPS_DLL:.dll=.tmp) -readonly -out:$(MIPS_DLL:.dll=.res)
+ link @<<
+-dll
+-out:$@
+-debugtype:both
+-debug:full
+-machine:mips
+-release
+-pdb:none
+-opt:ref
+-optidata
+-merge:.rdata=.text
+-subsystem:console,4.00
+-osversion:4.00
+-version:4.00
+-base:$(MIPS_DLLBASE)
+-entry:_CRTDLL_INIT
+-merge:asincosm=.text
+-merge:atanm=.text
+-merge:floorm=.text
+-merge:fmodm=.text
+-merge:trigm=.text
+$(MIPS_DLL:.dll=.exp)
+$(MIPS_DLL:.dll=.res)
+$(MIPS_LIBCDLL)
+$(MIPS_LINKLIBS)
+<<
+
+# BUGBUG: The merge directives can be removed if v-rogerl determines a src change can
+# be made. BryanT - 3/7/95
+
+#
+# alpha targets
+#
+
+$(RELEASE_CRTNT:*=alpha): $(COMPONENTS_CRTNT:*=alpha)
+ link -lib -out:$@ @<<
+$(COMPONENTS_CRTNT:*=alpha)
+<<
+
+$(RELEASE_SMALL:*=alpha): $(COMPONENTS_SMALL:*=alpha)
+ copy $** $@
+
+$(RELEASE_LIBC:*=alpha): $(COMPONENTS_LIBC:*=alpha)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBC:*=alpha)
+<<
+
+$(RELEASE_LIBCMT:*=alpha): $(COMPONENTS_LIBCMT:*=alpha)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBCMT:*=alpha)
+<<
+
+$(RELEASE_LIBCPSX:*=alpha): $(COMPONENTS_LIBCPSX:*=alpha)
+ link -lib -out:$@ @<<
+$(COMPONENTS_LIBCPSX:*=alpha)
+<<
+
+$(DSTDIR_OBJECTS:*=alpha)\binmode.obj: $(SRCDIR_LIBC:*=alpha)\binmode.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=alpha)\commode.obj: $(SRCDIR_LIBC:*=alpha)\commode.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=alpha)\setargv.obj: $(SRCDIR_LIBC:*=alpha)\setargv.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=alpha)\chkstk.obj: $(SRCDIR_LIBC:*=alpha)\chkstk.obj
+ copy $** $@
+
+
+ALPHA_DLL=$(RELEASE_DLL:*=alpha)
+ALPHA_DLL=$(ALPHA_DLL: =)
+ALPHA_LIBCDLL=$(COMPONENTS_CRTDLL:*=alpha)
+ALPHA_OBJECTS=$(COMPONENTS_SUPPOBJS:*=alpha)
+ALPHA_DEF=$(COMPONENTS_DLLDEF:*=alpha)
+ALPHA_LINKLIBS=$(LINKLIBS:*=alpha)
+ALPHA_DLLBASE=0x10010000
+
+$(ALPHA_DLL:.dll=.lib) $(ALPHA_DLL:.dll=.exp): $(ALPHA_DEF)
+ link -lib -out:$(@R).lib -machine:alpha -debugtype:cv -def:$(ALPHA_DEF)
+ ren $(ALPHA_DLL:.dll=.lib) tmp.lib
+ link -lib -out:$(@R).lib -machine:alpha $(@D)\tmp.lib $(ALPHA_OBJECTS)
+ del $(@D)\tmp.lib
+
+$(ALPHA_DEF): lib\crtdll.def $(ALPHA_DEF:.def=.alp)
+ copy lib\crtdll.def+$(ALPHA_DEF:.def=.alp) $(ALPHA_DEF)
+
+$(ALPHA_DLL): $(ALPHA_DLL:.dll=.lib) $(ALPHA_DLL:.dll=.exp) $(ALPHA_LIBCDLL) $(ALPHA_LINKLIBS) crtdll.rc
+ rc -l 409 -r -fo $(ALPHA_DLL:.dll=.tmp) $(RCALPHA_DEFS) -x $(RC_INCL) crtdll.rc
+ cvtres -machine:alpha $(ALPHA_DLL:.dll=.tmp) -readonly -out:$(ALPHA_DLL:.dll=.res)
+ link @<<
+-dll
+-out:$@
+-machine:alpha
+-base:$(ALPHA_DLLBASE)
+-debugtype:both
+-debug:full
+-release
+-pdb:none
+-opt:ref
+-optidata
+-merge:.rdata=.text
+-subsystem:console,4.00
+-osversion:4.00
+-version:4.00
+-entry:_CRTDLL_INIT
+$(ALPHA_DLL:.dll=.res)
+$(ALPHA_DLL:.dll=.exp)
+$(ALPHA_LIBCDLL)
+$(ALPHA_LINKLIBS)
+<<
+
+#
+# ppc targets
+#
+
+$(RELEASE_CRTNT:*=ppc): $(COMPONENTS_CRTNT:*=ppc)
+ link -lib -out:$@ @<<
+-machine:ppc
+$(COMPONENTS_CRTNT:*=ppc)
+<<
+
+$(RELEASE_SMALL:*=ppc): $(COMPONENTS_SMALL:*=ppc)
+ copy $** $@
+
+$(RELEASE_LIBC:*=ppc): $(COMPONENTS_LIBC:*=ppc)
+ link -lib -out:$@ @<<
+-machine:ppc
+$(COMPONENTS_LIBC:*=ppc)
+<<
+
+$(RELEASE_LIBCMT:*=ppc): $(COMPONENTS_LIBCMT:*=ppc)
+ link -lib -out:$@ @<<
+-machine:ppc
+$(COMPONENTS_LIBCMT:*=ppc)
+<<
+
+$(RELEASE_LIBCPSX:*=ppc): $(COMPONENTS_LIBCPSX:*=ppc)
+ link -lib -out:$@ @<<
+-machine:ppc
+$(COMPONENTS_LIBCPSX:*=ppc)
+<<
+
+$(DSTDIR_OBJECTS:*=ppc)\binmode.obj: $(SRCDIR_LIBC:*=ppc)\binmode.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=ppc)\commode.obj: $(SRCDIR_LIBC:*=ppc)\commode.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=ppc)\setargv.obj: $(SRCDIR_LIBC:*=ppc)\setargv.obj
+ copy $** $@
+
+$(DSTDIR_OBJECTS:*=ppc)\chkstk.obj: $(SRCDIR_LIBC:*=ppc)\chkstk.obj
+ copy $** $@
+
+
+PPC_DLL=$(RELEASE_DLL:*=ppc)
+PPC_DLL=$(PPC_DLL: =)
+PPC_LIBCDLL=$(COMPONENTS_CRTDLL:*=ppc)
+PPC_OBJECTS=$(COMPONENTS_SUPPOBJS:*\=ppc\)
+PPC_DEF=$(COMPONENTS_DLLDEF:*=ppc)
+PPC_LINKLIBS=$(LINKLIBS:*=ppc)
+PPC_DLLBASE=0x10010000
+
+$(PPC_DLL:.dll=.lib) $(PPC_DLL:.dll=.exp): $(PPC_DEF)
+ link -lib -out:$(@R).lib -machine:ppc -debugtype:cv -def:$(PPC_DEF)
+ ren $(PPC_DLL:.dll=.lib) tmp.lib
+ link -lib -out:$(@R).lib -machine:ppc $(@D)\tmp.lib $(PPC_OBJECTS)
+ del $(@D)\tmp.lib
+
+$(PPC_DEF): lib\crtdll.def $(PPC_DEF:.def=.ppc)
+ copy lib\crtdll.def+$(PPC_DEF:.def=.ppc) $(PPC_DEF)
+
+$(PPC_DLL): $(PPC_DLL:.dll=.lib) $(PPC_DLL:.dll=.exp) $(PPC_LIBCDLL) $(PPC_LINKLIBS) crtdll.rc
+ rc -l 409 -r -fo $(PPC_DLL:.dll=.tmp) $(RCPPC_DEFS) -x $(RC_INCL) crtdll.rc
+ cvtres -machine:ppc $(PPC_DLL:.dll=.tmp) -readonly -out:$(PPC_DLL:.dll=.res)
+ link @<<
+-dll
+-out:$@
+-debugtype:both
+-debug:full
+-machine:ppc
+-base:$(PPC_DLLBASE)
+-release
+-pdb:none
+-opt:ref
+-optidata
+-merge:.rdata=.text
+-subsystem:console,4.00
+-osversion:4.00
+-version:4.00
+-entry:_CRTDLL_INIT
+-NODEFAULTLIB
+$(PPC_DLL:.dll=.exp)
+$(PPC_DLL:.dll=.res)
+$(PPC_LIBCDLL)
+$(PPC_LINKLIBS)
+<<
diff --git a/private/crtlib/ssyncall.cmd b/private/crtlib/ssyncall.cmd
new file mode 100644
index 000000000..d66c5879b
--- /dev/null
+++ b/private/crtlib/ssyncall.cmd
@@ -0,0 +1,43 @@
+@echo off
+setlocal
+cd \nt\private\crt32nt
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\crt32
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\crt32st
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\crt32dll
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\crt32psx
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\fp32
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\fp32st
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\fp32nt
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\fp32dll
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+cd \nt\private\crtlib
+ech Syncing
+cd
+ssync -faq%_SYNCOPTIONS%
+endlocal
diff --git a/private/crtlib/statall.cmd b/private/crtlib/statall.cmd
new file mode 100644
index 000000000..4758d412a
--- /dev/null
+++ b/private/crtlib/statall.cmd
@@ -0,0 +1,45 @@
+@echo off
+setlocal
+set _statflags=-oabf$qcz
+erase crtstat.log
+cd \nt\private\crtlib
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\crt32
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\crt32st
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\crt32nt
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\crt32dll
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\crt32psx
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\fp32
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\fp32st
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\fp32nt
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+cd \nt\private\fp32dll
+ech Checking status for
+cd
+status %_statflags% nul >>..\crtlib\crtstat.log
+endlocal