summaryrefslogtreecommitdiffstats
path: root/private/crt32/h
diff options
context:
space:
mode:
Diffstat (limited to 'private/crt32/h')
-rw-r--r--private/crt32/h/assert.h89
-rw-r--r--private/crt32/h/cmacros.mas3050
-rw-r--r--private/crt32/h/cmsgs.h71
-rw-r--r--private/crt32/h/conio.h127
-rw-r--r--private/crt32/h/cruntime.h277
-rw-r--r--private/crt32/h/cruntime.inc826
-rw-r--r--private/crt32/h/ctime.h41
-rw-r--r--private/crt32/h/ctype.h321
-rw-r--r--private/crt32/h/cvt.h41
-rw-r--r--private/crt32/h/defsects.inc58
-rw-r--r--private/crt32/h/direct.h134
-rw-r--r--private/crt32/h/dos.h222
-rw-r--r--private/crt32/h/doscalls.h545
-rw-r--r--private/crt32/h/dostypes.h112
-rw-r--r--private/crt32/h/errmsg.h36
-rw-r--r--private/crt32/h/errno.h127
-rw-r--r--private/crt32/h/error.h383
-rw-r--r--private/crt32/h/error2.h277
-rw-r--r--private/crt32/h/except.inc100
-rw-r--r--private/crt32/h/excpt.h209
-rw-r--r--private/crt32/h/exsup.inc79
-rw-r--r--private/crt32/h/fcntl.h84
-rw-r--r--private/crt32/h/file2.h71
-rw-r--r--private/crt32/h/float.h493
-rw-r--r--private/crt32/h/fltintrn.h192
-rw-r--r--private/crt32/h/fpieee.h362
-rw-r--r--private/crt32/h/fstream.h145
-rw-r--r--private/crt32/h/heap.h433
-rw-r--r--private/crt32/h/internal.h359
-rw-r--r--private/crt32/h/io.h236
-rw-r--r--private/crt32/h/iomanip.h133
-rw-r--r--private/crt32/h/ios.h272
-rw-r--r--private/crt32/h/iostream.h90
-rw-r--r--private/crt32/h/istream.h165
-rw-r--r--private/crt32/h/jctype.h111
-rw-r--r--private/crt32/h/limits.h89
-rw-r--r--private/crt32/h/locale.h125
-rw-r--r--private/crt32/h/malloc.h168
-rw-r--r--private/crt32/h/math.h283
-rw-r--r--private/crt32/h/mbctype.h146
-rw-r--r--private/crt32/h/mbdata.h130
-rw-r--r--private/crt32/h/mbstring.h227
-rw-r--r--private/crt32/h/memory.h101
-rw-r--r--private/crt32/h/msdos.h83
-rw-r--r--private/crt32/h/msdos.inc276
-rw-r--r--private/crt32/h/mtest.h68
-rw-r--r--private/crt32/h/new.h67
-rw-r--r--private/crt32/h/nlsint.h60
-rw-r--r--private/crt32/h/os2dll.h260
-rw-r--r--private/crt32/h/oscalls.h141
-rw-r--r--private/crt32/h/ostream.h135
-rw-r--r--private/crt32/h/process.h244
-rw-r--r--private/crt32/h/pversion.inc28
-rw-r--r--private/crt32/h/rterr.h76
-rw-r--r--private/crt32/h/search.h104
-rw-r--r--private/crt32/h/setjmp.h299
-rw-r--r--private/crt32/h/setjmpex.h41
-rw-r--r--private/crt32/h/setlocal.h142
-rw-r--r--private/crt32/h/share.h35
-rw-r--r--private/crt32/h/signal.h129
-rw-r--r--private/crt32/h/sizeptr.h45
-rw-r--r--private/crt32/h/stdarg.h153
-rw-r--r--private/crt32/h/stddef.h153
-rw-r--r--private/crt32/h/stdio.h503
-rw-r--r--private/crt32/h/stdiostr.h59
-rw-r--r--private/crt32/h/stdlib.h552
-rw-r--r--private/crt32/h/streamb.h184
-rw-r--r--private/crt32/h/string.h228
-rw-r--r--private/crt32/h/strstrea.h93
-rw-r--r--private/crt32/h/sys/locking.h38
-rw-r--r--private/crt32/h/sys/stat.h151
-rw-r--r--private/crt32/h/sys/timeb.h129
-rw-r--r--private/crt32/h/sys/types.h58
-rw-r--r--private/crt32/h/sys/utime.h106
-rw-r--r--private/crt32/h/syserr.h44
-rw-r--r--private/crt32/h/tchar.h587
-rw-r--r--private/crt32/h/time.h242
-rw-r--r--private/crt32/h/timeb.inc37
-rw-r--r--private/crt32/h/v2tov3.h74
-rw-r--r--private/crt32/h/varargs.h160
-rw-r--r--private/crt32/h/wchar.h352
-rw-r--r--private/crt32/h/winheap.h25
82 files changed, 17701 insertions, 0 deletions
diff --git a/private/crt32/h/assert.h b/private/crt32/h/assert.h
new file mode 100644
index 000000000..944ba02b4
--- /dev/null
+++ b/private/crt32/h/assert.h
@@ -0,0 +1,89 @@
+/***
+*assert.h - define the assert macro
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Defines the assert(exp) macro.
+* [ANSI/System V]
+*
+*Revision History:
+* 12-18-87 JCR Added _FAR_ to declarations
+* 01-18-88 JCR Added fflush(stderr) to go with new stderr buffering scheme
+* 02-10-88 JCR Cleaned up white space
+* 05-19-88 JCR Use routine _assert() to save space
+* 07-14-88 JCR Allow user's to enable/disable assert multiple times in
+* a single module [ANSI]
+* 10-19-88 JCR Revised to also work for the 386 (small model only)
+* 12-22-88 JCR Assert() must be an expression (no 'if' statements)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 07-27-89 GJF Cleanup, now specific to the 386
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 02-27-90 GJF Added #include <cruntime.h> stuff. Also, removed some
+* (now) useless preprocessor directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 in prototype.
+* 07-31-90 SBM added ((void)0) to NDEBUG definition, now ANSI
+* 08-20-91 JCR C++ and ANSI naming
+* 08-26-92 GJF Function calling type and variable type macros.
+* 09-25-92 SRW Don't use ? in assert macro to keep CFRONT happy.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 02-01-93 GJF Replaced SteveWo's assert macro with an ANSI-conformant
+* one. Also got rid of '//' comment characters.
+*
+****/
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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) )
+
+#ifndef _INTERNAL_IFSTRIP_
+/*
+ * CFRONT chokes on ? if uses on a cdecl function call. So use if
+ * for now, until we convert to c8
+ *
+ * ( (exp) ? (void) 0 : _assert(#exp, __FILE__, __LINE__) )
+ */
+#endif /* _INTERNAL_IFSTRIP_ */
+
+#endif /* NDEBUG */
diff --git a/private/crt32/h/cmacros.mas b/private/crt32/h/cmacros.mas
new file mode 100644
index 000000000..a39638c24
--- /dev/null
+++ b/private/crt32/h/cmacros.mas
@@ -0,0 +1,3050 @@
+comment $
+
+ SCCSID = "@(#)cmacros.mas:1.12"
+
+cmacros - assembly macros for interfacing to hhls
+
+(C)Copyright Microsoft Corp. 1984-1987
+
+$
+
+;; Revision History
+;;
+;; 1.00 05/03/84 Initial Release
+;;
+;; 1.01 05/06/84 Greg Whitten
+;; Added defgrp and changed cMerge to Microsoft C
+;; Added copyright message and changed to 1.01
+;; Changes should have no affect on working programs
+;;
+;; 1.02 07/10/84 Steve Wood
+;; Added labelx macros
+;;
+;; 1.03 07/14/84 Greg Whitten
+;; Added defines for ?pu, ?adj, ?lblpu
+;; (removes undefined errors)
+;; Changes should have no affect on working programs
+;;
+;; 1.04 07/18/84 Greg Whitten
+;; Added local control from PL/M or C conventions
+;; except for cCall macro
+;;
+;; 1.05 08/06/84 Steve Wood
+;; Made ?PLM and ?WIN be the defaults
+;;
+;; 1.06 01/02/85 Steve Wood
+;; Changed createSeg and defgrp to automatically
+;; define the ln_assumes macro and the lnoffset
+;; and lnbase equates for each logical segment
+;; name.
+;;
+;; 1.07 02/19/85 Walt Moore
+;; Added farptr macro for defining a far pointer
+;; to be used in a cCall. Folded regptr into
+;; farptr. Space compaction in macros. Changed
+;; ?pp to be smaller. Moved ?ia out of ?al1 into
+;; ?aloc. Merged cProc and ?pd into one macro.
+;; Changed some %outs to use the error macro so
+;; an error would be generated. Added makeframe
+;; and parmR to cProc. Changed error to also put
+;; the error message in the listing.
+;; Deleted the smashes macro.
+;;
+;; 1.08 03/18/85 Steve Wood
+;; Added NODATA support.
+;;
+;; 1.09 03/27/85 Steve Wood
+;; Added ?definitions
+;;
+;; 2.00 04/01/85 Steve Wood
+;; April fools
+;;
+;; 2.01 06/17/85 Steve Wood
+;; Changed NODATA to always generate POP DS
+;; for return address patching
+;;
+;; 2.02 02/11/86 Steve Wood
+;; Added ATOMIC keyword to cProc macro
+;; Changed far epilog to use LEA SP,BP-2
+;; Changed error macro to ??error to avoid
+;; conflict
+;;
+;; 2.03 03/06/86 Steve Wood
+;; Fixed bug with ATOMIC and locals in far proc
+;; Added DOS5 switch to disable INC/DEC BP
+;; instructions in special far prologs/epilogs
+;;
+;; 2.04 08/07/86 Scott Randell
+;; Fixed bug with ATOMIC and ?TF
+;; (was doing unnecessary MOV SP,BP)
+;; Added pcode profile ?PROFILE
+;;
+;; 2.05 08/12/86 Walt Moore
+;; Changed _TEXT alignment to word.
+;; Added/corrected some comments.
+;; Removed redundant init of ?pc in cProc
+;; Made ATOMIC require NODATA
+;; Moved definition of non-underscored 'C' label
+;; from the cProc to the cBegin macro
+;; Minor clean-up of code
+;;
+;; 2.06 09/11/86 Walt Moore
+;; Added private stack checking
+;; Put local control for PL/M or C into cCall
+;;
+;;
+;; 2.07 09/19/86 Steve Wood
+;; Added ?SMALL, ?MEDIUM, etc. symbols
+;; Added forceframe keyword to cProc macro.
+;; Interpret ?TF for all epilogs.
+;;
+;; 3.xx.a 02/26/87 Walt Moore
+;; Massive rework. Documentation coming.
+;;
+;; 3.xx.b 04/08/87 NeilK
+;; Added parmH, which is like parmW except
+;; that it reserves 4 bytes on frame.
+;;
+;; 3.xx.c 05/11/87 Walt Moore
+;; Added <> to ?ap so that arg <DataOFFSET foo>
+;; can be used.
+;;
+;; 3.01 07/03/87 Walt Moore
+;; parm_bytes_&procname is now generated for
+;; all cProcs, and is the number of bytes of
+;; parameters to the cProc.
+;;
+;; NO_BP added as a keyword to cProc which
+;; causes all equates to be generated without
+;; reference to BP for the procedure. All type
+;; info is still generated, but the user must
+;; supply any segment and base register.
+;; ?NO_BP, if defined, makes this the default.
+;;
+;; USE_BP can be specified on the cProc line
+;; to force the generation of BP in equates.
+;;
+;; Moved definition of xxxxBASE. The equ was to
+;; a forward reference.
+;;
+;; Don't generate a warning for a nogen if only
+;; parameters are present.
+;;
+;; Keywords for cProc, cBegin, cEnd, and registers
+;; are now allowed to be either all upper case or
+;; all lower case.
+;;
+;; Only generate warnings on pass 2.
+;;
+;; 3.02 07/06/87 Walt Moore
+;; Boy did I screw up <nogen> If the text is
+;; recognized as nogen, then process it as such,
+;; else ignore it and generate frame as needed.
+;;
+;; 3.03 07/14/87 Walt Moore
+;; Added <partial> keyword to the cBegin macro
+;; to only allocate locals and save registers.
+;; Used in conjunction with dispatching in the
+;; Winthorn engine and drivers.
+;;
+;; Added cleanframe macro which will take the
+;; frame down, but not generate the RET statement.
+;; Used in conjunction with dispatching in the
+;; Winthorn engine and drivers.
+;;
+;; 3.04 07/16/87 Walt Moore
+;; globalD was generating off and seg name
+;; without word ptr override, giving them a
+;; dword attribute
+;;
+;; 3.05 07/17/87 Walt Moore
+;; .xcref cleanframe
+;;
+;; 3.06 07/24/87 Hans Spiller
+;; 32 bit small model (?SMALL32):
+;; new entry exit sequences using pseudoregs
+;; mach independant register names (IAX, etc)
+;; parmI/localI (int size variables)
+;; mpush/mpop uses mach independant names
+;; IPUSHF, IPOPF, IPUSHA,IPOPA,IIRET
+;;
+;; case sensitivity bugfix. the compiler
+;; generates "CODE", not "Code"
+;;
+;; 32 bit issues as yet undone: allocation
+;; macros for dealing with 32 bit mode far
+;; pointers, globalI, staticI, parmR, saving
+;; si,di vs. esi,edi,ebx
+;;
+;; 3.06a 09/29/87 Mark Roberts
+;; 32 bit small model (?SMALL32):
+;; fix a few bugs and add staticI
+;;
+;; 3.06b 07/20/87 Scott Randell
+;; Fix up for ?COW compatibility, added ?NOATOMIC
+;; to 3.xx version.
+;;
+;; 3.06c 04/29/88 Jim Schaad
+;; Put in ?DFDATA to force data segments even if
+;; ?NODATA is set.
+;;
+;; 3.06d 05/02/88 Andy Padawer
+;; Bug fixes for 3.06b (cEnd), 3.06c (general).
+;;
+;; 3.06e 08/31/88 Andy Padawer
+;; use "if memS32" not "ifdef ?SMALL32".
+;;
+;; 3.06f 05/12/89 Mark Roberts
+;; fix staticI, globalDP and add globalI
+;;
+;; 3.06g 12/07/89 Mark Roberts
+;; add externI
+;;
+;; 3.06h 01/25/90 Jan de Rie
+;; add ?DFCODE to allow suppressing code segments
+;;
+;; Assembly macros for interfacing to C
+;;
+;; User settable conditional assembly flags used within the cmacros
+;;
+;; Memory model flags. Set only one of the following. memS is the
+;; default. The symbols with ? are for defining from the command line
+;; and the memx symbols are numeric symbols that can be set in your source
+;; file prior to including this file.
+;;
+;; ?SMALL memS - small model
+;; ?MEDIUM memM - medium model
+;; ?LARGE memL - large model
+;; ?COMPACT memC - compact model
+;; ?HUGE memH - huge model
+;; ?SMALL32 memS32 - 32 bit small model
+;;
+;; ?DF Define flag. If this flag is 0, then defines default segment
+;; and group definitions based on the compiler flag. If this
+;; flag is 1, then does not define any segments or groups.
+;;
+;; ?DFDATA Define Data Flag. If this flag is 0, then defines default
+;; data segment and group definitions based on compiler flag.
+;; If this flag is 1, then does not define any data segments
+;; or groups.
+;;
+;; ?DFCODE Define Code Flag. If this flag is 0, then defines default
+;; code segments based on the compiler flag. If this flag is 1,
+;; then does not define the code segments. Inactive if
+;; ?DF is 1.
+;;
+;; ?TF Tight flag. If this flag is 0, then use longer epilog
+;; sequence that safely cleans up a stack frame. If this flag is
+;; 1, then use more efficient epilog that assumes the stack is
+;; valid (SP)
+;;
+;; ?WIN Windows flag. Enables generation of special prolog/epilog
+;; for far procedures. Default value is 1 (Windows).
+;;
+;; ?COW Character Windows flag. To be used in conjunction with ?WIN,
+;; If defined will not save DS for ?NODATA far prolog/epilog
+;; (CW does not modify the DS on the stack).
+;;
+;; DOS5 If defined, then special far prolog/epilog seqeuences will not
+;; include the INC/DEC BP instructions.
+;;
+;; ?PLM Calling convention flag. If this flag is 0, then the
+;; calling convention used is that of C. If this flag
+;; is 1, then the PL/M calling convention is used.
+;; The default value is 1. The PL/M calling convention
+;; is used by pascal, fortran, basic, and cobol.
+;;
+;; In the C calling convention, arguments are passed
+;; in reverse order; arg0 is the last pushed, argn is the
+;; first pushed. also, it is the callers responsibility
+;; to remove the arguments from the stack upon a return
+;; from a call.
+;;
+;; In the PL/M calling comvention, arguments are passed
+;; as encountered; arg0 is the first pushed, argn is the
+;; last pushed. also, it is the called procedure's
+;; responsibility to remove parameters from the stack
+;; before returning (using the RET n instruction)
+;;
+;; ?NODATA If defined, then no data segment or DGROUP is defined and
+;; the special prolog/epilog sequences will not contain the
+;; code needed to setup DS.
+;;
+;; ?CHKSTK If defined, then prolog sequences for cProcs with local
+;; parameters will call the CHKSTK procedure to allocate
+;; the stack space.
+;;
+;; ?CHKSTKPROC If defined, then this macro will be invoked to
+;; perform the stack checking, otherwise the
+;; standard stack checking procedure will be
+;; performed. ?CHKSTKPROC must be declared
+;; before the cmacros are included in the source
+;; else the standard chkstk routine will be declared
+;; as an external symbol.
+;;
+;; On entry to the user's stack checking procedure,
+;; the frame has been setup except for allocating
+;; local variable space and saving autosave registers.
+;;
+;; The user supplied macro is passed as an argument
+;; the number of byte of stack space requested.
+;;
+;; ?PROFILE If defined then all far cBegin entries will have StartNMeas,
+;; and all cEnd will have StopNMeas calls, StartNMeas and
+;; StopNMeas will be defined as externfp
+;;
+;; ?NOPARMR If defined, then the "parmR" macro will not be defined.
+;;
+;; ?NOGLOBAL If defined, then the "globalx" macros will not be defined.
+;;
+;; ?NOSTATIC If defined, then the "staticx" macros will not be defined.
+;;
+;; ?NOEXTERN If defined, then the "externx" macros will not be defined.
+;;
+;; ?NOLABEL If defined, then the "labelx" macros will not be defined.
+;;
+;; ?NODEF If defined, then the "defx" macros will not be defined.
+;;
+;; ?NOPTR If defined, then "farptr & regptr" will not be defined.
+;;
+;; ?QUIET If defined, then only error messages will be issued to
+;; the console. If undefined, then certain cmacro text will
+;; be generated to the console.
+;;
+;; ?NOATOMIC If defined, then ATOMIC will be ignored (for giving real
+;; frames to all procedures (and profiling).
+;;
+;; ?NO_BP If defined, then equates generated for parms and locals
+;; will not explicitly reference BP.
+;; IAX, ICX, IDX, IBX, ISP, IBP, ISI, IDI
+;; these pseudo registers expand to either ax..., or eax...
+;; depending upon 32bit mode being enabled. they should be
+;; used whenever a pointer or integer is being used in order
+;; to make source code machine independant
+
+
+
+.xcref ;;Get rid of a lot of symbols
+
+
+; ??_out - output given message to the console unless ?QUIET has
+; been specified.
+;
+; usage:
+; ??_out <t>
+;
+; where:
+; <t> is the message to output
+
+.xcref ??_out
+??_out macro t
+ ifndef ?QUIET
+ %out t
+ endif
+endm
+
+
+
+; outif - output msg if name is non-zero. if name is undefined,
+; set name = 0, else set name to the default value.
+;
+; usage:
+; outif name,defval,onmsg,offmsg
+; where:
+; name name of symbol
+; defval default value to give symbol if not defined
+; if blank, then 0 will be used
+; onmsg text to display if symbol is non-zero
+; offmsg test to be displayed if symbol is zero
+
+
+outif macro name,defval,onmsg,offmsg
+ ifndef name
+ ifb <defval>
+ name=0
+ else
+ name=defval
+ endif
+ endif
+ if name
+ name=1
+ ifnb <onmsg>
+ ??_out <! onmsg>
+ endif
+ else
+ ifnb <offmsg>
+ ??_out <! offmsg>
+ endif
+ endif
+endm
+
+
+
+; ??error - output msg and generate an assembly time error
+; on regardess of assembler pass
+; usage:
+; ??error <t>
+; where:
+; t is the text to be output
+
+
+.xcref ??error
+??error macro msg
+ %out e r r o r ----- msg ;;to console
+ .err e r r o r ----- msg ;;forced error by assembler
+endm
+
+
+; ??error2 - output msg and generate an assembly time error
+; on pass 2 only
+; usage:
+; ??error2 <t>
+; where:
+; t is the text to be output
+
+
+.xcref ??error2
+??error2 macro msg
+ if2
+ %out e r r o r ----- msg ;;to console
+ .err e r r o r ----- msg ;;forced error by assembler
+ endif
+endm
+
+
+.xcref ASMpass
+.xcref memS,memM,memL,memC,memH,memMOD,sizec,sized,memS32,sizeI,wordI
+
+;if1 ;;Only on pass 1
+ ASMpass=1
+ ifdef ?SMALL ;;inform user what is going on
+ memS=1
+ endif
+ ifdef ?MEDIUM
+ memM=1
+ endif
+ ifdef ?COMPACT
+ memC=1
+ endif
+ ifdef ?LARGE
+ memL=1
+ endif
+ ifdef ?HUGE
+ memH=1
+ endif
+ ifdef ?SMALL32
+ memS32=1
+ endif
+ ifdef ?FLAT32
+ memF32=1
+ endif
+
+ ??_out <cMacros Version 3.06h - 01/25/90>
+ ??_out <Copyright (C) Microsoft Corp. 1984-1990. All rights reserved.>
+ outif memS,0,<Small Model>
+ outif memM,0,<Medium model>
+ outif memL,0,<Large Model>
+ outif memC,0,<Compact Model>
+ outif memH,0,<Huge Model>
+ outif memS32,0,<32 Bit Small Model>
+ outif memF32,0,<32 Bit Flat Model>
+
+ memMOD= memS + memM + memL + memC + memH + memS32
+ if memMOD ne 1
+ if memMOD eq 0
+ memS = 1 ; assume small model
+ outif memS,0,<Small model>
+ else
+ ??error <must have only 1 memory model selected>
+ endif
+ endif
+
+ sizec= memM + memL + memH ; large code
+ sized= memL + memC + (memH*2) ; large data (2 if huge)
+ ;; note that memS32 is used generaly to indicate 32 bitness. I
+ ;; doubt very much whether anyone will ever do other models in
+ ;; 32 bit code...
+ if memS32
+ sizeI = 4 ; size of a push
+ wordI equ <dword>
+ asmdI equ <dd>
+ else
+ sizeI = 2
+ wordI equ <word>
+ asmdI equ <dw>
+ endif
+
+ outif ?DF,0,<No segments or groups will be defined>
+ outif ?DFDATA,0,<No data segments will be defined>
+ outif ?DFCODE,0,<No code segments will be defined>
+ outif ?TF,0,<Epilog sequences assume valid SP>
+ outif ?WIN,1,<Windows support>
+ outif ?COW,0,<Characters Windows support>
+ outif ?PLM,1,<PL/M calling convention>
+ outif ?NOATOMIC,0,<ATOMIC disabled>
+ outif ?NODATA,0,<NODATA module>
+
+ ife ?NODATA
+ ?nodata1=0
+ else
+ ?nodata1=1
+ endif
+
+ ifndef ?CHKSTK
+ ?chkstk1=0
+ else
+ ?chkstk1=1
+ ifdef ?CHKSTKPROC
+ ??_out <! Private stack checking enabled>
+ else
+ ??_out <! Stack checking enabled>
+ endif
+ endif
+
+ ifndef DOS5
+ ?DOS5=0
+ else
+ ?DOS5=1
+ ??_out <! DOS5 module>
+ endif
+
+ ifdef ?PROFILE
+ ??_out <! Native profiling enabled>
+ endif
+
+ ifndef ?NO_BP
+ ?no_bp1=0
+ else
+ ?no_bp1=1
+ ??_out <! NO_BP is default>
+ endif
+;else
+ ASMpass=2
+;endif
+
+;; define pseudo registers and instructions for 386/8086 independance
+if memS32
+ .386
+ IAX equ <eax>
+ ICX equ <ecx>
+ IDX equ <edx>
+ IBX equ <ebx>
+ ISP equ <esp>
+ IBP equ <ebp>
+ ISI equ <esi>
+ IDI equ <edi>
+ IPUSHF equ pushfd
+ IPOPF equ popfd
+ IPUSHA equ pushad
+ IPOPA equ popad
+ IIRET equ iretd
+else
+ IAX equ <ax>
+ ICX equ <cx>
+ IDX equ <dx>
+ IBX equ <bx>
+ ISP equ <sp>
+ IBP equ <bp>
+ ISI equ <si>
+ IDI equ <di>
+ IPUSHF equ pushf
+ IPOPF equ popf
+; IPUSHA equ pusha
+; IPOPA equ popa
+ IIRET equ iret
+endif
+
+;; Initialize all symbols used in the macros. Theses symbols will not be
+;; included in any cross reference listing.
+
+ .xcref ?n,?ax,?ah,?al,?bx,?bh
+ .xcref ?bl,?cx,?ch,?cl,?dx,?dh
+ .xcref ?dl,?si,?di,?es,?ds,?bp
+ .xcref ?sp,?ss,?cs
+ .xcref ?n,?AX,?AH,?AL,?BX,?BH
+ .xcref ?BL,?CX,?CH,?CL,?DX,?DH
+ .xcref ?DL,?SI,?DI,?ES,?DS,?BP
+ .xcref ?SP,?SS,?CS
+ .xcref ?EAX,?EBX,?ECX,?EDX,?ESI,?EDI,?ESP,?EBP
+ .xcref ?eax,?ebx,?ecx,?edx,?esi,?edi,?esp,?ebp
+ .xcref ?IAX,?IBX,?ICX,?IDX,?ISI,?IDI,?ISP,?IBP
+
+ .xcref ?rsl,?cpd,?argl,?argc,?ba
+ .xcref ?acb,???,?po
+ .xcref ?pas,?pc
+
+ .xcref uconcat,mpush,mpop
+ .xcref ?ri,?pp,?pp1,?al1
+ .xcref ?ad,?ap,?atal,?dd,?dd1,?dd2
+ .xcref ?pg,?pg1,?aloc,?cs1,?cs2
+ .xcref ?DF,?TF,?ff,?PLM,?WIN,?ia,?pu,?adj
+ .xcref ?uf,?rp,?nx,?nd,?nodata1,?chkstk1,?DOS5
+ .xcref ?wfp,arg,cCall,cProc,assumes,?cs3,?cs2,?cs1
+ .xcref defgrp,addseg,createSeg
+ .xcref save,outif,errnz,errn$,errnz1
+ .xcref ?PLMPrevParm,?gcc
+ .xcref ?cCall1,?pcc,?no_bp1,?no_bp2
+ .xcref ?cbe,?pcbe
+
+
+
+;; conditionals set by the macros
+;;
+;; ?pc Procedure class. If this is set to 1, then the procedure
+;; is a far procedure, else it is a near procedure.
+;;
+;; ?ia Interface adjustment count for far procedures. The
+;; interface adjustment defines the number of bytes of
+;; storage allocated between BP and the first frame variable
+;; allocated on the stack.
+;;
+;; Normally zero, it will be adjusted for both far windows
+;; procedures and by register parameters.
+;;
+;; ?cpd Current procedure defined. This is set to a non-zero
+;; value if a procedure is being defined (i.e a cProc has
+;; been encountered, and cBegin has not).
+;;
+;; ?ba Begin active. This is set to a non-zero value if a
+;; cBegin is active (i.e. a cBegin has been encountered,
+;; and cEnd has not).
+;;
+;; ?wfp Windows far procedure. Set if a windows far procedure
+;;
+;; ?pcc procedure calling conventing. Calling convention for
+;; this procedure. May be different than the default set
+;; via ?PLM
+;;
+;;
+;; Other variables that are defined once so that the .xcref command
+;; doesn't get too upset if they show up missing!
+
+?rsl = 0 ;;0 = no register to save
+?cpd = 0 ;;<> 0 if in a procedure definition
+?argl = 0 ;;length of arguments pushed on stack
+?argc = 0 ;;# of arguments so far
+?ba = 0 ;;<>0 if in a procedure (xbegin)
+?acb = 0 ;;number of arguments to a call
+??? = 0 ;;byte count of local storage
+?po = 0 ;;byte count of parameters
+?pas = 0 ;;autosave value for procedure
+?pc = 0 ;;class of a procedure (near/far)
+?ia = 0 ;;no adjustment
+?pu = 0 ;;public flag for some macros
+?adj = 0 ;;initial define for .xcref
+?rp = 0 ;;count of register parameters
+?uf = 0 ;;user's frame code specified
+?nd = 0 ;;NODATA keyword specified
+?nx = 0 ;;ATOMIC keyword specified
+?wfp = 0 ;;window far procedure
+?ff = 0 ;;forceframe keyword specified
+?dd2 = 0 ;;used for globalx and staticx
+?cCall1 = 0 ;;used for cCalls
+?pcc = ?PLM ;;procedure calling convention
+?PLMPrevParm = 0 ;;Used in parameter processing
+?no_bp2 = ?no_bp1 ;;BP / No BP flag
+?cbe = 0 ;;cbegin/cEnd keyword flag
+
+ .xcref ?casen
+if1 ;;only define ?casen on pass 1
+?casen = 0 ;;case sensitive assembly if <> 0
+endif
+
+
+
+?n = 0000000000000000b ;;register none
+?ax = 0000000000000011b ;;register ax
+?ah = 0000000000000001b ;;register ah
+?al = 0000000000000010b ;;register al
+?bx = 0000000000001100b ;;register bx
+?bh = 0000000000000100b ;;register bh
+?bl = 0000000000001000b ;;register bl
+?cx = 0000000000110000b ;;register cx
+?ch = 0000000000010000b ;;register ch
+?cl = 0000000000100000b ;;register cl
+?dx = 0000000011000000b ;;register dx
+?dh = 0000000001000000b ;;register dh
+?dl = 0000000010000000b ;;register dl
+?si = 0000000100000000b ;;register si
+?di = 0000001000000000b ;;register di
+?es = 0000010000000000b ;;register es
+?ds = 0000100000000000b ;;register ds
+?bp = 0001000000000000b ;;register bp
+?sp = 0010000000000000b ;;register sp
+?ss = 0100000000000000b ;;register ss
+?cs = 1000000000000000b ;;register cs
+ ;;Incase we're case sensitive
+?AX = 0000000000000011b ;;register ax
+?AH = 0000000000000001b ;;register ah
+?AL = 0000000000000010b ;;register al
+?BX = 0000000000001100b ;;register bx
+?BH = 0000000000000100b ;;register bh
+?BL = 0000000000001000b ;;register bl
+?CX = 0000000000110000b ;;register cx
+?CH = 0000000000010000b ;;register ch
+?CL = 0000000000100000b ;;register cl
+?DX = 0000000011000000b ;;register dx
+?DH = 0000000001000000b ;;register dh
+?DL = 0000000010000000b ;;register dl
+?SI = 0000000100000000b ;;register si
+?DI = 0000001000000000b ;;register di
+?ES = 0000010000000000b ;;register es
+?DS = 0000100000000000b ;;register ds
+?BP = 0001000000000000b ;;register bp
+?SP = 0010000000000000b ;;register sp
+?SS = 0100000000000000b ;;register ss
+?CS = 1000000000000000b ;;register cs
+
+?EAX = 0000000000000011b ;;register ax
+?EBX = 0000000000001100b ;;register bx
+?ECX = 0000000000110000b ;;register cx
+?EDX = 0000000011000000b ;;register dx
+?ESI = 0000000100000000b ;;register si
+?EDI = 0000001000000000b ;;register di
+?EBP = 0001000000000000b ;;register bp
+?ESP = 0010000000000000b ;;register sp
+
+?eax = 0000000000000011b ;;register ax
+?ebx = 0000000000001100b ;;register bx
+?ecx = 0000000000110000b ;;register cx
+?edx = 0000000011000000b ;;register dx
+?esi = 0000000100000000b ;;register si
+?edi = 0000001000000000b ;;register di
+?ebp = 0001000000000000b ;;register bp
+?esp = 0010000000000000b ;;register sp
+
+?IAX = 0000000000000011b ;;register ax
+?IBX = 0000000000001100b ;;register bx
+?ICX = 0000000000110000b ;;register cx
+?IDX = 0000000011000000b ;;register dx
+?ISI = 0000000100000000b ;;register si
+?IDI = 0000001000000000b ;;register di
+?IBP = 0001000000000000b ;;register bp
+?ISP = 0010000000000000b ;;register sp
+
+ .cref
+
+
+
+;; uconcat - unconditionally generate a statement from a field
+;; of given parameters
+;;
+;; usage:
+;; uconcat a,b,c,d,e,f,g
+;;
+;; where:
+;; a,b are concatenated for field 1
+;; c,d are concatenated for field 2
+;; e,f,g are concatenated for field 3
+
+uconcat macro a,b,c,d,e,f,g
+ a&b c&d e&f&g
+endm
+
+
+
+;; mpush pushes multiple registers onto the stack according to
+;; a register specification.
+;;
+;; format:
+;; mpush r
+;;
+;; where:
+;; r is a numeric expression returned from ?ri
+;; or any other valid register expression
+
+mpush macro r
+ irp x,<IAX,IBX,ICX,IDX,ISI,IDI,es,ds,IBP,ISP,ss,cs>
+ if (r and ?&&x)
+ push x ;@
+ endif
+ endm
+endm
+
+
+
+;; mpop pops multiple registers from the stack according to
+;; a register specification.
+;;
+;; format:
+;; mpop r
+;;
+;; where:
+;; r is a numeric expression returned from ?ri
+;; or any other valid register expression
+
+mpop macro r
+ irp x,<cs,ss,ISP,IBP,ds,es,IDI,ISI,IDX,ICX,IBX,IAX>
+ if (r and ?&&x)
+ pop x ;@
+ endif
+ endm
+endm
+
+
+;; save - flag that the indicated registers are to be saved/restored
+;;
+;; A flag is created which indicates which registers are to be saved
+;; when the cCall macro is invoked, and then restored after the call.
+;;
+;; usage:
+;; save <r>
+;;
+;; where r is the list of registers to save, which may be:
+;;
+;; register saves
+;; AX AX
+;; AH AX
+;; AL AX
+;; BX BX
+;; BH BX
+;; BL BX
+;; CX CX
+;; CH CX
+;; CL CX
+;; DX DX
+;; DH DX
+;; DL DX
+;; SI SI
+;; DI DI
+;; ES ES
+;; DS DS
+;; BP BP
+;;
+;; none nothing
+;;
+;; the macro generates a value for the variable ?rsl
+
+save macro r
+ ?rsl=0 ;;initialize save list
+ ?ri ?rsl,<r> ;;generate magic number
+endm
+
+
+
+;; ?ri - or register indexes to variable
+;;
+;; ?ri is a macro that examines the passed argument list and computes
+;; a register index variable.
+;;
+;; The values ORed with the variable are:
+;;
+;; ?n equ 0000000000000000b;
+;; ?AX equ 0000000000000011b;
+;; ?AH equ 0000000000000001b;
+;; ?AL equ 0000000000000010b;
+;; ?BX equ 0000000000001100b;
+;; ?BH equ 0000000000000100b;
+;; ?BL equ 0000000000001000b;
+;; ?CX equ 0000000000110000b;
+;; ?CH equ 0000000000010000b;
+;; ?CL equ 0000000000100000b;
+;; ?DX equ 0000000011000000b;
+;; ?DH equ 0000000001000000b;
+;; ?DL equ 0000000010000000b;
+;; ?SI equ 0000000100000000b;
+;; ?DI equ 0000001000000000b;
+;; ?ES equ 0000010000000000b;
+;; ?DS equ 0000100000000000b;
+;; ?BP equ 0001000000000000b;
+;; ?SP equ 0010000000000000b;
+;; ?SS equ 0100000000000000b;
+;; ?CS equ 1000000000000000b;
+;; usage:
+;; ?ri n,<rl>
+;s mach independant names; where:
+;; n is the variable to contain the new index value
+;; r is the register list
+
+?ri macro n,r
+ irp x,<r>
+ ifdef ?&&x ;;if defined, then add to list
+ n=n or ?&&x
+ else
+ ??error2 <unknown register x>
+ .err
+ endif
+ endm
+endm
+
+
+
+;; parmx - generate reference to parameter(s) on the stack
+;;
+;; An equate is generated for addressing a paramter(s)
+;; on the stack for the current procedural frame.
+;;
+;; An error message is generated if there isn't a current frame.
+;;
+;; usage:
+;; parmX n
+;; where:
+;; X is the type of the argument(s) B=byte, W=word, D=dword
+;; I = machine independant int size
+;; n is the name(s) to be given the parameter(s).
+;;
+;; Bytes are considered to be two bytes long for alignment.
+;;
+;; The parmd form of the macro generates three equates:
+;;
+;; name - for accessing the parameter as a double word
+;; off_name - for accessing the offset (lsw) of the parameter
+;; seg_name - for accessing the segment (msw) of the parameter
+
+.xcref
+.xcref parmB,parmW,parmD,parmQ,parmT,parmCP,parmDP,parmH,parmI
+.cref
+
+parmB macro n
+ ?pp <n>,<byte>,sizeI,1
+endm
+
+parmW macro n
+ ?pp <n>,<word>,sizeI,2
+endm
+
+parmI macro n
+ ?pp <n>,wordI,sizeI,sizeI
+endm
+
+parmD macro n
+ ife ?pcc ;;if to assemble for C
+ irp x,<n>
+ ?pp <&&x>,<dword>,0,4
+ ?pp <off_&&x>,<word>,2,2
+ ?pp <seg_&&x>,<word>,2,2
+ endm
+ else ;;if to assemble for PL/M
+ irp x,<n>
+ ?pp <seg_&&x>,<word>,2,2
+ ?pp <off_&&x>,<word>,2,2
+ ?pp <&&x>,<dword>,0,4
+ endm
+ endif
+endm
+
+parmH macro n
+ ?pp <n>,<word>,4,2
+endm
+
+parmQ macro n
+ ?pp <n>,<qword>,8,8
+endm
+
+parmT macro n
+ ?pp <n>,<tbyte>,10,10
+endm
+
+if sizec
+ parmCP macro n
+ parmD <n>
+ endm
+else
+ parmCP macro n
+ parmW <n>
+ endm
+endif
+
+if sized
+ parmDP macro n
+ parmD <n>
+ endm
+else
+ parmDP macro n
+ parmI <n>
+ endm
+endif
+
+
+
+;; ?pp is the generalized parameter definition macro
+;;
+;; usage:
+;; ?pp m,t,l,s
+;;
+;; where:
+;; n is the name(s) of the parameters
+;; t is the type (word, dword)
+;; l is the length to update parameter byte count by
+;; s is the internal typing size
+
+
+?pp macro n,t,l,s ;;process parameter
+ if ?cpd ;;must be in a procedure definition
+ .xcref
+ irp x,<n>
+ .xcref ?t&&x ;;don't want this in xref
+ ?t&&x=s ;;save size info
+ ife ?pcc ;;if C calling convention
+ ?pp1 x,<t>,,,%(?po+?adj)
+ ?po=?po+l ;;update parameter offset
+ else ;;else assemble for PL/M
+ ?PLMPrevParm=?PLMPrevParm+1 ;;Show next parameter
+ ?po=?po+l ;;update parameter offset
+ ?pp1 x,<t>,%?po,%?adj,,%?PLMPrevParm,%(?PLMPrevParm-1)
+ endif
+ endm
+ .cref
+ else
+ ??error2 <parm(s) "&n" declared outside proc def>
+ endif
+endm
+
+
+
+;; ?pp1 is the macro that generates the text equate for the
+;; parameter. Two options exist, one for the C calling
+;; convention where the last parameter was the first pushed onto
+;; the stack ('C' convention), and one for the PL/M calling
+;; convention where the first parameter was the first
+;; pushed (also the same as ms-pascal).
+;;
+;; The text generated will be of one of two forms:
+;;
+;; name equ (type ptr [bp+(adj+offset)]) for C
+;; or
+;; name equ (type ptr [bp+adj+?po-offset]) for PL/M
+;;
+;;
+;; For C, since parameters are pushed first last, the offset
+;; plus the adjust will point to the correct parameter.
+;;
+;; For PL/M, since parameters are pushed first first, the offset
+;; of a parameter is much more complicated. A known portion of
+;; the offset can be computed when the text equate is generated.
+;;
+;; What is known is the number of garbage bytes between BP and
+;; the nearest parameter (in this case the last parameter), and
+;; also how many bytes of parameters have preceeded this parameter.
+;;
+;; What is unknown is how many total bytes of parameters there will
+;; be, which affects all the generated text equates since the offset
+;; from bp must be determined at some point.
+;;
+;; Well, the offset from BP can be computed with one variable if
+;; the following is remembered:
+;;
+;; the offset of any parameter from the first parameter is always
+;; the current parameter offset (?po).
+;;
+;; With this in mind, you just have to figure out where the first
+;; parameter is, which is:
+;;
+;; bp + garbage adjustment + distance to first parameter
+;; or
+;; bp + ?adj + ?po
+;;
+;; This implies that any parameter can be defined as:
+;;
+;; bp + ?adj + ?po -%?po
+;;
+;; Make any sense?
+;;
+;; For PL/M, a chain of self-purging macros will be generated
+;; which will pass the evaluated ?po to any previous incarnation
+;; of the macro. This will allow the text equate to be generated
+;; with the actual offset instead of the symbolic ?po.
+;;
+;;
+;; usage:
+;; ?pp1 n,t,o,a,b,cpc,ppc
+;;
+;; where:
+;; n is the name to be given the equate
+;; t is the type (byte, word, dword)
+;; o is the offset from the first parameter
+;; a is the adjustment
+;; b is the adjustment plus the offset from the first parameter
+;; cpc is the number of parameters so far
+;; ppc is cpc - 1
+
+
+?pp1 macro n,t,o,a,b,cpc,ppc
+ ife ?pcc ;;if to generate for C
+ if ?no_bp2
+ n equ (t ptr [+b])
+ else
+ n equ (t ptr [IBP][+b])
+ endif
+ else ;;else generate for PL/M
+ .xcref
+ .xcref ?PLMParm&cpc
+ .cref
+ if ?no_bp2
+ ?PLMParm&cpc &macro po
+ uconcat <n>,,<equ>,,<(t ptr [+>,%(a+po-o),<])>
+ ?PLMParm&ppc po
+ purge ?PLMParm&cpc
+ &endm
+ else
+ ?PLMParm&cpc &macro po
+ uconcat <n>,,<equ>,,<(t ptr [IBP][+>,%(a+po-o),<])>
+ ?PLMParm&ppc po
+ purge ?PLMParm&cpc
+ &endm
+ endif
+ endif
+endm
+
+
+
+;; parmR - register parameter
+;;
+;; parmR is the macro used for generating register parameters.
+;; The space allocated for the register parameters will be
+;; the ?ia (interface adjust) area which is between the old
+;; BP and the first parameter. Normally this is empty (?ia=0),
+;; or has the saved ds for a windows far procedure.
+;;
+;; Byte and dword register parameters will be allowed.
+;;
+;; usage:
+;; parmR n,r,r2
+;; where:
+;; n is the name of the parameter
+;; r is the register it is in
+;; r2 is the offset register if a dword
+
+
+ifndef ?NOPARMR
+ .xcref
+ .xcref ?pr,parmR
+ .cref
+
+ parmR macro n,r,r2
+ ?pr n,r,r2,%?rp,%(?ia+2)
+ endm
+
+ ;; ?pr - register parameter
+ ;;
+ ;; ?pr is the actual macro for generating the equates for
+ ;; register parameters.
+ ;;
+ ;; usage:
+ ;; parmR n,r,r2,i,o
+ ;; where:
+ ;; n is the name of the parameter
+ ;; r is the register it is in
+ ;; r2 is the offset register if a dword
+ ;; i is the index of the ?rp to generate
+ ;; o is the offset from bp where the parm will be
+
+ ?pr macro n,r,r2,i,o
+ .xcref
+ ifnb <r2> ;;if a dword parameter
+ parmR seg_&n,r ;;define segment equate
+ parmR off_&n,r2 ;;define offset equate
+ if ?no_bp2
+ n equ (dword ptr [-o-2]) ;;define dword equate
+ else
+ n equ (dword ptr [bp][-o-2]) ;;define dword equate
+ endif
+ .xcref ?t&n
+ ?t&n=4 ;;show a dword to cmacros
+ else
+ .xcref ?rp&i
+ ?rp&i=0 ;;show no register(s)
+ ifdef ?&r ;;define register if valid
+ ?rp&i=?&r
+ endif
+
+ if ??? or (?cpd eq 0) or (?rp&i eq 0)
+ ??error2 <invalid parmR encountered: &n,&r>
+ exitm
+ endif
+
+ if ?no_bp2
+ n equ (word ptr [-o]) ;;assume a word register
+ else
+ n equ (word ptr [bp][-o]) ;;assume a word register
+ endif
+ .xcref ?t&n
+ ?t&n=2 ;;show a word to cmacros
+ irp x,<bh,ch,dh,bl,cl,dl,ah,al>
+ if ?&&x eq ?&r ;;if really a byte register
+ if ?no_bp2
+ n equ (byte ptr [-o]) ;; then make it a byte
+ else
+ n equ (byte ptr [bp][-o]) ;; then make it a byte
+ endif
+ ?t&n=1 ;;show a byte to cmacros
+ exitm
+ endif
+ endm
+ ?ia=?ia+2 ;;show this guy is out there
+ ?rp=?rp+1 ;;show one more register parameter
+ endif
+ .cref
+ endm
+endif
+
+
+
+;; localx - generate reference to a local variable on the stack
+;;
+;; An equate is generated for addressing a local variable
+;; on the stack for the current procedural frame.
+;;
+;; usage:
+;; localx n
+;; where:
+;; x is the type b=byte, w=word, d=dword, v=variable size
+;; n is the name(s) to be given the variable(s).
+;;
+;; Bytes are considered to be two bytes long for alignment reasons
+;;
+;; The locald form of the macro generates three equates:
+;;
+;; name - for accessing the variable as a double word
+;; off_name - for accessing the offset (lsw) of the variable
+;; seg_name - for accessing the segment (msw) of the variable
+
+
+.xcref
+.xcref localB,localW,localD,localQ,localT,localCP,localDP,localV,localI
+.cref
+
+localB macro n
+ ?aloc <n>,<byte ptr>,1,1,0 ;; no alignment
+endm
+
+localW macro n
+ ?aloc <n>,<word ptr>,2,2,1 ;; word aligned
+endm
+
+localI macro n
+ ?aloc <n>,&wordI&< ptr>,sizeI,sizeI,1 ;; dword aligned
+endm
+
+localD macro n
+ irp x,<n>
+ ?aloc <seg_&&x>,<word ptr>,2,2,1 ;; word aligned
+ ?aloc <off_&&x>,<word ptr>,2,2,1 ;; word aligned
+ ?aloc <&&x>,<dword ptr>,0,4,1 ;; word aligned
+ endm
+endm
+
+localQ macro n
+ ?aloc <n>,<qword ptr>,8,8,1 ;; word aligned
+endm
+
+localT macro n
+ ?aloc <n>,<tbyte ptr>,10,10,1 ;; word aligned
+endm
+
+if sizec
+ localCP macro n
+ localD <n>
+ endm
+else
+ localCP macro n
+ localW <n>
+ endm
+endif
+
+if sized
+ localDP macro n
+ localD <n>
+ endm
+else
+ localDP macro n
+ localI <n>
+ endm
+endif
+
+localV macro n,a
+ ?aloc <n>,,%(a),0,1 ;; word aligned
+endm
+
+
+;; ?aloc is the macro that actually allocates local storage.
+;; it is only invoked by the localx macros.
+;;
+;; usage:
+;; ?aloc n,t,l,s,a
+;; where:
+;; n is a list of names of local variable of the
+;; given type.
+;; t is the text string for the given variable
+;; and is one of:
+;; word ptr
+;; dword ptr
+;; byte ptr
+;; or alternatively left blank for variable size
+;; allocations (no implicit type).
+;; l is the size of the variable in bytes
+;; s is the internal type flag (size), and is one of:
+;; word - 2
+;; dword - 4
+;; byte - 1
+;; variable - 0
+;; a is a flag indicating that word alignment is to be
+;; forced for this type of item.
+;;
+;; NOTE: It is assumed that the stack is already aligned on a word
+;; boundary when the cProc is invoked. The macros will guarantee
+;; to allocate an even number of bytes on the stack to maintain
+;; word alignment.
+
+
+?aloc macro n,t,l,s,a
+ if ?cpd ;;must be in a proc def
+ .xcref
+ irp x,<n> ;;generate symbol equates
+ ???=???+l ;;update length of locals
+ if a ;;if align, then force word alignment
+ if memS32 and l GT 2
+ ???=((??? + 3) and 0fffffffch) ;; dword alignment
+ else
+ ???=((??? + 1) and 0fffeh)
+ endif
+ endif
+ ?al1 x,<t>,%(???+?ia) ;;?ia will always be valid (0 or 2)
+ .xcref ?t&&x
+ ?t&&x=s ;;save size info
+ endm
+ .cref
+ else
+ ??error2 <locals "&n" declared outside procedure def>
+ endif
+endm
+
+
+
+;; ?al1 - allocate local, continued.
+;;
+;; ?al1 actually generates the text equate for the local variable.
+;; The form of the text equate generated is more or less:
+;;
+;; name equ (type ptr [bp-?ia-nn])
+;; or
+;; name equ ([bp-?ia-nn])
+;;
+;; where:
+;; ?ia is defined to be either zero, or is defined to be
+;; the number of bytes between the saved BP and the first
+;; local. ?ia is only applicable if the current cProc is
+;; a windows far procedure or if parmRs have been
+;; encountered. If not, the ?ia will be zero. since ?ia
+;; is determinable prior to invoking this macro, it will be
+;; added into the offset ("nn") passed to this macro
+;;
+;; usage:
+;; ?al1 n,t,o
+;; where:
+;; n is the name for the text equate
+;; t is the type of the equate
+;; o is the offset of the equate
+
+
+?al1 macro n,t,o
+ if ?no_bp2
+ n equ (t [-o])
+ else
+ n equ (t [IBP][-o])
+ endif
+endm
+
+
+;; ?gcc - get calling convention
+;;
+;; ?gcv sets the given symbol to the calling convention
+;; to be used.
+;;
+;; usage:
+;; ?gcc s,i,cc
+;;
+;; where:
+;; s is the symbol to return the convention in
+;; s = 0 if 'C' calling convention
+;; s = 1 if PL/M (PASCAL) calling convention
+;; i is the initial value for s
+;; cc is the calling convention override, and may be one of
+;; C use 'C' convention
+;; PLM use PL/M calling convention
+;; PASCAL use PL/M calling convention
+
+?gcc macro s,i,cc
+ s = i ;;Set default calling convention
+ ifnb <cc>
+ ifidn <cc>,<C> ;;If overriding default
+ s=0 ;; 'C' calling convention
+ endif
+ ifidn <cc>,<PLM>
+ s=1 ;; PL/M calling convention
+ endif
+ ifidn <cc>,<PASCAL>
+ s=1 ;; PL/M calling convention
+ endif
+ endif
+endm
+
+
+
+ifndef ?NOGLOBAL
+ .xcref
+ .xcref globalB,globalW,globalD,globalQ,globalT,globalCP,globalDP,globalI
+ .cref
+
+ ;; globalx - define global data of type x
+ ;;
+ ;; usage:
+ ;; globalx n,i,s,c
+ ;; where:
+ ;; x is the type of the variable b=byte, w=word, d=dword
+ ;; q=quad word, t=tenbytes, cp=code pointer, dp=data pointer
+ ;; n is the name to be given the variable.
+ ;; i is the initial value of the variable.
+ ;; s is the duplication factor
+ ;; c is the convention, C for C, PLM or PASCAL for PL/M.
+ ;; The default (?PLM flag) will be used if not specified.
+ ;;
+ ;; The D form will generate two extra equates of the form off_n and seg_n.
+
+ globalB macro n,i,s,c
+ ?ad <n>,1
+ ?dd n,1,<byte>,<db>,<i>,<s>,<c>
+ endm
+
+ globalW macro n,i,s,c
+ ?ad <n>,2
+ ?dd n,1,<word>,<dw>,<i>,<s>,<c>
+ endm
+
+ globalI macro n,i,s,c
+ ?ad <n>,2
+ ?dd n,1,wordI,%asmdI,<i>,<s>,<c>
+ endm
+
+ globalD macro n,i,s,c
+ ?ad <n>,4
+ ?dd n,1,<dword>,<dd>,<i>,<s>,<c>
+ off_&n equ word ptr n[0]
+ seg_&n equ word ptr n[2]
+ endm
+
+ globalQ macro n,i,s,c
+ ?ad <n>,8
+ ?dd n,1,<qword>,<dq>,<i>,<s>,<c>
+ endm
+
+ globalT macro n,i,s,c
+ ?ad <n>,10
+ ?dd n,1,<tbyte>,<dt>,<i>,<s>,<c>
+ endm
+
+ if sizec
+ globalCP macro n,i,s,c
+ globalD n,<i>,<s>,<c>
+ endm
+ else
+ globalCP macro n,i,s,c
+ globalW n,<i>,<s>,<c>
+ endm
+ endif
+
+ if sized
+ globalDP macro n,i,s,c
+ globalD n,<i>,<s>,<c>
+ endm
+ else
+ globalDP macro n,i,s,c
+ globalI n,<i>,<s>,<c>
+ endm
+ endif
+
+endif
+
+
+ifndef ?NOSTATIC
+ .xcref
+ .xcref staticB,staticW,staticD,staticQ,staticT,staticCP,staticDP,staticI
+ .cref
+
+ ;; staticx - define static data of type x
+ ;;
+ ;; usage:
+ ;; staticx n,i,s
+ ;; where:
+ ;; x is the type of the variable b=byte, w=word, d=dword
+ ;; q=quad word, t=tenbytes, cp=code pointer, dp=data pointer
+ ;; n is the name to be given the variable.
+ ;; i is the initial value of the variable.
+ ;; s is the duplication factor
+ ;;
+ ;; statics do not generate an underscored version of the symbol
+ ;; since they are intended to be internal symbols. If they are
+ ;; required to be public, use globlax.
+
+
+ staticB macro n,i,s
+ ?ad <n>,1
+ ?dd n,0,<byte>,<db>,<i>,<s>,<PLM> ;;PLM to keep from generating _
+ endm
+
+ staticW macro n,i,s
+ ?ad <n>,2
+ ?dd n,0,<word>,<dw>,<i>,<s>,<PLM>
+ endm
+
+ staticD macro n,i,s
+ ?ad <n>,4
+ ?dd n,0,<dword>,<dd>,<i>,<s>,<PLM>
+ endm
+
+ staticI macro n,i,s
+ ?ad <n>,sizeI
+ ?dd n,0,wordI,%asmdI,<i>,<s>,<PLM>
+ endm
+
+ staticQ macro n,i,s
+ ?ad <n>,8
+ ?dd n,0,<qword>,<dq>,<i>,<s>,<PLM>
+ endm
+
+ staticT macro n,i,s
+ ?ad <n>,10
+ ?dd n,0,<tbyte>,<dt>,<i>,<s>,<PLM>
+ endm
+
+ if sizec
+ staticCP macro n,i,s
+ staticD n,<i>,<s>
+ endm
+ else
+ staticCP macro n,i,s
+ staticW n,<i>,<s>
+ endm
+ endif
+
+ if sized
+ staticDP macro n,i,s
+ staticD n,<i>,<s>
+ endm
+ else
+ staticDP macro n,i,s
+ staticI n,<i>,<s>
+ endm
+ endif
+endif
+
+
+
+;; ?dd is the generalized data definition macro.
+;;
+;; format:
+;; ?dd n,p,t,d,i,s,c
+;; where:
+;; n is the name of the procedure
+;; p is the public flag
+;; t is the assembler type (byte, word, dword)
+;; d is the assembler directive (db,dw or dd)
+;; i is the initial value
+;; s is a duplication factor
+;; c is the convention, C for C, PLM or PSACAL for PL/M.
+;; The default (?PLM flag) will be used if not specified.
+
+
+?dd macro n,p,t,d,i,s,c
+ ?gcc ?dd2,%?PLM,<c> ;;Set calling convention
+ ife ?dd2 ;;If 'C'
+ n label t
+ ?dd1 _&n,p,<d>,<i>,<s> ;;Microsoft C uses leading underscores
+ else
+ ?dd1 n,p,<d>,<i>,<s> ;;If PL/M
+ endif
+endm
+
+
+
+;; ?dd1 is the generalized data definition macro.
+;;
+;; format:
+;; ?dd1 n,p,d,i,s
+;; where:
+;; n is the name of the procedure
+;; p is the public flag
+;; d is the assembler directive (db,dw or dd)
+;; i is the initial value
+;; s is a duplication factor
+
+
+?dd1 macro n,p,d,i,s
+ if p
+ public n
+ endif
+ ifb <s>
+ n d i
+ else
+ ifb <i>
+ n d s dup (?)
+ else
+ n d s dup (i)
+ endif
+ endif
+endm
+
+
+
+ifndef ?NOEXTERN
+ .xcref
+ .xcref ?ex1,?ex2,externB,externW,externD,externQ,externT,externI
+ .xcref externNP,externFP,externP,externCP,externDP,externA
+ .cref
+ ?ex2 = 0
+
+ ;; externx - define external data of type x
+ ;;
+ ;; usage:
+ ;; externx n,c
+ ;; where:
+ ;; x is the type of the variable b=byte, w=word, d=dword
+ ;; q=quad word, t=tenbytes, cp=code pointer
+ ;; dp=data pointer, a=absolute
+ ;; n is a list of names to define
+ ;; c is the convention, C for C, PLM or PSACAL forPL/M.
+ ;; The default (?PLM flag) will be used if not specified.
+
+ externA macro n,c ;;40h is reserved for whatever will
+ ?ex1 <n>,40h,<abs>,<c>,<> ;; be done in the future for ASB
+ endm ;; externals
+
+ externB macro n,c
+ ?ex1 <n>,1,<byte>,<c>,<>
+ endm
+
+ externW macro n,c
+ ?ex1 <n>,2,<word>,<c>,<>
+ endm
+
+ externD macro n,c
+ ?ex1 <n>,4,<dword>,<c>,<>
+ endm
+
+ externI macro n,c
+ ?ex1 <n>,sizeI,%wordI,<c>,<>
+ endm
+
+ externQ macro n,c
+ ?ex1 <n>,8,<qword>,<c>,<>
+ endm
+
+ externT macro n,c
+ ?ex1 <n>,10,<tbyte>,<c>,<>
+ endm
+
+ externNP macro n,c
+ ?ex1 <n>,2,<near>,<c>,<cc>
+ endm
+
+ externFP macro n,c
+ ?ex1 <n>,4,<far>,<c>,<cc>
+ endm
+
+ if sizec
+ externP macro n,c
+ ?ex1 <n>,4,<far>,<c>,<cc>
+ endm
+ else
+ externP macro n,c
+ ?ex1 <n>,2,<near>,<c>,<cc>
+ endm
+ endif
+
+ if sizec
+ externCP macro n,c
+ ?ex1 <n>,4,<dword>,<c>,<>
+ endm
+ else
+ externCP macro n,c
+ ?ex1 <n>,2,<word>,<c>,<>
+ endm
+ endif
+
+ if sized
+ externDP macro n,c
+ ?ex1 <n>,4,<dword>,<c>,<>
+ endm
+ else
+ externDP macro n,c
+ ?ex1 <n>,2,<word>,<c>,<>
+ endm
+ endif
+
+
+
+ ;; ?ex1 is the generalized external definition macro
+ ;;
+ ;; format:
+ ;; ?ex1 n,s,d,c,scv
+ ;; where:
+ ;; n is are the names of the externals
+ ;; s is the size in bytes (used for typing)
+ ;; d is the type
+ ;; c is the convention, C for C, PLM or PSACAL for PL/M.
+ ;; The default (?PLM flag) will be used if not specified.
+ ;; scv save calling convention. If this field is "cc", then
+ ;; the calling convention will be saved in a ?CCn equ.
+
+ ?ex1 macro n,s,d,c,scv
+ ?gcc ?ex2,%?PLM,<c>
+ irp x,<n>
+ .xcref
+ .xcref ?t&&x
+ .cref
+ ?t&&x=s ;;save size info
+ ife ?ex2
+ extrn _&&x:&d
+ x equ _&&x
+ else
+ extrn x:&d
+ endif
+ ifidn <scv>,<cc> ;;save calling convention (C or PL/M)
+ .xcref ;; if NP, FP, or P
+ .xcref ?CC&&x
+ .cref
+ ?CC&&x=?ex2
+ endif
+ endm
+ endm
+endif
+
+
+
+ifndef ?NOLABEL
+ .xcref
+ .xcref ?lb1,?lblpu,?lb2
+ .xcref labelB,labelW,labelD,labelQ,labelT
+ .xcref labelNP,labelFP,labelP,labelCP,labelDP
+ .cref
+ ?lblpu = 0
+ ?lb2 = 0
+
+ ;; labelx - define label of data type x
+ ;;
+ ;; usage:
+ ;; labelx n,c
+ ;; where:
+ ;; x is the type of the variable b=byte, w=word, d=dword
+ ;; q=quad word, t=tenbytes, cp=code pointer, dp=data pointer
+ ;; n is a list of names to define, the first of which can
+ ;; be the keyword public
+ ;; c is the convention, C for C, PLM or PSACAL for PL/M.
+ ;; The default (?PLM flag) will be used if not specified.
+
+ labelB macro n,c
+ ?lb1 <n>,1,<byte>,<c>
+ endm
+
+ labelW macro n,c
+ ?lb1 <n>,2,<word>,<c>
+ endm
+
+ labelD macro n,c
+ ?lb1 <n>,4,<dword>,<c>
+ endm
+
+ labelQ macro n,c
+ ?lb1 <n>,8,<qword>,<c>
+ endm
+
+ labelT macro n,c
+ ?lb1 <n>,10,<tbyte>,<c>
+ endm
+
+ labelNP macro n,c
+ ?lb1 <n>,2,<near>,<c>
+ endm
+
+ labelFP macro n,c
+ ?lb1 <n>,4,<far>,<c>
+ endm
+
+ if sizec
+ labelP macro n,c
+ ?lb1 <n>,4,<far>,<c>
+ endm
+ else
+ labelP macro n,c
+ ?lb1 <n>,2,<near>,<c>
+ endm
+ endif
+
+ if sizec
+ labelCP macro n,c
+ ?lb1 <n>,4,<dword>,<c>
+ endm
+ else
+ labelCP macro n,c
+ ?lb1 <n>,2,<word>,<c>
+ endm
+ endif
+
+ if sized
+ labelDP macro n,c
+ ?lb1 <n>,4,<dword>,<c>
+ endm
+ else
+ labelDP macro n,c
+ ?lb1 <n>,2,<word>,<c>
+ endm
+ endif
+
+
+ ;; ?lb1 is the generalized label definition macro
+ ;;
+ ;; format:
+ ;; ?lb1 n,s,d
+ ;; where:
+ ;; n are the names of the labels
+ ;; s is the size in bytes (used for typing)
+ ;; d is the type
+ ;; c is the convention, C for C, PLM or PSACAL for PL/M.
+ ;; The default (?PLM flag) will be used if not specified.
+
+ ?lb1 macro n,s,d,c
+ ?gcc ?lb2,%?PLM,<c>
+ ?lblpu=0
+ irp x,<n>
+ ifidn <x>,<PUBLIC>
+ ?lblpu=1
+ else
+ .xcref
+ .xcref ?t&&x
+ .cref
+ ?t&&x=s ;;save size info
+ ife ?lb2 ;;If C
+ if ?lblpu
+ public _&&x
+ endif
+ _&&x label &d
+ x equ _&&x
+ else ;;If PL/M
+ if ?lblpu
+ public x
+ endif
+ x label &d
+ endif
+ endif
+ endm
+ endm
+endif
+
+
+
+ifndef ?NODEF
+
+ ;; defx - inform macros that name is of type x
+ ;;
+ ;; The given name(s) is flaged to be of the given type. This macro
+ ;; is intended for giving types to variables that were not generated
+ ;; by the macros (i.e., static storage). There must be a type definition
+ ;; for all parameters in a call list.
+ ;;
+ ;; usage:
+ ;; defx n
+ ;; where:
+ ;; x is the type of the variable b=byte, w=word, d=dword
+ ;; n is the name(s) to be given the variable(s).
+ ;;
+ ;; Bytes are considered to be two bytes long for alignment reasons
+
+ .xcref
+ .xcref defB,defW,defD,defQ,defT,defCP,defDP
+ .cref
+
+ defB macro n
+ ?ad <n>,1
+ endm
+
+ defW macro n
+ ?ad <n>,2
+ endm
+
+ defD macro n
+ ?ad <n>,4
+ endm
+
+ defQ macro n
+ ?ad <n>,8
+ endm
+
+ defT macro n
+ ?ad <n>,10
+ endm
+
+ if sizec
+ defCP macro n
+ defD <n>
+ endm
+ else
+ defCP macro n
+ defW <n>
+ endm
+ endif
+
+ if sized
+ defDP macro n
+ defD <n>
+ endm
+ else
+ defDP macro n
+ defW <n>
+ endm
+ endif
+endif
+
+
+
+; ?ad is the macro which creates a definition for the given
+; symbol
+;
+; usage:
+; ?ad <n>,s
+; where:
+; n is a list of names to define
+; s is the size info (1,2,4,8,10)
+
+
+?ad macro n,s
+ irp x,<n>
+ .xcref
+ .xcref ?t&&x
+ .cref
+ ?t&&x=s ;;save size info
+ endm
+endm
+
+
+
+ifndef ?NOPTR
+ .xcref
+ .xcref regPtr,farPtr
+ .cref
+
+ ;; regPtr generates information allowing a 32-bit pointer currently
+ ;; in a register to be pushed as a parameter to a subroutine using
+ ;; the cCall macro.
+ ;;
+ ;; usage:
+ ;; regptr n,s,o
+ ;; where:
+ ;; n is the name the argument will be known as
+ ;; s is the register containing the segment portion
+ ;; of the pointer
+ ;; o is the register containing the offset portion
+ ;; of the pointer
+ ;;
+ ;; 2/14/85 - made obsolete with farptr
+
+ regPtr macro n,s,o
+ farPtr n,s,o
+ endm
+
+
+
+ ;; farPtr generates information allowing a 32-bit pointer to be
+ ;; pushed as a parameter to a subroutine using the cCall macro.
+ ;;
+ ;; usage:
+ ;; farptr n,s,o
+ ;; where:
+ ;; n is the name the argument will be known as
+ ;; s is the segment portion of the pointer
+ ;; o is the offset portion of the pointer
+ ;;
+ ;; Note that any cast must have been made in the argument itself
+ ;; (i.e. regptr ptr1,ds,<word ptr 3[si]>)
+
+
+ farPtr macro n,s,o
+ .xcref
+ .xcref ?t&n
+ .cref
+ n &macro
+ push s ;@
+ push o ;@
+ &endm
+ ?t&n=80h
+ endm
+endif
+
+
+
+;; arg - declare argument
+;;
+;; The given argument(s) is added to the argument list structure
+;;
+;; format:
+;; arg a
+;;
+;; where:
+;; a is any valid argument to push.
+;;
+;; If any element in arglist has not been defined or isn't a 16-bit
+;; register, then a complete specification must have been given in a
+;; text equate and a defx also given (if not, you'll pay the penalty!)
+
+
+arg macro a
+ irp x,<a>
+ ?argc=?argc+1 ;;increment the arg count
+ ?atal <x>,%?argc ;;generate argument
+ endm
+endm
+
+
+
+;; ?atal (add to argument list) generates a macro that will cause
+;; the given argument to be processed when invoked. It is used by
+;; the arg macro only.
+
+
+?atal macro n,i
+ .xcref
+ .xcref ?ali&i
+ .cref
+ ?ali&i &macro
+ ?ap <n>
+ &endm
+endm
+
+
+
+;; ?ap - process arguments and place onto stack
+;;
+;; The given argument is processed (type checking) and place on
+;; the stack for a pending call. There must be a type definition
+;; for all arguments (except words). This can be done by using
+;; text equates and the defx macro.
+;;
+;; format:
+;; ?ap n
+;; where:
+;; n is the name of the argument to be pushed
+;;
+;; The variable ?argl is updated by the length of the arguments
+;; pushed so that the stack can be cleaned up after the call.
+
+
+?ap macro n
+ ?argl=?argl+2 ;;assume one word is pushed
+ ifdef ?t&n
+ ife ?t&n-1 ;;byte type
+ push word ptr (n) ;@
+ exitm
+ endif
+
+ ife ?t&n-2 ;;word type
+ push n ;@
+ exitm
+ endif
+
+ ife ?t&n-4 ;;dword type
+ push word ptr (n)[2] ;@
+ push word ptr (n) ;@
+ ?argl=?argl+2
+ exitm
+ endif
+
+ ife ?t&n-8 ;;qword type
+ push word ptr (n)[6] ;@
+ push word ptr (n)[4] ;@
+ push word ptr (n)[2] ;@
+ push word ptr (n) ;@
+ ?argl=?argl+6
+ exitm
+ endif
+
+ if ?t&n and 80h ;;far pointer type
+ n
+ ?argl=?argl+2
+ exitm
+ endif
+
+ ife ?t&n ;;variable storage
+ push word ptr (n) ;@
+ exitm
+ endif
+ endif
+
+ push n ;;unknown or register or immediate ;@
+endm
+
+
+
+;; cCall - call a 'c' language procedure
+;;
+;; The given procedure is called with the given parameters.
+;; If the calling convention is C, the arguments are pushed
+;; in reverse order, and removed after the called procedure
+;; returns. If the calling conventing is PL/M, the arguments
+;; are pushed as they were encountered, and the called procedure
+;; is assumed to have removed them from the stack.
+;;
+;; The calling convention priority will be:
+;; 1) that specified on the cCall if present
+;; 2) that defined by the target
+;; 3) the default (?PLM flag)
+;;
+;; format:
+;; ccall n,<a>,c
+;;
+;; where:
+;; n is the name of the procedure to call
+;; a are arguments to be pushed (optional, may be
+;; specified with the "arg" macro.
+;; c is the convention, C for C, PLM or PSACAL for PL/M.
+;; The default (?PLM flag) will be used if not specified.
+
+
+cCall macro n,a,c
+ ifnb <a> ;;add any arguments to list
+ arg <a>
+ endif
+ mpush %?rsl ;;save registers (if any)
+
+ ifdef ?CC&n ;;if calling convention has been
+ ?cCall1=?CC&n ;; defined for target, use it
+ else ;;else use the default
+ ?cCall1=?PLM
+ endif
+
+ ifnb <c> ;;If possible override, check it out
+ ?gcc ?cCall1,%?cCall1,<c>
+ endif
+
+ ?argl=0 ;;init argument length
+ ife ?cCall1 ;;if C calling convention
+ ?acb=?argc ;;initialize for looping
+ else
+ ?acb=1 ;;initialize for looping
+ endif
+
+ rept ?argc ;;push arguments and purge macros
+ uconcat <?ali>,%?acb
+ uconcat <purge>,,<?ali>,%?acb
+ ife ?cCall1 ;;if C calling convention
+ ?acb=?acb-1
+ else
+ ?acb=?acb+1
+ endif
+ endm
+ call n ;;call the procedure ;@
+ if ((?cCall1 eq 0) and (?argl ne 0)) ;;If C calling convention and arguments
+ add sp,?argl ;; then remove them ;@
+ endif
+ mpop %?rsl ;;pop all specified regs
+ ?rsl=0 ;;invalidate save list
+ ?argc= 0 ;; " arguments
+ ?argl= 0
+endm
+
+
+
+
+;; cProc - define a 'c' procedure
+;;
+;; cProc is the procedure definition for procedures.
+;;
+;; format:
+;; cProc n,cf,a
+;; where:
+;; n is the name of the procedure
+;;
+;; cf controls certain definitions, and may be:
+;; NEAR proc is to be a near label
+;; FAR proc is to be a far label
+;; PUBLIC proc is to be defined as public
+;; SMALL call makeframe procedure
+;; NODATA dont create prolog code to setup DS
+;; ATOMIC don't link stack if not needed
+;; NODATA must be specified for ATOMIC
+;; FORCEFRAME Force generation of a frame
+;; C proc is to be a C procedure
+;; PLM proc is to be a PL/M procedure
+;; PASCAL proc is to be a PL/M procedure
+;; WIN proc is to be a windows procedure
+;; NONWIN proc isn't to be a windows procedure
+;; NO_BP don't generate BP in text equates
+;; BP generate BP in text equates
+;;
+;; a is a list of registers that are to be saved whenever
+;; the procedure is invoked.
+;;
+;; makeframe procedure: If small is specified, then
+;; the "makeframe procedure" is invoked instead of
+;; generating normal prologues/epilogues
+;;
+;; A call is performed to the makeframe procedure. The
+;; call is followed by two bytes. the first byte is the
+;; number of locals to allocate for the frame, the second
+;; is the number of bytes of parameters. The makeframe
+;; procedure will in turn call the cProc routine at the
+;; address following the data bytes. When the cProc is
+;; finished, it will do a near return to the makeframe
+;; procedure to clean up the frame and exit.
+;;
+;; Note that register parameters and makeframe are
+;; incompatible and cannot be used together.
+;;
+;; The makeframe procedure will save SI, DI, and also
+;; DS if a far procedure. These registers will be
+;; removed from the autosave list if specified.
+
+
+cProc macro n,cf,a
+ if ?cpd
+ ?utpe ;;generate unterminated proc error
+ endif
+
+ ?cpd=1 ;;a procdef is active now
+ ???=0 ;;no locals are defined yet
+ ?argc=0 ;;no arguments are defined
+ ?ba=0 ;;not in a procedure
+ ?po=0 ;;initial parameter offset
+ ?pu=0 ;;initial public setting
+ ?ia=0 ;;no special prolog/epilog
+ ?adj=2*sizeI ;;parameter adjustment (near ret+bp)
+ ?rp=0 ;;no register parameters
+ ?uf=0 ;;don't use makeframe
+ ?wfp=?WIN ;;default far procedure (win or not)
+ ?ff=0 ;;don't force frame setup
+ ?pas=0 ;;process register save list
+ ?pcc=?PLM ;;calling convention (C or PL/M)
+ ?no_bp2=?no_bp1 ;;Default base register generation
+
+ ifnb <a> ;;register save list
+ ?ri ?pas,<a>
+ endif
+
+ ?pc=sizec ;;default size
+ ?nd=?nodata1 ;;default NODATA flag
+ ?nx=0 ;;default is not ATOMIC
+
+ irp x,<cf>
+ ifdef ??_cproc_&&x
+ ??_cproc_&&x
+ else
+ ??error2 <e r r o r - unknown keyword x>
+ .err
+ endif
+
+ endm
+
+ if ?pcc ;;If PLM
+ ?PLMPrevParm=0 ;; show no previous parameter
+ .xcref
+ .xcref ?PLMParm0
+ .cref
+ ?PLMParm0 &macro ;;Null macro to terminate
+ purge ?PLMParm0
+ &endm
+ endif
+
+ .xcref
+ .xcref ?CC&n
+ .cref
+ ?CC&n=?pcc ;;Save procedure type
+
+ if (?nx eq 1) and (?nd eq 0) ;;ATOMIC requires NODATA
+ ?nx = 0 ;;clear the ATOMIC keyword
+ ??error2 <ATOMIC specified without NODATA - ATOMIC ignored>
+ endif
+
+ if ?pc ;;if a far procedure
+ if ?wfp ;;if windows
+ ife ?nx ;;if not ATOMIC
+ ife ?COW ;; COW dos not save DS
+ ?ia=2 ;; adjust locals for saved ds
+ ?pas = ?pas and (not ?ds) ;;no need for extra save
+ endif
+ endif
+ endif
+ ?adj=?adj+sizeI ;;far, make parameter adjustment
+ else
+ ?wfp=0 ;;not a far windows procedure
+ endif
+
+ ?pas = ?pas and (not (?sp+?cs+?ss)) ;;make no sense to save these
+
+ if ?uf ;;don't save these if user frame
+ ?pas = ?pas and (not (?bp+?si+?di))
+ endif
+
+ ife ?pcc
+ ?pg <_&n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
+ else
+ ?pg <n>,%?pu,%?pc,%?pas,%?wfp,<n>,%?pcc
+ endif
+endm
+
+
+
+
+;; ?pg - generate begin and nested macros for current procedure
+;;
+;; format:
+;; ?pg n,p,c,a,w,nnu,cc
+;; where:
+;; n is the name of the procedure
+;; p is the public flag
+;; c is the class definition for the procedure
+;; a is an enumerated list of registers to save
+;; at entry and restore at exit
+;; w true if a far windows procedure
+;; nnu procedure name without any underscore
+;; cc calling convention (C or PL/M)
+;;
+;;
+;; local stack allocation will be forced to an even byte count to
+;; maintain stack word alignment.
+
+
+?pg macro n,p,c,a,w,nnu,cc
+ .xcref
+ if ?uf ;;if user frame
+ if ?nd
+ ??error2 <NODATA encountered in &n - user frame ignored>
+ ?uf=0
+ endif
+ endif
+
+ .xcref cBegin
+ cBegin &macro g ;;generate cBegin macro
+ .xcref
+ if cc ;;Finish definition of parameters
+ uconcat <?PLMParm>,%?PLMPrevParm,%?po
+ endif
+
+ if ?uf ;;if user frame
+ if ?rp ;;If register parameters
+ ??error2 <parmR encountered in &n - user frame ignored>
+ ?uf=0
+ endif
+ endif
+ ?pg1 <n>,c,a,%?po,w,%?uf,%?nd,%?rp,cc,<nnu>,%??? ;;generate cEnd macro
+ ?cpd=0 ;;terminate current proc def
+ ?argc=0 ;;no arguments are defined yet
+ ?ba=1 ;;have reached a begin
+ ???=(???+1) and 0fffeh ;;word align local storage
+
+ if p ;;If to be public
+ public n
+ endif
+
+ ife c ;;declare procedure type
+ n proc near
+ else
+ n proc far
+ endif
+
+ ife cc ;;if 'C' calling convention
+ nnu equ n ;; generate label without underscore
+ endif
+
+ ?cbe = 0 ;;Assume no command on cBegin line
+ ifnb <g>
+ ?pcbe <g>,<nnu>,<cBegin>
+ endif
+ if ?cbe eq 1 ;;if nogen, then cannot have locals
+ if ???+a+?rp ;; saved regs, or parmRs
+ if2
+ ??_out <cBegin - possibly invalid use of nogen>
+ endif
+ endif
+ else ;;else must generate a frame
+ if ?uf ;;if user frame code specified
+ ?mf c,%???,%?po ;; call user's makeframe
+ mpush a ;; save specified registers
+ else
+ ife ?cbe ;;If full frame to be set up
+ if w ;;if a far windows procedure
+ ife ?nd ;;if not NODATA,
+ mov IAX,ds ;; then set AX = current ds, and ;@
+ nop ;; leave room for MOV AX,1234h ;@
+ endif
+ ife ?nx ;;if not ATOMIC, far frame must be set
+ ife ?DOS5 ;;if not DOS5, then set far frame flag
+ inc IBP ;; by incrementing the old bp ;@
+ endif
+ push IBP ;@
+ mov IBP,ISP ;@
+ ife ?COW ;; save DS not needed for CW
+ push ds ;@
+ endif
+ else ;;ATOMIC procedure
+ if ?ff+???+?po+?rp ;;if any locals or parameters
+ push IBP ;; then must set frame pointer ;@
+ mov IBP,ISP ;; to be able to access them ;@
+ endif
+ endif
+ ife ?nd ;;if not NODATA, then AX should
+ mov ds,IAX ;; have the ds to use ;@
+ endif
+ else ;;not windows. use standard prolog
+ if ?ff+???+?po+?rp ;;if any locals or parameters
+ push IBP ;; then must set frame pointer ;@
+ mov IBP,ISP ;; to be able to access them ;@
+ endif
+ endif
+ if ?rp ;;if parmR's, push them before
+ ?uf=0 ;; allocating locals and saving
+ rept ?rp ;; the autosave registers
+ uconcat mpush,,?rp,%?uf
+ ?uf=?uf+1
+ endm
+ endif
+ if ??? ;;if locals to allocate
+ if ?chkstk1 ;;if stack checking enabled
+ ifdef ?CHKSTKPROC ;;if user supplied stack checking
+ ?CHKSTKPROC %??? ;; invoke it with bytes requested
+ else
+ mov IAX,??? ;;invoke default stack checking ;@
+ ife cc
+ call _chkstk ;@
+ else
+ call chkstk ;@
+ endif
+ endif
+ else ;;no stack checking
+ sub ISP,??? ;; allocate any local storage ;@
+ endif
+ endif
+ else ;;partial frame, only set locals
+ if ?rp ;;If parmRs, error
+ ??error2 <cBegin - parmRs encountered with partial frame>
+ else
+ if ??? ;;Only realloc frame if locals
+ lea ISP,[IBP][-???-?ia] ;;?ia will adjust for saved BP ;@
+ endif
+ endif
+ endif
+ mpush a ;;save autosave registers
+ endif
+
+ ifdef ?PROFILE ;;if profiling enabled
+ if c ;; and a far procedure
+ call StartNMeas ;; invoke profile start procedure ;@
+ endif
+ endif
+
+ endif
+
+ .cref
+ purge cBegin ;;remove the macro
+ &endm ;;end of cBegin macro
+
+ .xcref ?utpe
+ ?utpe &macro
+ ??error2 <unterminated procedure definition: "&n">
+ &endm
+ .cref
+endm ;;end of ?pg macro
+
+
+
+
+;; ?pg1 - generate end macro for current procedure
+;;
+;; format:
+;; ?pg1 n,c,a,o,w,f,d,r,cc,nnu,lc
+;; where:
+;; n is the name of the procedure
+;; c is the class definition for the procedure
+;; a is an enumerated list of registers to save
+;; at entry and restore at exit
+;; o is the number of bytes of paramteres to remove at exit
+;; w true if a far windows procedure
+;; f is 1 if to use the user's makeframe procedure
+;; d is 1 if NODATA procedure
+;; r number of register parameters
+;; cc calling convention (C or PL/M)
+;; nnu procedure name without any underscore
+;; lc locals byte count
+
+
+?pg1 macro n,c,a,o,w,f,d,r,cc,nnu,lc
+ .xcref
+ .xcref cEnd
+
+ parm_bytes_&nnu = o ;;Define number of parameter bytes
+
+ cEnd &macro g ;;start of cEnd macro
+ .xcref
+ ?ba=0 ;;no longer in a procedure
+ ?cbe = 0 ;;Assume no command on cBegin line
+ ifnb <g>
+ ?pcbe <g>,<nnu>,<cEnd>
+ endif
+ if ?cbe eq 1 ;;if nogen, then cannot have parmRs
+ if a+r+lc ;; locals, or saved registers
+ if2
+ ??_out <cEnd - possibly invalid use of nogen>
+ endif
+ endif
+ else ;;else must remove the frame
+ ifdef ?PROFILE ;;if profiling enabled
+ if c ;; and a far procedure
+ call StopNMeas ;; invoke profile stop procedure
+ endif ;; (doesn't trash DX:AX)
+ endif
+ mpop a ;;restore autosaved registers
+ if f ;;if to use the "makeframe" procedure
+ db 0c3h ;; near return to user's makeframe @
+ else
+ if w ;;if far win proc, use special epilog
+ ife ?nx ;;if not ATOMIC, bp was pushed
+ ife ?COW ;; restore DS not needed for CW
+ if (?TF eq 0) or (???+r) ;;if cannot assume valid sp
+ lea sp,-2[bp] ;; or locals or parmR's, get valid SP @
+ endif
+ pop ds ;;restore saved ds and bp @
+ else
+ if (?TF eq 0) or (???+r) ;;if cannot assume valid sp
+ mov sp,bp
+ endif
+ endif
+ pop IBP ;; @
+ ife ?DOS5 ;;if not DOS5, bp was
+ dec IBP ;; incremented to mark far frame @
+ endif
+ else ;;ATOMIC frame was set up
+ if memS32
+ leave
+ else
+ if (?TF eq 0) or (???+r) ;;if cannot assume valid sp
+ mov ISP,IBP ;; or locals or parmR's, get valid SP @
+ endif
+ if ???+?po+r
+ pop IBP ;@
+ endif
+ endif
+ endif
+ else ;;non-windows standard epilog
+ if ?ff+???+?po+r ;;if any parameters
+ if (?TF eq 0) or (???+r) ;;if cannot assume valid SP
+ mov ISP,IBP ;; or locals or parmR's, get valid SP;@
+ endif
+ pop IBP ;@
+ endif
+ endif
+ if ?cbe ne 4 ;;Don't generate ret if ??cleanframe?? e
+ ife cc ;;if C calling convention
+ ret ;; return ;@
+ else ;;else
+ ret o ;; return and remove paramteres ;@
+ endif
+ endif
+ endif
+ endif
+ if ?cbe ne 4 ;;Don't delete macro if ??cleanframe?? e
+ n endp ;;end of process
+ .cref
+ purge cEnd ;;remove the macro
+ else
+ .cref
+ endif
+ &endm
+ .cref
+endm
+
+
+;; cleanframe
+;;
+;; cleanframe removes a cMacros generated frame, invoking cEnd
+;; with a special keyword which will keep the cEnd macro from
+;; generating a return statement and purging itself.
+
+.xcref
+.xcref cleanframe
+cleanframe macro
+ cEnd <??cleanframe??>
+endm
+.cref
+
+
+
+;; The following macros are used to speed up the processing of the
+;; command allowed on a cProc command line. They simply set or clear
+;; the correct flag as needed.
+
+.xcref
+.xcref ??_cproc_FAR,??_cproc_NEAR,??_cproc_PUBLIC,??_cproc_SMALL
+.xcref ??_cproc_DATA,??_cproc_NODATA,??_cproc_ATOMIC,??_cproc_C
+.xcref ??_cproc_PLM,??_cproc_PASCAL,??_cproc_WIN,??_cproc_NONWIN
+.xcref ??_cproc_NO_BP,??_cproc_BP
+
+.xcref ??_cproc_far,??_cproc_near,??_cproc_public,??_cproc_small
+.xcref ??_cproc_data,??_cproc_nodata,??_cproc_atomic,??_cproc_c
+.xcref ??_cproc_plm,??_cproc_pascal,??_cproc_win,??_cproc_nonwin
+.xcref ??_cproc_no_bp,??_cproc_bp
+.cref
+
+??_cproc_FAR macro
+ ?pc=1
+endm
+
+??_cproc_NEAR macro
+ ?pc=0
+endm
+
+??_cproc_PUBLIC macro
+ ?pu=1
+endm
+
+??_cproc_SMALL macro
+ ?uf=1
+endm
+
+??_cproc_DATA macro
+ ?nd=0
+endm
+
+??_cproc_NODATA macro
+ ?nd=1
+endm
+
+??_cproc_ATOMIC macro
+ ?nx=1
+endm
+
+??_cproc_C macro
+ ?pcc=0
+endm
+
+??_cproc_PLM macro
+ ?pcc=1
+endm
+
+??_cproc_PASCAL macro
+ ?pcc=1
+endm
+
+??_cproc_WIN macro
+ ?wfp=1
+endm
+
+??_cproc_NONWIN macro
+ ?wfp=0
+endm
+
+??_cproc_NO_BP macro
+ ?no_bp2=1
+endm
+
+??_cproc_BP macro
+ ?no_bp2=0
+endm
+
+??_cproc_far macro
+ ?pc=1
+endm
+
+??_cproc_near macro
+ ?pc=0
+endm
+
+??_cproc_public macro
+ ?pu=1
+endm
+
+??_cproc_small macro
+ ?uf=1
+endm
+
+??_cproc_data macro
+ ?nd=0
+endm
+
+??_cproc_nodata macro
+ ?nd=1
+endm
+
+??_cproc_atomic macro
+ ?nx=1
+endm
+
+??_cproc_c macro
+ ?pcc=0
+endm
+
+??_cproc_plm macro
+ ?pcc=1
+endm
+
+??_cproc_pascal macro
+ ?pcc=1
+endm
+
+??_cproc_win macro
+ ?wfp=1
+endm
+
+??_cproc_nonwin macro
+ ?wfp=0
+endm
+
+??_cproc_no_bp macro
+ ?no_bp2=1
+endm
+
+??_cproc_bp macro
+ ?no_bp2=0
+endm
+
+
+; ?pcbe is the macro which processes the text on cBegin/cEnd
+; The text is allowed to be:
+;
+; NOGEN nogen
+; PARTIAL partial
+; the procedure name as given on the cProc line
+;
+; usage:
+; ?pcbe <g>,<nnu>,<mt>
+; where:
+; g is the text on the cBegin/cEnd line
+; nnu is the procedure name without any underscores
+; mt macro type (cBegin/cEnd)
+;
+; The variable ?cbe is set to the following value
+;
+; 0 = invalid (defualt action>
+; 1 = nogen
+; 2 = partial frame
+; 4 = clean frame
+
+
+?pcbe macro g,nnu,mt
+ ifidn <g>,<NOGEN>
+ ?cbe = 1
+ else
+ ifidn <g>,<nogen>
+ ?cbe = 1
+ else
+ ifidn <mt>,<cBegin>
+ ifidn <g>,<PARTIAL>
+ ?cbe = 2
+ else
+ ifidn <g>,<partial>
+ ?cbe = 2
+ else
+ ifdif <g>,<nnu>
+ ??error2 <mt - unknown keyword g>
+ endif
+ endif
+ endif
+ else
+ ifidn <g>,<??cleanframe??>
+ ?cbe = 4
+ else
+ ifdif <g>,<nnu>
+ ??error2 <mt - unknown keyword g>
+ endif
+ endif
+ endif
+ endif
+ endif
+endm
+
+
+
+; assumes is a macro that will set up the assumes for a segment
+; or group created with the createSeg macro. If the assumed
+; value passed in isn't known, then a normal assume is made.
+;
+; usage:
+; assumes s,g
+;
+; where:
+; s is the register to make the assumption about
+; g is the value to assume is in it
+;
+; as a hack, substitute FLAT for g if memF32 is set
+
+
+assumes macro s,ln
+ if memF32
+ assume s:FLAT
+ endif
+ ife memF32
+ ifndef ln&_assumes
+ assume s:ln
+ else
+ ln&_assumes s
+ endif
+ endif
+endm
+
+
+
+; createSeg is a macro that sets up a segment definition and
+; a logical name for that segment. The logical name can be
+; used to enter the segment, but it cannot be used for anything
+; else.
+;
+; usage:
+; createSeg n,ln,a,co,cl,grp
+; where:
+; n is the physical name of the segment
+; ln is the name it is to be invoked by
+; a is the alignment, and is optional
+; co is the combine type, and is optional
+; cl is the class, and is optional
+; grp is the name of the group that contains this segment
+
+
+createSeg macro n,ln,a,co,cl,grp
+ ifnb <cl>
+ n segment a co '&cl'
+ else
+ n segment a co
+ endif
+ n ends
+ ifnb <grp>
+ addseg grp,n
+ else
+ ln&OFFSET equ offset n:
+ ln&BASE equ n
+ ?cs3 <ln>,<n>
+ endif
+ ?cs1 <ln>,<n>
+endm
+
+
+addseg macro grp,seg
+ .xcref
+ .xcref grp&_def
+ .cref
+ ifndef grp&_def
+ grp&_def=0
+ endif
+ if grp&_def ne ASMpass
+ .xcref
+ .xcref grp&_add
+ .cref
+ grp&_add &macro s
+ grp&_in <seg>,s
+ &endm
+ .xcref
+ .xcref grp&_in
+ .cref
+ grp&_in &macro sl,s
+ ifb <s>
+ grp group sl
+ else
+ grp&_add &macro ns
+ grp&_in <sl,s>,ns
+ &endm
+ endif
+ &endm
+ grp&_def=ASMpass
+ else
+ grp&_add seg
+ endif
+endm
+
+
+defgrp macro grp,ln
+ addseg grp
+ ifnb <ln>
+ irp x,<ln>
+ ?cs3 <&x>,<grp>
+ x&&OFFSET equ offset grp:
+ x&&BASE equ grp
+ endm
+ endif
+endm
+
+
+?cs1 macro ln,n
+ .xcref
+ .xcref ln&_sbegin
+ .cref
+ ln&_sbegin &macro
+ .xcref
+ .xcref ?mf
+ .cref
+ ?mf &&macro c,l,p ;;when sBegin is invoked, generate
+ if c ;; the makeframe macro
+ extrn n&_FARFRAME:near ;; make frame for far procedures ;@
+ call n&_FARFRAME ;@
+ else
+ extrn n&_NEARFRAME:near ;; make frame for near procedures ;@
+ call n&_NEARFRAME ;@
+ endif
+ db l shr 1 ;;define number of locals ;@
+ db p shr 1 ;;define number of parameters ;@
+ &&endm
+ ?cs2 <ln>,<n>
+ n segment
+ &endm
+endm
+
+
+?cs2 macro ln,n
+ .xcref
+ .xcref sEnd
+ .cref
+ sEnd &macro
+ n ends
+ purge ?mf ;;delete the makeframe macro
+ purge sEnd
+ &endm
+endm
+
+
+?cs3 macro ln,n
+ .xcref
+ .xcref ln&_assumes
+ .cref
+ ln&_assumes &macro s
+ assume s:&n
+ &endm
+endm
+
+
+
+; sBegin is the macro that opens up the definition of a segment.
+; The segment must have already been defined with the createSeg
+; macro.
+;
+; usage:
+; sBegin ln
+;
+; where:
+; ln is the logical name given to the segment when
+; it was declared.
+
+.xcref
+.xcref sBegin
+.cref
+sBegin macro ln
+ ln&_sbegin
+endm
+
+BeginDATA macro
+ ife memF32
+ sBegin DATA
+ else
+ .data
+ endif
+endm
+
+BeginCODE macro
+ ife memF32
+ sBegin CODE
+ else
+ .code
+ endif
+endm
+
+EndDATA macro
+ ife memF32
+ sEnd DATA
+ endif
+endm
+
+EndCODE macro
+ ife memF32
+ sEnd CODE
+ endif
+endm
+
+ife ?DF
+
+ ; Define all segments that will be used. This will allow the
+ ; assume and groups to be set up at one given place, and also
+ ; allow quick changes to be made
+ ;
+ ; createSeg name,logname,align,combine,class,group
+
+ife ?DFCODE
+ createSeg _TEXT,CODE,%wordI,public,CODE
+endif
+ ife ?nodata1
+ createSeg _DATA,DATA,%wordI,public,DATA,DGROUP
+ defgrp DGROUP,DATA
+ else
+ ife ?DFDATA
+ createSeg _DATA,DATA,%wordI,public,DATA,DGROUP
+ defgrp DGROUP,DATA
+ endif
+ endif
+
+ if ?chkstk1
+ ifndef ?CHKSTKPROC
+ externp <chkstk>
+ endif
+ endif
+endif
+
+
+; errnz exp - generate error message if expression isn't zero
+;
+; The errnz will generate an error message if the expression "exp"
+; does not evaluate to zero. This macro is very useful for testing
+; relationships between items, labels, and data that was coded into
+; an application.
+;
+; errnz <offset $ - offset label> ;error if not at "label"
+; errnz <eofflag and 00000001b> ;eofflag must be bit 0
+;
+; For expressions involving more than one token, the angle brackets
+; must be used.
+;
+; The macro is only evaluated on pass 2, so forward references may be
+; used in the expression.
+
+errnz macro x ;;display error if expression is <>0
+ if2
+ if x ;;if expression is non-zero,
+ errnz1 <x>,%(x)
+ endif
+ endif
+endm
+
+errnz1 macro x1,x2
+ = *errnz* x1 = x2
+ .err
+endm
+
+
+
+; errn$ label,exp - generate error message if label (exp) <> $
+;
+; The errnz will generate an error message if the label and "exp"
+; does not evaluate to the current value of the location counter.
+; This macro is very useful for testing relationships between
+; labels and the location counter that was coded into an application.
+;
+; examples: errn$ label ;error if not at "label"
+; errn$ label,+3 ;error if not three bytes from "label"
+; errn$ label,-3 ;error if not three bytes past "label"
+;
+; If no "exp" is given, it is the same as specifying 0
+;
+; The macro is only evaluated on pass 2, so forward references may be
+; used in the expression.
+
+errn$ macro l,x ;;error if <$-label1 (exp2)> <>0
+ errnz <offset $ - offset l x>
+endm
+
+
+
+;; If profile has been specified, declare the profile routines
+;; to be external and far. It would be best if this could be done
+;; when the call is actually made, but then the fix-up would be
+;; generated as segment-relative.
+
+
+ifdef ?PROFILE
+ externFP <StartNMeas,StopNMeas>
+endif
+
+if memF32
+ .model small
+endif
+
diff --git a/private/crt32/h/cmsgs.h b/private/crt32/h/cmsgs.h
new file mode 100644
index 000000000..7aa737e3b
--- /dev/null
+++ b/private/crt32/h/cmsgs.h
@@ -0,0 +1,71 @@
+/***
+*cmsgs.h - runtime errors
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* The file defines, in one place, all error message strings used within
+* the C run-time library.
+*
+*Revision History:
+* 06-04-90 GJF Module created.
+* 08-08-90 GJF Added _RT_CONIO_TXT
+* 10-11-90 GJF Added _RT_ABORT_TXT, _RT_FLOAT_TXT, _RT_HEAP_TXT.
+* 09-08-91 GJF Added _RT_ONEXIT_TXT for Win32 (_WIN32_).
+* 09-18-91 GJF Fixed _RT_NONCONT_TXT and _RT_INVALDISP_TXT to
+* avoid conflict with RTE messages in 16-bit Windows
+* libs. Also, added math error messages.
+* 10-23-92 GJF Added _RT_PUREVIRT_TXT.
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+/*
+ * runtime error and termination messages
+ */
+
+#define _RT_STACK_TXT "R6000\r\n- stack overflow\r\n"
+
+#define _RT_FLOAT_TXT "R6002\r\n- floating point not loaded\r\n"
+
+#define _RT_INTDIV_TXT "R6003\r\n- integer divide by 0\r\n"
+
+#define _RT_SPACEARG_TXT "R6008\r\n- not enough space for arguments\r\n"
+
+#define _RT_SPACEENV_TXT "R6009\r\n- not enough space for environment\r\n"
+
+#define _RT_ABORT_TXT "\r\nabnormal program termination\r\n"
+
+#define _RT_THREAD_TXT "R6016\r\n- not enough space for thread data\r\n"
+
+#define _RT_LOCK_TXT "R6017\r\n- unexpected multithread lock error\r\n"
+
+#define _RT_HEAP_TXT "R6018\r\n- unexpected heap error\r\n"
+
+#define _RT_OPENCON_TXT "R6019\r\n- unable to open console device\r\n"
+
+#define _RT_NONCONT_TXT "R6022\r\n- non-continuable exception\r\n"
+
+#define _RT_INVALDISP_TXT "R6023\r\n- invalid exception disposition\r\n"
+
+/*
+ * _RT_ONEXIT_TXT is specific to Win32 and Dosx32 platforms
+ */
+#define _RT_ONEXIT_TXT "R6024\r\n- not enough space for _onexit/atexit table"
+
+#define _RT_PUREVIRT_TXT "R6025\r\n- pure virtual function call\r\n"
+
+/*
+ * _RT_DOMAIN_TXT, _RT_SING_TXT and _RT_TLOSS_TXT are used by the floating
+ * point library.
+ */
+#define _RT_DOMAIN_TXT "DOMAIN error\r\n"
+
+#define _RT_SING_TXT "SING error\r\n"
+
+#define _RT_TLOSS_TXT "TLOSS error\r\n"
+
+
+#define _RT_CRNL_TXT "\r\n"
+
+#define _RT_BANNER_TXT "runtime error "
diff --git a/private/crt32/h/conio.h b/private/crt32/h/conio.h
new file mode 100644
index 000000000..8baadaab5
--- /dev/null
+++ b/private/crt32/h/conio.h
@@ -0,0 +1,127 @@
+/***
+*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.
+*
+*Revision History:
+* 07-27-87 SKS Added inpw(), outpw()
+* 08-05-87 SKS Change outpw() from "int" return to "unsigned"
+* 11-16-87 JCR Multi-thread support
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-17-87 JCR Added _MTHREAD_ONLY
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-19-88 GJF Modified to also work for the 386 (small model only)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 07-27-89 GJF Cleanup, now specific to the 386
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-17-89 GJF Added const to appropriate arg types of cprintf(),
+* cputs() and cscanf().
+* 02-27-90 GJF Added #ifndef _INC_CONIO and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 or _CALLTYPE2 in
+* prototypes.
+* 07-23-90 SBM Added _getch_lk() prototype/macro
+* 01-16-91 GJF ANSI support. Also, removed prototypes for port i/o
+* functions (not supported in 32-bit).
+* 08-20-91 JCR C++ and ANSI naming
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 08-26-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_CONIO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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);
+
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+int _CRTAPI1 _getch_lk(void); /* _MTHREAD_ONLY */
+int _CRTAPI1 _getche_lk(void); /* _MTHREAD_ONLY */
+int _CRTAPI1 _putch_lk(int); /* _MTHREAD_ONLY */
+int _CRTAPI1 _ungetch_lk(int); /* _MTHREAD_ONLY */
+#else /* _MTHREAD_ONLY */
+#define _getch_lk() _getch() /* _MTHREAD_ONLY */
+#define _getche_lk() _getche() /* _MTHREAD_ONLY */
+#define _putch_lk(c) _putch(c) /* _MTHREAD_ONLY */
+#define _ungetch_lk(c) _ungetch(c) /* _MTHREAD_ONLY */
+#endif /* _MTHREAD_ONLY */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#ifndef _DOSX32_
+#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
+#else
+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);
+#endif
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_CONIO
+#endif /* _INC_CONIO */
diff --git a/private/crt32/h/cruntime.h b/private/crt32/h/cruntime.h
new file mode 100644
index 000000000..de8549076
--- /dev/null
+++ b/private/crt32/h/cruntime.h
@@ -0,0 +1,277 @@
+/***
+*cruntime.h - definitions specific to the target operating system and
+* hardware
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This header file contains widely used definitions specific to the
+* host operating system and hardware. It is included by every C source
+* and most every other header file.
+* [Internal]
+*
+*Revision History:
+* 02-27-90 GJF File created
+* 03-06-90 GJF Added register macros (REG1,...,etc.)
+* 04-11-90 GJF Set _CALLTYPE1 and _CALLTYPE4 to _stdcall.
+* 10-30-90 GJF Added macros defining variable args interface.
+* 10-31-90 GJF Added definition of _JBLEN (from setjmp.h).
+* 11-13-90 GJF Revised #ifdef-s, now use symbolic constants
+* representing target OS and target processor, with
+* #error directives for unsupported targets. Note the
+* general grouping of only OS-dependent definitions
+* followed by OS and processor dependent definitions.
+* 02-25-91 SRW Move _JBLEN definition back to setjmp.h [_WIN32_]
+* 04-09-91 PNT Added _MAC_ definitions
+* 05-09-91 GJF Restored _JBLEN definitions. Also fixed the macros
+* defining the target processor so both Stevewo's stuff
+* and mine would work.
+* 05-13-91 GJF Changed _CALLTYPE1 and _CALLTYPE4 to _cdecl for
+* Cruiser (_CRUISER_).
+* 08-28-91 JCR ANSI keywords
+* 11-01-91 GDP _JBLEN back to setjmp.h, stdarg macros back to stdarg.h
+* 03-30-92 DJM POSIX support.
+* 08-07-92 GJF Revised various macros.
+* 09-08-92 GJF Restored definition of _MIPS_ (temporarily).
+* 11-09-92 GJF Revised preprocessing conditionals for MIPS.
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 02-01-93 GJF Removed support for C6-386.
+*
+****/
+
+#ifndef _INC_CRUNTIME
+
+/*
+ * Some CRT sources have code conditioned on _MIPS_. Continue to define
+ * _MIPS_ when MIPS is defined until these sources are fixed.
+ */
+#if defined(MIPS) && !defined(_MIPS_)
+#define _MIPS_
+#endif
+
+#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
+#define UNALIGNED __unaligned
+#else
+#define UNALIGNED
+#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 /* User-visible CRT function */
+#define _CRTAPI2 __cdecl /* User-visible CRT function */
+#define _CRTAPI3 __cdecl /* Internal CRT function */
+#define _CRTVAR1 /* C global variable */
+
+#else
+
+/*
+ * Other compilers (e.g., MIPS)
+ */
+#define _CRTAPI1
+#define _CRTAPI2
+#define _CRTAPI3
+#define _CRTVAR1
+
+#endif
+
+/*
+ * Old function calling type and variable type qualifier macros
+ */
+#define _CALLTYPE1 _CRTAPI1
+#define _CALLTYPE2 _CRTAPI2
+#define _CALLTYPE4 _CRTAPI3
+#define _VARTYPE1 _CRTVAR1
+
+
+#ifdef _CRUISER_
+
+/*
+ * DEFINITIONS FOR CRUISER (AKA OS/2 2.0).
+ */
+
+#define _CALLTYPE3 __syscall /* OS API functions */
+
+
+/*
+ * Macros for register variable declarations
+ */
+
+#define REG1 register
+#define REG2 register
+#define REG3 register
+#define REG4
+#define REG5
+#define REG6
+#define REG7
+#define REG8
+#define REG9
+
+/*
+ * Macros for varargs support
+ */
+
+#define _VA_LIST_T char *
+
+#else /* ndef _CRUISER_ */
+
+#ifdef _WIN32_
+
+/*
+ * DEFINITIONS FOR WIN32
+ */
+
+#ifdef _ALPHA_
+#define _VA_LIST_T \
+ struct { \
+ char *a0; /* pointer to first homed integer argument */ \
+ int offset; /* byte offset of next parameter */ \
+ }
+#else
+#define _VA_LIST_T char *
+#endif
+
+#if defined(_M_IX86)
+/*
+ * 386/486
+ */
+#define REG1 register
+#define REG2 register
+#define REG3 register
+#define REG4
+#define REG5
+#define REG6
+#define REG7
+#define REG8
+#define REG9
+
+#elif defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
+/*
+ * MIPS or ALPHA
+ */
+#define REG1 register
+#define REG2 register
+#define REG3 register
+#define REG4 register
+#define REG5 register
+#define REG6 register
+#define REG7 register
+#define REG8 register
+#define REG9 register
+
+#else
+
+#error ERROR - SUPPORT FOR WIN32 NT-X86, NT-MIPS, NT-ALPHA, AND NT-PPC ONLY
+
+#endif
+
+#else /* ndef _WIN32_ */
+
+#ifdef _POSIX_
+/*
+ * DEFINITIONS FOR POSIX
+ */
+
+
+#ifdef _ALPHA_
+
+#define _VA_LIST_T \
+ struct { \
+ char *a0; /* pointer to first homed integer argument */ \
+ int offset; /* byte offset of next parameter */ \
+ }
+#else
+
+#define _VA_LIST_T char *
+
+#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
+
+#if defined(_M_IX86)
+/*
+ * 386/486
+ */
+#define REG1 register
+#define REG2 register
+#define REG3 register
+#define REG4
+#define REG5
+#define REG6
+#define REG7
+#define REG8
+#define REG9
+
+#elif defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
+/*
+ * MIPS/Alpha/PPC
+ */
+#define REG1 register
+#define REG2 register
+#define REG3 register
+#define REG4 register
+#define REG5 register
+#define REG6 register
+#define REG7 register
+#define REG8 register
+#define REG9 register
+
+#else
+
+#error ERROR - SUPPORT FOR POSIX NT-X86, NT-MIPS, NT-ALPHA, AND NT_PPC ONLY
+
+#endif
+
+#else /* ndef _POSIX_ */
+
+#ifdef _MAC_
+
+/*
+ * DEFINITIONS FOR MAC.
+ */
+
+/*
+ * Macros for register variable declarations
+ */
+
+#define REG1
+#define REG2
+#define REG3
+#define REG4
+#define REG5
+#define REG6
+#define REG7
+#define REG8
+#define REG9
+
+/*
+ * Macros for varargs support
+ */
+
+#define _VA_LIST_T char *
+
+#else /* ndef _MAC_ */
+
+#error ERROR - ONLY CRUISER, WIN32, OR MAC TARGET SUPPORTED!
+
+#endif /* _MAC_ */
+
+#endif /* _WIN32_ */
+
+#endif /* _POSIX_ */
+
+#endif /* _CRUISER_ */
+
+#define _INC_CRUNTIME
+#endif /* _INC_CRUNTIME */
diff --git a/private/crt32/h/cruntime.inc b/private/crt32/h/cruntime.inc
new file mode 100644
index 000000000..bbd96710b
--- /dev/null
+++ b/private/crt32/h/cruntime.inc
@@ -0,0 +1,826 @@
+;***
+;cruntime.inc - multi-model assembly macros for interfacing to HLLs
+;
+; Copyright (c) 1988-1992, Microsoft Corporation. All rights reserved.
+;
+;Purpose:
+; This file defines the current memory model being used.
+;
+;Revision History:
+; 08-04-88 SJM Initial version to handle all four memory models
+; in 16-bit mode and small model in 32-bit mode
+; 08-08-88 JCR Added CPDIST, ?WIN, PCS, ISHIFT/LSHIFT, OS2,
+; DNPTR/DFPTR, DFLOAT/DDOUBLE/DLDOUBLE
+; 08-16-88 PHG Added FPES, LFPES, CBI, ZXAL, ZXBL, ZXCL, ZXDL
+; 08-17-88 JCR Added CAXDX, modified FPSIZE
+; 08-20-88 PHG Added diagnostic messages, removed 386 16-bit support
+; and 386 large code/data support, added mucho comments,
+; PSS now defined as es: only if SS_NEQ_GROUP defined
+; 08-24-88 JCR Added RBXSAVE and RBXONLY for use in 'proc uses'
+; 08-25-88 JCR Added savereg macro, removed rbxsave/rbxonly...
+; 08-26-88 GJF Added codeseg (text) macro
+; 09-15-88 JCR Corrected savelist/reglist macro to go with new MASM
+; 09-21-88 WAJ Added JS*, static*, global*, and label*, and lab macros
+; 09-22-88 JCR Change 'plm' to 'pascal' in label macro
+; 09-26-88 WAJ Added PUSH16 which will do a 16 bit push in a USE32 seg.
+; 09-28-88 WAJ Added CPWORD and DPWORD
+; 09-29-88 WAJ Added JMPFAR16 macro
+; 10-12-88 JCR Made PCS evaluate to 'cs:' for 16/32 stub testbed
+; 04-24-89 JCR Added 'assume seg:flat' for 386 to avoid masm/link bug
+; 05-25-89 GJF Added APIEXT, a macro that expands to the proper extrn
+; declaration for an API function
+; 06-13-89 JCR Added 'flat:' to DCPTR and DDPTR
+; 09-15-89 JCR Added DCPTR? and DDPTR?, always use "FLAT" not "flat"
+; 10-27-92 SKS Miscellaneous minor changes for MASM 6.10 compatibility
+;
+;*******************************************************************************
+
+;==============================================================================
+;
+;Use the following defines to control processor/segment model
+;
+; -DI86 8086/8088 processor
+; -DI286 80286 processor
+; -DI386 80386 processor with 32-bit code/data segment
+;
+; -Dmem_S Small memory model (near code, near data)
+; -Dmem_M Medium memory model (far code, near data)
+; -Dmem_C Compact memory model (near code, fat data)
+; -Dmem_L Large memory model (far code, far data)
+;
+; -DSS_NEQ_DGROUP SS and DS point to different segments
+;
+; default is -DI86 -Dmem_S
+;
+;==============================================================================
+;
+;The following variables are defined by this file:
+; cpu 86, 286, or 386
+; sizeC code distance; 1 = far code, 0 = near code
+; sizeD data distance; 1 = far data, 0 = near data
+; mmodel english name of the memory model, i.e. "Medium"
+; ISIZE, LSIZE, NSIZE size of ints, longs, shorts
+; FLTSIZE, DBLSIZE, LDBLSIZE size of float, double, long double
+; NPSIZE, FPSIZE size of near/far pointers
+; CPSIZE, DPSIZE size of code/data pointers
+; ISHIFT, LSHIFT bits to shift to convert byte to int/long
+;
+;The following macros allow easy writing of combined 16/32 bit code:
+;
+; 16/32 bit registers:
+; rax, rbx, rcx, rdx, expand to native registers (rax = eax or ax)
+; rsi, rdi, rsp, rbp
+; 16/32 bit register instructions:
+; JRCXZ jump when rcx is zero
+; CBI convert byte to int (al to rax)
+; CAXDX convert rax to rax:rdx
+; ZXAL, ZXBL, ZXCL, ZXDL zero extend al,bl,cl,dl to rax,rbx,rcx,rdx
+; Pointer instructions:
+; LPDS, LPES load data pointer with ES or DS
+; PDS, PES segment overrides when pointer loaded as above
+; PCS, PSS segment override to get at code/stack segment
+; LFPDS, LFPES load far pointer with ES or DS
+; FPDS, FPES segment overrides when pointer loaded as above
+; CPTR data type of code pointer
+; CPDIST distance of code (near/far)
+; DNPTR, DFPTR define near/far pointer
+; DCPTR, DDPTR define code/data pointer
+; DCPTR?, DDPTR? define uninitialized code/data pointer
+; CPWORD, DPWORD data type of code or data pointer
+; Numeric type instructions:
+; IWORD, LWORD, SWORD data type of int, long, short
+; DINT, DLONG, DSHORT define int, long, short
+; DFLOAT, DDOUBLE, DLDOUBLE define float, double, long double
+; Offsets:
+; codeoffset, dataoffset offsets from code and data segments
+; API calls:
+; APIDIST distance of API calls (near/far)
+; APIEXT ApiName extrn declaration for an API function
+;
+;The following utility macros are provided:
+; codeseg define/declare code segment
+; error <msg> stop assembly with message
+; display <msg> display a message, unless QUIET defined
+; savelist [<reg> ...] init list of regs to be save by 'proc uses'
+; _if cond <instruction> assemble instruction only if cond is TRUE
+; _ife cond <instruction> assemble instruction only if cond is FALSE
+; _ifd symbol <instruction> assemble instruction only if symbol defined
+; _ifnd symbol <instruction> assemble instruction only if symbol not defined
+;
+; lab LabelName assembles to "LabelName:" If DEBUG is defined
+; LabelName is made public
+;
+; JS* (ex. JSE,JSZ,JSB ...) assemble to "je short","jz short","jb short"
+;
+; Cmacro look alikes
+; static* Name, InitialValue, Repeat defines a static variable of type *
+; global* Name, InitialValue, Repeat defines a global variable of type *
+; label* Name, {PUBLIC,PASCAL,C} defines a label of type *
+;
+; PUSH16 SegmentReg pushes 16 bits in a use32 segment
+; JMPFAR16 label will do a far 16:16 jmp from a use32 segment
+;
+;==============================================================================
+
+; error <msg> - Output message and generate error
+
+error MACRO msg
+if2 ;; only on pass 2 can we generate errors
+ %out **********************************************************
+ %out *** E r r o r -- msg
+ %out **********************************************************
+ .err
+endif
+ ENDM
+
+; display msg - Output message unless QUIET defined
+
+display MACRO msg
+ifndef QUIET ;; only when quiet flag not set
+if1 ;; and on pass 1, then display message
+ %out msg
+endif
+endif
+ ENDM
+
+; One line conditionals:
+; here we create the capability of writing code lines like
+;
+; _if sizeD <push ds> as opposed to if sizeD
+; push ds
+; endif
+
+_if MACRO cond,text
+ if cond
+ text
+ endif
+ ENDM
+
+_ife MACRO cond,text
+ ife cond
+ text
+ endif
+ ENDM
+
+_ifd MACRO cond,text
+ ifdef cond
+ text
+ endif
+ ENDM
+
+_ifnd MACRO cond,text
+ ifndef cond
+ text
+ endif
+ ENDM
+
+; set windows flag to 0
+
+ ?WIN equ 0 ; disable windows-specific code
+
+; check for MTHREAD, requires 286 or greater processor
+
+ifdef MTHREAD
+ifndef I386
+ifndef I286
+; MTHREAD implies 286 processor
+display <Multi-thread specified - assuming 80286 processor>
+I286 equ <>
+endif
+endif
+endif
+
+; Process memory-model arguments
+
+ifdef mem_M
+ ; Medium model
+ sizeC equ 1
+ sizeD equ 0
+ mmodel equ <Medium>
+elseifdef mem_C
+ ; Compact model
+ sizeC equ 0
+ sizeD equ 1
+ mmodel equ <Compact>
+elseifdef mem_L
+ ; Large model
+ sizeC equ 1
+ sizeD equ 1
+ mmodel equ <Large>
+else
+ ; Small model - default
+ sizeC equ 0
+ sizeD equ 0
+ mmodel equ <Small>
+endif
+
+; Process processor arguments
+
+ifdef I286
+ display <Processor: 80286>
+ cpu equ 286
+ .286
+elseifdef I386
+ display <Processor: 80386>
+ cpu equ 386
+ OS2 equ <> ; Define "OS2" since 386 can only run on that OS
+ .386
+else
+ display <Processor: 8086/8088>
+ cpu equ 86
+ .8086
+endif
+
+; 386 32-bit checking. Currently we are only expecting small model
+; 32 bit segments, so we make a few checks to be sure nothing is
+; incorrectly being defined.
+
+ifdef I386
+ if sizeC or sizeD
+ error <Must use Small memory model for 386 version.>
+ endif
+
+ ifdef _LOAD_DGROUP
+ error <No loading DGROUP in 386 version.>
+ endif
+
+ ifdef SS_NEQ_DGROUP
+ error <SS always equals DGROUP in 386 version.>
+ endif
+endif
+
+; Set memory model
+
+% display <Memory model: mmodel>
+% .model mmodel, C
+
+;
+; *** Temporary Workaround ***
+; Currently, MASM will not recognize the 'FLAT' keyword unless it previously
+; appears in an 'assume' statement. Presumably, when the '.model FLAT' feature
+; is implemented, this will go away. [Use 'gs:' since we never use that
+; segment register.
+;
+
+ifdef I386
+ ; ensure that MASM recognizes 'FLAT'
+ assume gs:FLAT
+endif
+
+
+; Define registers:
+; Instead of using the "word" registers directly, we will use a set of
+; text equates. This will allow you to use the native word size instead of
+; hard coded to 16 bit words. We also have some instruction equates for
+; instruction with the register type hard coded in.
+
+ifdef I386
+
+ rax equ <eax>
+ rbx equ <ebx>
+ rcx equ <ecx>
+ rdx equ <edx>
+ rdi equ <edi>
+ rsi equ <esi>
+ rbp equ <ebp>
+ rsp equ <esp>
+
+ JRCXZ equ <jecxz>
+ CBI equ <movsx eax, al> ; convert byte to int (al to rax)
+ CAXDX equ <cdq> ; convert rax to rdx:rax
+ ZXAL equ <movzx eax, al> ; zero extend al
+ ZXBL equ <movzx ebx, bl> ; zero extend bl
+ ZXCL equ <movzx ecx, cl> ; zero extend cl
+ ZXDL equ <movzx edx, dl> ; zero extend dl
+
+else
+
+ rax equ <ax>
+ rbx equ <bx>
+ rcx equ <cx>
+ rdx equ <dx>
+ rdi equ <di>
+ rsi equ <si>
+ rbp equ <bp>
+ rsp equ <sp>
+
+ JRCXZ equ <jcxz>
+ CBI equ <cbw> ; convert byte to int (al to rax)
+ CAXDX equ <cwd> ; convert rax to rdx:rax
+ ZXAL equ <xor ah, ah> ; zero extend al
+ ZXBL equ <xor bh, bh> ; zero extend bl
+ ZXCL equ <xor ch, ch> ; zero extend cl
+ ZXDL equ <xor dh, dh> ; zero extend dl
+
+endif
+
+; The following equates deal with the differences in near versus
+; far data pointers, and segment overrides.
+;
+; Use LPES and PES when loading a default size pointer -- it loads
+; a 16-bit pointer register in 286 Small/Medium model,
+; a 16-bit pointer register and 16-bit segment register in 8086/286
+; Compact/Large model, and a 32-bit pointer register in 386 mode.
+;
+; Use LFPES and FPES when loading an always far pointer -- it loads a
+; 16-bit pointer register and 16-bit segment register in 8086/286,
+; all models; a 32-bit pointer register in 386 mode.
+
+if sizeD
+ LPES equ <les>
+ LPDS equ <lds>
+ PDS equ <ds:>
+ PES equ <es:>
+else
+ LPES equ <mov>
+ LPDS equ <mov>
+ PDS equ <>
+ PES equ <>
+endif
+
+ifdef I386
+ LFPES equ <mov>
+ LFPDS equ <mov>
+ FPES equ <>
+ FPDS equ <>
+else
+ LFPES equ <les>
+ LFPDS equ <lds>
+ FPES equ <es:>
+ FPDS equ <ds:>
+endif
+
+if sizeC or @WordSize eq 2
+ PCS equ <cs:> ; large code model or non-386
+else
+ IF 1 ;*** TEMP 16/32 TESTBED ***
+ PCS equ <cs:>
+ ELSE
+ PCS equ <> ; 386 small code model
+ ENDIF ;*** END TEMP CODE
+endif
+
+ifdef SS_NEQ_DGROUP
+ PSS equ <ss:> ; SS != DS
+else
+ PSS equ <> ; SS == DS
+endif
+
+; Define offset macros:
+; The 32-bit segments will not have 'groups'
+
+ifdef I386
+ codeoffset equ <offset FLAT:>
+ dataoffset equ <offset FLAT:>
+else
+ codeoffset equ <offset @code:>
+ dataoffset equ <offset DGROUP:>
+endif
+
+; The next set of equates deals with the size of SHORTS, INTS, LONGS, and
+; pointers in the 16 and 32 bit versions.
+
+ifdef I386 ;--- 32 bit segment ---
+
+ ; parameters and locals
+ IWORD equ <dword>
+ LWORD equ <dword>
+if @Version LT 600
+ SWORD equ <word>
+endif
+
+ ; static storage
+ DINT equ <dd>
+ DLONG equ <dd>
+ DSHORT equ <dw>
+
+ ; sizes for fixing SP, stepping through tables, etc.
+ ISIZE equ 4
+ LSIZE equ 4
+ SSIZE equ 2
+ NPSIZE equ 4
+ FPSIZE equ 4
+
+ ; bit shift count to convert byte cnt/ptr to int/long cnt/ptr
+ ISHIFT equ 2 ; byte-to-int shift count
+ LSHIFT equ 2 ; byte-to-long shift count
+
+ ; sizes dependent upon memory model. dq -vs- df is not yet clear
+ DNPTR equ <dd> ; near pointer
+ DFPTR equ <dd> ; far pointer
+
+ DCPTR equ <dd offset FLAT:>; 32 bit offset only
+ DCPTR? equ <dd> ; No seg override for uninitialized values
+ CPSIZE equ 4
+ CPDIST equ <near> ; code pointers are near
+ CPTR equ <near ptr>
+
+ DDPTR equ <dd offset FLAT:>
+ DDPTR? equ <dd>
+ DPSIZE equ 4
+
+ CPWORD equ <dword> ; code pointers are dwords
+ DPWORD equ <dword> ; data pointers are dwords
+
+ APIDIST equ <near> ; all API calls are NEAR in the 32 bit model
+
+; macro to declare API functions
+EXTAPI macro apiname
+ extrn pascal apiname:near
+endm
+
+else ;--- 16-bit segment ---
+
+ ; parameters and locals
+ IWORD equ <word>
+ LWORD equ <dword>
+if @Version LT 600
+ SWORD equ <word>
+endif
+
+ ; static storage
+ DINT equ <dw>
+ DLONG equ <dd>
+ DSHORT equ <dw>
+
+ ; sizes for fixing SP, stepping through tables, etc
+ ISIZE equ 2
+ LSIZE equ 4
+ SSIZE equ 2
+ NPSIZE equ 2
+ FPSIZE equ 4
+
+ ; bit shift count to convert byte cnt/ptr to int/long cnt/ptr
+ ISHIFT equ 1 ; byte-to-int shift count
+ LSHIFT equ 2 ; byte-to-long shift count
+
+ ; sizes dependent upon memory model
+ DNPTR equ <dw> ; near pointer
+ DFPTR equ <dd> ; far pointer
+
+ if sizeC
+ DCPTR equ <dd> ; 16 bit segment and 16 bit offset
+ DCPTR? equ <dd>
+ CPSIZE equ 4
+ CPDIST equ <far> ; code pointers are far
+ CPTR equ <far ptr>
+ CPWORD equ <dword> ; code pointers are dwords
+ else
+ DCPTR equ <dw> ; 16 bit offset only
+ DCPTR? equ <dw>
+ CPSIZE equ 2
+ CPDIST equ <near> ; code pointers are near
+ CPTR equ <near ptr>
+ CPWORD equ <word> ; code pointers are words
+ endif
+
+ if sizeD
+ DDPTR equ <dd>
+ DDPTR? equ <dd>
+ DPSIZE equ 4
+ DPWORD equ <dword> ; data pointers are dwords
+ else
+ DDPTR equ <dw>
+ DDPTR? equ <dw>
+ DPSIZE equ 2
+ DPWORD equ <word> ; data pointers are words
+ endif
+
+ APIDIST equ <far> ; API calls are FAR in 16 bit model
+
+; macro to declare API functions
+EXTAPI macro apiname
+ extrn pascal apiname:far
+endm
+
+endif ; --- 16/32 segment ---
+
+; Float/double definitions
+; (currently the same for 16- and 32-bit segments)
+
+FLTSIZE equ 4 ; float
+DBLSIZE equ 8 ; double
+LDBLSIZE equ 10 ; long double
+
+DFLOAT equ <dd>
+DDOUBLE equ <dq>
+DLDOUBLE equ <dt>
+
+;
+; savelist - Generate a list of regs to be saved by the proc 'uses' option.
+;
+; Input:
+; reg1, reg2, reg3, reg4 = registers to be saved across function
+; Output:
+; reglist = text string of registers that can be passed to the 'uses'
+; option on the 'proc' command.
+;
+
+savelist MACRO reg1, reg2, reg3, reg4
+ local ws, listsize
+ ws catstr < > ; whitespace char
+
+ IFNDEF I386
+ rbx equ <> ; 8086/286 don't save rbx
+ ENDIF
+
+ IFNB <reg4>
+ reglist catstr reg1, ws, reg2, ws, reg3, ws, reg4
+ ELSEIFNB <reg3>
+ reglist catstr reg1, ws, reg2, ws, reg3, ws
+ ELSEIFNB <reg2>
+ reglist catstr reg1, ws, reg2, ws, ws
+ ELSEIFNB <reg1>
+ reglist catstr reg1, ws, ws, ws
+ ELSE
+ reglist catstr <>
+ ENDIF
+
+ listsize sizestr reglist ; size of register list
+
+ IF listsize LE 3 ; if list is only the 3 ws chars...
+ reglist catstr <>
+ ENDIF
+
+ IFNDEF I386
+ rbx equ <bx> ; restore rbx
+ ENDIF
+
+ ENDM ; savelist
+
+;
+; codeseg - Define/declare the standard code segment. Maps to the proper
+; form of the .code directive.
+;
+; Input:
+;
+; Output:
+; .code _TEXT ; for large code models
+; .code ; for small code models
+; assume cs:FLAT ; for 386
+; assume ds:FLAT ; for 386
+; assume es:FLAT ; for 386
+; assume ss:FLAT ; for 386
+;
+
+codeseg MACRO
+
+if sizeC
+ .code _TEXT
+else
+ .code
+endif
+
+ifdef I386
+if @Version LT 600
+ assume cs:FLAT
+endif ;@Version LT 600
+ assume ds:FLAT
+ assume es:FLAT
+ assume ss:FLAT
+endif
+
+ ENDM
+
+;***************************************************************
+;*
+;* Debug lab macro
+;*
+;***************************************************************
+
+lab macro name
+ifdef DEBUG
+ public pascal name ;; define label public for Symdeb
+endif
+name:
+ endm
+
+
+;***************************************************************
+;*
+;* Conditional jump short macros
+;*
+;***************************************************************
+
+
+ irp x,<Z,NZ,E,NE,S,NS,C,NC,P,NP,PE,PO,A,AE,B,BE,NB,G,GE,L,LE>
+JS&x equ <j&x short>
+ endm
+
+
+;***************************************************************
+;*
+;* Global data definition macros
+;*
+;* Usage:
+;* globalI Name, InitialValue, Repeat
+;*
+;***************************************************************
+
+
+MakeGlobal macro suffix, DataType ;; makes all of the global* macros
+
+global&suffix macro name, data, rep
+public name
+ifb <rep>
+ _repeat = 1
+else
+ _repeat = (rep)
+endif
+
+name &DataType _repeat dup( data )
+ endm
+
+ endm
+
+
+ MakeGlobal T, dt ; globalT
+ MakeGlobal Q, dq ; globalQ
+ MakeGlobal D, dd ; globalD
+ MakeGlobal W, dw ; globalW
+ MakeGlobal B, db ; globalB
+
+% MakeGlobal I, <DINT> ; globalI
+
+% MakeGlobal DP, <DDPTR> ; globalDP
+% MakeGlobal CP, <DCPTR> ; globalCP
+% MakeGlobal FP, <DFPTR> ; globalFP
+% MakeGlobal NP, <DNPTR> ; globalNP
+
+
+
+;***************************************************************
+;*
+;* Static data definition macros
+;*
+;* Usage:
+;* staticI Name, InitialValue, Repeat
+;*
+;***************************************************************
+
+
+MakeStatic macro suffix, DataType ;; makes all of the static* macros
+
+static&suffix macro name, data, rep
+
+ifdef DEBUG
+ public pascal name ;; make statics public if DEBUG
+endif
+
+ifb <rep>
+ _repeat = 1
+else
+ _repeat = (rep)
+endif
+
+name &DataType _repeat dup( data )
+ endm
+
+ endm
+
+
+ MakeStatic T, dt ; staticT
+ MakeStatic Q, dq ; staticQ
+ MakeStatic D, dd ; staticD
+ MakeStatic W, dw ; staticW
+ MakeStatic B, db ; staticB
+
+% MakeStatic I, <DINT> ; staticI
+
+% MakeStatic DP, <DDPTR> ; staticDP
+% MakeStatic CP, <DCPTR> ; staticCP
+% MakeStatic FP, <DFPTR> ; staticFP
+% MakeStatic NP, <DNPTR> ; staticNP
+
+;***************************************************************
+;*
+;* Label definition macros
+;*
+;***************************************************************
+;*
+;* Label definition macros
+;*
+;* Usage:
+;* labelI Name, {PUBLIC, PASCAL, C}
+;*
+;***************************************************************
+
+__MakePublic macro name, option ;; decides if a label should be
+ifidni <option>, <PUBLIC> ;; made public
+ public name
+elseifidni <option>, <PASCAL>
+ public pascal name
+elseifidni <option>, <C>
+ public C name
+elseifb <option>
+ ifdef DEBUG
+ public pascal name ;; make public if DEBUG
+ endif
+endif
+ endm
+
+
+if @Version GE 600
+
+MakeLabel macro suffix, LabelType ;; makes all of the label* macros
+
+%@CatStr(<label>,<suffix>) macro name, option
+ __MakePublic <name>,<option>
+name label &LabelType
+ endm
+
+ endm
+
+else ;!(@Version GE 600)
+
+MakeLabel macro suffix, LabelType ;; makes all of the label* macros
+
+label&suffix macro name, option
+ __MakePublic <name>,<option>
+name label &LabelType
+ endm
+
+ endm
+
+endif ;!(@Version GE 600)
+
+
+ MakeLabel T, tbyte ; make labelT
+ MakeLabel Q, qword ; make labelQ
+ MakeLabel D, dword ; make labelD
+ MakeLabel W, word ; make labelW
+ MakeLabel B, byte ; make labelB
+
+ MakeLabel P, proc ; make labelP
+ MakeLabel FP, far ; make labelFP
+ MakeLabel NP, near ; make labelNP
+
+% MakeLabel I, IWORD ; make labelI
+
+
+labelDP macro name, option ;; labelDP
+ __MakePublic <name>,<option>
+ifdef I386
+ if sizeD
+ name label fword
+ else
+ name label dword
+ endif
+else ;not I386
+ if sizeD
+ name label dword
+ else
+ name label word
+ endif
+endif ;not I386
+ endm
+
+labelCP macro name, option ;; labelCP
+ __MakePublic <name>,<option>
+ifdef I386
+ if sizeC
+ name label fword
+ else
+ name label dword
+ endif
+else ;not I386
+ if sizeC
+ name label dword
+ else
+ name label word
+ endif
+endif ;not I386
+ endm
+
+
+;*
+;* PUSH16 SegReg - pushes 16 bits in a use32 segment
+;*
+
+PUSH16 macro SegReg
+
+ifdef I386
+ nop
+ db 66h ; operand size over-ride
+endif ; I386
+
+ push SegReg
+ endm
+
+
+;*
+;* JMPFAR16 label - jmps far from a use32 to a use16 segment
+;*
+
+JMPFAR16 macro label
+
+ifndef I386
+ error <JMPFAR16 can only be used in a use32 code segment>
+endif ;I386
+
+ nop
+ db 66h ;; operand size over-ride
+ db 0eah ;; jmp far immediate op code
+ dw offset label
+ dw seg label
+ endm
diff --git a/private/crt32/h/ctime.h b/private/crt32/h/ctime.h
new file mode 100644
index 000000000..c09abf17c
--- /dev/null
+++ b/private/crt32/h/ctime.h
@@ -0,0 +1,41 @@
+/***
+*ctime.h - constant for dates and times
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Include file used by the ctime routines containing definitions of
+* various constants used in determining dates and times.
+* [Internal]
+*
+*Revision History:
+* 03-??-84 RLB written
+* 05-??-84 DFW split out the constant from each routine into this file
+* 07-27-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 02-28-90 GJF Added #ifndef _INC_CTIME stuff.
+* 03-29-93 GJF Revised constants.
+*
+****/
+
+#ifndef _INC_CTIME
+
+#define _DAY_SEC (24L * 60L * 60L) /* secs in a day */
+
+#define _YEAR_SEC (365L * _DAY_SEC) /* secs in a year */
+
+#define _FOUR_YEAR_SEC (1461L * _DAY_SEC) /* secs in a 4 year interval */
+
+#define _DEC_SEC 315532800L /* secs in 1970-1979 */
+
+#define _BASE_YEAR 70L /* 1970 is the base year */
+
+#define _BASE_DOW 4 /* 01-01-70 was a Thursday */
+
+#define _LEAP_YEAR_ADJUST 17L /* Leap years 1900 - 1970 */
+
+#define _MAX_YEAR 138L /* 2038 is the max year */
+
+
+#define _INC_CTIME
+#endif /* _INC_CTIME */
diff --git a/private/crt32/h/ctype.h b/private/crt32/h/ctype.h
new file mode 100644
index 000000000..d4b746d52
--- /dev/null
+++ b/private/crt32/h/ctype.h
@@ -0,0 +1,321 @@
+/***
+*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]
+*
+*Revision History:
+* 07-31-87 PHG changed (unsigned char)(c) to (0xFF & (c)) to
+* suppress -W2 warning
+* 08-07-87 SKS Removed (0xFF & (c)) -- is????() functions take an (int)
+* 12-18-87 JCR Added _FAR_ to declarations
+* 01-19-87 JCR DLL routines
+* 02-10-88 JCR Cleaned up white space
+* 08-19-88 GJF Modify to also work for the 386 (small model only)
+* 12-08-88 JCR DLL now access _ctype directly (removed DLL routines)
+* 03-26-89 GJF Brought into sync with CRT\H\CTYPE.H
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 07-28-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright, removed dummy args from prototypes
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 02-28-90 GJF Added #ifndef _INC_CTYPE and #include <cruntime.h>
+* stuff. Also, removed #ifndef _CTYPE_DEFINED stuff and
+* some other (now) useless preprocessor directives.
+* 03-22-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes and
+* with _VARTYPE1 in variable declarations.
+* 01-16-91 GJF ANSI naming.
+* 03-21-91 KRS Added isleadbyte macro.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 10-11-91 ETC All under _INTL: isleadbyte/isw* macros, prototypes;
+* new is* macros; add wchar_t typedef; some intl defines.
+* 12-17-91 ETC ctype width now independent of _INTL, leave original
+* short ctype table under _NEWCTYPETABLE.
+* 01-22-92 GJF Changed definition of _ctype for users of crtdll.dll.
+* 04-06-92 KRS Changes for new ISO proposal.
+* 08-07-92 GJF Function calling type and variable type macros.
+* 10-26-92 GJF Fixed _pctype and _pwctype for crtdll.
+* 01-19-93 CFW Move to _NEWCTYPETABLE, remove switch.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 02-17-93 CFW Removed incorrect UNDONE comment and unused code.
+* 02-18-93 CFW Clean up common _WCTYPE_DEFINED section.
+* 03-25-93 CFW _toupper\_tolower now defined when _INTL.
+* 03-30-93 CFW is* functions now use MB_CUR_MAX, MB_CUR_MAX defined.
+* 05-05-93 CFW Change is_wctype to iswctype as per ISO.
+* 06-26-93 CFW Remove is_wctype macro.
+* 10-14-93 SRW Add support for _CTYPE_DISABLE_MACROS symbol
+*
+****/
+
+#ifndef _INC_CTYPE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 * _CRTVAR1 _ctype;
+
+#define _pctype (*_pctype_dll)
+extern unsigned short **_pctype_dll;
+
+#define _pwctype (*_pwctype_dll)
+extern unsigned short **_pwctype_dll;
+
+#else /* _DLL */
+
+#ifdef CRTDLL
+#define _pctype _pctype_dll
+#define _pwctype _pwctype_dll
+#endif /* CRTDLL */
+
+extern unsigned short _CRTVAR1 _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 */
+
+#ifdef _INTL
+#define _LEADBYTE 0x8000 /* multibyte leadbyte */
+#define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */
+#else
+#define _ALPHA (_UPPER|_LOWER) /* alphabetic character */
+#endif
+
+
+/* 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);
+
+#ifdef _INTL
+int _CRTAPI1 _isctype(int, int);
+#endif /* _INTL */
+
+#define _WCTYPE_DEFINED
+#endif
+
+/* the character classification macro definitions */
+
+#ifndef _CTYPE_DISABLE_MACROS
+
+#ifndef _INTL
+#define isalpha(_c) ( (_ctype+1)[_c] & (_UPPER|_LOWER) )
+#define isupper(_c) ( (_ctype+1)[_c] & _UPPER )
+#define islower(_c) ( (_ctype+1)[_c] & _LOWER )
+#define isdigit(_c) ( (_ctype+1)[_c] & _DIGIT )
+#define isxdigit(_c) ( (_ctype+1)[_c] & _HEX )
+#define isspace(_c) ( (_ctype+1)[_c] & _SPACE )
+#define ispunct(_c) ( (_ctype+1)[_c] & _PUNCT )
+#define isalnum(_c) ( (_ctype+1)[_c] & (_UPPER|_LOWER|_DIGIT) )
+#define isprint(_c) ( (_ctype+1)[_c] & (_BLANK|_PUNCT|_UPPER|_LOWER|_DIGIT) )
+#define isgraph(_c) ( (_ctype+1)[_c] & (_PUNCT|_UPPER|_LOWER|_DIGIT) )
+#define iscntrl(_c) ( (_ctype+1)[_c] & _CONTROL )
+
+#if !__STDC__
+#define toupper(_c) ( (islower(_c)) ? _toupper(_c) : (_c) )
+#define tolower(_c) ( (isupper(_c)) ? _tolower(_c) : (_c) )
+#endif /* __STDC__ */
+
+#else
+
+#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
+#ifdef CRTDLL
+#define __mb_cur_max __mb_cur_max_dll
+#endif
+#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)
+#endif /* _INTL */
+
+#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 )
+
+#ifdef _INTL
+/* note: MS-specific routine, may evaluate its arguments more than once */
+#define isleadbyte(_c) ((_c) < 256 ? _pctype[_c] & _LEADBYTE : 0)
+#else
+#define isleadbyte(_c) (0)
+#endif /* _INTL */
+
+
+/* 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 */
+#ifndef _DOSX32_
+#define isascii __isascii
+#define toascii __toascii
+#define iscsymf __iscsymf
+#define iscsym __iscsym
+#else
+#ifndef _CTYPE_DEFINED
+int _CRTAPI1 isascii(int);
+int _CRTAPI1 toascii(int);
+int _CRTAPI1 iscsymf(int);
+int _CRTAPI1 iscsym(int);
+#else
+#define isascii __isascii
+#define toascii __toascii
+#define iscsymf __iscsymf
+#define iscsym __iscsym
+#endif
+#endif
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_CTYPE
+#endif /* _INC_CTYPE */
diff --git a/private/crt32/h/cvt.h b/private/crt32/h/cvt.h
new file mode 100644
index 000000000..6b6014658
--- /dev/null
+++ b/private/crt32/h/cvt.h
@@ -0,0 +1,41 @@
+/***
+*cvt.h - definitions used by formatting routines
+*
+* Copyright (c) 1985-1990, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* cvt.h contains definitions used by the formatting routines [efg]cvt and
+* _output and _input. The value of CVTBUFSIZE is used to dimension
+* arrays used to hold the maximum size double precision number plus some
+* slop to aid in formatting.
+* [Internal]
+*
+*Revision History:
+* 12-11-87 JCR Added "_loadds" functionality
+* 02-10-88 JCR Cleaned up white space
+* 07-28-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 02-28-90 GJF Added #ifndef _INC_CVT stuff. Also, removed some
+* (now) useless preprocessor directives.
+*
+****/
+
+#ifndef _INC_CVT
+
+#define SHORT 1
+#define LONG 2
+#define USIGN 4
+#define NEAR 8
+#define FAR 16
+
+#define OCTAL 8
+#define DECIMAL 10
+#define HEX 16
+
+#define MUL10(x) ( (((x)<<2) + (x))<<1 )
+#define ISDIGIT(c) ( ((c) >= '0') && ((c) <= '9') )
+
+#define CVTBUFSIZE (309+40) /* # of digits in max. dp value + slop */
+
+#define _INC_CVT
+#endif /* _INC_CVT */
diff --git a/private/crt32/h/defsects.inc b/private/crt32/h/defsects.inc
new file mode 100644
index 000000000..a736b02a1
--- /dev/null
+++ b/private/crt32/h/defsects.inc
@@ -0,0 +1,58 @@
+;***
+;defsects.inc - defines sections.
+;
+; Copyright (c) 1989-1992, Microsoft Corporation. All rights reserved.
+;
+;Purpose:
+; This file defines sections for the C and C++ libs.
+;
+; NOTE: As needed, special "CRT" sections can be added into the existing
+; init/term tables. These will be for our use only -- users who put
+; stuff in here do so at their own risk.
+;
+;Revision History:
+; 03-19-92 SKS Loosely based on the 16-bit include file DEFSEGS.INC
+; 08-06-92 SKS Changed these section names from X[ICPT]$[ACLUXZ] to
+; .CRT$X[ICPT][ACLUXZ] to avoid creating too many sections
+; Also, sections are no longer defined in groups. That was
+; for use with OMF type objects where order of appearance
+; is important. With COFF, sorting is done by section name.
+;
+;******************************************************************************
+
+;*******
+;*
+;* beginSection - a macro for declaring and beginning a section
+;*
+;* endSection - a macro for ending a previously declared section
+;*
+;*******
+
+beginSection MACRO SectName
+.CRT$&SectName SEGMENT DWORD PUBLIC 'DATA'
+ ENDM
+
+endSection MACRO SectName
+.CRT$&SectName ENDS
+ ENDM
+
+; XIA Begin C Initializer Sections
+; XIC Microsoft Reserved
+; XIU User
+; XIZ End C Initializer Sections
+;
+; XCA Begin C++ Constructor Sections
+; XCC Compiler (MS)
+; XCL Library
+; XCU User
+; XCZ End C++ Constructor Sections
+;
+; XPA Begin C Pre-Terminator Sections
+; XPU User
+; XPX Microsoft Reserved
+; XPZ End C Pre-Terminator Sections
+;
+; XTA Begin C Pre-Terminator Sections
+; XTU User
+; XTX Microsoft Reserved
+; XTZ End C Pre-Terminator Sections
diff --git a/private/crt32/h/direct.h b/private/crt32/h/direct.h
new file mode 100644
index 000000000..90b82c7f9
--- /dev/null
+++ b/private/crt32/h/direct.h
@@ -0,0 +1,134 @@
+/***
+*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.
+*
+*Revision History:
+* 12/11/87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-22-88 GJF Modified to also work with the 386 (small model only)
+* 01-31-89 JCR Added _chdrive, _fullpath, _getdrive, _getdcwd
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 07-28-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-17-89 GJF Moved _fullpath prototype to stdlib.h. Added const
+* attrib. to arg types for chdir, mkdir, rmdir
+* 02-28-90 GJF Added #ifndef _INC_DIRECT and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 or _CALLTYPE2 in
+* prototypes.
+* 03-30-90 GJF Now all are _CALLTYPE1.
+* 01-17-91 GJF ANSI naming.
+* 08-20-91 JCR C++ and ANSI naming
+* 08-26-91 BWM Added _diskfree_t, _getdiskfree, and
+* 09-26-91 JCR Non-ANSI alias is for getcwd, not getDcwd (oops)
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 04-29-92 GJF Added _getdcwd_lk for Win32.
+* 08-07-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_DIRECT
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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);
+
+
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+char * _CRTAPI1 _getdcwd_lk(int, char *, int); /* _MTHREAD_ONLY */
+#else /* _MTHREAD_ONLY */
+#define _getdcwd_lk(drv, buf, len) _getdcwd(drv, buf, len) /* _MTHREAD_ONLY */
+#endif /* _MTHREAD_ONLY */
+
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#ifndef _DOSX32_
+#define chdir _chdir
+#define getcwd _getcwd
+#define mkdir _mkdir
+#define rmdir _rmdir
+#else
+int _CRTAPI1 chdir(const char *);
+char * _CRTAPI1 getcwd(int, char *, int);
+int _CRTAPI1 mkdir(const char *);
+int _CRTAPI1 rmdir(const char *);
+#endif
+#define diskfree_t _diskfree_t
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_DIRECT
+#endif /* _INC_DIRECT */
diff --git a/private/crt32/h/dos.h b/private/crt32/h/dos.h
new file mode 100644
index 000000000..259b60d74
--- /dev/null
+++ b/private/crt32/h/dos.h
@@ -0,0 +1,222 @@
+/***
+*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.
+*
+*Revision History:
+* 06-11-87 JCR Added find_t
+* 06-15-87 JCR Added O_NOINHERIT
+* 06-18-87 JCR Added some DOS function prototypes
+* 06-19-87 JCR Moved O_NOINHERIT to fcntl.h
+* 06-25-87 JMB Added _HARDERR_* constants
+* 06-25-87 SKS Added diskfree_t, dosdate_t, dostime_t structures
+* 06-25-87 JCR Added _A_NORMAL, etc. constants
+* 07-17-87 JCR Added _chain_intr, also the "interrupt" type to
+* _dos_setvec and _dos_getvec.
+* 07-27-87 SKS Added several _dos_*() functions, _disable()/_enable()
+* 08-17-87 PHG Fixed bad prototype for _dos_getdiskfree()
+* 10-08-87 JCR Added _CDECL to prototypes with "interrupt" declaration
+* (needed for compiling with -Gc switch).
+* 09-27-88 JCR 386 version
+* 10-03-88 GJF Use M_I386, not I386
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 07-25-89 GJF Major cleanup. Alignment of struct fields is now
+* protected by pack pragmas. Now specific to 386.
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 02-28-90 GJF Added #ifndef _INC_DOS and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-22-90 GJF Replaced _cdecl with _CALLTYPE1 in prototype and with
+* _VARTYPE1 in variable declaration.
+* 12-28-90 SRW Added _CRUISER_ conditional around pack pragmas
+* 01-23-91 GJF Removed segread() prototype.
+* 04-04-91 GJF Added version info variables (_WIN32_).
+* 08-20-91 JCR C++ and ANSI naming
+* 08-26-91 BWM Added _peek, poke, and _getvideoaddr (_DOSX32_).
+* 08-26-91 BWM Removed _harderr constants, replaced by _seterrormode.
+* 08-26-91 BWM Removed datetime prototypes, replaced by systime functions.
+* 09-05-91 JCR Added missing #endif (bug fix), removed obsolete stuff
+* 09-16-91 BWM Fixed reversed #ifdef on screen address constants.
+* 01-22-92 GJF Fixed up definitions of global variables for build of,
+* and users of, crtdll.dll.
+* 03-30-92 DJM POSIX support.
+* 06-02-92 SKS Fix typo in DLL declaration of _osmajor
+* Add declartion of _pgmptr
+* 08-07-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_DOS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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
+
+
+#ifdef _CRUISER_
+/* ensure proper alignment of struct fields */
+
+#pragma pack(4)
+#endif /* ndef _CRUISER_ */
+
+#ifdef _DOSX32_
+/* Absolute address type for _peek and _poke */
+
+#ifndef _ABSADDR_T_DEFINED
+typedef unsigned long _absaddr_t;
+#define _ABSADDR_T_DEFINED
+#endif
+#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
+
+#ifdef _DOSX32_
+/* Region constants for _getvideoaddress() */
+
+#define _ADDR_NO_PALETTE_GRAPHICS 0x18000 /* For modes 4-6 */
+#define _ADDR_PALETTE_GRAPHICS 0x00000 /* For modes 9+ */
+#define _ADDR_COLOR_TEXT 0x18000 /* For modes 0-3 */
+#define _ADDR_MONO_TEXT 0x10000 /* For mode 7 */
+#endif
+
+#ifdef _DOSX32_
+/* Macro to convert segmented address to _absaddr_t */
+
+#define _MAKE_ABS(seg,off) ((seg << 16) | (off & 0xffff))
+#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 * _CRTVAR1 _osversion_dll;
+extern unsigned int * _CRTVAR1 _osmajor_dll;
+extern unsigned int * _CRTVAR1 _osminor_dll;
+extern unsigned int * _CRTVAR1 _baseversion_dll;
+extern unsigned int * _CRTVAR1 _basemajor_dll;
+extern unsigned int * _CRTVAR1 _baseminor_dll;
+extern char ** _CRTVAR1 _pgmptr_dll;
+
+#else
+
+#ifdef CRTDLL
+#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
+#endif
+
+extern unsigned int _CRTVAR1 _osversion;
+extern unsigned int _CRTVAR1 _osmajor;
+extern unsigned int _CRTVAR1 _osminor;
+extern unsigned int _CRTVAR1 _baseversion;
+extern unsigned int _CRTVAR1 _basemajor;
+extern unsigned int _CRTVAR1 _baseminor;
+extern char * _CRTVAR1 _pgmptr;
+
+#endif
+
+#else /* ndef (_WIN32_ || _POSIX_) */
+
+extern unsigned int _CRTVAR1 _osversion;
+
+#endif /* _WIN32_ */
+
+
+/* function prototypes */
+
+unsigned _CRTAPI1 _getdiskfree(unsigned, struct _diskfree_t *);
+#ifdef _DOSX32_
+void * _CRTAPI1 _getvideoaddr(unsigned);
+#endif
+#ifdef _DOSX32_
+void _CRTAPI1 _peek(_absaddr_t, void *, unsigned short);
+void _CRTAPI1 _poke(void *, _absaddr_t, unsigned short);
+#endif
+
+#if !__STDC__
+/* Non-ANSI name for compatibility */
+#define diskfree_t _diskfree_t
+#endif /* __STDC__ */
+
+/* restore default alignment */
+
+#ifdef _CRUISER_
+#pragma pack()
+#endif /* ndef _CRUISER_ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_DOS
+#endif /* _INC_DOS */
diff --git a/private/crt32/h/doscalls.h b/private/crt32/h/doscalls.h
new file mode 100644
index 000000000..fe573da45
--- /dev/null
+++ b/private/crt32/h/doscalls.h
@@ -0,0 +1,545 @@
+/***
+*doscalls.h - functions declarations for OS/2 function calls
+*
+* Copyright (c) 1986-1991, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Function declarations to provide strong type checking on
+* arguments to OS/2 function calls used by the C run-time.
+* Only those functions which are referenced in the run-time
+* are included in this file. This saves compilation time,
+* reduces the amount of memory needed by the compiler, and
+* prevents recompilation due to changes that do not directly
+* affect the C run-time. This file should only be updated
+* when a change is made to BSEDOS.H which affects a
+* function used in a C module in the C run-time, or when a
+* "C" module is changed to use a new OS/2 function call.
+*
+* Note: functions reference only in ASM files are included also
+* so that this file can serve as a reference.
+* [Internal]
+*
+*Revision History:
+* 08-31-88 PHG created from BSEDOS.H, changed SHORT to INT
+* 10-10-88 GJF Made specific to 386 (changed "Dos" prefix to
+* "Sys", removed "far",...,etc.)
+* 11-09-88 JCR _DATETIME.year and _DATETIME.timezone are USHORT
+* 04-28-89 JCR Upgraded for OS/2 1.20 (32-bit)
+* 05-25-89 JCR New system calling convention = "_syscall"
+* 06-06-89 PHG Added several new systems calls, updated RESULTCODES
+* made SHANDLE/HFILE/HDIR a long
+* 07-05-89 PHG Added HDIR types, and VECTOR constants
+* 07-06-89 JCR Corrected memory calls and constants
+* 07-28-89 GJF Corrected copyright. Protected alignment of struct
+* fields with pack pragma
+* 08-10-89 JCR Changed DOS32FILELOCKS to DOS32SETFILELOCKS
+* 08-14-89 GJF Added prototypes for DOS32QUERYFHSTATE and
+* DOS32SETFILEHSTATE
+* 10-18-89 JCR Changed _NEWREGION to match change in OS2 mem APIs
+* 10-27-89 JCR Added DOS32GETTHREADINFO change (under switch DCR757)
+* 10-30-89 GJF Fixed copyright
+* 11-06-89 JCR Added DOS32FREEMEM
+* 11-10-89 JCR Added OBJ_TILE bit to _NEWREGION definition
+* 11-10-89 JCR Removed DOS32QUERYFILEMODE/SETFILEMODE (not supported),
+* Added DOS32QUERYPATHINFO/SETPATHINFO
+* 11-16-89 GJF Changed DOS32SETFILEHSTATE to DOS32SETFHSTATE
+* 11-17-89 JCR Corrected DOS32SETFILEPTR
+* 11-17-89 JCR Enabled DOS32GETTHREADINFO code (DCR757)
+* 02-28-90 GJF Added #ifndef _INC_DOSCALLS stuff
+* 05-07-90 JCR Added correct semaphore calls
+* 05-09-90 JCR Corrected CREATETHREAD, etc.
+* 05-28-90 SBM Added DOS32RESETBUFFER
+* 06-06-90 SBM Added tentative new DOS32QUERYFHSTATE flags
+* 07-02-90 GJF Fixed thread info structures to conform with MS 2012
+* (aka DCR 1024).
+* 07-23-90 SBM Removed '32' from all API names
+* 08-23-90 GJF Added prototypes for new exception/signal API, removed
+* obsolete prototypes and definitions.
+* 12-10-90 GJF Updated values of new DOSQUERYFHSTATE flags.
+* 01-28-91 GJF Updated definition of struct _FILEFINDBUF
+* 08-20-91 JCR C++ and ANSI naming
+*
+****/
+
+#ifndef _INC_DOSCALLS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ensure proper alignment of struct fields */
+
+#pragma pack(4)
+
+
+#define PASCAL pascal
+#define VOID void
+
+#define APIENTRY _syscall /* OS/2 386 system calling convention =
+ C arg passing, no leading underscore */
+
+#define CHAR char /* ch */ /* always 8-bit */
+#define SHORT short /* s */ /* always 16-bit */
+#define LONG long /* l */ /* always 32-bit */
+#define INT int /* i */ /* 286:16-bit, 386:32-bit */
+
+typedef unsigned CHAR UCHAR; /* uch */
+typedef unsigned SHORT USHORT; /* us */
+typedef unsigned LONG ULONG; /* ul */
+typedef unsigned INT UINT; /* ui */
+
+typedef unsigned CHAR BYTE; /* b */
+
+typedef CHAR *PSZ;
+
+typedef INT (PASCAL *PFN)();
+typedef INT (PASCAL **PPFN)();
+
+typedef BYTE *PBYTE;
+
+typedef CHAR *PCHAR;
+typedef SHORT *PSHORT;
+typedef LONG *PLONG;
+typedef INT *PINT;
+
+typedef UCHAR *PUCHAR;
+typedef USHORT *PUSHORT;
+typedef ULONG *PULONG;
+typedef UINT *PUINT;
+
+typedef VOID *PVOID;
+
+typedef UINT BOOL; /* f */
+typedef BOOL *PBOOL;
+
+#define FALSE 0
+#define TRUE 1
+
+typedef ULONG SHANDLE;
+
+typedef SHANDLE HFILE; /* hf */
+typedef HFILE *PHFILE;
+
+typedef ULONG HMTX; /* mutex semaphore */
+typedef HMTX *PHMTX;
+
+typedef UINT PID; /* pid */
+typedef PID *PPID;
+
+typedef UINT TID; /* tid */
+typedef TID *PTID;
+
+/* File time and date types */
+
+typedef struct _FTIME { /* ftime */
+ unsigned short twosecs : 5;
+ unsigned short minutes : 6;
+ unsigned short hours : 5;
+} FTIME;
+typedef FTIME *PFTIME;
+
+typedef struct _FDATE { /* fdate */
+ unsigned short day : 5;
+ unsigned short month : 4;
+ unsigned short year : 7;
+} FDATE;
+typedef FDATE *PFDATE;
+
+/*
+ * CCHMAXPATH is the maximum fully qualified path name length including
+ * the drive letter, colon, backslashes and terminating NULL.
+ */
+#define CCHMAXPATH 260
+
+typedef struct _FILEFINDBUF { /* findbuf */
+ ULONG oNextEntryOffset; /* new field */
+ FDATE fdateCreation;
+ FTIME ftimeCreation;
+ FDATE fdateLastAccess;
+ FTIME ftimeLastAccess;
+ FDATE fdateLastWrite;
+ FTIME ftimeLastWrite;
+ ULONG cbFile;
+ ULONG cbFileAlloc;
+ ULONG attrFile; /* widened field */
+ UCHAR cchName;
+ CHAR achName[CCHMAXPATH];
+} FILEFINDBUF;
+typedef FILEFINDBUF *PFILEFINDBUF;
+
+/* Directory handle types */
+
+#define HDIR_SYSTEM 0x0001
+#define HDIR_CREATE 0xFFFF
+
+#define EXIT_THREAD 0
+#define EXIT_PROCESS 1
+
+VOID APIENTRY DOSEXIT(ULONG, ULONG);
+
+UINT APIENTRY DOSCREATETHREAD(PTID, VOID (*)(VOID), ULONG, ULONG, ULONG);
+UINT APIENTRY DOSRESUMETHREAD(TID);
+UINT APIENTRY DOSSUSPENDTHREAD(TID);
+
+/* Wait option values */
+
+#define DCWW_WAIT 0
+#define DCWW_NOWAIT 1
+
+typedef struct _RESULTCODES { /* resc */
+ ULONG codeTerminate;
+ ULONG codeResult;
+} RESULTCODES;
+typedef RESULTCODES *PRESULTCODES;
+
+/* codeTerminate values (also passed to ExitList routines) */
+
+#define TC_EXIT 0
+#define TC_HARDERROR 1
+#define TC_TRAP 2
+#define TC_KILLPROCESS 3
+
+ULONG APIENTRY DOSWAITCHILD(ULONG, ULONG, PRESULTCODES, PPID, PID);
+UINT APIENTRY DOSSLEEP(ULONG);
+
+/* DOSEXECPGM functions */
+
+#define EXEC_SYNC 0
+#define EXEC_ASYNC 1
+#define EXEC_ASYNCRESULT 2
+#define EXEC_TRACE 3
+#define EXEC_BACKGROUND 4
+#define EXEC_LOAD 5
+
+ULONG APIENTRY DOSEXECPGM(PCHAR, ULONG, ULONG, PSZ, PSZ, PRESULTCODES, PSZ);
+
+
+typedef struct tib2_s { /* System Specific Thread Info Block */
+ ULONG tib2_ultid; /* Thread I.D. */
+ ULONG tib2_ulpri; /* Thread priority */
+ ULONG tib2_version; /* Version number for this structure */
+ USHORT tib2_usMCCount; /* Must Complete count */
+ USHORT tib2_fMCForceFlag; /* Must Complete force flag */
+} TIB2;
+typedef TIB2 *PTIB2;
+
+typedef struct tib_s { /* Thread Information Block (TIB) */
+ PVOID tib_pexchain; /* Head of exception handler chain */
+ PVOID tib_pstack; /* Pointer to base of stack */
+ PVOID tib_pstacklimit; /* Pointer to end of stack */
+ PTIB2 tib_ptib2; /* Pointer to system specific TIB */
+ ULONG tib_version; /* Version number for this TIB structure */
+ PVOID tib_arbpointer; /* A pointer for the user */
+} TIB;
+typedef TIB *PTIB;
+
+typedef struct pib_s { /* Process Information Block (PIB) */
+ ULONG pib_ulpid; /* Process I.D. */
+ ULONG pib_ulppid; /* Parent process I.D. */
+ ULONG pib_hmte; /* Program (.EXE) module handle */
+ PCHAR pib_pchcmd; /* Command line pointer */
+ PCHAR pib_pchenv; /* Environment pointer */
+ ULONG pib_flstatus; /* Process' status bits */
+ ULONG pib_ultype; /* Process' type code */
+} PIB;
+typedef PIB *PPIB;
+
+ULONG APIENTRY DOSGETTHREADINFO(PTIB *, PPIB *);
+
+
+/* Global Info Seg */
+
+typedef struct _GINFOSEG { /* gis */
+ ULONG time;
+ ULONG msecs;
+ UCHAR hour;
+ UCHAR minutes;
+ UCHAR seconds;
+ UCHAR hundredths;
+ UINT timezone;
+ UINT cusecTimerInterval;
+ UCHAR day;
+ UCHAR month;
+ UINT year;
+ UCHAR weekday;
+ UCHAR uchMajorVersion;
+ UCHAR uchMinorVersion;
+ UCHAR chRevisionLetter;
+ UCHAR sgCurrent;
+ UCHAR sgMax;
+ UCHAR cHugeShift;
+ UCHAR fProtectModeOnly;
+ UINT pidForeground;
+ UCHAR fDynamicSched;
+ UCHAR csecMaxWait;
+ UINT cmsecMinSlice;
+ UINT cmsecMaxSlice;
+ UINT bootdrive;
+ UCHAR amecRAS[32];
+} GINFOSEG;
+typedef GINFOSEG *PGINFOSEG;
+
+/* Local Info Seg */
+
+typedef struct _LINFOSEG { /* lis */
+ PID pidCurrent;
+ PID pidParent;
+ UINT prtyCurrent;
+ TID tidCurrent;
+ UINT sgCurrent;
+ UINT sgSub;
+ BOOL fForeground;
+} LINFOSEG;
+typedef LINFOSEG *PLINFOSEG;
+
+/* Process Type codes (local info seg typeProcess field) */
+
+#define PT_FULLSCREEN 0
+#define PT_REALMODE 1
+#define PT_WINDOWABLEVIO 2
+#define PT_PM 3
+#define PT_DETACHED 4
+
+UINT APIENTRY DOSGETINFOSEG(PGINFOSEG *, PLINFOSEG *); /* correct?? */
+
+/* extended attribute structures */
+
+typedef struct _GEA { /* gea */
+ BYTE cbName; /* name length not including NULL */
+ CHAR szName[1]; /* attribute name */
+} GEA;
+typedef GEA *PGEA;
+
+typedef struct _GEALIST { /* geal */
+ USHORT cbList; /* total bytes of structure including full list */
+ GEA list[1]; /* variable length GEA structures */
+} GEALIST;
+typedef GEALIST * PGEALIST;
+
+typedef struct _FEA { /* fea */
+ BYTE bRsvd; /* reserved */
+ BYTE cbName; /* name length not including NULL */
+ USHORT cbValue; /* value length */
+} FEA;
+typedef FEA *PFEA;
+
+typedef struct _FEALIST { /* feal */
+ USHORT cbList; /* total bytes of structure including full list */
+ FEA list[1]; /* variable length FEA structures */
+} FEALIST;
+typedef FEALIST * PFEALIST;
+
+typedef struct _EAOP { /* eaop */
+ PGEALIST fpGEAList; /* general EA list */
+ PFEALIST fpFEAList; /* full EA list */
+ USHORT oError;
+} EAOP;
+typedef EAOP * PEAOP;
+
+ULONG APIENTRY DOSOPEN(PSZ, PHFILE, PULONG, ULONG, ULONG, ULONG, ULONG, PEAOP, ULONG);
+ULONG APIENTRY DOSCLOSE(HFILE);
+ULONG APIENTRY DOSREAD(HFILE, PVOID, ULONG, PULONG);
+ULONG APIENTRY DOSWRITE(HFILE, PVOID, ULONG, PULONG);
+
+/* File time and date types */
+
+typedef struct _FILESTATUS { /* fsts */
+ FDATE fdateCreation;
+ FTIME ftimeCreation;
+ FDATE fdateLastAccess;
+ FTIME ftimeLastAccess;
+ FDATE fdateLastWrite;
+ FTIME ftimeLastWrite;
+ ULONG cbFile;
+ ULONG cbFileAlloc;
+ USHORT attrFile;
+} FILESTATUS;
+typedef FILESTATUS *PFILESTATUS;
+
+/* File locking/unlocking */
+typedef struct _FILELOCK {
+ LONG lOffset;
+ LONG lRange;
+} FILELOCK;
+typedef FILELOCK *PFILELOCK;
+
+typedef SHANDLE HDIR; /* hdir */
+typedef HDIR *PHDIR;
+
+/* DosOpen() open flags */
+
+#define FILE_OPEN 0x0001
+#define FILE_TRUNCATE 0x0002
+#define FILE_CREATE 0x0010
+
+/* DosOpen/DosSetFHandState flags */
+
+#define OPEN_ACCESS_READONLY 0x0000
+#define OPEN_ACCESS_WRITEONLY 0x0001
+#define OPEN_ACCESS_READWRITE 0x0002
+#define OPEN_SHARE_DENYREADWRITE 0x0010
+#define OPEN_SHARE_DENYWRITE 0x0020
+#define OPEN_SHARE_DENYREAD 0x0030
+#define OPEN_SHARE_DENYNONE 0x0040
+#define OPEN_FLAGS_NOINHERIT 0x0080
+#define OPEN_FLAGS_FAIL_ON_ERROR 0x2000
+#define OPEN_FLAGS_WRITE_THROUGH 0x4000
+#define OPEN_FLAGS_DASD 0x8000
+
+/* new DosQueryFHState flags from DCR 'Add full 32-bit support for runtime
+ libraries.' NAMES TENTATIVE AND SUBJECT TO CHANGE. STAY AWAY. */
+
+#define OPEN_FLAGS_CONSOLE 0x00080000
+#define OPEN_FLAGS_RAWMODE 0x00100000
+#define OPEN_FLAGS_EOF 0x00200000
+
+/* HANDTYPE values */
+#define HANDTYPE_FILE 0x00
+#define HANDTYPE_DEVICE 0x01
+#define HANDTYPE_PIPE 0x02
+#define HANDTYPE_NETWORK 0x80
+
+ULONG APIENTRY DOSDELETE(PSZ, ULONG);
+ULONG APIENTRY DOSDUPHANDLE(HFILE, PHFILE);
+ULONG APIENTRY DOSQUERYFHSTATE(HFILE, PULONG);
+ULONG APIENTRY DOSQUERYHTYPE(HFILE, PULONG, PULONG);
+ULONG APIENTRY DOSFINDFIRST(PSZ, PHDIR, ULONG, PFILEFINDBUF, ULONG, PULONG, ULONG);
+ULONG APIENTRY DOSFINDNEXT(HDIR, PFILEFINDBUF, ULONG, PULONG);
+ULONG APIENTRY DOSFINDCLOSE(HDIR);
+ULONG APIENTRY DOSSETFHSTATE(HFILE, ULONG);
+ULONG APIENTRY DOSSETFILESIZE(HFILE, ULONG);
+ULONG APIENTRY DOSSETFILEPTR(HFILE, ULONG, LONG, PULONG);
+ULONG APIENTRY DOSSETFILELOCKS(HFILE, PFILELOCK, PFILELOCK);
+ULONG APIENTRY DOSMOVE(PSZ, PSZ, ULONG);
+ULONG APIENTRY DOSCREATEDIR(PSZ, PEAOP, ULONG);
+ULONG APIENTRY DOSDELETEDIR(PSZ, ULONG);
+ULONG APIENTRY DOSQUERYCURRENTDISK(PULONG, PULONG);
+ULONG APIENTRY DOSSETDEFAULTDISK(ULONG);
+ULONG APIENTRY DOSSETCURRENTDIR(PSZ, ULONG);
+ULONG APIENTRY DOSQUERYCURRENTDIR(ULONG, PBYTE, PULONG);
+ULONG APIENTRY DOSSETMAXFH(ULONG);
+ULONG APIENTRY DOSQUERYFILEINFO(HFILE, ULONG, PFILESTATUS, ULONG);
+ULONG APIENTRY DOSQUERYPATHINFO(PCHAR, ULONG, PFILESTATUS, ULONG);
+ULONG APIENTRY DOSSETPATHINFO(PCHAR, ULONG, PFILESTATUS, ULONG, ULONG);
+ULONG APIENTRY DOSSETFILEINFO(HFILE, ULONG, PFILESTATUS, ULONG);
+ULONG APIENTRY DOSCREATEPIPE(PULONG, PULONG, ULONG);
+ULONG APIENTRY DOSQUERYSYSINFO(ULONG, ULONG, PBYTE, ULONG);
+ULONG APIENTRY DOSRESETBUFFER(HFILE);
+
+/* File attribute flags */
+#define FILE_NORMAL 0x0000
+#define FILE_READONLY 0x0001
+#define FILE_HIDDEN 0x0002
+#define FILE_SYSTEM 0x0004
+#define FILE_DIRECTORY 0x0010
+#define FILE_ARCHIVED 0x0020
+
+/* DosSetFilePtr() file position codes */
+
+#define FILE_BEGIN 0x0000
+#define FILE_CURRENT 0x0001
+#define FILE_END 0x0002
+
+/* 386 allocation API */
+
+/* Access protection */
+#define PAG_READ 0x00000001 /* read access */
+#define PAG_WRITE 0x00000002 /* write access */
+#define PAG_EXECUTE 0x00000004 /* execute access */
+#define PAG_GUARD 0x00000008 /* guard protection */
+
+/* Commit */
+#define PAG_COMMIT 0x00000010 /* commit storage */
+#define PAG_DECOMMIT 0x00000020 /* decommit storage */
+
+/* Allocation attributes */
+#define OBJ_TILE 0x00000040 /* tile object */
+#define OBJ_PROTECTED 0x00000080 /* protect object
+#define OBJ_GETTABLE 0x00000100 /* gettable by other processes */
+#define OBJ_GIVEABLE 0x00000200 /* giveable to other processes */
+
+/* Standard memory values for C lib (heap and mthread code) */
+#define _NEWREGION (PAG_READ | PAG_WRITE | OBJ_TILE)
+#define _COMMIT (PAG_COMMIT | PAG_READ | PAG_WRITE)
+#define _DECOMMIT (PAG_DECOMMIT)
+
+UINT APIENTRY DOSALLOCMEM(PVOID, UINT, UINT, UINT);
+UINT APIENTRY DOSFREEMEM(PVOID);
+UINT APIENTRY DOSSETMEM(PVOID, UINT, UINT);
+
+/*** Semaphore support */
+
+UINT APIENTRY DOSCREATEMUTEXSEM (PSZ, PHMTX, ULONG, ULONG);
+UINT APIENTRY DOSQUERYMUTEXSEM (HMTX, PID *, TID *, PULONG);
+UINT APIENTRY DOSREQUESTMUTEXSEM (HMTX, ULONG);
+UINT APIENTRY DOSRELEASEMUTEXSEM (HMTX);
+
+/*** Time support */
+
+typedef struct _DATETIME { /* date */
+ UCHAR hours;
+ UCHAR minutes;
+ UCHAR seconds;
+ UCHAR hundredths;
+ UCHAR day;
+ UCHAR month;
+ USHORT year;
+ SHORT timezone;
+ UCHAR weekday;
+} DATETIME;
+typedef DATETIME *PDATETIME;
+
+ULONG APIENTRY DOSGETDATETIME(PDATETIME);
+
+/* Exception/signal API */
+
+/* Argument values for DOSSETSIGNALEXCEPTIONFOCUS */
+
+#define SIG_UNSETFOCUS 0
+#define SIG_SETFOCUS 1
+
+/* Include type and constant definitions */
+
+#include <except.h>
+
+/* Prototypes */
+
+UINT APIENTRY DOSRAISEEXCEPTION(_PEXCEPTIONREPORTRECORD);
+UINT APIENTRY DOSSENDSIGNALEXCEPTION(PID, ULONG);
+UINT APIENTRY DOSUNWINDEXCEPTION(_PEXCEPTIONREGISTRATIONRECORD, PVOID, _PEXCEPTIONREPORTRECORD);
+UINT APIENTRY DOSSETSIGNALEXCEPTIONFOCUS(ULONG, PULONG);
+UINT APIENTRY DOSENTERMUSTCOMPLETE(PULONG);
+UINT APIENTRY DOSEXITMUSTCOMPLETE(PULONG);
+UINT APIENTRY DOSACKNOWLEDGESIGNALEXCEPTION(ULONG);
+
+UINT APIENTRY DOSGETVERSION(PUINT); /* correct? */
+UINT APIENTRY DOSGETMACHINEMODE(PBYTE); /* correct? */
+
+ULONG APIENTRY DOSDEVCONFIG(PULONG, ULONG, ULONG);
+
+/* indices for DosQuerySysInfo */
+#define _QSV_MAX_PATH_LENGTH 1
+#define _QSV_MAX_TEXT_SESSIONS 2
+#define _QSV_MAX_PM_SESSIONS 3
+#define _QSV_MAX_VDM_SESSIONS 4
+#define _QSV_BOOT_DRIVE 5 /* 1=A, 2=B, etc. */
+#define _QSV_DYN_PRI_VARIATION 6 /* 0=Absolute, 1=Dynamic */
+#define _QSV_MAX_WAIT 7 /* seconds */
+#define _QSV_MIN_SLICE 8 /* milli seconds */
+#define _QSV_MAX_SLICE 9 /* milli seconds */
+#define _QSV_PAGE_SIZE 10
+#define _QSV_VERSION_MAJOR 11 /* OS revision (major) */
+#define _QSV_VERSION_MINOR 12 /* OS revision (minor) */
+#define _QSV_VERSION_REVISION 13 /* Revision letter */
+
+
+/* restore default alignment */
+
+#pragma pack()
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_DOSCALLS
+#endif /* _INC_DOSCALLS */
diff --git a/private/crt32/h/dostypes.h b/private/crt32/h/dostypes.h
new file mode 100644
index 000000000..92f6771dd
--- /dev/null
+++ b/private/crt32/h/dostypes.h
@@ -0,0 +1,112 @@
+/***
+*dostypes.h - defines DOS packed date and time types
+*
+* Copyright (c) 1987-1990, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the DOS packed date and time types.
+*
+*Revision History:
+* 11-18-87 SKS Removed declaration of _dtoxtime
+* 09-27-88 JCR 386 versions of macros
+* 10-03-88 GJF Use M_I386, not I386
+* 05-01-89 JCR Fixed 386 versions for new rev of OS/2 386
+* 08-03-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 02-28-90 GJF Added #ifndef _INC_DOSTYPES stuff
+* 08-11-90 SBM Enhanced SET_DOS_* macros to compile cleanly with -W3
+* 04-09-91 PNT Added _MAC_ definitions
+*
+****/
+
+#ifndef _INC_DOSTYPES
+
+#define MASK4 0xf /* 4 bit mask */
+#define MASK5 0x1f /* 5 bit mask */
+#define MASK6 0x3f /* 6 bit mask */
+#define MASK7 0x7f /* 7 bit mask */
+
+#define DAYLOC 0 /* day value starts in bit 0 */
+#define MONTHLOC 5 /* month value starts in bit 5 */
+#define YEARLOC 9 /* year value starts in bit 9 */
+
+#define SECLOC 0 /* seconds value starts in bit 0 */
+#define MINLOC 5 /* minutes value starts in bit 5 */
+#define HOURLOC 11 /* hours value starts in bit 11 */
+
+#define _DATECAST(fd) * (unsigned short *) &(fd)
+#define _TIMECAST(ft) * (unsigned short *) &(ft)
+
+#ifdef _CRUISER_
+
+#define SET_DOS_DAY(fd, xday) fd.day = (unsigned short)((xday) & MASK5)
+#define SET_DOS_MONTH(fd, xmon) fd.month = (unsigned short)((xmon) & MASK4)
+#define SET_DOS_YEAR(fd, xyr) fd.year = (unsigned short)((xyr) & MASK7)
+
+#define SET_DOS_HOUR(ft, xhr) ft.hours = (unsigned short)((xhr) & MASK5)
+#define SET_DOS_MIN(ft, xmin) ft.minutes = (unsigned short)((xmin) & MASK6)
+#define SET_DOS_SEC(ft, xsec) ft.twosecs = (unsigned short)((xsec) & MASK5)
+
+#define DOS_DAY(fd) (fd.day)
+#define DOS_MONTH(fd) (fd.month)
+#define DOS_YEAR(fd) (fd.year)
+
+#define DOS_HOUR(ft) (ft.hours)
+#define DOS_MIN(ft) (ft.minutes)
+#define DOS_SEC(ft) (ft.twosecs)
+
+#else /* ndef _CRUISER_ */
+
+#ifdef _WIN32_
+
+#define SET_DOS_DAY(fd, xday) fd.Day = (unsigned short)((xday) & MASK5)
+#define SET_DOS_MONTH(fd, xmon) fd.Month = (unsigned short)((xmon) & MASK4)
+#define SET_DOS_YEAR(fd, xyr) fd.Year = (unsigned short)((xyr) & MASK7)
+
+#define SET_DOS_HOUR(ft, xhr) ft.Hours = (unsigned short)((xhr) & MASK5)
+#define SET_DOS_MIN(ft, xmin) ft.Minutes = (unsigned short)((xmin) & MASK6)
+#define SET_DOS_SEC(ft, xsec) ft.DoubleSeconds = (unsigned short)((xsec) & MASK5)
+
+#define DOS_DAY(fd) (fd.Day)
+#define DOS_MONTH(fd) (fd.Month)
+#define DOS_YEAR(fd) (fd.Year)
+
+#define DOS_HOUR(ft) (ft.Hours)
+#define DOS_MIN(ft) (ft.Minutes)
+#define DOS_SEC(ft) (ft.DoubleSeconds)
+
+#else /* ndef _WIN32_ */
+
+#ifdef _MAC_
+
+#define SET_DOS_DAY(fd, xday) fd.day = (unsigned short)((xday) & MASK5)
+#define SET_DOS_MONTH(fd, xmon) fd.month = (unsigned short)((xmon) & MASK4)
+#define SET_DOS_YEAR(fd, xyr) fd.year = (unsigned short)((xyr) & MASK7)
+
+#define SET_DOS_HOUR(ft, xhr) ft.hours = (unsigned short)((xhr) & MASK5)
+#define SET_DOS_MIN(ft, xmin) ft.minutes = (unsigned short)((xmin) & MASK6)
+#define SET_DOS_SEC(ft, xsec) ft.twosecs = (unsigned short)((xsec) & MASK5)
+
+#define DOS_DAY(fd) (fd.day)
+#define DOS_MONTH(fd) (fd.month)
+#define DOS_YEAR(fd) (fd.year)
+
+#define DOS_HOUR(ft) (ft.hours)
+#define DOS_MIN(ft) (ft.minutes)
+#define DOS_SEC(ft) (ft.twosecs)
+
+#else /* ndef _MAC_ */
+
+#error ERROR - ONLY CRUISER, WIN32, _MAC_ TARGET SUPPORTED!
+
+#endif /* _MAC_ */
+
+#endif /* _WIN32_ */
+
+#endif /* _CRUISER_ */
+
+#define XTIME(d,t) _dtoxtime(DOS_YEAR(d),DOS_MONTH(d),DOS_DAY(d),DOS_HOUR(t),\
+ DOS_MIN(t),DOS_SEC(t)*2)
+
+#define _INC_DOSTYPES
+#endif /* _INC_DOSTYPES */
diff --git a/private/crt32/h/errmsg.h b/private/crt32/h/errmsg.h
new file mode 100644
index 000000000..740affe75
--- /dev/null
+++ b/private/crt32/h/errmsg.h
@@ -0,0 +1,36 @@
+/***
+*errmsg.h - defines error message numbers
+*
+* Copyright (c) 1985-1990, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains the constants for error message numbers.
+* Same as errmsg.inc
+* [Internal]
+*
+*Revision History:
+* 08-03-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright
+* 02-28-90 GJF Added #ifndef _INC_ERRMSG stuff
+*
+****/
+
+#ifndef _INC_ERRMSG
+
+#define STCKOVR 0
+#define NULLERR 1
+#define NOFP 2
+#define DIVZR 3
+#define BADVERS 4
+#define NOMEM 5
+#define BADFORM 6
+#define BADENV 7
+#define NOARGV 8
+#define NOENVP 9
+#define ABNORM 10
+#define UNKNOWN 11
+
+#define CRT_NERR 11
+
+#define _INC_ERRMSG
+#endif /* _INC_ERRMSG */
diff --git a/private/crt32/h/errno.h b/private/crt32/h/errno.h
new file mode 100644
index 000000000..04bcfdeb2
--- /dev/null
+++ b/private/crt32/h/errno.h
@@ -0,0 +1,127 @@
+/***
+*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]
+*
+*Revision History:
+* 07-15-88 JCR Added errno definition [ANSI]
+* 08-22-88 GJF Modified to also work with the 386 (small model only)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-01-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 02-28-90 GJF Added #ifndef _INC_ERRNO and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-29-90 GJF Replaced _cdecl with _CALLTYPE1 or _VARTYPE1, as
+* appropriate.
+* 08-16-90 SBM Made MTHREAD _errno() return int *
+* 08-20-91 JCR C++ and ANSI naming
+* 08-06-92 GJF Function calling type and variable type macros.
+* 10-01-92 GJF Made compatible with POSIX. Next step is to renumber
+* to remove gaps (after next beta).
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 04-08-93 CFW Added EILSEQ 42.
+*
+****/
+
+#ifndef _INC_ERRNO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 MTHREAD
+extern int * _CRTAPI1 _errno(void);
+#define errno (*_errno())
+#else
+extern int _CRTVAR1 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/crt32/h/error.h b/private/crt32/h/error.h
new file mode 100644
index 000000000..174690a10
--- /dev/null
+++ b/private/crt32/h/error.h
@@ -0,0 +1,383 @@
+/***
+*error.h - DOS error codes
+*
+* Copyright (c) 1987-1990, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* DOS calls all return error codes through AX. If an error occurred then
+* the carry bit will be set and the error code is in AX. If no error occurred
+* then the carry bit is reset and AX contains returned info.
+*
+* Since the set of error codes is being extended as we extend the operating
+* system, we have provided a means for applications to ask the system for a
+* recommended course of action when they receive an error.
+*
+* The GetExtendedError system call returns a universal error, an error
+* location and a recommended course of action. The universal error code is
+* a symptom of the error REGARDLESS of the context in which GetExtendedError
+* is issued.
+*
+*Revision History:
+* 10-25-87 SKS Updated from final OS/2 v1.0 sources as of 10-25-87
+* 06-06-89 PHG Added network related errors from error.inc
+* 08-03-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 02-28-90 GJF Added #ifndef _INC_ERROR stuff
+*
+*******************************************************************************/
+
+#ifndef _INC_ERROR
+
+/*static char *SCCSID = "@(#)error.h 7.25 87/07/23";*/
+/* XENIX calls all return error codes through AX. If an error occurred then */
+/* the carry bit will be set and the error code is in AX. If no error occurred */
+/* then the carry bit is reset and AX contains returned info. */
+/* */
+/* Since the set of error codes is being extended as we extend the operating */
+/* system, we have provided a means for applications to ask the system for a */
+/* recommended course of action when they receive an error. */
+/* */
+/* The GetExtendedError system call returns a universal error, an error */
+/* location and a recommended course of action. The universal error code is */
+/* a symptom of the error REGARDLESS of the context in which GetExtendedError */
+/* is issued. */
+/* */
+/* */
+/* These are the 2.0 error codes */
+/* */
+#define NO_ERROR 0
+#define ERROR_INVALID_FUNCTION 1
+#define ERROR_FILE_NOT_FOUND 2
+#define ERROR_PATH_NOT_FOUND 3
+#define ERROR_TOO_MANY_OPEN_FILES 4
+#define ERROR_ACCESS_DENIED 5
+#define ERROR_INVALID_HANDLE 6
+#define ERROR_ARENA_TRASHED 7
+#define ERROR_NOT_ENOUGH_MEMORY 8
+#define ERROR_INVALID_BLOCK 9
+#define ERROR_BAD_ENVIRONMENT 10
+#define ERROR_BAD_FORMAT 11
+#define ERROR_INVALID_ACCESS 12
+#define ERROR_INVALID_DATA 13
+/* **** reserved 14 ; ***** */
+#define ERROR_INVALID_DRIVE 15
+#define ERROR_CURRENT_DIRECTORY 16
+#define ERROR_NOT_SAME_DEVICE 17
+#define ERROR_NO_MORE_FILES 18
+/* */
+/* These are the universal int 24 mappings for the old INT 24 set of errors */
+/* */
+#define ERROR_WRITE_PROTECT 19
+#define ERROR_BAD_UNIT 20
+#define ERROR_NOT_READY 21
+#define ERROR_BAD_COMMAND 22
+#define ERROR_CRC 23
+#define ERROR_BAD_LENGTH 24
+#define ERROR_SEEK 25
+#define ERROR_NOT_DOS_DISK 26
+#define ERROR_SECTOR_NOT_FOUND 27
+#define ERROR_OUT_OF_PAPER 28
+#define ERROR_WRITE_FAULT 29
+#define ERROR_READ_FAULT 30
+#define ERROR_GEN_FAILURE 31
+/* */
+/* These are the new 3.0 error codes reported through INT 24 */
+/* */
+#define ERROR_SHARING_VIOLATION 32
+#define ERROR_LOCK_VIOLATION 33
+#define ERROR_WRONG_DISK 34
+#define ERROR_FCB_UNAVAILABLE 35
+#define ERROR_SHARING_BUFFER_EXCEEDED 36
+/* */
+/* New OEM network-related errors are 50-79 */
+/* */
+#define ERROR_NOT_SUPPORTED 50
+/* */
+/* End of INT 24 reportable errors */
+/* */
+
+/* Network related errors */
+#define ERROR_NOT_SUPPORTED 50 /* Network request not supported */
+#define ERROR_REM_NOT_LIST 51 /* Remote computer not listening */
+#define ERROR_DUP_NAME 52 /* Duplicate name on network */
+#define ERROR_BAD_NETPATH 53 /* Network path not found */
+#define ERROR_NETWORK_BUSY 54 /* Network busy */
+#define ERROR_DEV_NOT_EXIST 55 /* Network device no longer exists */
+#define ERROR_TOO_MANY_CMDS 56 /* Net BIOS command limit exceeded */
+#define ERROR_ADAP_HDW_ERR 57 /* Network adapter hardware error */
+#define ERROR_BAD_NET_RESP 58 /* Incorrect response from network */
+#define ERROR_UNEXP_NET_ERR 59 /* Unexpected network error */
+#define ERROR_BAD_REM_ADAP 60 /* Incompatible remote adapter */
+#define ERROR_PRINTQ_FULL 61 /* Print queue full */
+#define ERROR_NO_SPOOL_SPACE 62 /* Not enough space for print file */
+#define ERROR_PRINT_CANCELLED 63 /* Print file was cancelled */
+#define ERROR_NETNAME_DELETED 64 /* Network name was deleted */
+#define ERROR_NETWORK_ACCESS_DENIED 65 /* Access denied */
+#define ERROR_BAD_DEV_TYPE 66 /* Network device type incorrect */
+#define ERROR_BAD_NET_NAME 67 /* Network name not found */
+#define ERROR_TOO_MANY_NAMES 68 /* Network name limit exceeded */
+#define ERROR_TOO_MANY_SESS 69 /* Net BIOS session limit exceeded */
+#define ERROR_SHARING_PAUSED 70 /* Sharing temporarily paused */
+#define ERROR_REQ_NOT_ACCEP 71 /* Network request not accepted */
+#define ERROR_REDIR_PAUSED 72 /* Print or disk redirection is paused */
+
+#define ERROR_FILE_EXISTS 80
+#define ERROR_DUP_FCB 81 /* ***** */
+#define ERROR_CANNOT_MAKE 82
+#define ERROR_FAIL_I24 83
+/* */
+/* New 3.0 network related error codes */
+/* */
+#define ERROR_OUT_OF_STRUCTURES 84
+#define ERROR_ALREADY_ASSIGNED 85
+#define ERROR_INVALID_PASSWORD 86
+#define ERROR_INVALID_PARAMETER 87
+#define ERROR_NET_WRITE_FAULT 88
+/* */
+/* New error codes for 4.0 */
+/* */
+#define ERROR_NO_PROC_SLOTS 89 /* no process slots available */
+#define ERROR_NOT_FROZEN 90
+#define ERR_TSTOVFL 91 /* timer service table overflow */
+#define ERR_TSTDUP 92 /* timer service table duplicate */
+#define ERROR_NO_ITEMS 93 /* There were no items to operate upon */
+#define ERROR_INTERRUPT 95 /* interrupted system call */
+
+#define ERROR_TOO_MANY_SEMAPHORES 100
+#define ERROR_EXCL_SEM_ALREADY_OWNED 101
+#define ERROR_SEM_IS_SET 102
+#define ERROR_TOO_MANY_SEM_REQUESTS 103
+#define ERROR_INVALID_AT_INTERRUPT_TIME 104
+
+#define ERROR_SEM_OWNER_DIED 105 /* waitsem found owner died */
+#define ERROR_SEM_USER_LIMIT 106 /* too many procs have this sem */
+#define ERROR_DISK_CHANGE 107 /* insert disk b into drive a */
+#define ERROR_DRIVE_LOCKED 108 /* drive locked by another process */
+#define ERROR_BROKEN_PIPE 109 /* write on pipe with no reader */
+/* */
+/* New error codes for OS/2 */
+/* */
+#define ERROR_OPEN_FAILED 110 /* open/created failed due to */
+ /* explicit fail command */
+#define ERROR_BUFFER_OVERFLOW 111 /* buffer passed to system call */
+ /* is too small to hold return */
+ /* data. */
+#define ERROR_DISK_FULL 112 /* not enough space on the disk */
+ /* (DOSNEWSIZE/w_NewSize) */
+#define ERROR_NO_MORE_SEARCH_HANDLES 113 /* can't allocate another search */
+ /* structure and handle. */
+ /* (DOSFINDFIRST/w_FindFirst) */
+#define ERROR_INVALID_TARGET_HANDLE 114 /* Target handle in DOSDUPHANDLE */
+ /* is invalid */
+#define ERROR_PROTECTION_VIOLATION 115 /* Bad user virtual address */
+#define ERROR_VIOKBD_REQUEST 116
+#define ERROR_INVALID_CATEGORY 117 /* Category for DEVIOCTL in not */
+ /* defined */
+#define ERROR_INVALID_VERIFY_SWITCH 118 /* invalid value passed for */
+ /* verify flag */
+#define ERROR_BAD_DRIVER_LEVEL 119 /* DosDevIOCTL looks for a level */
+ /* four driver. If the driver */
+ /* is not level four we return */
+ /* this code */
+#define ERROR_CALL_NOT_IMPLEMENTED 120 /* returned from stub api calls. */
+ /* This call will disappear when */
+ /* all the api's are implemented. */
+#define ERROR_SEM_TIMEOUT 121 /* Time out happened from the */
+ /* semaphore api functions. */
+#define ERROR_INSUFFICIENT_BUFFER 122 /* Some call require the */
+ /* application to pass in a buffer */
+ /* filled with data. This error is */
+ /* returned if the data buffer is too */
+ /* small. For example: DosSetFileInfo */
+ /* requires 4 bytes of data. If a */
+ /* two byte buffer is passed in then */
+ /* this error is returned. */
+ /* error_buffer_overflow is used when */
+ /* the output buffer in not big enough. */
+#define ERROR_INVALID_NAME 123 /* illegal character or malformed */
+ /* file system name */
+#define ERROR_INVALID_LEVEL 124 /* unimplemented level for info */
+ /* retrieval or setting */
+#define ERROR_NO_VOLUME_LABEL 125 /* no volume label found with */
+ /* DosQFSInfo command */
+#define ERROR_MOD_NOT_FOUND 126 /* w_getprocaddr,w_getmodhandle */
+#define ERROR_PROC_NOT_FOUND 127 /* w_getprocaddr */
+
+#define ERROR_WAIT_NO_CHILDREN 128 /* CWait finds to children */
+
+#define ERROR_CHILD_NOT_COMPLETE 129 /* CWait children not dead yet */
+
+/*This is a temporary fix for the 4-19-86 build this should be changed when */
+/* we get the file from MS */
+#define ERROR_DIRECT_ACCESS_HANDLE 130 /* handle operation is invalid */
+ /* for direct disk access */
+ /* handles */
+#define ERROR_NEGATIVE_SEEK 131 /* application tried to seek */
+ /* with negative offset */
+#define ERROR_SEEK_ON_DEVICE 132 /* application tried to seek */
+ /* on device or pipe */
+/* */
+/* The following are errors generated by the join and subst workers */
+/* */
+#define ERROR_IS_JOIN_TARGET 133
+#define ERROR_IS_JOINED 134
+#define ERROR_IS_SUBSTED 135
+#define ERROR_NOT_JOINED 136
+#define ERROR_NOT_SUBSTED 137
+#define ERROR_JOIN_TO_JOIN 138
+#define ERROR_SUBST_TO_SUBST 139
+#define ERROR_JOIN_TO_SUBST 140
+#define ERROR_SUBST_TO_JOIN 141
+#define ERROR_BUSY_DRIVE 142
+#define ERROR_SAME_DRIVE 143
+#define ERROR_DIR_NOT_ROOT 144
+#define ERROR_DIR_NOT_EMPTY 145
+#define ERROR_IS_SUBST_PATH 146
+#define ERROR_IS_JOIN_PATH 147
+#define ERROR_PATH_BUSY 148
+#define ERROR_IS_SUBST_TARGET 149
+#define ERROR_SYSTEM_TRACE 150 /* system trace error */
+#define ERROR_INVALID_EVENT_COUNT 151 /* DosMuxSemWait errors */
+#define ERROR_TOO_MANY_MUXWAITERS 152
+#define ERROR_INVALID_LIST_FORMAT 153
+#define ERROR_LABEL_TOO_LONG 154
+#define ERROR_TOO_MANY_TCBS 155
+#define ERROR_SIGNAL_REFUSED 156
+#define ERROR_DISCARDED 157
+#define ERROR_NOT_LOCKED 158
+#define ERROR_BAD_THREADID_ADDR 159
+#define ERROR_BAD_ARGUMENTS 160
+#define ERROR_BAD_PATHNAME 161
+#define ERROR_SIGNAL_PENDING 162
+#define ERROR_UNCERTAIN_MEDIA 163
+#define ERROR_MAX_THRDS_REACHED 164
+#define ERROR_MONITORS_NOT_SUPPORTED 165
+
+#define ERROR_INVALID_SEGMENT_NUMBER 180
+#define ERROR_INVALID_CALLGATE 181
+#define ERROR_INVALID_ORDINAL 182
+#define ERROR_ALREADY_EXISTS 183
+#define ERROR_NO_CHILD_PROCESS 184
+#define ERROR_CHILD_ALIVE_NOWAIT 185
+#define ERROR_INVALID_FLAG_NUMBER 186
+#define ERROR_SEM_NOT_FOUND 187
+
+/* following error codes have added to make the loader error
+ messages distinct
+*/
+
+#define ERROR_INVALID_STARTING_CODESEG 188
+#define ERROR_INVALID_STACKSEG 189
+#define ERROR_INVALID_MODULETYPE 190
+#define ERROR_INVALID_EXE_SIGNATURE 191
+#define ERROR_EXE_MARKED_INVALID 192
+#define ERROR_BAD_EXE_FORMAT 193
+#define ERROR_ITERATED_DATA_EXCEEDS_64k 194
+#define ERROR_INVALID_MINALLOCSIZE 195
+#define ERROR_DYNLINK_FROM_INVALID_RING 196
+#define ERROR_IOPL_NOT_ENABLED 197
+#define ERROR_INVALID_SEGDPL 198
+#define ERROR_AUTODATASEG_EXCEEDS_64k 199
+#define ERROR_RING2SEG_MUST_BE_MOVABLE 200
+#define ERROR_RELOC_CHAIN_XEEDS_SEGLIM 201
+#define ERROR_INFLOOP_IN_RELOC_CHAIN 202
+
+#define ERROR_ENVVAR_NOT_FOUND 203
+#define ERROR_NOT_CURRENT_CTRY 204
+#define ERROR_NO_SIGNAL_SENT 205
+#define ERROR_FILENAME_EXCED_RANGE 206 /* if filename > 8.3 */
+#define ERROR_RING2_STACK_IN_USE 207 /* for FAPI */
+#define ERROR_META_EXPANSION_TOO_LONG 208 /* if "*a" > 8.3 */
+
+#define ERROR_INVALID_SIGNAL_NUMBER 209
+#define ERROR_THREAD_1_INACTIVE 210
+#define ERROR_INFO_NOT_AVAIL 211 /*@@ PTM 5550 */
+#define ERROR_LOCKED 212
+#define ERROR_BAD_DYNALINK 213 /*@@ PTM 5760 */
+#define ERROR_TOO_MANY_MODULES 214
+#define ERROR_NESTING_NOT_ALLOWED 215
+
+/*
+ * Error codes 230 - 249 are reserved for MS Networks
+ */
+
+#define ERROR_USER_DEFINED_BASE 0xF000
+
+#define ERROR_I24_WRITE_PROTECT 0
+#define ERROR_I24_BAD_UNIT 1
+#define ERROR_I24_NOT_READY 2
+#define ERROR_I24_BAD_COMMAND 3
+#define ERROR_I24_CRC 4
+#define ERROR_I24_BAD_LENGTH 5
+#define ERROR_I24_SEEK 6
+#define ERROR_I24_NOT_DOS_DISK 7
+#define ERROR_I24_SECTOR_NOT_FOUND 8
+#define ERROR_I24_OUT_OF_PAPER 9
+#define ERROR_I24_WRITE_FAULT 0x0A
+#define ERROR_I24_READ_FAULT 0x0B
+#define ERROR_I24_GEN_FAILURE 0x0C
+#define ERROR_I24_DISK_CHANGE 0x0D
+#define ERROR_I24_WRONG_DISK 0x0F
+#define ERROR_I24_UNCERTAIN_MEDIA 0x10
+#define ERROR_I24_CHAR_CALL_INTERRUPTED 0x11
+#define ERROR_I24_NO_MONITOR_SUPPORT 0x12
+#define ERROR_I24_INVALID_PARAMETER 0x13
+
+#define ALLOWED_FAIL 0x0001
+#define ALLOWED_ABORT 0x0002
+#define ALLOWED_RETRY 0x0004
+#define ALLOWED_IGNORE 0x0008
+
+#define I24_OPERATION 0x1
+#define I24_AREA 0x6
+ /* 01 if FAT */
+ /* 10 if root DIR */
+ /* 11 if DATA */
+#define I24_CLASS 0x80
+
+
+/* Values for error CLASS */
+
+#define ERRCLASS_OUTRES 1 /* Out of Resource */
+#define ERRCLASS_TEMPSIT 2 /* Temporary Situation */
+#define ERRCLASS_AUTH 3 /* Permission problem */
+#define ERRCLASS_INTRN 4 /* Internal System Error */
+#define ERRCLASS_HRDFAIL 5 /* Hardware Failure */
+#define ERRCLASS_SYSFAIL 6 /* System Failure */
+#define ERRCLASS_APPERR 7 /* Application Error */
+#define ERRCLASS_NOTFND 8 /* Not Found */
+#define ERRCLASS_BADFMT 9 /* Bad Format */
+#define ERRCLASS_LOCKED 10 /* Locked */
+#define ERRCLASS_MEDIA 11 /* Media Failure */
+#define ERRCLASS_ALREADY 12 /* Collision with Existing Item */
+#define ERRCLASS_UNK 13 /* Unknown/other */
+#define ERRCLASS_CANT 14
+#define ERRCLASS_TIME 15
+
+/* Values for error ACTION */
+
+#define ERRACT_RETRY 1 /* Retry */
+#define ERRACT_DLYRET 2 /* Delay Retry, retry after pause */
+#define ERRACT_USER 3 /* Ask user to regive info */
+#define ERRACT_ABORT 4 /* abort with clean up */
+#define ERRACT_PANIC 5 /* abort immediately */
+#define ERRACT_IGNORE 6 /* ignore */
+#define ERRACT_INTRET 7 /* Retry after User Intervention */
+
+/* Values for error LOCUS */
+
+#define ERRLOC_UNK 1 /* No appropriate value */
+#define ERRLOC_DISK 2 /* Random Access Mass Storage */
+#define ERRLOC_NET 3 /* Network */
+#define ERRLOC_SERDEV 4 /* Serial Device */
+#define ERRLOC_MEM 5 /* Memory */
+
+/* Abnormal termination codes */
+
+#define TC_NORMAL 0
+#define TC_HARDERR 1
+#define TC_GP_TRAP 2
+#define TC_SIGNAL 3
+
+#define _INC_ERROR
+#endif /* _INC_ERROR */
diff --git a/private/crt32/h/error2.h b/private/crt32/h/error2.h
new file mode 100644
index 000000000..550449942
--- /dev/null
+++ b/private/crt32/h/error2.h
@@ -0,0 +1,277 @@
+/***
+*error2.h - OS/2 error codes
+*
+* Copyright (c) 1987-1990, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file lists the OS/2 error codes.
+*
+*Revision History:
+* 10-25-87 SKS Updated from final OS/2 v1.0 source as of 10-25-87
+* 08-03-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 02-28-90 GJF Added #ifndef _INC_ERROR2 stuff
+*
+****/
+
+#ifndef _INC_ERROR2
+
+/* SCCSID = @(#)error2.h 8.17 87/08/06 */
+/****************************************************************/
+/* */
+/* FILE NAME: ERROR2.H */
+/* */
+/* COPYRIGHT: IBM Corp., 1987 */
+/* */
+/* REVISION LEVEL: 1.0 */
+/* */
+/* WHAT THIS FILE DOES: */
+/* This file contains equates associating error codes */
+/* returned from system function calls. The equates */
+/* in this file start at 303. You must include */
+/* ERROR.H for return codes under 303. */
+/* */
+/* WHAT YOU NEED TO USE THIS FILE: */
+/* */
+/* IN YOUR SOURCE PROGRAM: */
+/* */
+/* #include <ERROR2.H> */
+/* */
+/****************************************************************/
+
+#define ERROR_INVALID_PROCID 303 /* invalid process id */
+#define ERROR_INVALID_PDELTA 304 /* invalid priority delta */
+#define ERROR_NOT_DESCENDANT 305 /* not descendant */
+#define ERROR_NOT_SESSION_MANAGER 306 /* requestor not session manager */
+#define ERROR_INVALID_PCLASS 307 /* invalid p class */
+#define ERROR_INVALID_SCOPE 308 /* invalid scope */
+#define ERROR_INVALID_THREADID 309 /* invalid thread id */
+#define ERROR_DOSSUB_SHRINK 310 /* can't shrink - MspSet */
+#define ERROR_DOSSUB_NOMEM 311 /* no memory - MspAlloc */
+#define ERROR_DOSSUB_OVERLAP 312 /* overlap - MspFree */
+#define ERROR_DOSSUB_BADSIZE 313 /* bad size parameter - MspAlloc or MspFree */
+#define ERROR_DOSSUB_BADFLAG 314 /* bad flag parameter - MspSet */
+#define ERROR_DOSSUB_BADSELECTOR 315 /* invalid MspSegment Selector */
+#define ERROR_MR_MSG_TOO_LONG 316 /* message too long for buffer */
+#define ERROR_MR_MID_NOT_FOUND 317 /* message id number not found */
+#define ERROR_MR_UN_ACC_MSGF 318 /* unable to access message file */
+#define ERROR_MR_INV_MSGF_FORMAT 319 /* invalid message file format */
+#define ERROR_MR_INV_IVCOUNT 320 /* invalid insertion variable count */
+#define ERROR_MR_UN_PERFORM 321 /* unable to perform function */
+#define ERROR_TS_WAKEUP 322 /* unable to wake up */
+#define ERROR_TS_SEMHANDLE 323 /* user passed invalid system semaphore */
+#define ERROR_TS_NOTIMER 324 /* no times available */
+#define ERROR_TS_HANDLE 326 /* invalid timer handle */
+#define ERROR_TS_DATETIME 327 /* date or time invalid */
+#define ERROR_SYS_INTERNAL 328 /* internal system error */
+#define ERROR_QUE_CURRENT_NAME 329 /* current name does not exist */
+#define ERROR_QUE_PROC_NOT_OWNED 330 /* current process does not own queue */
+#define ERROR_QUE_PROC_OWNED 331 /* current process owns queue */
+#define ERROR_QUE_DUPLICATE 332 /* duplicate name */
+#define ERROR_QUE_ELEMENT_NOT_EXIST 333 /* element does not exist */
+#define ERROR_QUE_NO_MEMORY 334 /* inadequate memory */
+#define ERROR_QUE_INVALID_NAME 335 /* invalid name */
+#define ERROR_QUE_INVALID_PRIORITY 336 /* invalid priority parameter */
+#define ERROR_QUE_INVALID_HANDLE 337 /* invalid queue handle */
+#define ERROR_QUE_LINK_NOT_FOUND 338 /* link not found */
+#define ERROR_QUE_MEMORY_ERROR 339 /* memory error */
+#define ERROR_QUE_PREV_AT_END 340 /* previous element was at end of queue */
+#define ERROR_QUE_PROC_NO_ACCESS 341 /* process does not have access to queues */
+#define ERROR_QUE_EMPTY 342 /* queue is empty */
+#define ERROR_QUE_NAME_NOT_EXIST 343 /* queue name does not exist */
+#define ERROR_QUE_NOT_INITIALIZED 344 /* queues not initialized */
+#define ERROR_QUE_UNABLE_TO_ACCESS 345 /* unable to access queues */
+#define ERROR_QUE_UNABLE_TO_ADD 346 /* unable to add new queue */
+#define ERROR_QUE_UNABLE_TO_INIT 347 /* unable to initialize queues */
+#define ERROR_VIO_INVALID_MASK 349 /* invalid replacement mask */
+#define ERROR_VIO_PTR 350 /* invalid pointer to parameter */
+#define ERROR_VIO_APTR 351 /* invalid pointer to attribute */
+#define ERROR_VIO_RPTR 352 /* invalid pointer to row */
+#define ERROR_VIO_CPTR 353 /* invalid pointer to column */
+#define ERROR_VIO_LPTR 354 /* invalid pointer to length */
+#define ERROR_VIO_MODE 355 /* unsupported screen mode */
+#define ERROR_VIO_WIDTH 356 /* invalid cursor width value */
+#define ERROR_VIO_ATTR 357 /* invalid cursor attribute value */
+#define ERROR_VIO_ROW 358 /* invalid row value */
+#define ERROR_VIO_COL 359 /* invalid column value */
+#define ERROR_VIO_TOPROW 360 /* invalid toprow value */
+#define ERROR_VIO_BOTROW 361 /* invalid botrow value */
+#define ERROR_VIO_RIGHTCOL 362 /* invalid right column value */
+#define ERROR_VIO_LEFTCOL 363 /* invalid left column value */
+#define ERROR_SCS_CALL 364 /* call issued by other than sm */
+#define ERROR_SCS_VALUE 365 /* value is not for save or restore */
+#define ERROR_VIO_WAIT_FLAG 366 /* invalid wait flag setting */
+#define ERROR_VIO_UNLOCK 367 /* screen not previously locked */
+#define ERROR_SGS_NOT_SESSION_MGR 368 /* caller not session manager */
+#define ERROR_SMG_INVALID_SGID 369 /* invalid screen group id */
+#define ERROR_SMG_INVALID_SESSION_ID 369 /* invalid session id */
+#define ERROR_SMG_NOSG 370 /* all screen groups in use */
+#define ERROR_SMG_NO_SESSIONS 370 /* no sessions available */
+#define ERROR_SMG_GRP_NOT_FOUND 371 /* screen group not found */
+#define ERROR_SMG_SESSION_NOT_FOUND 371 /* session not found */
+#define ERROR_SMG_SET_TITLE 372 /* title set by shell or parent cant be changed */
+#define ERROR_KBD_PARAMETER 373 /* invalid parameter to kbd */
+#define ERROR_KBD_NO_DEVICE 374 /* out of system handles */
+#define ERROR_KBD_INVALID_IOWAIT 375 /* invalid i/o wait specified */
+#define ERROR_KBD_INVALID_LENGTH 376 /* invalid length for keyboard */
+#define ERROR_KBD_INVALID_ECHO_MASK 377 /* invalid echo mode mask */
+#define ERROR_KBD_INVALID_INPUT_MASK 378 /* invalid input mode mask */
+#define ERROR_MON_INVALID_PARMS 379 /* invalid parameters to dos mon */
+#define ERROR_MON_INVALID_DEVNAME 380 /* invalid device name string */
+#define ERROR_MON_INVALID_HANDLE 381 /* invalid device handle */
+#define ERROR_MON_BUFFER_TOO_SMALL 382 /* buffer too small */
+#define ERROR_MON_BUFFER_EMPTY 383 /* buffer is empty */
+#define ERROR_MON_DATA_TOO_LARGE 384 /* data record too large */
+#define ERROR_MOUSE_NO_DEVICE 385 /* no mouse device attached */
+#define ERROR_MOUSE_INV_HANDLE 386 /* mouse device closed (invalid device handle) */
+#define ERROR_MOUSE_INV_PARMS 387 /* parameters invalid or out of range */
+#define ERROR_MOUSE_CANT_RESET 388 /* function assigned and cannot be reset */
+#define ERROR_MOUSE_DISPLAY_PARMS 389 /* parameters invalid for display mode */
+#define ERROR_MOUSE_INV_MODULE 390 /* module not found */
+#define ERROR_MOUSE_INV_ENTRY_PT 391 /* entry point not valid */
+#define ERROR_MOUSE_INV_MASK 392 /* function mask invalid */
+#define NO_ERROR_MOUSE_NO_DATA 393 /* no mouse data */
+#define NO_ERROR_MOUSE_PTR_DRAWN 394 /* pointer drawn */
+#define ERROR_INVALID_FREQUENCY 395 /* invalid frequency for beep */
+#define ERROR_NLS_NO_COUNTRY_FILE 396 /* can't find country.sys */
+#define ERROR_NLS_OPEN_FAILED 397 /* can't open country.sys */
+#define ERROR_NLS_NO_CTRY_CODE 398 /* country code not found */
+#define ERROR_NO_COUNTRY_OR_CODEPAGE 398 /* country code not found */
+#define ERROR_NLS_TABLE_TRUNCATED 399 /* table truncated, buffer too small */
+#define ERROR_NLS_BAD_TYPE 400 /* selector type does not exist */
+#define ERROR_NLS_TYPE_NOT_FOUND 401 /* selector type not in file */
+#define ERROR_VIO_SMG_ONLY 402 /* valid from session manager only */
+#define ERROR_VIO_INVALID_ASCIIZ 403 /* invalid asciiz length */
+#define ERROR_VIO_DEREGISTER 404 /* vio deregister disallowed */
+#define ERROR_VIO_NO_POPUP 405 /* popup not allocated */
+#define ERROR_VIO_EXISTING_POPUP 406 /* popup on screen (no wait) */
+#define ERROR_KBD_SMG_ONLY 407 /* valid from session manager only */
+#define ERROR_KBD_INVALID_ASCIIZ 408 /* invalid asciiz length */
+#define ERROR_KBD_INVALID_MASK 409 /* invalid replacement mask */
+#define ERROR_KBD_REGISTER 410 /* kbdregister disallowed */
+#define ERROR_KBD_DEREGISTER 411 /* kbdderegister disalloed */
+#define ERROR_MOUSE_SMG_ONLY 412 /* valid from session manager only */
+#define ERROR_MOUSE_INVALID_ASCIIZ 413 /* invalid asciiz length */
+#define ERROR_MOUSE_INVALID_MASK 414 /* invalid replacement mask */
+#define ERROR_MOUSE_REGISTER 415 /* mouse register disallowed */
+#define ERROR_MOUSE_DEREGISTER 416 /* mouse deregister disallowed */
+#define ERROR_SMG_BAD_ACTION 417 /* invalid action specified */
+#define ERROR_SMG_INVALID_CALL 418 /* init called more than once */
+#define ERROR_SCS_SG_NOTFOUND 419 /* new screen group # */
+#define ERROR_SCS_NOT_SHELL 420 /* caller is not shell */
+#define ERROR_VIO_INVALID_PARMS 421 /* invalid parms passed in */
+#define ERROR_VIO_FUNCTION_OWNED 422 /* save/restore already owned */
+#define ERROR_VIO_RETURN 423 /* non-destruct return (undo) */
+#define ERROR_SCS_INVALID_FUNCTION 424 /* not valid request for caller */
+#define ERROR_SCS_NOT_SESSION_MGR 425 /* caller not session manager */
+#define ERROR_VIO_REGISTER 426 /* VIO register disallowed */
+#define ERROR_VIO_NO_MODE_THREAD 427 /* No mode restore thread in SG */
+#define ERROR_VIO_NO_SAVE_RESTORE_THD 428 /* No save/rest thread in SG */
+#define ERROR_VIO_IN_BG 429 /* Physical selector requested in background */
+#define ERROR_VIO_ILLEGAL_DURING_POPUP 430 /* Function not allowed during popup */
+#define ERROR_SMG_NOT_BASESHELL 431 /* caller is not the base shell */
+#define ERROR_SMG_BAD_STATUSREQ 432 /* invalid status requested */
+#define ERROR_QUE_INVALID_WAIT 433 /* nowait parameter out of bounds */
+#define ERROR_VIO_LOCK 434 /* error returned from scrlock */
+#define ERROR_MOUSE_INVALID_IOWAIT 435 /* invalid parameters for IO wait */
+#define ERROR_VIO_INVALID_HANDLE 436 /* invalid vio handle */
+#define ERROR_VIO_ILLEGAL_DURING_LOCK 437 /* Function not allowed during screen lock */
+#define ERROR_VIO_INVALID_LENGTH 438 /* invalid vio length */
+#define ERROR_KBD_INVALID_HANDLE 439 /* invalid kbd handle */
+#define ERROR_KBD_NO_MORE_HANDLE 440 /* ran out of handles */
+#define ERROR_KBD_CANNOT_CREATE_KCB 441 /* unable to create kcb */
+#define ERROR_KBD_CODEPAGE_LOAD_INCOMPL 442 /* unsuccessful codepage load */
+#define ERROR_KBD_INVALID_CODEPAGE_ID 443 /* invalid codepage id */
+#define ERROR_KBD_NO_CODEPAGE_SUPPORT 444 /* no codepage support */
+#define ERROR_KBD_FOCUS_REQUIRED 445 /* keyboard focus required */
+#define ERROR_KBD_FOCUS_ALREADY_ACTIVE 446 /* keyboard focus exists */
+#define ERROR_KBD_KEYBOARD_BUSY 447 /* keyboard busy */
+#define ERROR_KBD_INVALID_CODEPAGE 448 /* invalid codepage */
+#define ERROR_KBD_UNABLE_TO_FOCUS 449 /* focus attempt failed */
+#define ERROR_SMG_SESSION_NON_SELECT 450 /* session is not selectable */
+#define ERROR_SMG_SESSION_NOT_FOREGRND 451 /* parent/child session not foreground */
+#define ERROR_SMG_SESSION_NOT_PARENT 452 /* not parent of requested child */
+#define ERROR_SMG_INVALID_START_MODE 453 /* invalid session start mode */
+#define ERROR_SMG_INVALID_RELATED_OPT 454 /* invalid session start related option */
+#define ERROR_SMG_INVALID_BOND_OPTION 455 /* invalid session bond option */
+#define ERROR_SMG_INVALID_SELECT_OPT 456 /* invalid session select option */
+#define ERROR_SMG_START_IN_BACKGROUND 457 /* session started in background */
+#define ERROR_SMG_INVALID_STOP_OPTION 458 /* invalid session stop option */
+#define ERROR_SMG_BAD_RESERVE 459 /* reserved parameters not zero */
+#define ERROR_SMG_PROCESS_NOT_PARENT 460 /* session parent process already exists */
+#define ERROR_SMG_INVALID_DATA_LENGTH 461 /* invalid data length */
+#define ERROR_SMG_NOT_BOUND 462 /* parent not bound */
+#define ERROR_SMG_RETRY_SUB_ALLOC 463 /* retry request block allocation */
+#define ERROR_KBD_DETACHED 464 /* this call disallawed for detached pid */
+#define ERROR_VIO_DETACHED 465 /* this call disallawed for detached pid */
+#define ERROR_MOU_DETACHED 466 /* this call disallawed for detached pid */
+#define ERROR_VIO_FONT 467 /* no font available to support mode */
+#define ERROR_VIO_USER_FONT 468 /* user font active */
+#define ERROR_VIO_BAD_CP 469 /* invalid code page specified */
+#define ERROR_VIO_NO_CP 470 /* system displays don't support code page */
+#define ERROR_VIO_NA_CP 471 /* current displays doesn't support code page */
+#define ERROR_INVALID_CODE_PAGE 472 /* invalid code page */
+#define ERROR_CPLIST_TOO_SMALL 473 /* code page list is too small */
+#define ERROR_CP_NOT_MOVED 474 /* code page not moved */
+#define ERROR_MODE_SWITCH_INIT 475 /* mode switch init error */
+#define ERROR_CODE_PAGE_NOT_FOUND 476 /* code page not found */
+#define ERROR_UNEXPECTED_SLOT_RETURNED 477 /* internal error */
+#define ERROR_SMG_INVALID_TRACE_OPTION 478 /* invalid start session trace indicator */
+#define ERROR_VIO_INTERNAL_RESOURCE 479 /* vio internal resource error */
+#define ERROR_VIO_SHELL_INIT 480 /* vio shell init error */
+#define ERROR_SMG_NO_HARD_ERRORS 481 /* no session manager hard errors */
+#define ERROR_CP_SWITCH_INCOMPLETE 482 /* dossetcp unable to set kbd/vio cp */
+#define ERROR_VIO_TRANSPARENT_POPUP 483 /* error during vio popup */
+#define ERROR_CRITSEC_OVERFLOW 484 /* critical section overflow */
+#define ERROR_CRITSEC_UNDERFLOW 485 /* critical section underflow */
+#define ERROR_VIO_BAD_RESERVE 486 /* reserved parameter is not zero */
+#define ERROR_INVALID_ADDRESS 487 /* bad physical address */
+#define ERROR_ZERO_SELECTORS_REQUESTED 488 /* must request at least on selector */
+#define ERROR_NOT_ENOUGH_SELECTORS_AVA 489 /* not enought GDT selectors to satisfy request */
+#define ERROR_INVALID_SELECTOR 490 /* not a GDT selector */
+
+/* */
+/* intercomponent error codes (from 8000H or 32768) */
+/* */
+#define ERROR_SWAPPER_NOT_ACTIVE 32768 /* swapper is not active */
+#define ERROR_INVALID_SWAPID 32769 /* invalid swap identifier */
+#define ERROR_IOERR_SWAP_FILE 32770 /* i/o error on swap file */
+#define ERROR_SWAP_TABLE_FULL 32771 /* swap control table is full */
+#define ERROR_SWAP_FILE_FULL 32772 /* swap file is full */
+#define ERROR_CANT_INIT_SWAPPER 32773 /* cannot initialize swapper */
+#define ERROR_SWAPPER_ALREADY_INIT 32774 /* swapper already initialized */
+#define ERROR_PMM_INSUFFICIENT_MEMORY 32775 /* insufficient memory */
+#define ERROR_PMM_INVALID_FLAGS 32776 /* invalid flags for phys. mem. */
+#define ERROR_PMM_INVALID_ADDRESS 32777 /* invalid address of phys. mem. */
+#define ERROR_PMM_LOCK_FAILED 32778 /* lock of storage failed */
+#define ERROR_PMM_UNLOCK_FAILED 32779 /* unlock of storage failed */
+#define ERROR_PMM_MOVE_INCOMPLETE 32780 /* move not completed */
+#define ERROR_UCOM_DRIVE_RENAMED 32781 /* drive name was renamed */
+#define ERROR_UCOM_FILENAME_TRUNCATED 32782 /* file name was truncated */
+#define ERROR_UCOM_BUFFER_LENGTH 32783 /* bad buffer length */
+#define ERROR_MON_CHAIN_HANDLE 32784 /* invalid chain handle - mon dh */
+#define ERROR_MON_NOT_REGISTERED 32785 /* monitor not registered */
+#define ERROR_SMG_ALREADY_TOP 32786 /* specified screen group is top */
+#define ERROR_PMM_ARENA_MODIFIED 32787 /* arena modified - phys mem */
+#define ERROR_SMG_PRINTER_OPEN 32788 /* printer open error on prtsc */
+#define ERROR_PMM_SET_FLAGS_FAILED 32789 /* update to arena header flags failed */
+#define ERROR_INVALID_DOS_DD 32790 /* invalid DOS mode device driver */
+#define ERROR_CPSIO_CODE_PAGE_INVALID 65026 /* code page is not available */
+#define ERROR_CPSIO_NO_SPOOLER 65027 /* spooler not started */
+#define ERROR_CPSIO_FONT_ID_INVALID 65028 /* font id is not avail (verify) */
+#define ERROR_CPSIO_INTERNAL_ERROR 65033 /* error caused by switcher internal error */
+#define ERROR_CPSIO_INVALID_PTR_NAME 65034 /* error caused by invalid printer name input */
+#define ERROR_CPSIO_NOT_ACTIVE 65037 /* got code page req - cp switcher not initialized */
+#define ERROR_CPSIO_PID_FULL 65039 /* pid table full- cannot activate another entry */
+#define ERROR_CPSIO_PID_NOT_FOUND 65040 /* received request for pid not in table */
+#define ERROR_CPSIO_READ_CTL_SEQ 65043 /* error reading font file control sequence section */
+#define ERROR_CPSIO_READ_FNT_DEF 65045 /* error reading font file font definition block */
+#define ERROR_CPSIO_WRITE_ERROR 65047 /* error writing to temp spool file */
+#define ERROR_CPSIO_WRITE_FULL_ERROR 65048 /* disk full error writing temp spool file */
+#define ERROR_CPSIO_WRITE_HANDLE_BAD 65049 /* spool file handle bad */
+#define ERROR_CPSIO_SWIT_LOAD 65074 /* switcher load error */
+#define ERROR_CPSIO_INV_COMMAND 65077 /* invalid spool command */
+#define ERROR_CPSIO_NO_FONT_SWIT 65078 /* no font switch active */
+
+#define _INC_ERROR2
+#endif /* _INC_ERROR2 */
diff --git a/private/crt32/h/except.inc b/private/crt32/h/except.inc
new file mode 100644
index 000000000..938a141b2
--- /dev/null
+++ b/private/crt32/h/except.inc
@@ -0,0 +1,100 @@
+;***
+;except.inc - definitions for exception handling
+;
+; Copyright (c) 1990-1991, Microsoft Corporation. All rights reserved.
+;
+;Purpose:
+; Structure and constant definitions used by exception handling code.
+;
+;Revision History:
+; 07-19-90 GJF Module created.
+; 08-28-90 GJF Added some definitions of exceptions.
+; 10-19-90 GJF Revised some constants to agree with the definitions in
+; \\os2rel\public!2.0\h\bsexcpt.h (dated 10-1-90).
+; 07-30-91 GJF Different values of _XCPT_CONTINUE_[SEARCH|EXECUTION]
+; for Cruiser and Win32 [_WIN32_].
+;
+;*******************************************************************************
+
+; structure used by SEH support function and intrinsics. the information
+; passed by the OS exception dispatcher is repackaged in this form by the
+; runtime (_except_handler()).
+
+__EXCEPTION_INFO_PTRS struc
+ preport dd ?
+ pcontext dd ?
+__EXCEPTION_INFO_PTRS ends
+
+
+; exception registration record structure.
+
+__EXCEPTIONREGISTRATIONRECORD struc
+ prev_structure dd ?
+ ExceptionHandler dd ?
+ ExceptionFilter dd ?
+ FilterFrame dd ?
+ PExceptionInfoPtrs dd ?
+__EXCEPTIONREGISTRATIONRECORD ends
+
+; size of exception registration record in double words
+
+DWORDS_IN_XREGREC equ 5
+
+
+; exception report record
+
+__EXCEPTIONREPORTRECORD struc
+ ExceptionNum dd ?
+ fHandlerFlags dd ?
+ ExceptionReportRecord dd ?
+ ExceptionAddress dd ?
+ cParameters dd ?
+ ExceptionInfo dd 4 dup (?)
+__EXCEPTIONREPORTRECORD ends
+
+
+; setjmp/longjmp buffer (i.e., structure underlying jmp_buf array)
+
+_JMP_BUF struc
+ ebpsave dd ?
+ ebxsave dd ?
+ edisave dd ?
+ esisave dd ?
+ espsave dd ?
+ retsave dd ?
+ xcptsave dd ?
+_JMP_BUF ends
+
+
+; exceptions corresponding to C runtime errors (these are explicitly
+; referenced in the startup code)
+
+_XCPT_UNABLE_TO_GROW_STACK equ 080010001h
+_XCPT_INTEGER_DIVIDE_BY_ZERO equ 0C000009Bh
+_XCPT_NONCONTINUABLE_EXCEPTION equ 0C0000024h
+_XCPT_INVALID_DISPOSITION equ 0C0000025h
+_XCPT_SIGABRT equ 020000001h
+
+
+; unwind settings in fHandlerFlags
+
+_EH_UNWINDING equ 2
+_EH_EXIT_UNWIND equ 4
+UNWIND equ _EH_UNWINDING OR _EH_EXIT_UNWIND
+
+
+; return values (to the exception dispatcher)
+
+IFDEF _CRUISER_
+
+_XCPT_CONTINUE_SEARCH equ 000000000h
+_XCPT_CONTINUE_EXECUTION equ 0FFFFFFFFh
+
+ELSE
+IFDEF _WIN32_
+
+_XCPT_CONTINUE_SEARCH equ 000000001h
+_XCPT_CONTINUE_EXECUTION equ 000000000h
+
+ENDIF
+ENDIF
diff --git a/private/crt32/h/excpt.h b/private/crt32/h/excpt.h
new file mode 100644
index 000000000..c73e08d29
--- /dev/null
+++ b/private/crt32/h/excpt.h
@@ -0,0 +1,209 @@
+/***
+*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.
+*
+*Revision History:
+* 11-01-91 GJF Module created. Basically a synthesis of except.h
+* and excpt.h and intended as a replacement for
+* both.
+* 12-13-91 GJF Fixed build for Win32.
+* 05-05-92 SRW C8 wants C6 style names for now.
+* 07-20-92 SRW Moved from winxcpt.h to excpt.h
+* 08-06-92 GJF Function calling type and variable type macros. Also
+* revised compiler/target processor macro usage.
+* 11-09-92 GJF Fixed preprocessing conditionals for MIPS. Also,
+* fixed some compiler warning (fix from/for RichardS).
+* 01-03-93 SRW Fold in ALPHA changes
+* 01-04-93 SRW Add leave keyword for x86
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 02-18-93 GJF Changed _try to __try, etc.
+* 10-04-93 SRW Fix ifdefs for MIPS and ALPHA to only check for _M_?????? defines
+*
+****/
+
+#ifndef _INC_EXCPT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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
+
+
+#ifndef _INTERNAL_IFSTRIP_
+/*
+ * for convenience, define a type name for a pointer to signal-handler
+ */
+
+typedef void (_CRTAPI1 * _PHNDLR)(int);
+
+/*
+ * Exception-action table used by the C runtime to identify and dispose of
+ * exceptions corresponding to C runtime errors or C signals.
+ */
+struct _XCPT_ACTION {
+
+ /*
+ * exception code or number. defined by the host OS.
+ */
+ unsigned long XcptNum;
+
+ /*
+ * signal code or number. defined by the C runtime.
+ */
+ int SigNum;
+
+ /*
+ * exception action code. either a special code or the address of
+ * a handler function. always determines how the exception filter
+ * should dispose of the exception.
+ */
+ _PHNDLR XcptAction;
+};
+
+extern struct _XCPT_ACTION _CRTVAR1 _XcptActTab[];
+
+/*
+ * number of entries in the exception-action table
+ */
+
+extern int _CRTVAR1 _XcptActTabCount;
+
+/*
+ * size of exception-action table (in bytes)
+ */
+
+extern int _CRTVAR1 _XcptActTabSize;
+
+/*
+ * return values and prototype for the exception filter function used in the
+ * C startup
+ */
+int _CRTAPI1 _XcptFilter(unsigned long, struct _EXCEPTION_POINTERS *);
+
+#endif /* _INTERNAL_IFSTRIP_ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_EXCPT
+#endif /* _INC_EXCPT */
diff --git a/private/crt32/h/exsup.inc b/private/crt32/h/exsup.inc
new file mode 100644
index 000000000..7cf621d91
--- /dev/null
+++ b/private/crt32/h/exsup.inc
@@ -0,0 +1,79 @@
+;***
+;exsup.inc
+;
+; Copyright (C) 1993, Microsoft Corporation. All rights reserved.
+;
+;Purpose:
+; Common data structures & definitions for exsup.asm and other
+; Structured Exception Handling support modules.
+;
+;Revision History:
+; 04-13-93 JWM Initial version
+; 12-05-93 PML Update for C9.0
+; 01-12-94 PML Move jmp_buf struct here, add new fields
+;
+;******************************************************************************
+
+
+;handler dispositions
+DISPOSITION_DISMISS equ 0
+DISPOSITION_CONTINUE_SEARCH equ 1
+DISPOSITION_NESTED_EXCEPTION equ 2
+DISPOSITION_COLLIDED_UNWIND equ 3
+
+;filter return codes
+FILTER_ACCEPT equ 1
+FILTER_DISMISS equ -1
+FILTER_CONTINUE_SEARCH equ 0
+
+;handler flags settings..
+EXCEPTION_UNWINDING equ 2
+EXCEPTION_EXIT_UNWIND equ 4
+EXCEPTION_UNWIND_CONTEXT equ EXCEPTION_UNWINDING OR EXCEPTION_EXIT_UNWIND
+
+TRYLEVEL_NONE equ -1
+TRYLEVEL_INVALID equ -2
+
+;callback interface codes (mimimal required set)
+CB_GET_MAX_CODE equ 0
+CB_DO_LOCAL_UNWIND equ 1
+CB_GET_FRAME_EBP equ 2
+CB_GET_SCOPE_INDEX equ 3
+CB_GET_SCOPE_DATA equ 4
+MAX_CALLBACK_CODE equ 4
+
+;typedef struct _EXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION;
+;struct _EXCEPTION_REGISTRATION{
+; struct _EXCEPTION_REGISTRATION *prev;
+; void (*handler)(PEXCEPTION_RECORD, PEXCEPTION_REGISTRATION, PCONTEXT, PEXCEPTION_RECORD);
+; struct scopetable_entry *scopetable;
+; int trylevel;
+; int _ebp;
+; PEXCEPTION_POINTERS xpointers;
+;};
+_EXCEPTION_REGISTRATION struc
+ prev dd ?
+ handler dd ?
+_EXCEPTION_REGISTRATION ends
+
+;setjmp/longjmp buffer
+_JMP_BUF struc
+ saved_ebp dd ?
+ saved_ebx dd ?
+ saved_edi dd ?
+ saved_esi dd ?
+ saved_esp dd ?
+ saved_return dd ?
+ saved_xregistration dd ?
+ saved_trylevel dd ?
+ ; following only found in C9.0 or later jmp_buf
+ version_cookie dd ?
+ unwind_func dd ?
+ unwind_data dd 6 dup(?)
+_JMP_BUF ends
+
+; Cookie placed in the jmp_buf to identify the new, longer form
+JMPBUF_COOKIE equ 'VC20'
+
+; Offset of TryLevel in a C8.0 SEH registration node
+C8_TRYLEVEL equ 12
diff --git a/private/crt32/h/fcntl.h b/private/crt32/h/fcntl.h
new file mode 100644
index 000000000..f476cc9f0
--- /dev/null
+++ b/private/crt32/h/fcntl.h
@@ -0,0 +1,84 @@
+/***
+*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]
+*
+*Revision History:
+* 06-19-87 JCR Added O_NOINHERIT
+* 08-18-88 GJF Modified (slightly) to also work for the 386.
+* 08-01-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright
+* 02-28-90 GJF Added #ifndef _INC_FCNTL stuff. Made the definition
+* of O_BINARY a 32-bit constant unconditionally.
+* 01-17-91 GJF ANSI naming.
+* 03-30-92 DJM POSIX support.
+* 05-02-92 SRW Add support for _O_TEMPORARY flag
+* 05-24-93 PML Add support for _O_SHORT_LIVED, _O_SEQUENTIAL,
+* _O_RANDOM
+*
+****/
+
+#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/crt32/h/file2.h b/private/crt32/h/file2.h
new file mode 100644
index 000000000..06c2dddf2
--- /dev/null
+++ b/private/crt32/h/file2.h
@@ -0,0 +1,71 @@
+/***
+*file2.h - auxiliary file structure used internally by file run-time routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the auxiliary file structure used internally by
+* the file run time routines.
+* [Internal]
+*
+*Revision History:
+* 06-29-87 JCR Removed _OLD_IOLBF/_OLD_IOFBF and associated lbuf macro.
+* 09-28-87 JCR Added _iob_index(); modified ybuf() and tmpnum() to use it.
+* 06-03-88 JCR Added _iob2_ macro; modified ybuf()/tmpnum()/_iob_index;
+* also padded FILE2 definition to be the same size as FILE.
+* 06-10-88 JCR Added ybuf2()/bigbuf2()/anybuf2()
+* 06-14-88 JCR Added (FILE *) casts to _iob_index() macro
+* 06-29-88 JCR Added _IOFLRTN bit (flush stream on per routine basis)
+* 08-18-88 GJF Revised to also work with the 386 (small model only).
+* 12-05-88 JCR Added _IOCTRLZ bit (^Z encountered by lowio read)
+* 04-11-89 JCR Removed _IOUNGETC bit (no longer needed)
+* 07-27-89 GJF Cleanup, now specific to the 386. Struct field
+* alignment is now protected by pack pragma.
+* 10-30-89 GJF Fixed copyright
+* 02-16-90 GJF _iob[], _iob2[] merge
+* 02-21-90 GJF Restored _iob_index() macro
+* 02-28-90 GJF Added #ifndef _INC_FILE2 stuff. Also, removed some
+* (now) useless preprocessor directives.
+* 07-11-90 SBM Added _IOCOMMIT bit (lowio commit on fflush call)
+* 03-11-92 GJF Removed _tmpnum() macro for Win32.
+* 06-03-92 KRS Added extern "C" stuff.
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#ifndef _INC_FILE2
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Additional _iobuf[]._flag values */
+
+#define _IOYOURBUF 0x0100
+#define _IOFEOF 0x0800
+#define _IOFLRTN 0x1000
+#define _IOCTRLZ 0x2000
+#define _IOCOMMIT 0x4000
+
+/* Macro for getting _iob[] index */
+
+#define _iob_index(s) ((FILE *)(s) - (FILE *)_iob)
+
+/* General use macros */
+
+#define inuse(s) ((s)->_flag & (_IOREAD|_IOWRT|_IORW))
+#define mbuf(s) ((s)->_flag & _IOMYBUF)
+#define nbuf(s) ((s)->_flag & _IONBF)
+#define ybuf(s) ((s)->_flag & _IOYOURBUF)
+#define bigbuf(s) ((s)->_flag & (_IOMYBUF|_IOYOURBUF))
+#define anybuf(s) ((s)->_flag & (_IOMYBUF|_IONBF|_IOYOURBUF))
+#ifdef _CRUISER_
+#define _tmpnum(s) ((s)->__tmpnum)
+#endif /* _CRUISER_ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_FILE2
+#endif /* _INC_FILE2 */
diff --git a/private/crt32/h/float.h b/private/crt32/h/float.h
new file mode 100644
index 000000000..54e9a3b7e
--- /dev/null
+++ b/private/crt32/h/float.h
@@ -0,0 +1,493 @@
+/***
+*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]
+*
+*Revision History:
+* 08-05-87 PHG added comments
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 07-12-88 JCR Added some close comment delimeters (bug fix)
+* 08-22-88 GJF Modified to also work with the 386 (small model only)
+* 12-16-88 GJF Changed [FLT|DBL|LDBL]_ROUNDS to 1
+* 04-28-89 SKS Put parentheses around negative constants
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-03-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-20-89 KRS Add 'F' to FLT_MAX/MIN/EPSILON consts like in ANSI spec.
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 02-28-90 GJF Added #ifndef _INC_FLOAT and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-22-90 GJF Replaced _cdecl with _CALLTYPE2 (for now).
+* 08-17-90 WAJ Floating point routines now use _stdcall.
+* 09-25-90 GJF Added _fpecode stuff.
+* 08-20-91 JCR C++ and ANSI naming
+* 02-03-91 GDP Added definitions for MIPS
+* 04-03-92 GDP Use abstract control word definitions for all platforms
+* Removed Infinity Control, [EM|SW]_DENORMAL, SW_SQRTNEG
+* 04-14-92 GDP Added Inf. control, [EM|SW]_DENORMAL, SW_SQRTNEG again
+* 05-07-92 GDP Added IEEE recommended functions
+* 08-06-92 GJF Function calling type and variable type macros. Also
+* revised compiler/target processor macro usage.
+* 09-16-92 GJF Added _CRTAPI1 to _copysign - _fpclass prototypes.
+* 11-09-92 GJF Fixed preprocessing conditionals for MIPS.
+* 01-03-93 SRW Fold in ALPHA changes
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_FLOAT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+
+#include <cruntime.h>
+
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 */
+
+
+#ifdef _WIN32_
+#ifndef _DOSX32_
+
+
+/* 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 MTHREAD
+extern int * _CRTAPI1 __fpecode(void);
+#define _fpecode (*__fpecode())
+#else
+extern int _CRTVAR1 _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__ */
+#else /* _DOSX32_ */
+
+/*
+ * 8087/80287 math control information
+ */
+
+
+/* User Control Word Mask and bit definitions.
+ * These definitions match the 8087/80287
+ */
+
+#define _MCW_EM 0x003f /* interrupt Exception Masks */
+#define _EM_INVALID 0x0001 /* invalid */
+#define _EM_DENORMAL 0x0002 /* denormal */
+#define _EM_ZERODIVIDE 0x0004 /* zero divide */
+#define _EM_OVERFLOW 0x0008 /* overflow */
+#define _EM_UNDERFLOW 0x0010 /* underflow */
+#define _EM_INEXACT 0x0020 /* inexact (precision) */
+
+#define _MCW_IC 0x1000 /* Infinity Control */
+#define _IC_AFFINE 0x1000 /* affine */
+#define _IC_PROJECTIVE 0x0000 /* projective */
+
+#define _MCW_RC 0x0c00 /* Rounding Control */
+#define _RC_CHOP 0x0c00 /* chop */
+#define _RC_UP 0x0800 /* up */
+#define _RC_DOWN 0x0400 /* down */
+#define _RC_NEAR 0x0000 /* near */
+
+#define _MCW_PC 0x0300 /* Precision Control */
+#define _PC_24 0x0000 /* 24 bits */
+#define _PC_53 0x0200 /* 53 bits */
+#define _PC_64 0x0300 /* 64 bits */
+
+
+/* initial Control Word value */
+
+#define _CW_DEFAULT ( _IC_AFFINE + _RC_NEAR + _PC_64 + _EM_DENORMAL + _EM_UNDERFLOW + _EM_INEXACT )
+
+/* user Status Word bit definitions */
+
+#define _SW_INVALID 0x0001 /* invalid */
+#define _SW_DENORMAL 0x0002 /* denormal */
+#define _SW_ZERODIVIDE 0x0004 /* zero divide */
+#define _SW_OVERFLOW 0x0008 /* overflow */
+#define _SW_UNDERFLOW 0x0010 /* underflow */
+#define _SW_INEXACT 0x0020 /* inexact (precision) */
+
+
+/* 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 */
+
+
+/* function prototypes */
+
+unsigned int _CRTAPI1 _clear87(void);
+unsigned int _CRTAPI1 _control87(unsigned int,unsigned int);
+void _CRTAPI1 _fpreset(void);
+unsigned int _CRTAPI1 _status87(void);
+
+/* Global variable holding floating point error code */
+
+#ifdef MTHREAD
+extern int * _CRTAPI1 __fpecode(void);
+#define _fpecode (*__fpecode())
+#else
+extern int _CRTVAR1 _fpecode;
+#endif
+
+/* 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 ); */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+
+#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__ */
+
+#endif /* _DOSX32_ */
+
+#else
+
+#error ERROR - ONLY WIN32 TARGET SUPPORTED!
+
+#endif /* _WIN32_ */
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_FLOAT
+#endif /* _INC_FLOAT */
diff --git a/private/crt32/h/fltintrn.h b/private/crt32/h/fltintrn.h
new file mode 100644
index 000000000..5f6cc4d19
--- /dev/null
+++ b/private/crt32/h/fltintrn.h
@@ -0,0 +1,192 @@
+/***
+*fltintrn.h - contains declarations of internal floating point types,
+* routines and variables
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Declares floating point types, routines and variables used
+* internally by the C run-time.
+* [Internal]
+*
+*Revision History:
+* 10-20-88 JCR Changed 'DOUBLE' to 'double' for 386
+* 08-15-89 GJF Fixed copyright, indents
+* 10-30-89 GJF Fixed copyright (again)
+* 03-02-90 GJF Added #ifndef _INC_STRUCT stuff. Also, cleaned up
+* the formatting a bit.
+* 03-05-90 GJF Fixed up the arg types in protoypes. Also, added
+* #include <cruntime.h>
+* 03-22-90 GJF Made _fltin(), _fltin2(), _fltout() and _fltout2()
+* _CALLTYPE2 (for now) and added a prototype for
+* _fptostr().
+* 08-01-90 SBM Moved _cftoe() and _cftof() here from internal.h
+* and _cfltcvt_tab from input.c and output.c,
+* added typedefs for _cfltcvt_tab entries,
+* renamed module from <struct.h> to <fltintrn.h> and
+* adjusted #ifndef stuff to #ifndef _INC_FLTINTRN
+* 08-29-90 SBM Changed type of _cfltcvt_tab[] to agree with
+* definition in cmiscdat.c
+* 04-26-91 SRW Removed level 3 warnings
+* 08-26-91 JCR Changed MIPS to _MIPS_, ANSI naming
+* 08-06-92 GJF Function calling type and variable type macros. Revised
+* use of target processor macros.
+* 11-09-92 GJF Fixed preprocessing conditionals for MIPS.
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 03-31-93 CFW Added #pragma warning to suppress "long double" warnings.
+*
+****/
+
+#ifndef _INC_FLTINTRN
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <cruntime.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
+#define _CRTVAR1
+
+#endif
+
+// C4069: "long double != double"
+#pragma warning(disable:4069) // disable C4069 warning
+// #pragma warning(default:4069) // use this to reenable, if desired
+
+/*
+ * structs used to fool the compiler into not generating floating point
+ * instructions when copying and pushing [long] double values
+ */
+
+#ifndef DOUBLE
+
+typedef struct {
+ double x;
+} DOUBLE;
+
+#endif
+
+#ifndef LONGDOUBLE
+
+typedef struct {
+#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC)
+ /*
+ * No long double type for MIPS, ALPHA, or PPC
+ */
+ double x;
+#else
+ /*
+ * Assume there is a long double type
+ */
+ long double x;
+#endif
+} LONGDOUBLE;
+
+#endif
+
+/*
+ * typedef for _fltout
+ */
+
+typedef struct _strflt
+{
+ int sign; /* zero if positive otherwise negative */
+ int decpt; /* exponent of floating point number */
+ int flag; /* zero if okay otherwise IEEE overflow */
+ char *mantissa; /* pointer to mantissa in string form */
+}
+ *STRFLT;
+
+
+/*
+ * typedef for _fltin
+ */
+
+typedef struct _flt
+{
+ int flags;
+ int nbytes; /* number of characters read */
+ long lval;
+ double dval; /* the returned floating point number */
+}
+ *FLT;
+
+
+/* floating point conversion routines, keep in sync with mrt32\include\convert.h */
+
+char *_cftoe(double *, char *, int, int);
+char *_cftof(double *, char *, int);
+void _CRTAPI1 _fptostr(char *, int, STRFLT);
+
+#ifdef MTHREAD
+
+STRFLT _CRTAPI2 _fltout2( double, STRFLT, char * );
+FLT _CRTAPI2 _fltin2( FLT , const char *, int, int, int );
+
+#else
+
+STRFLT _CRTAPI2 _fltout( double );
+FLT _CRTAPI2 _fltin( const char *, int, int, int );
+
+#endif
+
+
+/*
+ * table of pointers to floating point helper routines
+ *
+ * We can't specify the prototypes for the entries of the table accurately,
+ * since different functions in the table have different arglists.
+ * So we declare the functions to take and return void (which is the
+ * correct prototype for _fptrap(), which is what the entries are all
+ * initialized to if no floating point is loaded) and cast appropriately
+ * on every usage.
+ */
+
+typedef void (* PFV)(void);
+extern PFV _cfltcvt_tab[6];
+
+typedef void (* PF0)(DOUBLE*, char*, int, int, int);
+#define _cfltcvt(a,b,c,d,e) (*((PF0)_cfltcvt_tab[0]))(a,b,c,d,e)
+
+typedef void (* PF1)(char*);
+#define _cropzeros(a) (*((PF1)_cfltcvt_tab[1]))(a)
+
+typedef void (* PF2)(int, char*, char*);
+#define _fassign(a,b,c) (*((PF2)_cfltcvt_tab[2]))(a,b,c)
+
+typedef void (* PF3)(char*);
+#define _forcdecpt(a) (*((PF3)_cfltcvt_tab[3]))(a)
+
+typedef int (* PF4)(DOUBLE*);
+#define _positive(a) (*((PF4)_cfltcvt_tab[4]))(a)
+
+typedef void (* PF5)(LONGDOUBLE*, char*, int, int, int);
+#define _cldcvt(a,b,c,d,e) (*((PF5)_cfltcvt_tab[5]))(a,b,c,d,e)
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_FLTINTRN
+#endif /* _INC_FLTINTRN */
diff --git a/private/crt32/h/fpieee.h b/private/crt32/h/fpieee.h
new file mode 100644
index 000000000..6949fb522
--- /dev/null
+++ b/private/crt32/h/fpieee.h
@@ -0,0 +1,362 @@
+/***
+* 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]
+*
+*Revision History:
+* 03-01-92 GDP written
+* 04-05-92 GDP calling convention macros
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 01-13-94 RDL Added #ifndef _LANGUAGE_ASSEMBLY for asm includes.
+*
+*******************************************************************************/
+
+#ifndef _INC_FPIEEE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 */
+
+
+#ifndef _INTERNAL_IFSTRIP_
+
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+#define OP_UNSPEC _FpCodeUnspecified
+#define OP_ADD _FpCodeAdd
+#define OP_SUB _FpCodeSubtract
+#define OP_MUL _FpCodeMultiply
+#define OP_DIV _FpCodeDivide
+#define OP_REM _FpCodeRemainder
+#define OP_COMP _FpCodeCompare
+#define OP_CVT _FpCodeConvert
+#define OP_RND _FpCodeRound
+#define OP_TRUNC _FpCodeTruncate
+
+#define OP_EXP _FpCodeExp
+
+#define OP_POW _FpCodePow
+#define OP_LOG _FpCodeLog
+#define OP_LOG10 _FpCodeLog10
+#define OP_SINH _FpCodeSinh
+#define OP_COSH _FpCodeCosh
+#define OP_TANH _FpCodeTanh
+#define OP_ASIN _FpCodeAsin
+#define OP_ACOS _FpCodeAcos
+#define OP_ATAN _FpCodeAtan
+#define OP_ATAN2 _FpCodeAtan2
+#define OP_SQRT _FpCodeSquareRoot
+#define OP_SIN _FpCodeSin
+#define OP_COS _FpCodeCos
+#define OP_TAN _FpCodeTan
+#define OP_CEIL _FpCodeCeil
+#define OP_FLOOR _FpCodeFloor
+#define OP_ABS _FpCodeFabs
+#define OP_MODF _FpCodeModf
+#define OP_LDEXP _FpCodeLdexp
+#define OP_CABS _FpCodeCabs
+#define OP_HYPOT _FpCodeHypot
+#define OP_FMOD _FpCodeFmod
+#define OP_FREXP _FpCodeFrexp
+#define OP_Y0 _FpCodeY0
+#define OP_Y1 _FpCodeY1
+#define OP_YN _FpCodeYn
+
+#define OP_LOGB _FpCodeLogb
+#define OP_NEXTAFTER _FpCodeNextafter
+
+#else /* _LANGUAGE_ASSEMBLY */
+
+/* This must be the same as the enumerator _FP_OPERATION_CODE ! */
+#define OP_UNSPEC 0
+#define OP_ADD 1
+#define OP_SUB 2
+#define OP_MUL 3
+#define OP_DIV 4
+#define OP_SQRT 5
+#define OP_REM 6
+#define OP_COMP 7
+#define OP_CVT 8
+#define OP_RND 9
+#define OP_TRUNC 10
+#define OP_FLOOR 11
+#define OP_CEIL 12
+#define OP_ACOS 13
+#define OP_ASIN 14
+#define OP_ATAN 15
+#define OP_ATAN2 16
+#define OP_CABS 17
+#define OP_COS 18
+#define OP_COSH 19
+#define OP_EXP 20
+#define OP_ABS 21 /* same as OP_FABS */
+#define OP_FABS 21 /* same as OP_ABS */
+#define OP_FMOD 22
+#define OP_FREXP 23
+#define OP_HYPOT 24
+#define OP_LDEXP 25
+#define OP_LOG 26
+#define OP_LOG10 27
+#define OP_MODF 28
+#define OP_POW 29
+#define OP_SIN 30
+#define OP_SINH 31
+#define OP_TAN 32
+#define OP_TANH 33
+#define OP_Y0 34
+#define OP_Y1 35
+#define OP_YN 36
+#define OP_LOGB 37
+#define OP_NEXTAFTER 38
+#define OP_NEG 39
+
+
+
+#endif /* _LANGUAGE_ASSEMBLY */
+
+#endif /* _INTERNAL_IFSTRIP_ */
+
+
+/*
+ * 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;
+
+#ifndef _INTERNAL_IFSTRIP_
+
+typedef struct {
+ unsigned long W[4];
+} _U32ARRAY;
+
+#endif /* _INTERNAL_IFSTRIP_ */
+
+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;
+#ifndef _INTERNAL_IFSTRIP_
+ _U32ARRAY U32ArrayValue;
+#endif /* _INTERNAL_IFSTRIP_ */
+ } 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/crt32/h/fstream.h b/private/crt32/h/fstream.h
new file mode 100644
index 000000000..aba7b09cd
--- /dev/null
+++ b/private/crt32/h/fstream.h
@@ -0,0 +1,145 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 08-19-92 KRS Remove sh_compat for NT.
+* 02-23-93 SKS Update copyright to 1993
+* 03-23-93 CFW Modified #pragma warnings.
+*
+****/
+
+#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/crt32/h/heap.h b/private/crt32/h/heap.h
new file mode 100644
index 000000000..2650fe8b2
--- /dev/null
+++ b/private/crt32/h/heap.h
@@ -0,0 +1,433 @@
+/***
+* heap.h - Heap code include file
+*
+* Copyright (c) 1988-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains information needed by the C library heap code.
+* [Internal]
+*
+*Revision History:
+* 05-16-89 JCR Module created
+* 06-02-89 GJF Removed naming conflict
+* 06-29-89 JCR Completely new for "New heap - rev 2"
+* 06-29-89 GJF Added _HDRSIZE, fixed some minor glitches.
+* 06-29-89 GJF Added _BLKSIZE(), fixed more minor bugs.
+* 06-30-89 GJF Changed several macros to operate on a pointer to a
+* descriptor, rather than a descriptor itself.
+* 06-30-89 JCR Corrected/updated several macros
+* 07-06-89 JCR Added region support, misc improvements, etc.
+* 07-07-89 GJF Minor bug in _ROUND() macro
+* 07-07-89 JCR Added _DUMMY status
+* 07-19-89 GJF Removed _PBACKPTR macro
+* 07-20-89 JCR Region routine prototypes, _HEAPFIND values
+* 07-21-89 JCR #define _heap_growsize to _amblksiz for compatibility
+* 07-25-89 GJF Added prototypes for calloc, free and malloc
+* 07-28-89 GJF Added prototype for _msize
+* 08-28-89 JCR Added _HEAP_COALESCE value
+* 10-30-89 GJF Fixed copyright
+* 11-03-89 GJF Added _DISTTOBNDRY(), _NEXTSEGBNDRY() macros and
+* prototypes for _flat_malloc(), _heap_advance_rover(),
+* _heap_split_block() functions
+* 11-07-89 GJF Added _SEGSIZE_, added prototype for _heap_search()
+* restored function prototype for_heap_grow_region()
+* 11-08-89 JCR Added non-pow2 rounding macro
+* 11-10-89 JCR Added _heap_free_region prototype
+* 11-10-89 GJF Added prototypes and macros for multi-thread support
+* 11-16-89 JCR If DEBUG defined include <assert.h>, added sanity check
+* 12-13-89 GJF Removed prototypes duplicated in malloc.h
+* 12-20-89 GJF Removed plastdesc from _heap_desc_ struct, removed
+* _DELHEAP and _ADDHEAP macros (unused and wrong), added
+* explicit _cdecl to function prototypes
+* 01-08-89 GJF Use assert macro from assertm.h instead of assert.h
+* 03-01-90 GJF Added #ifndef _INC_HEAP and #include <cruntime.h>
+* stuff. Also, removed some unused DEBUG286 stuff.
+* 03-22-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes.
+* 07-25-90 SBM Replaced <assertm.h> by <assert.h>
+* 08-13-90 SBM Added casts to macros for clean compiles at -W3
+* 12-28-90 SRW Fixed _heap_split_block prototype to match code
+* 12-28-90 SRW Changed _HEAP_GROWSIZE to be 0x10000 [_WIN32_]
+* 03-05-91 GJF Added decl for _heap_resetsize, removed proto for
+* _heap_advance_rover (both conditioned on _OLDROVER_
+* not being #define-d).
+* 03-13-91 GJF Made _HEAP_GROWSIZE 32K for [_CRUISER_].
+* 04-09-91 PNT Added _MAC_ definitions
+* 08-20-91 JCR C++ and ANSI naming
+* 03-30-92 DJM POSIX support.
+* 08-06-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+*******************************************************************************/
+
+#ifdef _POSIX_ /* Since the heap routines are the same as WIN32 under
+ POSIX, define _WIN32_ if we are in POSIX */
+
+#define _WIN32_
+#endif
+
+#ifndef _INC_HEAP
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <cruntime.h>
+
+#ifdef DEBUG
+#include <assert.h>
+#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
+
+
+/*
+ * Heap block descriptor
+ */
+
+struct _block_descriptor {
+ struct _block_descriptor *pnextdesc; /* ptr to next descriptor */
+ void *pblock; /* ptr to memory block */
+};
+
+#define _BLKDESC struct _block_descriptor
+#define _PBLKDESC struct _block_descriptor *
+
+
+/*
+ * Useful Constants
+ */
+
+/* size of the header in a memory block */
+#define _HDRSIZE sizeof(void *)
+
+/* _heapchk/_heapset parameter */
+#define _HEAP_NOFILL 0x7FFFFFF
+
+
+/*
+ * Descriptor status values
+ */
+
+#define _INUSE 0
+#define _FREE 1
+#define _DUMMY 2
+
+
+#if (_INUSE != 0)
+#error *** Heap code assumes _INUSE value is 0! ***
+#endif
+
+
+/*
+ * Macros for manipulating heap memory block descriptors
+ * stat = one of the status values
+ * addr = user-visible address of a heap block
+ */
+
+#define _STATUS_MASK 0x3 /* last 2 bits are status */
+
+#define _ADDRESS(pdesc) ( (void *) ((unsigned)((pdesc)->pblock) & \
+ (~_STATUS_MASK)) )
+#define _STATUS(pdesc) ( (unsigned) ((unsigned)((pdesc)->pblock) & \
+ _STATUS_MASK) )
+
+#define _SET_INUSE(pdesc) ( pdesc->pblock = (void *) \
+ ((unsigned)_ADDRESS(pdesc) | _INUSE) )
+#define _SET_FREE(pdesc) ( pdesc->pblock = (void *) \
+ ((unsigned)_ADDRESS(pdesc) | _FREE) )
+#define _SET_DUMMY(pdesc) ( pdesc->pblock = (void *) \
+ ((unsigned)_ADDRESS(pdesc) | _DUMMY) )
+
+#define _IS_INUSE(pdesc) ( _STATUS(pdesc) == _INUSE )
+#define _IS_FREE(pdesc) ( _STATUS(pdesc) == _FREE )
+#define _IS_DUMMY(pdesc) ( _STATUS(pdesc) == _DUMMY )
+
+#define _BLKSIZE(pdesc) ( (unsigned) ( \
+ (char *)_ADDRESS(pdesc->pnextdesc) - \
+ (char *)_ADDRESS(pdesc) - _HDRSIZE ) )
+
+#define _MEMSIZE(pdesc) ( (char *)_ADDRESS(pdesc->pnextdesc) - \
+ (char *)_ADDRESS(pdesc) )
+
+#define _BACKPTR(addr) ( *(_PBLKDESC*)((char *)(addr) - _HDRSIZE) )
+
+#define _CHECK_PDESC(pdesc) ( (*(_PBLKDESC*) (_ADDRESS(pdesc))) == pdesc )
+
+#define _CHECK_BACKPTR(addr) ( ((char *)(_BACKPTR(addr)->pblock) + _HDRSIZE) \
+ == addr)
+
+
+/*
+ * Heap descriptor
+ */
+
+struct _heap_desc_ {
+
+ _PBLKDESC pfirstdesc; /* pointer to first descriptor */
+ _PBLKDESC proverdesc; /* rover pointer */
+ _PBLKDESC emptylist; /* pointer to empty list */
+
+ _BLKDESC sentinel; /* Sentinel block for end of heap list */
+
+};
+
+extern struct _heap_desc_ _heap_desc;
+
+
+/*
+ * Region descriptor and heap grow data
+ */
+
+struct _heap_region_ {
+ void * _regbase; /* base address of region */
+ unsigned _currsize; /* current size of region */
+ unsigned _totalsize; /* total size of region */
+ };
+
+#ifndef _OLDROVER_
+extern unsigned int _heap_resetsize;
+#endif /* _OLDROVER_ */
+#define _heap_growsize _amblksiz
+extern unsigned int _heap_regionsize;
+extern struct _heap_region_ _heap_regions[];
+
+#ifdef _M_ALPHA
+#define _PAGESIZE_ 0x2000 /* Alpha has 8k pages */
+#else
+#define _PAGESIZE_ 0x1000 /* one page */
+#endif
+
+#define _SEGSIZE_ 0x10000 /* one segment (i.e., 64 Kb) */
+#define _HEAP_REGIONMAX 0x10 /* Max number of regions */
+#define _HEAP_REGIONSIZE 0x400000 /* Default region size (4 meg) */
+
+#ifdef _CRUISER_ /* CRUISER TARGET */
+#define _HEAP_GROWSIZE 0x8000 /* Default grow increment (32K) */
+#else /* ndef _CRUISER_ */
+
+#ifdef _WIN32_
+#define _HEAP_GROWSIZE 0x10000 /* Default grow increment (64K) */
+#else /* ndef _WIN32_ */
+
+#ifdef _MAC_
+#define _HEAP_GROWSIZE 0x8000 /* Default grow increment (32K) */
+#else /* ndef _MAC_ */
+
+#error ERROR - ONLY CRUISER, WIN32, OR MAC TARGET SUPPORTED!
+
+#endif /* _MAC_ */
+
+#endif /* _WIN32_ */
+
+#endif /* _CRUISER_ */
+
+#define _HEAP_GROWMIN _PAGESIZE_ /* Minimum grow inc (1 page) */
+#define _HEAP_GROWSTART _PAGESIZE_ /* Startup grow increment */
+#define _HEAP_COALESCE -1 /* Coalesce heap value */
+
+/*
+ * Values returned by _heap_findaddr() routine
+ */
+
+#define _HEAPFIND_EXACT 0 /* found address exactly */
+#define _HEAPFIND_WITHIN 1 /* address is within a block */
+#define _HEAPFIND_BEFORE -1 /* address before beginning of heap */
+#define _HEAPFIND_AFTER -2 /* address after end of heap */
+#define _HEAPFIND_EMPTY -3 /* address not found: empty heap */
+
+/*
+ * Arguments to _heap_param
+ */
+
+#define _HP_GETPARAM 0 /* get heap parameter value */
+#define _HP_SETPARAM 1 /* set heap parameter value */
+
+#define _HP_AMBLKSIZ 1 /* get/set _amblksiz value (aka */
+#define _HP_GROWSIZE _HP_AMBLKSIZ /* _heap_growsize */
+#define _HP_RESETSIZE 2 /* get/set _heap_resetsize value */
+
+
+/*
+ * Macros to round numbers
+ *
+ * _ROUND2 = rounds a number up to a power of 2
+ * _ROUND = rounds a number up to any other numer
+ *
+ * n = number to be rounded
+ * pow2 = must be a power of two value
+ * r = any number
+ */
+
+#define _ROUND2(n,pow2) \
+ ( ( n + pow2 - 1) & ~(pow2 - 1) )
+
+#define _ROUND(n,r) \
+ ( ( (n/r) + ((n%r)?1:0) ) * r)
+
+/*
+
+ Macros for accessing heap descriptor lists:
+
+ _GETEMPTY(x) = Returns a pointer to an empty heap desc
+ _PUTEMPTY(x) = Puts an empty heap desc on the empty list
+
+ (x = _PBLKDESC = pointer to heap block descriptor)
+*/
+
+#ifdef DEBUG
+
+#define _GETEMPTY(x) \
+{ \
+ if (_heap_desc.emptylist == NULL) \
+ _heap_grow_emptylist(); \
+ \
+ x = _heap_desc.emptylist; \
+ \
+ assert(("bad descriptor in empty list", x->pblock == NULL)); \
+ \
+ _heap_desc.emptylist = _heap_desc.emptylist->pnextdesc; \
+}
+
+#define _PUTEMPTY(x) \
+{ \
+ x->pnextdesc = _heap_desc.emptylist; \
+ \
+ x->pblock = NULL; \
+ \
+ _heap_desc.emptylist = x; \
+}
+
+#else
+
+#define _GETEMPTY(x) \
+{ \
+ if (_heap_desc.emptylist == NULL) \
+ _heap_grow_emptylist(); \
+ \
+ x = _heap_desc.emptylist; \
+ \
+ _heap_desc.emptylist = _heap_desc.emptylist->pnextdesc; \
+}
+
+#define _PUTEMPTY(x) \
+{ \
+ x->pnextdesc = _heap_desc.emptylist; \
+ \
+ _heap_desc.emptylist = x; \
+}
+
+#endif
+
+
+/*
+ * Macros for finding the next 64 Kb boundary from a pointer
+ */
+
+#define _NXTSEGBNDRY(p) ((void *)((unsigned)(p) & 0xffff0000 + 0x10000))
+
+#define _DISTTOBNDRY(p) ((unsigned)(0x10000 - (0x0000ffff & (unsigned)(p))))
+
+
+/*
+ * Define size_t type (if necessary)
+ */
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+
+/*
+ * Prototypes
+ */
+
+void * _CRTAPI1 _flat_malloc(size_t);
+void _CRTAPI1 _heap_abort(void);
+int _CRTAPI1 _heap_addblock(void *, unsigned int);
+
+#ifdef _OLDROVER_
+void _CRTAPI1 _heap_advance_rover(void);
+#endif /* _OLDROVER_ */
+
+void _CRTAPI1 _heap_free_region(int);
+int _CRTAPI1 _heap_findaddr(void *, _PBLKDESC *);
+int _CRTAPI1 _heap_grow(unsigned int);
+void _CRTAPI1 _heap_grow_emptylist(void);
+int _CRTAPI1 _heap_grow_region(unsigned, size_t);
+void _CRTAPI1 _heap_init(void);
+
+#ifndef _OLDROVER_
+int _CRTAPI1 _heap_param(int, int, void *);
+#endif /* _OLDROVER_ */
+
+_PBLKDESC _CRTAPI1 _heap_search(unsigned size);
+void _CRTAPI1 _heap_split_block(_PBLKDESC, size_t);
+
+#ifdef DEBUG
+void _CRTAPI1 _heap_print_all(void);
+void _CRTAPI1 _heap_print_regions(void);
+void _CRTAPI1 _heap_print_desc(void);
+void _CRTAPI1 _heap_print_emptylist(void);
+void _CRTAPI1 _heap_print_heaplist(void);
+#endif
+
+
+/*
+ * Prototypes and macros for multi-thread support
+ */
+
+#ifdef MTHREAD
+
+void _CRTAPI1 _free_lk(void *);
+void * _CRTAPI1 _malloc_lk(size_t);
+size_t _CRTAPI1 _msize_lk(void *);
+
+#ifdef DEBUG
+void _CRTAPI1 _heap_print_regions_lk(void);
+void _CRTAPI1 _heap_print_desc_lk(void);
+void _CRTAPI1 _heap_print_emptylist_lk(void);
+void _CRTAPI1 _heap_print_heaplist_lk(void);
+#endif
+
+#else /* ndef MTHREAD */
+
+#define _malloc_lk(s) malloc(s)
+#define _free_lk(p) free(p)
+#define _msize_lk(p) _msize(p)
+
+#ifdef DEBUG
+#define _heap_print_regions_lk() _heap_print_regions()
+#define _heap_print_desc_lk() _heap_print_desc()
+#define _heap_print_emptylist_lk() _heap_print_emptylist()
+#define _heap_print_heaplist_lk() _heap_print_heaplist()
+#endif
+
+#endif /* MTHREAD */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_HEAP
+#endif /* _INC_HEAP */
diff --git a/private/crt32/h/internal.h b/private/crt32/h/internal.h
new file mode 100644
index 000000000..8609f63bc
--- /dev/null
+++ b/private/crt32/h/internal.h
@@ -0,0 +1,359 @@
+/***
+*internal.h - contains declarations of internal routines and variables
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Declares routines and variables used internally by the C run-time.
+* [Internal]
+*
+*Revision History:
+* 05-18-87 SKS Module created
+* 07-15-87 JCR Added _old_pfxlen and _tempoff
+* 08-05-87 JCR Added _getbuf (corrected by SKS)
+* 11-05-87 JCR Added _buferr
+* 11-18-87 SKS Add __tzset(), made _isindst() near, remove _dtoxmode
+* 01-26-88 SKS Make __tzset, _isindst, _dtoxtime near/far for QC
+* 02-10-88 JCR Cleaned up white space
+* 06-22-88 SKS _canonic/_getcdrv are now used by all models
+* 06-29-88 JCR Removed static buffers _bufout and _buferr
+* 08-18-88 GJF Revised to also work for the 386 (small model only).
+* 09-22-88 GJF Added declarations for _freebuf, _stbuf and _ftbuf.
+* 01-31-89 JCR Removed _canonic, _getcdrv, _getcdwd (see direct.h)
+* 06-07-89 PHG Added _dosret for i860 (N10) version of libs
+* 07-05-89 PHG Changed above to _dosmaperr, added startup variables
+* 08-17-89 GJF Cleanup, removed stuff not needed for 386
+* 10-25-89 JCR Added prototype for _getpath()
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-01-90 GJF Added #ifndef _INC_INTERNAL and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessing
+* directives.
+* 03-21-90 GJF Put _CALLTYPE1 into prototypes.
+* 03-26-90 GJF Added prototypes for _output() and _input(). Filled
+* out the prototype for _openfile
+* 04-05-90 GJF Added prototype for __NMSG_WRITE() (C source build
+* only).
+* 04-10-90 GJF Added prototypes for startup functions.
+* 05-28-90 SBM Added _flush()
+* 07-11-90 SBM Added _commode, removed execload()
+* 07-20-90 SBM Changes supporting clean -W3 compiles (added _cftoe
+* and _cftof prototypes)
+* 08-01-90 SBM Moved _cftoe() and _cftof() to new header
+* <fltintrn.h>, formerly named <struct.h>
+* 08-21-90 GJF Changed prototypes for _amsg_exit() and _NMSG_WRITE().
+* 11-29-90 GJF Added some defs/decls for lowio under Win32.
+* 12-04-90 SRW Added _osfile back for win32. Changed _osfinfo from
+* an array of structures to an array of 32-bit handles
+* (_osfhnd)
+* 04-06-91 GJF Changed _heapinit to _heap_init.
+* 08-19-91 JCR Added _exitflag
+* 08-20-91 JCR C++ and ANSI naming
+* 01-05-92 GJF Added declaration for termination done flag [_WIN32_]
+* 01-08-92 GJF Added prototype for _GetMainArgs.
+* 01-18-92 GJF Added _aexit_rtn.
+* 01-22-92 GJF Fixed definitions of _acmdln and _aexit_rtn for the
+* of crtdll.dll, crtdll.lib.
+* 01-29-92 GJF Added support for linked-in options equivalent to
+* commode.obj and setargv.obj (i.e., special declarations
+* for _commode and _dowildcard).
+* 02-14-92 GJF Replace _nfile with _nhandle for Win32. Also, added
+* #define-s for _NHANDLE_.
+* 03-17-92 GJF Removed declaration of _tmpoff for Win32.
+* 03-30-92 DJM POSIX support.
+* 04-27-92 GJF Added prototypes for _ValidDrive (in stat.c).
+* 05-28-92 GJF Added prototype for _mtdeletelocks() for Win32.
+* 06-02-92 SKS Move prototype for _pgmptr to <DOS.H>
+* 06-02-92 KRS Added prototype for _woutput().
+* 08-06-92 GJF Function calling type and variable type macros.
+* 08-17-92 KRS Added prototype for _winput().
+* 08-21-92 GJF Merged last two changes above.
+* 08-24-92 PBS Added _dstoffset for posix TZ
+* 10-24-92 SKS Add a fourth parameter to _GetMainArgs: wildcard flag
+* _GetMainArgs => __GetMainArgs: 2 leading _'s = internal
+* 10-24-92 SKS Remove two unnecessary parameters from _cenvarg()
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 03-30-93 GJF __gmtotime_t supercedes _dtoxtime.
+* 04-17-93 SKS Add _mtterm
+* 05-11-93 SKS _mtinit now returns success (1) or failure (0)
+* _C_Termination_Done needed in all models (for DLLs)
+* 06-02-93 CFW Add _flswbuf, _filwbuf protos.
+* 07-15-93 SRW Added _capture_argv function prototype
+* 09-22-93 CFW Test for invalid MB chars using global preset flag.
+*
+****/
+
+#ifndef _INC_INTERNAL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <cruntime.h>
+
+/* Define function type used in several startup sources */
+
+typedef void (__cdecl *_PVFV)(void);
+
+
+/*
+ * 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
+
+
+#ifdef _DLL
+#define _commode (*_commode_dll)
+extern int * _commode_dll;
+#else
+#ifdef CRTDLL
+#define _commode _commode_dll
+#endif
+extern int _commode;
+#endif
+
+#ifdef _WIN32_
+
+/*
+ * Define the number of supported handles. This definition must exactly match
+ * the one in os2dll.h.
+ */
+#ifdef MTHREAD
+#define _NHANDLE_ 256
+#else
+#define _NHANDLE_ 64
+#endif
+
+extern int _nhandle; /* == _NHANDLE_, set in ioinit.c */
+
+#else /* ndef _WIN32_ */
+
+extern int _nfile;
+
+#endif /* _WIN32_ */
+
+extern char _osfile[];
+
+#ifdef _WIN32_
+extern long _osfhnd[];
+int _CRTAPI1 _alloc_osfhnd(void);
+int _CRTAPI1 _free_osfhnd(int);
+int _CRTAPI1 _set_osfhnd(int,long);
+#endif /* _WIN32_ */
+
+#ifdef _POSIX_
+extern long _dstoffset;
+#endif /* _POSIX_ */
+
+extern char __dnames[];
+extern char __mnames[];
+
+extern int _days[];
+extern int _lpdays[];
+
+#ifndef _TIME_T_DEFINED
+typedef long time_t; /* time value */
+#define _TIME_T_DEFINED /* avoid multiple def's of time_t */
+#endif
+
+extern time_t _CRTAPI1 __gmtotime_t(int, int, int, int, int, int);
+
+#ifdef _TM_DEFINED
+extern int _CRTAPI1 _isindst(struct tm *);
+#endif
+
+extern void _CRTAPI1 __tzset(void);
+#ifdef _POSIX_
+extern void _CRTAPI1 _tzset(void);
+#endif
+
+extern int _CRTAPI1 _ValidDrive(unsigned);
+
+
+/**
+** This variable is in the C start-up; the length must be kept synchronized
+** It is used by the *cenvarg.c modules
+**/
+
+extern char _acfinfo[]; /* "_C_FILE_INFO=" */
+
+#define CFI_LENGTH 12 /* "_C_FILE_INFO" is 12 bytes long */
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+#ifndef _VA_LIST_DEFINED
+#if defined(_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
+
+/*
+ * stdio internals
+ */
+#ifdef _FILE_DEFINED
+
+extern FILE * _lastiob;
+
+FILE * _CRTAPI1 _getstream(void);
+#ifdef _POSIX_
+FILE * _CRTAPI1 _openfile(const char *, const char *, FILE *);
+#else
+FILE * _CRTAPI1 _openfile(const char *, const char *, int, FILE *);
+#endif
+void _CRTAPI1 _getbuf(FILE *);
+int _CRTAPI1 _filwbuf (FILE *);
+int __cdecl _flswbuf(int, FILE *);
+void _CRTAPI1 _freebuf(FILE *);
+int _CRTAPI1 _stbuf(FILE *);
+void _CRTAPI1 _ftbuf(int, FILE *);
+int _CRTAPI1 _output(FILE *, const char *, va_list);
+int _CRTAPI1 _woutput(FILE *, const wchar_t *, va_list);
+int _CRTAPI1 _input(FILE *, const unsigned char *, va_list);
+int _CRTAPI1 _winput(FILE *, const wchar_t *, va_list);
+int _CRTAPI1 _flush(FILE *);
+void _CRTAPI1 _endstdio(void);
+
+#endif
+
+extern int __invalid_mb_chars;
+
+extern int _cflush;
+
+#ifdef _CRUISER_
+extern unsigned int _tmpoff;
+#endif /* _CRUISER_ */
+
+extern unsigned int _tempoff;
+
+extern unsigned int _old_pfxlen;
+
+extern int _umaskval; /* the umask value */
+
+extern char _pipech[]; /* pipe lookahead */
+
+extern char _exitflag; /* callable termination flag */
+
+#if defined(_WIN32_)
+extern int _C_Termination_Done; /* termination done flag */
+#endif /* _WIN32_ */
+
+char * _CRTAPI1 _getpath(const char *, char *, unsigned);
+
+/* startup set values */
+extern char **__argv; /* argument vector */
+extern int __argc; /* argument count */
+extern char *_aenvptr; /* environment ptr */
+
+/* command line */
+#ifdef _DLL
+#define _acmdln (*_acmdln_dll)
+extern char **_acmdln_dll;
+#else
+#ifdef CRTDLL
+#define _acmdln _acmdln_dll
+#endif
+extern char *_acmdln;
+#endif
+
+/*
+ * prototypes for internal startup functions
+ */
+int _CRTAPI1 _cwild(void); /* wild.c */
+char * _CRTAPI1 _find(char *); /* stdarg.asm or stdargv.c */
+#ifdef MTHREAD
+int _CRTAPI1 _mtinit(void); /* tidtable.asm */
+void _CRTAPI1 _mtinitlocks(void); /* mlock.asm */
+void _CRTAPI1 _mtterm(void); /* tidtable.asm */
+void _CRTAPI1 _mtdeletelocks(void); /* mlock.asm */
+#endif
+
+/*
+ * C source build only!!!!
+ *
+ * more prototypes for internal startup functions
+ */
+void _CRTAPI1 _amsg_exit(int); /* crt0.c */
+void _CRTAPI1 _cinit(void); /* crt0dat.c */
+void _CRTAPI1 __doinits(void); /* astart.asm */
+void _CRTAPI1 __doterms(void); /* astart.asm */
+void _CRTAPI1 __dopreterms(void); /* astart.asm */
+void _CRTAPI1 _FF_MSGBANNER(void);
+void _CRTAPI1 _fptrap(void); /* crt0fp.c */
+void _CRTAPI1 _heap_init(void);
+#ifdef _WIN32_
+void _CRTAPI1 _ioinit(void); /* crt0.c, crtlib.c */
+#endif /* _WIN32_ */
+void _CRTAPI1 _NMSG_WRITE(int);
+void _CRTAPI1 _setargv(void); /* setargv.c, stdargv.c */
+void _CRTAPI1 __setargv(void); /* stdargv.c */
+void _CRTAPI1 _setenvp(void); /* stdenvp.c */
+
+#ifdef _DLL
+#define _aexit_rtn (*_aexit_rtn_dll)
+extern void (_CRTAPI1 ** _aexit_rtn_dll)(int);
+#else
+#ifdef CRTDLL
+#define _aexit_rtn _aexit_rtn_dll
+#endif
+extern void (_CRTAPI1 * _aexit_rtn)(int);
+#endif
+
+#ifdef _WIN32_
+#if defined(_DLL) || defined(CRTDLL)
+void _CRTAPI1 __GetMainArgs(int *, char ***, char ***, int);
+#endif
+#endif /* _WIN32_ */
+
+/*
+ * C source build only!!!!
+ *
+ * map OS/2 errors into Xenix errno values -- for modules written in C
+ */
+extern void _CRTAPI1 _dosmaperr(unsigned long);
+
+/*
+ * internal routines used by the exec/spawn functions
+ */
+
+extern int _CRTAPI1 _dospawn(int, const char *, char *, char *);
+extern int _CRTAPI1 _cenvarg(const char * const *, const char * const *,
+ char **, char **, const char *);
+extern char ** _CRTAPI1 _capture_argv(
+ va_list *,
+ const char *,
+ char **,
+ size_t
+ );
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_INTERNAL
+#endif /* _INC_INTERNAL */
diff --git a/private/crt32/h/io.h b/private/crt32/h/io.h
new file mode 100644
index 000000000..e41025c7a
--- /dev/null
+++ b/private/crt32/h/io.h
@@ -0,0 +1,236 @@
+/***
+*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.
+*
+*Revision History:
+* 10/20/87 JCR Removed "MSC40_ONLY" entries
+* 11/09/87 JCR Multi-thread support
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-17-87 JCR Added _MTHREAD_ONLY comments
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-19-88 GJF Modified to also work for the 386 (small model only)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-03-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 08-14-89 GJF Added prototype for _pipe()
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-17-89 GJF read() should take "void *" not "char *", write()
+* should take "const void *" not "char *". Also,
+* added const to appropriate arg types for access(),
+* chmod(), creat(), open() and sopen()
+* 03-01-90 GJF Added #ifndef _INC_IO and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 or _CALLTYPE2 in
+* prototypes.
+* 05-28-90 SBM Added _commit()
+* 01-18-91 GJF ANSI naming.
+* 02-25-91 SRW Exposed _get_osfhandle and _open_osfhandle [_WIN32_]
+* 08-01-91 GJF No _pipe for Dosx32.
+* 08-20-91 JCR C++ and ANSI naming
+* 08-26-91 BWM Added _findfirst, etc.
+* 09-16-91 BWM Changed find handle type to long.
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 03-30-92 DJM POSIX support.
+* 06-23-92 GJF // is non-ANSI comment delimiter.
+* 08-06-92 GJF Function calling type and variable type macros.
+* 08-25-92 GJF For POSIX build, #ifdef-ed out all but some internally
+* used macros (and these are stripped out on release).
+* 09-03-92 GJF Merge two changes above.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 05-11-93 SKS Increased name buffer in finddata structure to 260 bytes.
+*
+****/
+
+#ifndef _INC_IO
+
+#ifndef _POSIX_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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, ...);
+#ifndef _DOSX32_
+int _CRTAPI1 _pipe(int *, unsigned int, int);
+#endif /* _DOSX32_ */
+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);
+
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+int _CRTAPI1 _chsize_lk(int,long); /* _MTHREAD_ONLY */
+int _CRTAPI1 _close_lk(int); /* _MTHREAD_ONLY */
+long _CRTAPI1 _lseek_lk(int, long, int); /* _MTHREAD_ONLY */
+int _CRTAPI1 _setmode_lk(int, int); /* _MTHREAD_ONLY */
+int _CRTAPI1 _read_lk(int, void *, unsigned int); /* _MTHREAD_ONLY */
+int _CRTAPI1 _write_lk(int, const void *, unsigned int); /* _MTHREAD_ONLY */
+#else /* not MTHREAD */ /* _MTHREAD_ONLY */
+#define _chsize_lk(fh,size) _chsize(fh,size) /* _MTHREAD_ONLY */
+#define _close_lk(fh) _close(fh) /* _MTHREAD_ONLY */
+#define _lseek_lk(fh,offset,origin) _lseek(fh,offset,origin) /* _MTHREAD_ONLY */
+#define _setmode_lk(fh,mode) _setmode(fh,mode) /* _MTHREAD_ONLY */
+#define _read_lk(fh,buff,count) _read(fh,buff,count) /* _MTHREAD_ONLY */
+#define _write_lk(fh,buff,count) _write(fh,buff,count) /* _MTHREAD_ONLY */
+#endif /* _MTHREAD_ONLY */
+
+#ifdef _WIN32_
+long _CRTAPI1 _get_osfhandle(int);
+int _CRTAPI1 _open_osfhandle(long, int);
+#endif /* _WIN32_ */
+
+#if !(__STDC__ || defined(__cplusplus))
+/* Non-ANSI names for compatibility */
+#ifndef _DOSX32_
+#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
+#else
+int _CRTAPI1 access(const char *, int);
+int _CRTAPI1 chmod(const char *, int);
+int _CRTAPI1 chsize(int, long);
+int _CRTAPI1 close(int);
+int _CRTAPI1 creat(const char *, int);
+int _CRTAPI1 dup(int);
+int _CRTAPI1 dup2(int, int);
+int _CRTAPI1 eof(int);
+long _CRTAPI1 filelength(int);
+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 read(int, void *, unsigned int);
+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);
+#endif
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#else /* _MTHREAD_ONLY */
+#define _close_lk(fh) close(fh) /* _MTHREAD_ONLY */
+#define _lseek_lk(fh,offset,origin) lseek(fh,offset,origin) /* _MTHREAD_ONLY */
+#define _read_lk(fh,buff,count) read(fh,buff,count) /* _MTHREAD_ONLY */
+#define _write_lk(fh,buff,count) write(fh,buff,count) /* _MTHREAD_ONLY */
+
+#endif /* _POSIX_ */
+
+#define _INC_IO
+#endif /* _INC_IO */
diff --git a/private/crt32/h/iomanip.h b/private/crt32/h/iomanip.h
new file mode 100644
index 000000000..43d8980b3
--- /dev/null
+++ b/private/crt32/h/iomanip.h
@@ -0,0 +1,133 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 02-23-93 SKS Update copyright to 1993
+* 06-08-93 SKS Add "const" keyword in declaration operator >> & <<
+*
+****/
+
+#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/crt32/h/ios.h b/private/crt32/h/ios.h
new file mode 100644
index 000000000..40234d308
--- /dev/null
+++ b/private/crt32/h/ios.h
@@ -0,0 +1,272 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 03-02-92 KRS Added locks for multithread support.
+* 06-03-92 KRS Add NULL definition here too, for convenience.
+* 08-27-92 KRS Removed bogus 'short' defs from private section.
+* 02-23-93 SKS Update copyright to 1993
+* 03-23-93 CFW Modified #pragma warnings.
+*
+****/
+
+#ifndef _INC_IOS
+#define _INC_IOS
+
+#ifndef _INTERNAL_IFSTRIP_
+#ifdef COMBOINC
+#if defined(_DLL) && !defined(MTHREAD)
+#error Cannot define _DLL without MTHREAD
+#endif
+#endif
+
+#endif /* !_INTERNAL_IFSTRIP_ */
+
+#ifdef MTHREAD
+#ifndef _INTERNAL_IFSTRIP_
+// CONSIDER: change implementation so crit. sect. not exposed
+#include <oscalls.h> // critical section declarations
+#else /* !_INTERNAL_IFSTRIP_ */
+#include <windows.h> // critical section declarations
+#endif /* !_INTERNAL_IFSTRIP_ */
+
+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 MTHREAD
+ 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 MTHREAD
+ 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 MTHREAD
+#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 MTHREAD
+ 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/crt32/h/iostream.h b/private/crt32/h/iostream.h
new file mode 100644
index 000000000..6c07ea39e
--- /dev/null
+++ b/private/crt32/h/iostream.h
@@ -0,0 +1,90 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 02-23-92 KRS Added cruntime.h.
+* 02-23-93 SKS Update copyright to 1993
+* 03-23-93 CFW Modified #pragma warnings.
+*
+****/
+
+#ifndef _INC_IOSTREAM
+#define _INC_IOSTREAM
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#ifdef COMBOINC
+#if defined(_DLL) && !defined(MTHREAD)
+#error Cannot define _DLL without MTHREAD
+#endif
+#endif
+
+// temp hack
+#ifndef _WINSTATIC
+#define _WINSTATIC
+#endif
+
+#endif /* !_INTERNAL_IFSTRIP_ */
+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/crt32/h/istream.h b/private/crt32/h/istream.h
new file mode 100644
index 000000000..b881e9181
--- /dev/null
+++ b/private/crt32/h/istream.h
@@ -0,0 +1,165 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 02-23-93 SKS Update copyright to 1993
+* 03-23-93 CFW Modified #pragma warnings.
+*
+****/
+
+#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)
+
+#ifndef _INTERNAL_IFSTRIP_
+#ifdef COMBOINC
+#if defined(_DLL) && !defined(MTHREAD)
+#error Cannot define _DLL without MTHREAD
+#endif
+#endif
+
+#endif /* !_INTERNAL_IFSTRIP_ */
+
+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/crt32/h/jctype.h b/private/crt32/h/jctype.h
new file mode 100644
index 000000000..74ed8cf0f
--- /dev/null
+++ b/private/crt32/h/jctype.h
@@ -0,0 +1,111 @@
+/***
+*jctype.h - kanji character conversion macros and jctype macros
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Defines macros for kanji character classification/conversion.
+*
+*Revision History:
+* 05-10-89 MT Got rid of conditional use of extended keywords
+* based on NO_EXT_KEYS.
+* 05-19-89 MT Added _FAR_ , MTHREAD , and DLL.
+* 05-23-89 MT Got rid of including ctype.h and defined each macro
+* directly without using macros in ctype.h.
+* Prefixed '_' onto dummy parameter names.
+* 08-11-89 GJF Changed DLL to _DLL
+* 08-22-89 GJF Fixed copyright (again)
+* 09-06-89 GJF Removed dummy parameters from prototypes
+* 03-06-90 WAJ Added extern "C".
+* 07-23-90 SBM First version for 32-bit OS/2
+* 08-20-91 JCR C++ naming
+* 08-05-92 GJF Function calling type and variable type macros.
+* 11-30-92 KRS Generalized from 16-bit version to use mbctype.h.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+*******************************************************************************/
+
+#ifndef _INC_JCTYPE
+
+#define _MBCS 1
+#define _KANJI 1
+
+#include <mbctype.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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
+
+
+/*
+ * This declaration allows the user access to the mbctype look-up
+ * array _mbctype defined in mbctype.obj by simply including jctype.h
+ */
+
+extern unsigned char _CRTVAR1 _mbctype[];
+extern unsigned char _CRTVAR1 _ctype[];
+
+/* Kanji character classification function prototypes */
+#ifndef _JCTYPE_DEFINED
+#define iskana _ismbbkana
+#define iskpun _ismbbkpunct
+#define iskmoji _ismbbkalnum
+#define isalkana _ismbbalpha
+#define ispnkana _ismbbpunct
+#define isalnmkana _ismbbalnum
+#define isprkana _ismbbprint
+#define isgrkana _ismbbgraph
+#define iskanji _ismbblead
+#define iskanji2 _ismbbtrail
+#define _JCTYPE_DEFINED
+
+#else
+
+/* the kanji character classification macro definitions */
+
+#define iskana(_c) ((_mbctype+1)[(unsigned char)(_c)] & (_MS|_MP))
+#define iskpun(_c) ((_mbctype+1)[(unsigned char)(_c)] & _MP)
+#define iskmoji(_c) ((_mbctype+1)[(unsigned char)(_c)] & _MS)
+#define isalkana(_c) (((_ctype+1)[(unsigned char)(_c)] & (_UPPER|_LOWER))||iskmoji(_c))
+#define ispnkana(_c) (((_ctype+1)[(unsigned char)(_c)] & _PUNCT)||iskpun(_c))
+#define isalnmkana(_c) (((_ctype+1)[(unsigned char)(_c)] & (_UPPER|_LOWER|_DIGIT))||iskmoji(_c))
+#define isprkana(_c) (((_ctype+1)[(unsigned char)(_c)] & (_BLANK|_PUNCT|_UPPER|_LOWER|_DIGIT))||iskana(_c))
+#define isgrkana(_c) (((_ctype+1)[(unsigned char)(_c)] & (_PUNCT|_UPPER|_LOWER|_DIGIT))||iskana(_c))
+
+#define iskanji(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M1)
+#define iskanji2(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M2)
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_JCTYPE
+#endif /* _INC_JCTYPE */
diff --git a/private/crt32/h/limits.h b/private/crt32/h/limits.h
new file mode 100644
index 000000000..0cdde7d1f
--- /dev/null
+++ b/private/crt32/h/limits.h
@@ -0,0 +1,89 @@
+/***
+*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]
+*
+*Revision History:
+* 06-03-87 JMB Added support for unsigned char max values
+* 08-19-88 GJF Revised to also support the 386
+* 04-28-89 SKS Put parentheses around negative constants
+* 08-17-89 GJF Cleanup, now specific to 386
+* 10-30-89 GJF Fixed copyright
+* 11-15-89 KRS Add MB_LEN_MAX, fix CHAR_MIN/MAX, order like ANSI spec.
+* 03-01-90 GJF Added #ifndef _INC_LIMITS stuff
+* 02-21-91 KRS Change MB_LEN_MAX to 2 for C 7.00.
+* 03-30-92 DJM POSIX support.
+* 08-22-92 SRW Fix value of _POSIX_ARG_MAX
+* 12-14-92 SRW Fix value of _POSIX_ARG_MAX again
+* 12-14-92 SRW Back merge MattBr's changes from 10/29/92
+* 01-15-93 CFW Added __c_lconvinit dummy variable.
+* 01-28-93 SRW MAke PATH_MAX for Posix right for Posix
+* 02-01-93 CFW Removed __c_lconvinit vars to locale.h.
+* 03-10-93 MJB More fixes for Posix.
+* 04-20-93 GJF Changed SCHAR_MIN, SHRT_MIN, INT_MIN, LONG_MIN
+*
+****/
+
+#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/crt32/h/locale.h b/private/crt32/h/locale.h
new file mode 100644
index 000000000..43e6f1615
--- /dev/null
+++ b/private/crt32/h/locale.h
@@ -0,0 +1,125 @@
+/***
+*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.
+*
+*Revision History:
+* 03-21-89 JCR Module created.
+* 03-11-89 JCR Modified for 386.
+* 04-06-89 JCR Corrected lconv definition (don't use typedef)
+* 04-18-89 JCR Added _LCONV_DEFINED so locale.h can be included twice
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-04-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright, removed dummy args from prototype
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-01-90 GJF Added #ifndef _INC_LOCALE and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-15-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes.
+* 11-12-90 GJF Changed NULL to (void *)0.
+* 02-12-91 GJF Only #define NULL if it isn't #define-d.
+* 08-20-91 JCR C++ and ANSI naming
+* 08-05-92 GJF Function calling type and variable type macros.
+* 12-29-92 CFW Added _lc_time_data definition and supporting #defines.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 02-01-93 CFW Removed __c_lconvinit vars to locale.h.
+* 02-08-93 CFW Removed time definitions to setlocal.h.
+*
+****/
+
+#ifndef _INC_LOCALE
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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/crt32/h/malloc.h b/private/crt32/h/malloc.h
new file mode 100644
index 000000000..975f6c3fb
--- /dev/null
+++ b/private/crt32/h/malloc.h
@@ -0,0 +1,168 @@
+/***
+*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]
+*
+*Revision History:
+* 01-08-87 JMB Standardized header, added heap consistency routines
+* 02-26-87 BCM added the manifest constant _HEAPBADPTR
+* 04-13-87 JCR Added size_t and "void *" to declarations
+* 04-24-87 JCR Added 'defined' statements around _heapinfo
+* 05-15-87 SKS Cleaned up _CDECL and near/far ptr declarations
+* corrected #ifdef usage, and added _amblksiz
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-05-88 JCR Added DLL _amblksiz support
+* 02-10-88 JCR Cleaned up white space
+* 04-21-88 WAJ Added _FAR_ to halloc/_fmalloc/_nmalloc
+* 05-13-88 GJF Added new heap functions
+* 05-18-88 GJF Removed #defines, added prototypes for _heapchk, _heapset
+* and _heapwalk
+* 05-25-88 GJF Added _bheapseg
+* 08-22-88 GJF Modified to also work for the 386 (small model only,
+* no far or based heap support)
+* 12-07-88 JCR DLL refers to _amlbksiz directly now
+* 01-10-89 JCR Removed sbrk() prototype
+* 04-28-89 SKS Put parentheses around negative constants
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-01-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-27-89 JCR Removed near (_n) and _freect/memavl/memmax prototypes
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-01-90 GJF Added #ifndef _INC_MALLOC and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes.
+* 04-10-90 GJF Made stackavail() _CALLTYPE1, _amblksiz _VARTYPE1.
+* 01-17-91 GJF ANSI naming.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-23-91 JCR stackavail() not supported in WIN32
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 01-18-92 JCR put _CRTHEAP_ ifdefs in; this stuff is only needed
+* for a heap implemented in the runtime (not OS)
+* 08-05-92 GJF Function calling type and variable type macros.
+* 08-22-92 SRW Add alloca intrinsic pragma for MIPS
+* 09-03-92 GJF Merged two changes above.
+* 09-23-92 SRW Change winheap code to call NT directly always
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 02-02-93 SRW Removed bogus semicolon on #pragma
+* 06-10-93 SRW Use _MIPS_ instead of MIPS
+*
+****/
+
+#ifndef _INC_MALLOC
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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
+
+#ifdef _CRTHEAP_
+/* external variable declarations */
+
+extern unsigned int _CRTVAR1 _amblksiz;
+
+#endif /* _CRTHEAP_ */
+
+/* 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);
+#ifdef _CRTHEAP_
+int _CRTAPI1 _heapadd(void *, size_t);
+#endif
+int _CRTAPI1 _heapchk(void);
+int _CRTAPI1 _heapmin(void);
+int _CRTAPI1 _heapset(unsigned int);
+int _CRTAPI1 _heapwalk(_HEAPINFO *);
+size_t _CRTAPI1 _msize(void *);
+#ifndef _WIN32_
+size_t _CRTAPI1 _stackavail(void);
+#endif
+#endif /* !_POSIX_ */
+
+#if !__STDC__
+/* Non-ANSI names for compatibility */
+#ifndef _DOSX32_
+#define alloca _alloca
+#else
+void * _CRTAPI1 alloca(size_t);
+#ifndef _WIN32_
+size_t _CRTAPI1 stackavail(void);
+#endif
+#endif
+#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/crt32/h/math.h b/private/crt32/h/math.h
new file mode 100644
index 000000000..2ebd5dbb7
--- /dev/null
+++ b/private/crt32/h/math.h
@@ -0,0 +1,283 @@
+/***
+*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]
+*
+*Revision History:
+* 10/20/87 JCR Removed "MSC40_ONLY" entries
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 02-10-88 WAJ Changed HUGE and HUGE_VAL definitions for DLL libraries
+* 05-32-88 PHG Added _CDECL and _NEAR for declaration of HUGE
+* 08-22-88 GJF Modified to also work with the 386 (small model only)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-02-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-20-89 JCR Routines are now _cdecl in both single and multi-thread
+* 12-14-89 WAJ Removed pascal from mthread version.
+* 03-01-90 GJF Added #ifndef _INC_MATH and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-29-90 GJF Replaced _cdecl with _VARTYPE1, _CALLTYPE1 or
+* _CALLTYPE2, as appropriate.
+* 07-30-90 SBM Removed special _DLL definitions of HUGE and HUGE_VAL
+* 08-17-90 WAJ Floating point routines now use _stdcall.
+* 08-08-91 GJF Added long double stuff. ANSI naming.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 10-03-91 GDP Added #pragma function(...)
+* No floating point intrinsics for WIN32/NT86
+* 10-06-91 SRW Removed long double stuff.
+* 01-24-92 GJF Fixed [_]HUGE for crtdll.dll.
+* 01-30-92 GJF Removed prototypes and macros for the ieee-to/from-
+* msbin functions (they don't exist).
+* 08-05-92 GJF Function calling type and variable type macros.
+* 12-18-92 GDP Removed #pragma function(...)
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 11-17-93 CFW Fixed HUGE (oldname) macro, now maps to _HUGE.
+* 01-13-94 RDL Added #ifndef _LANGUAGE_ASSEMBLY for asm includes.
+*
+****/
+
+#ifndef _INC_MATH
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _LANGUAGE_ASSEMBLY
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 * _CRTVAR1 _HUGE_dll;
+#else
+#ifdef CRTDLL
+#define _HUGE _HUGE_dll
+#endif
+extern double _CRTVAR1 _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
+
+#ifndef _DOSX32_
+#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
+#else
+#ifndef _LANGUAGE_ASSEMBLY
+double _CRTAPI1 cabs(struct complex);
+double _CRTAPI1 hypot(double, double);
+double _CRTAPI1 j0(double);
+double _CRTAPI1 j1(double);
+double _CRTAPI1 jn(int, double);
+double _CRTAPI1 y0(double);
+double _CRTAPI1 y1(double);
+double _CRTAPI1 yn(int, double);
+
+#endif /* _LANGUAGE_ASSEMBLY */
+
+#endif
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_MATH
+#endif /* _INC_MATH */
diff --git a/private/crt32/h/mbctype.h b/private/crt32/h/mbctype.h
new file mode 100644
index 000000000..990f1a0a4
--- /dev/null
+++ b/private/crt32/h/mbctype.h
@@ -0,0 +1,146 @@
+/***
+*mbctype.h - MBCS character conversion macros
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Defines macros for MBCS character classification/conversion.
+*
+*Revision History:
+* 11-19-92 KRS Ported from 16-bit sources.
+* 02-23-93 SKS Update copyright to 1993
+* 07-09-93 KRS Fix problems with _isxxxlead/trail macros, etc.
+* 08-12-93 CFW Change _mbctype type, fix ifstrip macro name.
+*
+*******************************************************************************/
+
+/* include the standard ctype.h header file */
+
+#include <ctype.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#ifdef COMBOINC
+#if defined(_DLL) && !defined(MTHREAD)
+#error Cannot define _DLL without MTHREAD
+#endif
+#endif
+
+#endif /* !_INTERNAL_IFSTRIP */
+
+/*
+ * 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 _MBCS
+/*
+ * SBCS - Single Byte Character Set
+ */
+
+#define _ismbblead(_c) (0)
+#define _ismbbtrail(_c) (0)
+#define _ismbslead(_s,_c) (0)
+#define _ismbstrail(_s,_c) (0)
+
+#else
+
+/*
+ * MBCS - Multi-Byte Character Set
+ */
+
+/*
+ * This declaration allows the user access the _mbctype[] look-up array.
+ */
+
+#ifdef _DLL
+extern unsigned char * _CRTVAR1 _mbctype;
+#else
+extern unsigned char _CRTVAR1 _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 */
+#ifdef _KANJI
+int _CRTAPI1 _ismbbkalnum( unsigned int );
+int _CRTAPI1 _ismbbkana( unsigned int );
+int _CRTAPI1 _ismbbkpunct( unsigned int );
+#endif
+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
+ */
+
+#ifdef _KANJI
+#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))
+#endif
+
+#define _ismbblead(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M1)
+#define _ismbbtrail(_c) ((_mbctype+1)[(unsigned char)(_c)] & _M2)
+
+#endif /* _MBCS */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/private/crt32/h/mbdata.h b/private/crt32/h/mbdata.h
new file mode 100644
index 000000000..4a70f682f
--- /dev/null
+++ b/private/crt32/h/mbdata.h
@@ -0,0 +1,130 @@
+/***
+*mbdata.h - MBCS lib data
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Defines data for use when building MBCS libs and routines
+*
+*Revision History:
+* 11-19-92 KRS Ported from 16-bit sources.
+* 02-23-93 SKS Update copyright to 1993
+* 08-03-93 KRS Move _ismbbtruelead() from mbctype.h. Internal-only.
+*
+*******************************************************************************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP
+#ifdef COMBOINC
+#if defined(_DLL) && !defined(MTHREAD)
+#error Cannot define _DLL without MTHREAD
+#endif
+#endif
+#endif /* !_INTERNAL_IFSTRIP */
+
+/* validate MBCS defines */
+#ifdef _MBCS
+
+#if (!defined(_KANJI) && !defined(_MBCS_OS))
+#error Must specify MBCS locale.
+#endif
+
+#if (defined(_KANJI) && defined(_MBCS_OS))
+#error Can't define _KANJI and _MBCS_OS together.
+#endif
+
+#else
+
+#if defined(_KANJI)
+#error Can not specify locale without definining _MBCS.
+#endif
+
+#if defined(_MBCS_OS)
+#error Can not specify locale without definining _MBCS.
+#error *** _MBCS_OS NOT IMPLEMENTED ***
+#endif
+
+#endif
+
+
+#ifndef _MBCS
+
+/*
+ * SBCS - Single Byte Character Set
+ */
+
+#define _ISLEADBYTE(c) (0)
+#define _ISTRAILBYTE(c) (0)
+
+#define _ismbbtruelead(_lb,_ch) (0)
+
+#else
+
+/*
+ * MBCS - Multi-Byte Character Set
+ */
+
+extern unsigned int _mbascii; /* flag for handling MB ASCII chars */
+
+/*
+ * general use macros for model dependent/independet versions.
+ */
+
+#define _ISLEADBYTE(c) _ismbblead(c)
+#define _ISTRAILBYTE(c) _ismbbtrail(c)
+
+#define _ismbbtruelead(_lb,_ch) (!(_lb) && _ismbblead((_ch)))
+
+/* define char range values */
+
+#ifdef _KANJI
+
+#define _MBASCIILEAD 0x82 /* lead byte value for MB ASCII char */
+
+#define _MBUPPERLOW 0x8260 /* upper case */
+#define _MBUPPERHIGH 0x8279
+#define _MBLOWERLOW 0x8281 /* lower case */
+#define _MBLOWERHIGH 0x829a
+#define _MBCASEDIFF 0x21 /* diff between upper and lower case letters */
+
+#define _MBDIGITLOW 0x824f /* digit */
+#define _MBDIGITHIGH 0x8258
+
+#define _MBSPACECHAR 0x8140 /* space */
+
+/* Kanji-specific ranges */
+#define _MBHIRALOW 0x829f /* hiragana */
+#define _MBHIRAHIGH 0x82f1
+
+#define _MBKATALOW 0x8340 /* katakana */
+#define _MBKATAHIGH 0x8396
+#define _MBKATAEXCEPT 0x837f /* exception */
+
+#define _MBKIGOULOW 0x8141 /* kanji punctuation */
+#define _MBKIGOUHIGH 0x81ac
+#define _MBKIGOUEXCEPT 0x817f /* exception */
+
+#endif
+
+
+#ifdef _MBCS_OS
+
+/*
+ * Portable MBCS libs
+ */
+
+#ifndef _WIN32_
+extern unsigned int _CRTVAR1 _mbcsflag; /* pulls in _mbcsinit code */
+#endif
+
+#endif
+
+
+#endif /* MBCS */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/private/crt32/h/mbstring.h b/private/crt32/h/mbstring.h
new file mode 100644
index 000000000..5b05f3690
--- /dev/null
+++ b/private/crt32/h/mbstring.h
@@ -0,0 +1,227 @@
+/***
+* 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.
+*
+*Revision History:
+* 11-19-92 KRS Ported from 16-bit sources.
+* 02-23-93 SKS Update copyright to 1993
+* 05-24-93 KRS Added new functions from Ikura.
+* 07-09-93 KRS Put proper switches around _ismbblead/trail.
+* 07-14-93 KRS Add new mbsnbxxx functions: byte-count versions.
+* 08-12-93 CFW Fix ifstrip macro name.
+*
+*******************************************************************************/
+
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#ifdef COMBOINC
+#if defined(_DLL) && !defined(MTHREAD)
+#error Cannot define _DLL without MTHREAD
+#endif
+#endif
+
+#endif /* !_INTERNAL_IFSTRIP */
+
+/*
+ * 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 _MBCS
+/*
+ * SBCS - Single Byte Character Set
+ */
+
+#define _mbscat strcat
+#define _mbschr strchr
+#define _mbscmp strcmp
+#define _mbscpy strcpy
+#define _mbscspn strcspn
+#define _mbsdec _strdec
+#define _mbsdup _strdup
+#define _mbsicmp _stricmp
+#define _mbsinc _strinc
+#define _mbslen strlen
+#define _mbslwr strlwr
+#define _mbsnbcat strncat
+#define _mbsnbcmp strncmp
+#define _mbsnbcnt _strncnt
+#define _mbsnbcpy strncpy
+#define _mbsnbicmp _strnicmp
+#define _mbsnbset _strnset
+#define _mbsncat strncat
+#define _mbsnccnt _strncnt
+#define _mbsncmp strncmp
+#define _mbsncpy strncpy
+#define _mbsnextc _strnextc
+#define _mbsnicmp _strnicmp
+#define _mbsninc _strninc
+#define _mbsnset _strnset
+#define _mbsrchr strrchr
+#define _mbsrev _strrev
+#define _mbspbrk strpbrk
+#define _mbsset _strset
+#define _mbsspn strspn
+#define _mbsspnp _strspnp
+#define _mbsstr strstr
+#define _mbstok strtok
+#define _mbsupr _strupr
+
+#define _mbclen(_cpc) (1)
+#define _mbccpy(_pc1, _cpc2) (*(_pc1) = *(_cpc2))
+#define _mbccmp(_cpc1, _cpc2) (((unsigned char)*(_cpc1)) - ((unsigned char)*(_cpc2)))
+
+/* Character function mappings. */
+
+#define _ismbcalpha isalpha
+#define _ismbcdigit isdigit
+#define _ismbclegal(_c) (1)
+#define _ismbclower islower
+#define _ismbcprint isprint
+#define _ismbcspace isspace
+#define _ismbcupper isupper
+
+#define _ismbblead(_c) (0)
+#define _ismbbtrail(_c) (0)
+#define _ismbslead(_s,_c) (0)
+#define _ismbstrail(_s,_c) (0)
+
+/* SBCS routines needed for MBCS mappings */
+
+unsigned char * _CRTAPI1 _strdec(const unsigned char *, const unsigned char *);
+unsigned char * _CRTAPI1 _strinc(const unsigned char *);
+size_t _CRTAPI1 _strncnt(const unsigned char *, size_t);
+unsigned int _CRTAPI1 _strnextc(const unsigned char *);
+unsigned char * _CRTAPI1 _strninc(const unsigned char *, size_t);
+unsigned char * _CRTAPI1 _strspnp(const unsigned char *, const unsigned char *);
+
+#else
+/*
+ * 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
+
+#ifdef _KANJI
+
+/* 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);
+
+#endif /* KANJI */
+
+#endif /* MBCS */
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/private/crt32/h/memory.h b/private/crt32/h/memory.h
new file mode 100644
index 000000000..0fa4e3a41
--- /dev/null
+++ b/private/crt32/h/memory.h
@@ -0,0 +1,101 @@
+/***
+*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]
+*
+*Revision History:
+* 10/20/87 JCR Removed "MSC40_ONLY" entries
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-22-88 GJF Modified to also work for the 386 (small model only)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-03-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-17-89 GJF Added const to appropriate arg types for memccpy() and
+* memicmp().
+* 03-01-90 GJF Added #ifndef _INC_MEMORY and #include <cruntime.h>
+* stuff. Replace _cdecl with _CALLTYPE1 in prototypes.
+* Also, removed some (now) useless preprocessor
+* directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes. Also,
+* got rid of movedata() prototype.
+* 01-17-91 GJF ANSI naming.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 08-05-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_MEMORY
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 */
+#ifndef _DOSX32_
+#define memccpy _memccpy
+#define memicmp _memicmp
+#else
+void * _CRTAPI1 memccpy(void *, const void *, int, unsigned int);
+int _CRTAPI1 memicmp(const void *, const void *, unsigned int);
+#endif
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_MEMORY
+#endif /* _INC_MEMORY */
diff --git a/private/crt32/h/msdos.h b/private/crt32/h/msdos.h
new file mode 100644
index 000000000..5b7beee2a
--- /dev/null
+++ b/private/crt32/h/msdos.h
@@ -0,0 +1,83 @@
+/***
+*msdos.h - MS-DOS definitions for C runtime
+*
+* Copyright (c) 1987-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* The file contains the MS-DOS definitions (function request numbers,
+* flags, etc.) used by the C runtime.
+* [Internal]
+*
+*Revision History:
+* 08-01-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 03-01-90 GJF Added #ifndef _INC_MSDOS stuff
+* 05-09-90 JCR Added _STACKSLOP (from msdos.inc)
+* 11-30-90 GJF Added Win32 support. Also removed constants that
+* are not used in Cruiser or Win32 runtimes.
+* 12-04-90 SRW Removed Win32 dependencies from this file.
+* Put them in internal.h
+* 07-01-92 GJF FRDONLY is not set or used for Win32.
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#ifndef _INC_MSDOS
+
+/* Stack slop for OS/2 system call overhead */
+
+#define _STACKSLOP 1024
+
+/* __osfile flag values for DOS file handles */
+
+#define FOPEN 0x01 /* file handle open */
+#define FEOFLAG 0x02 /* end of file has been encountered */
+#define FCRLF 0x04 /* CR-LF across read buffer (in text mode) */
+#define FPIPE 0x08 /* file handle refers to a pipe */
+
+#ifndef _WIN32_
+#define FRDONLY 0x10 /* file handle associated with read only file */
+#endif
+
+#define FAPPEND 0x20 /* file handle opened O_APPEND */
+#define FDEV 0x40 /* file handle refers to device */
+#define FTEXT 0x80 /* file handle is in text mode */
+
+/* DOS errno values for setting __doserrno in C routines */
+
+#define E_ifunc 1 /* invalid function code */
+#define E_nofile 2 /* file not found */
+#define E_nopath 3 /* path not found */
+#define E_toomany 4 /* too many open files */
+#define E_access 5 /* access denied */
+#define E_ihandle 6 /* invalid handle */
+#define E_arena 7 /* arena trashed */
+#define E_nomem 8 /* not enough memory */
+#define E_iblock 9 /* invalid block */
+#define E_badenv 10 /* bad environment */
+#define E_badfmt 11 /* bad format */
+#define E_iaccess 12 /* invalid access code */
+#define E_idata 13 /* invalid data */
+#define E_unknown 14 /* ??? unknown error ??? */
+#define E_idrive 15 /* invalid drive */
+#define E_curdir 16 /* current directory */
+#define E_difdev 17 /* not same device */
+#define E_nomore 18 /* no more files */
+#define E_maxerr2 19 /* unknown error - Version 2.0 */
+#define E_sharerr 32 /* sharing violation */
+#define E_lockerr 33 /* locking violation */
+#define E_maxerr3 34 /* unknown error - Version 3.0 */
+
+/* DOS file attributes */
+
+#define A_RO 0x1 /* read only */
+#define A_H 0x2 /* hidden */
+#define A_S 0x4 /* system */
+#define A_V 0x8 /* volume id */
+#define A_D 0x10 /* directory */
+#define A_A 0x20 /* archive */
+
+#define A_MOD (A_RO+A_H+A_S+A_A) /* changeable attributes */
+
+#define _INC_MSDOS
+#endif /* _INC_MSDOS */
diff --git a/private/crt32/h/msdos.inc b/private/crt32/h/msdos.inc
new file mode 100644
index 000000000..863642ada
--- /dev/null
+++ b/private/crt32/h/msdos.inc
@@ -0,0 +1,276 @@
+;***
+;msdos.inc - MS-DOS definitions for C runtime
+;
+; Copyright (c) 1987-1991, Microsoft Corporation. All rights reserved.
+;
+;Purpose:
+; This file contains the MS-DOS definitions (DOS function request
+; numbers, flags, etc) used by the C runtime.
+;
+;Revision History:
+; 10-22-87 JCR Removed "PROTMODE_ONLY" comments
+; 02-19-88 SKS STACKSLOP is 256 for DOS, 512 for OS/2
+; 06-02-89 JCR Added 386 OS/2 allocmem/setmem flag definitions
+; 06-07-89 JCR Bumped STACKSLOP to 1024 for 386 OS/2
+; 10-18-89 JCR Changed _NEWREGION to match change in OS2 mem APIs
+; 11-02-89 JCR Added DOS32QUERYSYSINFO offset definitions
+; 11-10-89 JCR Added OBJ_TILE bit to _NEWREGION memory request
+; 06-06-90 SBM Added DOSOPEN flags, names match doscalls.h, added
+; tentative new DOS32QUERYFHSTATE flags
+; 12-10-90 GJF Updated values of new flags introduced above.
+;
+;*******************************************************************************
+
+
+;_NFILE equ 20 ; maximum # files per process
+
+ifdef OS2
+ifdef I386
+STACKSLOP equ 1024 ; stack slop for 386 OS/2 system call overhead
+else
+STACKSLOP equ 512 ; stack slop for 286 OS/2 system call overhead
+endif
+else
+STACKSLOP equ 256 ; stack slop for DOS interrupt overhead
+endif
+
+; __osfile flag values for DOS file handles
+
+FOPEN equ 01H ; file handle open
+FEOFLAG equ 02H ; end of file has been encountered
+FCRLF equ 04H ; CR-LF across read buffer (in text mode)
+FPIPE equ 08H ; file handle refers to a pipe
+FRDONLY equ 10H ; file handle associated with read only file
+FAPPEND equ 20H ; file handle opened O_APPEND
+FDEV equ 40H ; file handle refers to device
+FTEXT equ 80H ; file handle is in text mode
+
+
+callos MACRO func
+ifnb <func>
+ mov ah,DOS_&func
+endif
+ int DOS
+ ENDM
+
+
+DOS equ 21H ; MS-DOS interrupt
+
+DOS_exit equ 00000H ; exit offset (PSP:0000)
+DOS_maxpara equ 00002H ; maximum paragraph (PSP:0002)
+DOS_envp equ 0002cH ; environment address (PSP:002c)
+DOS_cmdline equ 00080H ; command line offset (PSP:0080)
+
+DOS_kill equ 00H ; terminate
+DOS_echoread equ 01H ; read keyboard and echo
+DOS_display equ 02H ; display character
+DOS_auxinput equ 03H ; auxiliary input
+DOS_auxoutput equ 04H ; auxiliary output
+DOS_print equ 05H ; print character
+DOS_conio equ 06H ; direct console i/o
+DOS_coninput equ 07H ; direct console input
+DOS_readkbd equ 08H ; read keyboard
+DOS_message equ 09H ; display string
+DOS_bufkbdin equ 0aH ; buffered keyboard input
+DOS_kbdstatus equ 0bH ; check keyboard status
+DOS_flshread equ 0cH ; flush buffer and read keyboard
+DOS_diskreset equ 0dH ; disk reset
+DOS_selectdisk equ 0eH ; select default disk
+DOS_fcbopen equ 0fH ; open file with fcb
+DOS_fcbclose equ 10H ; close file with fcb
+DOS_fcbfirst equ 11H ; search for first entry with fcb
+DOS_fcbnext equ 12H ; search for next entry with fcb
+DOS_fcbdelete equ 13H ; delete file with fcb
+DOS_fcbsread equ 14H ; sequential read with fcb
+DOS_fcbswrite equ 15H ; sequential write with fcb
+DOS_fcbcreate equ 16H ; create file with fcb
+DOS_fcbrename equ 17H ; rename file with fcb
+DOS_currentd equ 19H ; current default disk
+DOS_setDMA equ 1aH ; set DMA
+DOS_fcbrread equ 21H ; random read with fcb
+DOS_fcbrwrite equ 22H ; random write with fcb
+DOS_fcbsize equ 23H ; file size with fcb
+DOS_fcbsetrec equ 24H ; set relative record with fcb
+DOS_setvector equ 25H ; set interrupt vector
+DOS_fcbbread equ 27H ; random block read with fcb
+DOS_fcbbwrite equ 28H ; random block write with fcb
+DOS_fcbparse equ 29H ; parse file name with fcb
+DOS_getdate equ 2aH ; get date
+DOS_setdate equ 2bH ; set date
+DOS_gettime equ 2cH ; get time
+DOS_settime equ 2dH ; set time
+DOS_verify equ 2eH ; set/reset verify flag
+DOS_getDMA equ 2fH ; get DMA
+DOS_version equ 30H ; get version number
+DOS_keep equ 31H ; keep process
+DOS_cntlc equ 33H ; Cntl-C check
+DOS_getvector equ 35H ; get interrupt vector
+DOS_getdskspc equ 36H ; get disk free space
+DOS_country equ 38H ; get country dependent info
+DOS_mkdir equ 39H ; make subdirectory
+DOS_rmdir equ 3aH ; remove subdirectory
+DOS_chdir equ 3bH ; change subdirectory
+DOS_create equ 3cH ; create pathname
+DOS_open equ 3dH ; open pathname
+DOS_close equ 3eH ; close file handle
+DOS_read equ 3fH ; read from file handle
+DOS_write equ 40H ; write from file handle
+DOS_delete equ 41H ; delete pathname
+DOS_lseek equ 42H ; move file pointer
+DOS_filemode equ 43H ; get/set attributes of pathname
+DOS_ioctl equ 44H ; ioctl for devices
+DOS_dup equ 45H ; duplicate file handle
+DOS_forcedup equ 46H ; force duplicate file handle
+DOS_curdir equ 47H ; get current directory
+DOS_allocmem equ 48H ; allocate memory block
+DOS_freemem equ 49H ; free memory block
+DOS_setmem equ 4aH ; set size of memory block
+DOS_exec equ 4bH ; load and execute program
+DOS_terminate equ 4cH ; terminate process with errorcode
+DOS_wait equ 4dH ; get child process return code
+DOS_findfirst equ 4eH ; find first file match
+DOS_findnext equ 4fH ; find next file match
+DOS_getverify equ 54H ; return current verify flag
+DOS_rename equ 56H ; rename pathname
+DOS_filedate equ 57H ; get/set file handle date/time
+DOS_createnew equ 5BH ; create new file
+DOS_locking equ 5CH ; file record locking/unlocking
+DOS_sleep equ 89H ; delay process execution
+
+
+; DOS error codes
+
+doserr MACRO num,name,text
+name equ num
+ ENDM
+
+doserr 1, E_ifunc, <invalid function code>
+doserr 2, E_nofile, <file not found>
+doserr 3, E_nopath, <path not found>
+doserr 4, E_toomany, <too many open files>
+doserr 5, E_access, <access denied>
+doserr 6, E_ihandle, <invalid handle>
+doserr 7, E_arena, <arena trashed>
+doserr 8, E_nomem, <not enough memory>
+doserr 9, E_iblock, <invalid block>
+doserr 10, E_badenv, <bad environment>
+doserr 11, E_badfmt, <bad format>
+doserr 12, E_iaccess, <invalid access code>
+doserr 13, E_idata, <invalid data>
+doserr 14, E_unknown, <??? unknown error ???>
+doserr 15, E_idrive, <invalid drive>
+doserr 16, E_curdir, <current directory>
+doserr 17, E_difdev, <not same device>
+doserr 18, E_nomore, <no more files>
+doserr 19, E_maxerr2, <unknown error - Version 2.0>
+
+; the following errors can occur only in DOS 3.0
+
+doserr 32, E_sharerr, <sharing violation>
+doserr 33, E_lockerr, <locking violation>
+doserr 34, E_maxerr3, <unknown error - Version 3.0>
+
+
+; DOS file attributes
+
+A_ro equ 01H ; read-only file
+A_h equ 02H ; hidden
+A_s equ 04H ; system
+A_v equ 08H ; volume ID
+A_d equ 10H ; directory
+A_a equ 20H ; archive
+
+A_mod equ A_ro+A_h+A_s+A_a ; modifiable attributes
+
+; OS/2 file attributes, names match doscalls.h
+
+FILE_NORMAL equ 00h
+FILE_READONLY equ 01h
+FILE_HIDDEN equ 02h
+FILE_SYSTEM equ 04h
+FILE_DIRECTORY equ 10h
+FILE_ARCHIVED equ 20h
+
+; OS/2 file creation bits
+
+F_CREATFLAG equ 10h
+F_OPENFLAG equ 01h
+F_TRUNCFLAG equ 02h
+
+; OS/2 file creation bits, names match doscalls.h
+
+FILE_OPEN equ 01h
+FILE_TRUNCATE equ 02h
+FILE_CREATE equ 10h
+
+; OS/2 DOS32OPEN/DOS32SETFHSTATE flags
+
+OPEN_ACCESS_READONLY equ 0000h
+OPEN_ACCESS_WRITEONLY equ 0001h
+OPEN_ACCESS_READWRITE equ 0002h
+OPEN_SHARE_DENYREADWRITE equ 0010h
+OPEN_SHARE_DENYWRITE equ 0020h
+OPEN_SHARE_DENYREAD equ 0030h
+OPEN_SHARE_DENYNONE equ 0040h
+OPEN_FLAGS_NOINHERIT equ 0080h
+OPEN_FLAGS_FAIL_ON_ERROR equ 2000h
+OPEN_FLAGS_WRITE_THROUGH equ 4000h
+OPEN_FLAGS_DASD equ 8000h
+
+; new DOS32QUERYFHSTATE flags from DCR 'Add full 32-bit support for
+; runtime libraries.' NAMES TENTATIVE AND SUBJECT TO CHANGE. STAY AWAY.
+
+OPEN_FLAGS_CONSOLE equ 00080000h
+OPEN_FLAGS_RAWMODE equ 00100000h
+OPEN_FLAGS_EOF equ 00200000h
+
+; OS/2 device mask
+
+IS_DEV equ 1
+IS_PIPE equ 2
+
+ifdef I386
+;
+; OS/2 System Call Flags (from bse32dos.h)
+;
+
+; Access protection
+PAG_READ equ 00000001h ; read access
+PAG_WRITE equ 00000002h ; write access
+PAG_EXECUTE equ 00000004h ; execute access
+PAG_GUARD equ 00000008h ; guard protection
+
+; Commit
+PAG_COMMIT equ 00000010h ; commit storage
+PAG_DECOMMIT equ 00000020h ; decommit storage
+
+; Allocation attributes
+OBJ_TILE equ 00000040h ; tile object
+OBJ_PROTECTED equ 00000080h ; protect object
+OBJ_GETTABLE equ 00000100h ; gettable by other processes
+OBJ_GIVEABLE equ 00000200h ; giveable to other processes
+
+; Standard memory values for C lib (heap and mthread code)
+_NEWREGION equ (PAG_READ OR PAG_WRITE OR OBJ_TILE)
+_COMMIT equ (PAG_COMMIT OR PAG_READ OR PAG_WRITE)
+_DECOMMIT equ (PAG_DECOMMIT)
+
+; Indices for DOS32QUERYSYSINFO system call (from bsedos.h)
+_QSV_MAX_PATH_LENGTH EQU 1
+_QSV_MAX_TEXT_SESSIONS EQU 2
+_QSV_MAX_PM_SESSIONS EQU 3
+_QSV_MAX_VDM_SESSIONS EQU 4
+_QSV_BOOT_DRIVE EQU 5 ; 1=A, 2=B, etc.
+_QSV_DYN_PRI_VARIATION EQU 6 ; 0=Absolute, 1=Dynamic
+_QSV_MAX_WAIT EQU 7 ; seconds
+_QSV_MIN_SLICE EQU 8 ; milli seconds
+_QSV_MAX_SLICE EQU 9 ; milli seconds
+_QSV_PAGE_SIZE EQU 10
+_QSV_VERSION_MAJOR EQU 11
+_QSV_VERSION_MINOR EQU 12
+_QSV_VERSION_REVISION EQU 13 ; Revision letter
+
+endif
+
+; end of msdos.inc
+;-----------------------------------------------------------------------
diff --git a/private/crt32/h/mtest.h b/private/crt32/h/mtest.h
new file mode 100644
index 000000000..e24b4b4af
--- /dev/null
+++ b/private/crt32/h/mtest.h
@@ -0,0 +1,68 @@
+/***
+* mtest.h - Multi-thread testing include file
+*
+* Copyright (c) 1988-1990, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This source contains prototypes and definitions used for multi-thread
+* testing. In order to use the debug flavor of these routines, you
+* MUST link special debug versions of multi-thread crt0dat.obj and
+* mlock.obj into your program. In addition, mtest.obj contains the
+* routines prototyped in this include file.
+*
+* [NOTE: This source module is NOT included in the C runtime library;
+* it is used only for testing.]
+*
+*Revision History:
+* 08-25-88 JCR Module created
+* 11-17-88 JCR Added _print_tiddata()
+* 04-04-89 JCR Added _THREADLOOPCNT_ (used in optional mtest.c code)
+* 07-11-89 JCR Added _SLEEP_ macro
+* 10-30-89 GJF Fixed copyright
+* 04-09-90 GJF Added _INC_MTEST stuff and #include <cruntime.h>.
+* Removed some leftover 16-bit support. Also, made
+* _print_tiddata() _CALLTYPE1.
+* 08-20-91 JCR C++ and ANSI naming
+*
+*******************************************************************************/
+
+#ifndef _INC_MTEST
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <cruntime.h>
+
+#ifndef _MIPS_
+#if (_MSC_VER <= 600)
+#define __cdecl _cdecl
+#endif
+#endif
+
+/* Maximum thread count that mtest.c can handle */
+#define _THREADMAX_ 256
+
+/* Define thread loop count for mtest.c optional code path */
+#define _THREADLOOPCNT_ 5
+
+/* sleep macro */
+#define _SLEEP_(l) DOS32SLEEP(l)
+
+#ifdef DEBUG
+int printlock(int locknum);
+int print_single_locks(void);
+int print_stdio_locks(void);
+int print_lowio_locks(void);
+int print_iolocks(void);
+int print_locks(void);
+#endif
+
+void _CALLTYPE1 _print_tiddata(int);
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_MTEST
+#endif /* _INC_MTEST */
diff --git a/private/crt32/h/new.h b/private/crt32/h/new.h
new file mode 100644
index 000000000..ec034fe3c
--- /dev/null
+++ b/private/crt32/h/new.h
@@ -0,0 +1,67 @@
+/***
+*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.
+*
+*Revision History:
+*
+* 03-07-90 WAJ Initial version.
+* 04-09-91 JCR ANSI keyword conformance
+* 08-12-91 JCR Renamed new.hxx to new.h
+* 08-13-91 JCR Better set_new_handler names (ANSI, etc.).
+* 10-03-91 JCR Added _OS2_IFSTRIP switches for ifstrip'ing purposes
+* 10-30-91 JCR Changed "nhew" to "hnew" (typo in name!)
+* 11-13-91 JCR 32-bit version.
+* 06-03-92 KRS Fix CAVIAR #850: _CALLTYPE1 missing from prototype.
+* 08-05-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef __INC_NEW
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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/crt32/h/nlsint.h b/private/crt32/h/nlsint.h
new file mode 100644
index 000000000..b73b15d55
--- /dev/null
+++ b/private/crt32/h/nlsint.h
@@ -0,0 +1,60 @@
+/***
+*nlsint.h - national language support internal defintions
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains internal definitions/declarations for international functions,
+* shared between run-time and math libraries, in particular,
+* the localized decimal point.
+* [Internal]
+*
+*Revision History:
+* 10-16-91 ETC Created.
+* 11-15-91 JWM Added _PREPUTDECIMAL macro.
+* 02-23-93 SKS Update copyright to 1993
+* 02-23-93 CFW Added size_t definition for decimal_point_length.
+*
+****/
+
+#ifndef _INC_NLSINT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _SIZE_T_DEFINED
+typedef unsigned int size_t;
+#define _SIZE_T_DEFINED
+#endif
+
+/*
+ * Definitions for a localized decimal point.
+ * Currently, run-times only support a single character decimal point.
+ */
+#define __decimal_point _decimal_point
+extern char _decimal_point[]; /* localized decimal point string */
+
+#define __decimal_point_length _decimal_point_length
+#ifdef _INTL
+extern size_t _decimal_point_length; /* not including terminating null */
+#else
+#define _decimal_point_length 1
+#endif
+
+#ifdef _INTL
+#define _ISDECIMAL(p) (*(p) == *__decimal_point)
+#define _PUTDECIMAL(p) (*(p)++ = *__decimal_point)
+#define _PREPUTDECIMAL(p) (*(++p) = *__decimal_point)
+#else
+#define _ISDECIMAL(p) (*(p) == '.')
+#define _PUTDECIMAL(p) (*(p)++ = '.')
+#define _PREPUTDECIMAL(p) (*(++p) = '.')
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_NLSINT
+#endif /* _INC_NLSINT */
diff --git a/private/crt32/h/os2dll.h b/private/crt32/h/os2dll.h
new file mode 100644
index 000000000..f18229052
--- /dev/null
+++ b/private/crt32/h/os2dll.h
@@ -0,0 +1,260 @@
+/***
+*os2dll.h - DLL/Multi-thread include
+*
+* Copyright (c) 1987-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+*
+*Revision History:
+* 10-27-87 JCR Module created.
+* 11-13-87 SKS Added _HEAP_LOCK
+* 12-15-87 JCR Added _EXIT_LOCK
+* 01-07-88 BCM Added _SIGNAL_LOCK; upped MAXTHREADID from 16 to 32
+* 02-01-88 JCR Added _dll_mlock/_dll_munlock macros
+* 05-02-88 JCR Added _BHEAP_LOCK
+* 06-17-88 JCR Corrected prototypes for special mthread debug routines
+* 08-15-88 JCR _check_lock now returns int, not void
+* 08-22-88 GJF Modified to also work for the 386 (small model only)
+* 06-05-89 JCR 386 mthread support
+* 06-09-89 JCR 386: Added values to _tiddata struc (for _beginthread)
+* 07-13-89 JCR 386: Added _LOCKTAB_LOCK
+* 08-17-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 01-02-90 JCR Moved a bunch of definitions from os2dll.inc
+* 04-06-90 GJF Added _INC_OS2DLL stuff and #include <cruntime.h>. Made
+* all function _CALLTYPE2 (for now).
+* 04-10-90 GJF Added prototypes for _[un]lockexit().
+* 08-16-90 SBM Made _terrno and _tdoserrno int, not unsigned
+* 09-14-90 GJF Added _pxcptacttab, _pxcptinfoptr and _fpecode fields
+* to _tiddata struct.
+* 10-09-90 GJF Thread ids are of type unsigned long.
+* 12-06-90 SRW Added _OSFHND_LOCK
+* 06-04-91 GJF Win32 version of multi-thread types and prototypes.
+* 08-15-91 GJF Made _tdoserrno an unsigned long for Win32.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-29-91 GJF Conditionally added prototypes for _getptd_lk
+* and _getptd1_lk for Win32 under DEBUG.
+* 10-03-91 JCR Added _cvtbuf to _tiddata structure
+* 02-17-92 GJF For Win32, replaced _NFILE_ with _NHANDLE_ and
+* _NSTREAM_.
+* 03-06-92 GJF For Win32, made _[un]mlock_[fh|stream]() macros
+* directly call _[un]lock().
+* 03-17-92 GJF Dropped _namebuf field from _tiddata structure for
+* Win32.
+* 08-05-92 GJF Function calling type and variable type macros.
+* 12-03-91 ETC Added _wtoken to _tiddata, added intl LOCK's;
+* added definition of wchar_t (needed for _wtoken).
+* 08-14-92 KRS Port ETC's _wtoken change from other tree.
+* 08-21-92 GJF Merged 08-05-92 and 08-14-92 versions.
+* 12-03-92 KRS Added _mtoken field for MTHREAD _mbstok().
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 02-25-93 GJF Purged Cruiser support and many outdated definitions
+* and declarations.
+* 12-14-93 SKS Add _freeptd(), which frees per-thread CRT data
+*
+****/
+
+#ifndef _INC_OS2DLL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <cruntime.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
+
+
+/*
+ * Define the number of supported handles and streams. The definitions
+ * here must exactly match those in internal.h (for _NHANDLE_) and stdio.h
+ * (for _NSTREAM_).
+ */
+#ifdef MTHREAD
+#define _NHANDLE_ 256
+#define _NSTREAM_ 40
+#else
+#define _NHANDLE_ 64
+#define _NSTREAM_ 20
+#endif
+
+
+/* Lock symbols */
+
+/* ---- do not change lock #1 without changing emulator ---- */
+#define _SIGNAL_LOCK 1 /* lock for signal() & emulator SignalAddress */
+ /* emulator uses \math\include\os2dll.inc */
+
+#define _IOB_SCAN_LOCK 2 /* _iob[] table lock */
+#define _TMPNAM_LOCK 3 /* lock global tempnam variables */
+#define _INPUT_LOCK 4 /* lock for _input() routine */
+#define _OUTPUT_LOCK 5 /* lock for _output() routine */
+#define _CSCANF_LOCK 6 /* lock for _cscanf() routine */
+#define _CPRINTF_LOCK 7 /* lock for _cprintf() routine */
+#define _CONIO_LOCK 8 /* lock for conio routines */
+#define _HEAP_LOCK 9 /* lock for heap allocator routines */
+#define _BHEAP_LOCK 10 /* lock for based heap routines */
+#define _TIME_LOCK 11 /* lock for time functions */
+#define _ENV_LOCK 12 /* lock for environment variables */
+#define _EXIT_LOCK1 13 /* lock #1 for exit code */
+#define _EXIT_LOCK2 14 /* lock #2 for exit code */
+#define _THREADDATA_LOCK 15 /* lock for thread data table */
+#define _POPEN_LOCK 16 /* lock for _popen/_pclose database */
+#define _LOCKTAB_LOCK 17 /* lock to protect semaphore lock table */
+#define _OSFHND_LOCK 18 /* lock to protect _osfhnd array */
+#define _SETLOCALE_LOCK 19 /* lock for locale handles, etc. */
+#define _LC_COLLATE_LOCK 20 /* lock for LC_COLLATE locale */
+#define _LC_CTYPE_LOCK 21 /* lock for LC_CTYPE locale */
+#define _LC_MONETARY_LOCK 22 /* lock for LC_MONETARY locale */
+#define _LC_NUMERIC_LOCK 23 /* lock for LC_NUMERIC locale */
+#define _LC_TIME_LOCK 24 /* lock for LC_TIME locale */
+
+#define _STREAM_LOCKS 25 /* Table of stream locks */
+
+#ifdef _WIN32_
+#define _LAST_STREAM_LOCK (_STREAM_LOCKS+_NSTREAM_-1) /* Last stream lock */
+#else
+#define _LAST_STREAM_LOCK (_STREAM_LOCKS+_NFILE_-1) /* Last stream lock */
+#endif
+
+#define _FH_LOCKS (_LAST_STREAM_LOCK+1) /* Table of fh locks */
+
+#ifdef _WIN32_
+#define _LAST_FH_LOCK (_FH_LOCKS+_NHANDLE_-1) /* Last fh lock */
+#else
+#define _LAST_FH_LOCK (_FH_LOCKS+_NFILE_-1) /* Last fh lock */
+#endif
+
+#define _TOTAL_LOCKS (_LAST_FH_LOCK+1) /* Total number of locks */
+
+#define _LOCK_BIT_INTS (_TOTAL_LOCKS/(sizeof(unsigned)*8))+1 /* # of ints to hold lock bits */
+
+
+/* Multi-thread macros and prototypes */
+
+#ifdef MTHREAD
+
+
+/* need wchar_t for _wtoken field in _tiddata */
+#ifndef _WCHAR_T_DEFINED
+typedef unsigned short wchar_t;
+#define _WCHAR_T_DEFINED
+#endif
+
+
+extern unsigned long _CRTAPI1 __threadid(void);
+#define _threadid (__threadid())
+extern unsigned long _CRTAPI1 __threadhandle(void);
+#define _threadhandle (__threadhandle())
+
+
+/* Structure for each thread's data */
+
+struct _tiddata {
+ unsigned long _tid; /* thread ID */
+ unsigned long _thandle; /* thread handle */
+
+ int _terrno; /* errno value */
+ unsigned long _tdoserrno; /* _doserrno value */
+ unsigned int _fpds; /* Floating Point data segment */
+ unsigned long _holdrand; /* rand() seed value */
+ char * _token; /* ptr to strtok() token */
+ wchar_t * _wtoken; /* ptr to wcstok() token */
+#ifdef _MBCS
+ unsigned char * _mtoken; /* ptr to _mbstok() token */
+#endif
+
+ /* following pointers get malloc'd at runtime */
+ char * _errmsg; /* ptr to strerror()/_strerror() buff */
+ char * _namebuf0; /* ptr to tmpnam() buffer */
+ char * _namebuf1; /* ptr to tmpfile() buffer */
+ char * _asctimebuf; /* ptr to asctime() buffer */
+ void * _gmtimebuf; /* ptr to gmtime() structure */
+ char * _cvtbuf; /* ptr to ecvt()/fcvt buffer */
+
+ /* following fields are needed by _beginthread code */
+ void * _initaddr; /* initial user thread address */
+ void * _initarg; /* initial user thread argument */
+
+ /* following three fields are needed to support signal handling and
+ * runtime errors */
+ void * _pxcptacttab; /* ptr to exception-action table */
+ void * _tpxcptinfoptrs; /* ptr to exception info pointers */
+ int _tfpecode; /* float point exception code */
+ };
+
+typedef struct _tiddata * _ptiddata;
+
+/*
+ * Declaration of TLS index used in storing pointers to per-thread data
+ * structures.
+ */
+extern unsigned long __tlsindex;
+
+
+/* macros */
+
+#define _lock_fh(fh) _lock(fh+_FH_LOCKS)
+#define _lock_str(s) _lock(s+_STREAM_LOCKS)
+#define _lock_fh_check(fh,flag) if (flag) _lock_fh(fh)
+#define _mlock(l) _lock(l)
+#define _munlock(l) _unlock(l)
+#define _unlock_fh(fh) _unlock(fh+_FH_LOCKS)
+#define _unlock_str(s) _unlock(s+_STREAM_LOCKS)
+#define _unlock_fh_check(fh,flag) if (flag) _unlock_fh(fh)
+
+
+/* multi-thread routines */
+
+void _CRTAPI1 _lock(int);
+void _CRTAPI1 _lockexit(void);
+void _CRTAPI1 _unlock(int);
+void _CRTAPI1 _unlockexit(void);
+
+_ptiddata _CRTAPI1 _getptd(void); /* return address of per-thread CRT data */
+void _CRTAPI1 _freeptd(_ptiddata); /* free up the per-thread CRT data blocks */
+
+
+#else /* not MTHREAD */
+
+
+/* macros */
+#define _lock_fh(fh)
+#define _lock_str(s)
+#define _lock_fh_check(fh,flag)
+#define _mlock(l)
+#define _munlock(l)
+#define _unlock_fh(fh)
+#define _unlock_str(s)
+#define _unlock_fh_check(fh,flag)
+
+
+#endif /* MTHREAD */
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_OS2DLL
+#endif /* _INC_OS2DLL */
diff --git a/private/crt32/h/oscalls.h b/private/crt32/h/oscalls.h
new file mode 100644
index 000000000..542ad28cc
--- /dev/null
+++ b/private/crt32/h/oscalls.h
@@ -0,0 +1,141 @@
+/***
+*oscalls.h - contains declarations of Operating System types and constants.
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Declares types and constants that are defined by the target OS.
+* [Internal]
+*
+*Revision History:
+* 12-01-90 SRW Module created
+* 02-01-91 SRW Removed usage of NT header files (_WIN32_)
+* 02-28-91 SRW Removed usage of ntconapi.h (_WIN32_)
+* 04-09-91 PNT Added _MAC_ definitions
+* 04-26-91 SRW Disable min/max definitions in windows.h and added debug
+* definitions for DbgPrint and DbgBreakPoint(_WIN32_)
+* 08-05-91 GJF Use win32.h instead of windows.h for now.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-12-91 GJF Go back to using windows.h for win32 build.
+* 09-26-91 GJF Don't use error.h for Win32.
+* 11-07-91 GJF win32.h renamed to dosx32.h
+* 11-08-91 GJF Don't use windows.h, excpt.h. Add ntstatus.h.
+* 12-13-91 GJF Fixed so that exception stuff will build for Win32
+* 02-04-92 GJF Now must include ntdef.h to get LPSTR type.
+* 02-07-92 GJF Backed out change above, LPSTR also got added to
+* winnt.h
+* 03-30-92 DJM POSIX support.
+* 04-06-92 SRW Backed out 11-08-91 change and went back to using
+* windows.h only.
+* 05-12-92 DJM Moved POSIX code to it's own ifdef.
+* 08-01-92 SRW Let windows.h include excpt.h now that it replaces winxcpt.h
+* 09-30-92 SRW Use windows.h for _POSIX_ as well
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#ifndef _INC_OSCALLS
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef _CRUISER_ /* CRUISER TARGET */
+
+#include <doscalls.h>
+#include <error.h>
+#include <error2.h>
+#include <except.h>
+
+#else /* ndef _CRUISER_ */
+
+#ifdef _WIN32_
+
+#ifdef NULL
+#undef NULL
+#endif
+
+#if defined(DEBUG) && defined(_WIN32_)
+
+void DbgBreakPoint(void);
+int DbgPrint(char *Format, ...);
+
+#endif /* DEBUG && _WIN32_ */
+
+#define NOMINMAX 1
+
+#ifdef _DOSX32_
+
+#include <excpt.h>
+#include <dosx32.h>
+#include <error.h>
+#include <error2.h>
+
+#else
+#include <windows.h>
+#endif
+
+#undef NULL
+#ifndef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+#endif
+
+/* File time and date types */
+
+typedef struct _FTIME { /* ftime */
+ unsigned short twosecs : 5;
+ unsigned short minutes : 6;
+ unsigned short hours : 5;
+} FTIME;
+typedef FTIME *PFTIME;
+
+typedef struct _FDATE { /* fdate */
+ unsigned short day : 5;
+ unsigned short month : 4;
+ unsigned short year : 7;
+} FDATE;
+typedef FDATE *PFDATE;
+
+#else /* ndef _WIN32_ */
+
+#ifdef _POSIX_
+
+#undef NULL
+#ifdef __cplusplus
+#define NULL 0
+#else
+#define NULL ((void *)0)
+#endif
+
+#include <windows.h>
+
+#else /* ndef _POSIX_ */
+
+#ifdef _MAC_
+
+#include <doscalls.h>
+#include <error.h>
+#include <error2.h>
+
+#else /* ndef _MAC_ */
+
+#error ERROR - ONLY CRUISER, WIN32, POSIX, OR MAC TARGET SUPPORTED!
+
+#endif /* _POSIX_ */
+
+#endif /* _MAC_ */
+
+#endif /* _WIN32_ */
+
+#endif /* _CRUISER_ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_OSCALLS
+#endif /* _INC_OSCALLS */
diff --git a/private/crt32/h/ostream.h b/private/crt32/h/ostream.h
new file mode 100644
index 000000000..a81819139
--- /dev/null
+++ b/private/crt32/h/ostream.h
@@ -0,0 +1,135 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 06-03-92 KRS CAV #1183: Add 'const' to ptr output function.
+* 02-23-93 SKS Update copyright to 1993
+* 03-23-93 CFW Modified #pragma warnings.
+* 06-22-93 CFW Enable operator<<(long double)
+*
+****/
+
+#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/crt32/h/process.h b/private/crt32/h/process.h
new file mode 100644
index 000000000..946545f7c
--- /dev/null
+++ b/private/crt32/h/process.h
@@ -0,0 +1,244 @@
+/***
+*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.
+*
+*Revision History:
+* 08/24/87 JCR Added P_NOWAITO
+* 10/20/87 JCR Removed "MSC40_ONLY" entries and "MSSDK_ONLY" comments
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 01-11-88 JCR Added _beginthread/_endthread
+* 01-15-88 JCR Got rid of _p_overlay for MTRHEAD/DLL
+* 02-10-88 JCR Cleaned up white space
+* 05-08-88 SKS Removed bogus comment about "DOS 4"; Added "P_DETACH"
+* 08-22-88 GJF Modified to also work for the 386 (small model only)
+* 09-14-88 JCR Added _cexit and _c_exit declarations
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 06-08-89 JCR 386 _beginthread does NOT take a stackpointer arg
+* 08-01-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-17-89 GJF Added const attribute to appropriate arg types
+* 03-01-90 GJF Added #ifndef _INC_PROCESS and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 or _CALLTYPE2 in
+* prototypes.
+* 04-10-90 GJF Replaced remaining instances of _cdecl (with _CALLTYPE1
+* or _VARTYPE1, as appropriate).
+* 10-12-90 GJF Changed return type of _beginthread() to unsigned long.
+* 01-17-91 GJF ANSI naming.
+* 08-20-91 JCR C++ and ANSI naming
+* 08-26-91 BWM Added prototypes for _loaddll, unloaddll, and
+* _getdllprocaddr.
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 07-22-92 GJF Deleted references to _wait for Win32.
+* 08-05-92 GJF Function calling type and variable type macros.
+* 08-28-92 GJF #ifdef-ed out for POSIX.
+* 09-03-92 GJF Merged two changes above.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_PROCESS
+
+#ifndef _POSIX_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 MTHREAD
+extern int _CRTVAR1 _p_overlay;
+#endif
+
+#define _P_WAIT 0
+#define _P_NOWAIT 1
+#ifdef MTHREAD
+#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 MTHREAD
+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 *);
+#ifndef _WIN32_
+int _CRTAPI1 _wait(int *);
+#endif
+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
+
+#ifndef _DOSX32_
+#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
+#ifndef _WIN32_
+#define wait _wait
+#endif
+#else
+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 *);
+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 *);
+#ifndef _WIN32_
+int _CRTAPI1 wait(int *);
+#endif
+#endif
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _POSIX_ */
+
+#define _INC_PROCESS
+#endif /* _INC_PROCESS */
diff --git a/private/crt32/h/pversion.inc b/private/crt32/h/pversion.inc
new file mode 100644
index 000000000..b53a0eb8c
--- /dev/null
+++ b/private/crt32/h/pversion.inc
@@ -0,0 +1,28 @@
+; SCCSID = "@(#)pversion.inc:1.8"
+?PLM = 1
+?WIN = 0
+REALFAR = 0 ; used for QC only
+ifdef large
+ ?LARGE equ 1
+endif
+ifdef compact
+ ?COMPACT equ 1
+endif
+ifdef medium
+ ?MEDIUM equ 1
+endif
+ifdef small
+ ?SMALL equ 1
+endif
+ifdef small32
+ ?SMALL32 equ 1
+ memS32 = 1
+else
+ memS32 = 0
+endif
+ifdef flat32
+ ?FLAT32 equ 1
+ memF32 = 1
+else
+ memF32 = 0
+endif
diff --git a/private/crt32/h/rterr.h b/private/crt32/h/rterr.h
new file mode 100644
index 000000000..e8d6b11c3
--- /dev/null
+++ b/private/crt32/h/rterr.h
@@ -0,0 +1,76 @@
+/***
+*rterr.h - runtime errors
+*
+* Copyright (c) 1990-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the C runtime errors
+*
+*Revision History:
+* 06-01-90 GJF Module created.
+* 08-08-90 GJF Added _RT_CONIO, redefined _RT_NONCONT and
+* _RT_INVALDISP.
+* 09-08-91 GJF Added _RT_ONEXIT for Win32 (_WIN32_).
+* 09-28-91 GJF Fixed conflict with RTEs in 16-bit Win support. Also,
+* added three math errors.
+* 10-23-92 GJF Added _RT_PUREVIRT.
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#define _RT_STACK 0 /* stack overflow */
+#define _RT_NULLPTR 1 /* null pointer assignment */
+#define _RT_FLOAT 2 /* floating point not loaded */
+#define _RT_INTDIV 3 /* integer divide by 0 */
+
+/*
+ * the following three errors must be in the given order!
+ */
+#define _RT_EXECMEM 5 /* not enough memory on exec */
+#define _RT_EXECFORM 6 /* bad format on exec */
+#define _RT_EXECENV 7 /* bad environment on exec */
+
+#define _RT_SPACEARG 8 /* not enough space for arguments */
+#define _RT_SPACEENV 9 /* not enough space for environment */
+#define _RT_ABORT 10 /* Abnormal program termination */
+
+#define _RT_NPTR 12 /* illegal near pointer use */
+#define _RT_FPTR 13 /* illegal far pointer use */
+#define _RT_BREAK 14 /* control-BREAK encountered */
+#define _RT_INT 15 /* unexpected interrupt */
+#define _RT_THREAD 16 /* not enough space for thread data */
+#define _RT_LOCK 17 /* unexpected multi-thread lock error */
+#define _RT_HEAP 18 /* unexpected heap error */
+#define _RT_OPENCON 19 /* unable to open console device */
+
+/*
+ * _RT_QWIN and _RT_NOMAIN are used in 16-bit Windows support
+ */
+#define _RT_QWIN 20 /* unexpected QuickWin error */
+#define _RT_NOMAIN 21 /* no main procedure */
+
+
+#define _RT_NONCONT 22 /* non-continuable exception */
+#define _RT_INVALDISP 23 /* invalid disposition of exception */
+
+
+/*
+ * _RT_ONEXIT is specific to Win32 and Dosx32 platforms
+ */
+#define _RT_ONEXIT 24 /* insufficient heap to allocate
+ * initial table of funct. ptrs
+ * used by _onexit()/atexit(). */
+
+#define _RT_PUREVIRT 25 /* pure virtual function call attempted
+ * (C++ error) */
+
+/*
+ * _RT_DOMAIN, _RT_SING and _RT_TLOSS are generated by the floating point
+ * library.
+ */
+#define _RT_DOMAIN 120
+#define _RT_SING 121
+#define _RT_TLOSS 122
+
+#define _RT_CRNL 252
+#define _RT_BANNER 255
diff --git a/private/crt32/h/search.h b/private/crt32/h/search.h
new file mode 100644
index 000000000..107f99801
--- /dev/null
+++ b/private/crt32/h/search.h
@@ -0,0 +1,104 @@
+/***
+*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]
+*
+*Revision History:
+* 10/20/87 JCR Removed "MSC40_ONLY" entries
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 01-21-88 JCR Removed _LOAD_DS from declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-22-88 GJF Modified to also work for the 386 (small model only)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-01-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-17-89 GJF Changed arg types to be consistently "[const] void *"
+* (same as 06-05-89 change to CRT version)
+* 03-01-90 GJF Added #ifndef _INC_SEARCH and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes.
+* 01-17-91 GJF ANSI naming.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 08-05-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_SEARCH
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 */
+#ifndef _DOSX32_
+#define lfind _lfind
+#define lsearch _lsearch
+#else
+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 *));
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_SEARCH
+#endif /* _INC_SEARCH */
diff --git a/private/crt32/h/setjmp.h b/private/crt32/h/setjmp.h
new file mode 100644
index 000000000..0bf778e6c
--- /dev/null
+++ b/private/crt32/h/setjmp.h
@@ -0,0 +1,299 @@
+/***
+*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]
+*
+*Revision History:
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-15-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-01-90 GJF Added #ifndef _INC_SETJMP and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 04-10-90 GJF Replaced _cdecl with _CALLTYPE1.
+* 05-18-90 GJF Revised for SEH.
+* 10-30-90 GJF Moved definition of _JBLEN into cruntime.h.
+* 02-25-91 SRW Moved definition of _JBLEN back here [_WIN32_]
+* 04-09-91 PNT Added _MAC_ definitions
+* 04-17-91 SRW Fixed definition of _JBLEN for i386 and MIPS to not
+* include the * sizeof(int) factor [_WIN32_]
+* 05-09-91 GJF Moved _JBLEN defs back to cruntime.h. Also, turn on
+* intrinsic _setjmp for Dosx32.
+* 08-27-91 GJF #ifdef out everything for C++.
+* 08-29-91 JCR ANSI naming
+* 11-01-91 GDP MIPS compiler support -- Moved _JBLEN back here
+* 01-16-92 GJF Fixed _JBLEN and map to _setjmp intrinsic for i386
+* target [_WIN32_].
+* 05-08-92 GJF Changed _JBLEN to support C8-32 (support for C6-386 has
+* been dropped).
+* 08-06-92 GJF Function calling type and variable type macros. Revised
+* use of compiler/target processor macros.
+* 11-09-92 GJF Fixed some preprocessing conditionals.
+* 01-03-93 SRW Fold in ALPHA changes
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 02-20-93 GJF Per ChuckG and MartinO, setjmp/longjmp to used in
+* C++ programs.
+* 03-23-93 SRW Change _JBLEN for MIPS in preparation for SetJmpEx
+* 04-23-93 SRW Added _JBTYPE and finalized setjmpex support.
+* 06-09-93 SRW Missing one line in previous merge.
+* 10-04-93 SRW Fix ifdefs for MIPS and ALPHA to only check for _M_?????? defines
+* 01-12-93 PML Increased x86 _JBLEN from 8 to 16. Added new fields
+* to _JUMP_BUFFER for use with C9.0.
+*
+****/
+
+#ifndef _INC_SETJMP
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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/crt32/h/setjmpex.h b/private/crt32/h/setjmpex.h
new file mode 100644
index 000000000..68d9486c9
--- /dev/null
+++ b/private/crt32/h/setjmpex.h
@@ -0,0 +1,41 @@
+/***
+*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.
+*
+*Revision History:
+* 03-23-93 SRW Created.
+* 04-23-93 SRW Modified to not use a global variable.
+* 01-13-94 PML #define longjmp on x86 so setjmp still an intrinsic
+*
+****/
+
+#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/crt32/h/setlocal.h b/private/crt32/h/setlocal.h
new file mode 100644
index 000000000..f69b2b430
--- /dev/null
+++ b/private/crt32/h/setlocal.h
@@ -0,0 +1,142 @@
+/***
+*setlocal.h - internal definitions used by locale-dependent functions.
+*
+* Copyright (c) 1991-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains internal definitions/declarations for locale-dependent
+* functions, in particular those required by setlocale().
+* [Internal]
+*
+*Revision History:
+* 10-16-91 ETC 32-bit version created from 16-bit setlocal.c
+* 12-20-91 ETC Removed GetLocaleInfo structure definitions.
+* 08-18-92 KRS Make _CLOCALEHANDLE == LANGNEUTRAL HANDLE = 0.
+* 12-17-92 CFW Added LC_ID, LCSTRINGS, and GetQualifiedLocale
+* 12-17-92 KRS Change value of NLSCMPERROR from 0 to INT_MAX.
+* 01-08-93 CFW Added LC_*_TYPE and _getlocaleinfo (wrapper) prototype.
+* 01-13-93 KRS Change LCSTRINGS back to LC_STRINGS for consistency.
+* Change _getlocaleinfo prototype again.
+* 02-08-93 CFW Added time defintions from locale.h, added 'const' to
+* GetQualifiedLocale prototype, added _lconv_static_*.
+* 02-16-93 CFW Changed time defs to long and short.
+* 03-17-93 CFW Add language and country info definitions.
+* 03-23-93 CFW Add _ to GetQualifiedLocale prototype.
+* 03-24-93 CFW Change to _get_qualified_locale.
+*
+****/
+
+#ifndef _INC_SETLOCAL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <cruntime.h>
+#include <oscalls.h>
+#include <limits.h>
+
+#define ERR_BUFFER_TOO_SMALL 1 // should be in windef.h
+
+#define NLSCMPERROR INT_MAX // Return value for *cmp and *coll
+ // functions when NLSAPI call fails
+
+#define _CLOCALEHANDLE 0 /* "C" locale handle */
+#define _CLOCALECP CP_ACP /* "C" locale Code page (ANSI 8859) */
+
+/* Define the max length for each string type including space for a null. */
+
+#define _MAX_WDAY_ABBR 4
+#define _MAX_WDAY 10
+#define _MAX_MONTH_ABBR 4
+#define _MAX_MONTH 10
+#define _MAX_AMPM 3
+
+#define _DATE_LENGTH 8 /* mm/dd/yy (null not included) */
+#define _TIME_LENGTH 8 /* hh:mm:ss (null not included) */
+
+/* LC_TIME localization structure */
+
+struct _lc_time_data {
+ char *wday_abbr[7];
+ char *wday[7];
+ char *month_abbr[12];
+ char *month[12];
+ char *ampm[2];
+#ifdef _INTL
+ char *ww_sdatefmt;
+ char *ww_ldatefmt;
+ char *ww_timefmt;
+#endif
+ };
+
+
+#define MAX_LANG_LEN 64 /* max language name length */
+#define MAX_CTRY_LEN 64 /* max country name length */
+#define MAX_MODIFIER_LEN 0 /* max modifier name length - n/a */
+#define MAX_LC_LEN (MAX_LANG_LEN+MAX_CTRY_LEN+MAX_MODIFIER_LEN+3)
+ /* max entire locale string length */
+#define MAX_CP_LEN 5 /* max code page name length */
+#define CATNAMES_LEN 57 /* "LC_COLLATE=;LC_CTYPE=;..." length */
+
+#define LC_INT_TYPE 0
+#define LC_STR_TYPE 1
+
+#define QF_STRINGS 1
+#define QF_LCID 2
+
+typedef struct tagLC_ID {
+ WORD wLanguage;
+ WORD wCountry;
+ WORD wCodePage;
+} LC_ID, *LPLC_ID;
+
+typedef struct tagLC_STRINGS {
+ char szLanguage[MAX_LANG_LEN];
+ char szCountry[MAX_CTRY_LEN];
+ char szCodePage[MAX_CP_LEN];
+} LC_STRINGS, *LPLC_STRINGS;
+
+extern LC_ID _lc_id[]; /* complete info from GetQualifiedLocale */
+extern LCID _lc_handle[]; /* locale "handles" -- ignores country info */
+extern UINT _lc_codepage; /* code page */
+
+BOOL _CRTAPI1 _get_qualified_locale(
+ const DWORD dwType,
+ const LPVOID lpInput,
+ LPLC_ID lpOutId,
+ LPLC_STRINGS lpOutStr
+ );
+
+int _CRTAPI3 _getlocaleinfo (
+ int lc_type,
+ LCID localehandle,
+ LCTYPE fieldtype,
+ void *address
+ );
+
+/* initial values for lconv structure */
+extern char _lconv_static_decimal[];
+extern char _lconv_static_null[];
+
+/* language and country string definitions */
+typedef struct tagLANGREC
+{
+ CHAR szLanguage[MAX_LANG_LEN];
+ WORD wLanguage;
+} LANGREC;
+extern LANGREC __rg_lang_rec[];
+
+typedef struct tagCTRYREC
+{
+ CHAR szCountry[MAX_CTRY_LEN];
+ WORD wCountry;
+} CTRYREC;
+extern CTRYREC __rg_ctry_rec[];
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_SETLOCAL
+#endif /* _INC_SETLOCAL */
diff --git a/private/crt32/h/share.h b/private/crt32/h/share.h
new file mode 100644
index 000000000..346ec3c5a
--- /dev/null
+++ b/private/crt32/h/share.h
@@ -0,0 +1,35 @@
+/***
+*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().
+*
+*Revision History:
+* 08-15-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 03-01-90 GJF Added #ifndef _INC_SHARE stuff
+* 01-18-91 GJF ANSI naming
+* 08-11-92 GJF Removed SH_COMPAT (no such mode except in DOS).
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#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/crt32/h/signal.h b/private/crt32/h/signal.h
new file mode 100644
index 000000000..86367e3bd
--- /dev/null
+++ b/private/crt32/h/signal.h
@@ -0,0 +1,129 @@
+/***
+*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]
+*
+*Revision History:
+* 06-03-87 JMB Added MSSDK_ONLY comment on OS/2 related constants
+* 06-08-87 JCR Changed SIG_RRR to SIG_SGE
+* 08-07-87 SKS Signal handlers are now of type "void", not "int"
+* 10/20/87 JCR Removed "MSC40_ONLY" entries and "MSSDK_ONLY" comments
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-22-88 GJF Modified to also work for the 386 (small model only)
+* 12-06-88 SKS Add _CDECL to SIG_DFL, SIG_IGN, SIG_SGE, SIG_ACK
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-15-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-01-90 GJF Added #ifndef _INC_SIGNAL and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-15-90 GJF Replaced _cdecl with _CALLTYPE1 in #defines and
+* prototypes.
+* 07-27-90 GJF Added definition for SIG_DIE (internal action code,
+* not valid as an argument to signal()).
+* 09-25-90 GJF Added _pxcptinfoptrs stuff.
+* 10-09-90 GJF Added arg type specification (int) to pointer-to-
+* signal-handler-type usages
+* 08-20-91 JCR C++ and ANSI naming
+* 07-17-92 GJF Removed unsupported signals: SIGUSR1, SIGUSR2, SIGUSR3.
+* 08-05-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_SIGNAL
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 */
+
+#ifndef _INTERNAL_IFSTRIP_
+/* internal use only! not valid as an argument to signal() */
+
+#define SIG_GET (void (_CRTAPI1 *)(int))2 /* accept signal */
+#define SIG_DIE (void (_CRTAPI1 *)(int))5 /* terminate process */
+#endif
+
+/* 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 MTHREAD
+extern void * * _CRTAPI1 __pxcptinfoptrs(void);
+#define _pxcptinfoptrs (*__pxcptinfoptrs())
+#else
+extern void * _CRTVAR1 _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/crt32/h/sizeptr.h b/private/crt32/h/sizeptr.h
new file mode 100644
index 000000000..735622819
--- /dev/null
+++ b/private/crt32/h/sizeptr.h
@@ -0,0 +1,45 @@
+/***
+*sizeptr.h - defines constants based on memory model
+*
+* Copyright (c) 1985-1990, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines the constants SIZEC, SIZED, DIST, BDIST based
+* on the current memory model.
+* SIZEC is for far code models (medium, large).
+* SIZED is for large data models (compact, large).
+* [Internal]
+*
+*Revision History:
+* 08-15-89 GJF Fixed copyright, changed far to _far, near to _near
+* 10-30-89 GJF Fixed copyright (again)
+*
+****/
+
+
+#ifdef M_I86MM
+#undef SIZED
+#define SIZEC
+#endif
+
+#ifdef M_I86CM
+#undef SIZEC
+#define SIZED
+#endif
+
+#ifdef M_I86LM
+#define SIZEC
+#define SIZED
+#endif
+
+#ifdef SS_NE_DS
+#define SIZED
+#endif
+
+#ifdef SIZED
+#define DIST _far
+#define BDIST _near /*bizzare distance*/
+#else
+#define DIST _near
+#define BDIST _far /*bizzare distance*/
+#endif
diff --git a/private/crt32/h/stdarg.h b/private/crt32/h/stdarg.h
new file mode 100644
index 000000000..66c88a1f1
--- /dev/null
+++ b/private/crt32/h/stdarg.h
@@ -0,0 +1,153 @@
+/***
+*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]
+*
+*Revision History:
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-15-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 01-05-90 JCR Added NULL definition
+* 03-02-90 GJF Added #ifndef _INC_STDARG stuff. Also, removed some
+* (now) useless preprocessor directives.
+* 05-29-90 GJF Replaced sizeof() with _INTSIZEOF() and revised the
+* va_arg() macro (fixes PTM 60)
+* 05-31-90 GJF Revised va_end() macro (propagated 5-25-90 change to
+* crt7 version by WAJ)
+* 10-30-90 GJF Moved the real definitions into cruntime.h (for NT
+* folks) and relinc.sed (to release ANSI compatible
+* version). Ugly compromise.
+* 08-20-91 JCR C++ and ANSI naming
+* 11-01-91 GDP MIPS Compiler support. Moved real definitions back here
+* 10-16-92 SKS Replaced "#ifdef i386" with "#ifdef _M_IX86".
+* 11-03-92 GJF Fixed several conditionals, dropped _DOSX32_ support.
+* 01-03-93 SRW Fold in ALPHA changes
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 01-25-93 GJF Fix va_list definition.
+* 10-04-93 SRW Fix ifdefs for MIPS and ALPHA to only check for _M_?????? defines
+*
+****/
+
+#ifndef _INC_STDARG
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+
+#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/crt32/h/stddef.h b/private/crt32/h/stddef.h
new file mode 100644
index 000000000..a9abd9563
--- /dev/null
+++ b/private/crt32/h/stddef.h
@@ -0,0 +1,153 @@
+/***
+*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]
+*
+*Revision History:
+* 10-02-87 JCR Changed NULL definition #else to #elif (C || L || H)
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-16-87 JCR Added threadid definition
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-19-88 GJF Revised to also work for the 386
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 06-06-89 JCR 386: Made _threadid a function
+* 08-01-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat
+* model). Also added parens to *_errno definition
+* (same as 11-14-88 change to CRT version).
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-02-90 GJF Added #ifndef _INC_STDDEF and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 04-10-90 GJF Replaced _cdecl with _VARTYPE1 or _CALLTYPE1, as
+* appropriate.
+* 08-16-90 SBM Made MTHREAD _errno return int *
+* 10-09-90 GJF Changed return type of __threadid() to unsigned long *.
+* 11-12-90 GJF Changed NULL to (void *)0.
+* 02-11-91 GJF Added offsetof() macro.
+* 02-12-91 GJF Only #define NULL if it isn't #define-d.
+* 03-21-91 KRS Added wchar_t typedef, also in stdlib.h.
+* 06-27-91 GJF Revised __threadid, added __threadhandle, both
+* for Win32 [_WIN32_].
+* 08-20-91 JCR C++ and ANSI naming
+* 01-29-92 GJF Got rid of silly macro defining _threadhandle to be
+* __threadhandle (no reason for the former name to be
+* be defined).
+* 08-05-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_STDDEF
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 MTHREAD
+extern int * _CRTAPI1 _errno(void);
+#define errno (*_errno())
+#else
+extern int _CRTVAR1 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 MTHREAD
+
+#ifdef _CRUISER_
+
+/* define pointer to thread id value */
+extern unsigned long * _CRTAPI1 __threadid(void);
+#define _threadid (__threadid())
+
+#else /* ndef _CRUISER_ */
+
+#ifdef _WIN32_
+
+extern unsigned long _CRTAPI1 __threadid(void);
+#define _threadid (__threadid())
+extern unsigned long _CRTAPI1 __threadhandle(void);
+
+#else /* ndef _WIN32_ */
+
+#error ERROR - ONLY CRUISER OR WIN32 TARGET SUPPORTED!
+
+#endif /* _WIN32_ */
+
+#endif /* _CRUISER_ */
+
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STDDEF
+#endif /* _INC_STDDEF */
diff --git a/private/crt32/h/stdio.h b/private/crt32/h/stdio.h
new file mode 100644
index 000000000..37fbe9c28
--- /dev/null
+++ b/private/crt32/h/stdio.h
@@ -0,0 +1,503 @@
+/***
+*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]
+*
+*Revision History:
+* 06-24-87 JMB Added char cast to putc macro
+* 07-20-87 SKS Fixed declaration of _flsbuf
+* 08-10-87 JCR Modified P_tmpdir/L_tmpdir
+* 08-17-87 PHG Fixed prototype for puts to take const char * per ANSI.
+* 10-02-87 JCR Changed NULL from #else to #elif (C || L || H)
+* 10/20/87 JCR Removed "MSC40_ONLY" entries
+* 11/09/87 JCR Multi-thread support
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-17-87 JCR Added _MTHREAD_ONLY comments
+* 12-18-87 JCR Added _FAR_ to declarations
+* 01-07-88 JCR _NFILE = 40 for mthread includes
+* 01-13-88 JCR Removed mthread _fileno_lk/_feof_lk/_ferror_lk declarations
+* 01-15-88 JCR DLL versions of stdin/stdout/stderr
+* 01-18-88 SKS Change _stdio() to __iob()
+* 01-20-88 SKS Change __iob() to _stdin(), _stdout(), _stderr()
+* 02-10-88 JCR Cleaned up white space
+* 04-21-88 WAJ Added _FAR_ to tempnam/_tmpnam_lk
+* 05-31-88 SKS Add FILENAME_MAX and FOPEN_MAX
+* 06-01-88 JCR Removed clearerr_lk macro
+* 07-28-88 GJF Added casts to fileno() so the file handle is zero
+* extended instead of sign extended
+* 08-18-88 GJF Revised to also work with the 386 (in small model only).
+* 11-14-88 GJF Added _fsopen()
+* 12-07-88 JCR DLL _iob[] references are now direct
+* 03-27-89 GJF Brought into sync with CRT\H\STDIO.H
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 07-24-89 GJF Changed FILE and fpos_t to be type names rather than
+* macros (ANSI requirement). Same as 04-06-89 change in
+* CRT
+* 07-25-89 GJF Cleanup. Alignment of struct fields is now protected
+* by pack pragmas. Now specific to 386.
+* 10-30-89 GJF Fixed copyright, removed dummy args from prototypes
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-17-89 GJF Added const to appropriate arg type for fdopen() and
+* _popen().
+* 02-16-90 GJF _iob[], _iob2[] merge
+* 03-02-90 GJF Added #ifndef _INC_STDIO and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives and pragmas.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1 or _CALLTYPE2 in
+* prototypes.
+* 04-10-90 GJF Made _iob[] _VARTYPE1.
+* 10-30-90 GJF Moved actual type for va_list into cruntime.h
+* 11-12-90 GJF Changed NULL to (void *)0.
+* 01-21-91 GJF ANSI naming.
+* 02-12-91 GJF Only #define NULL if it isn't #define-d.
+* 08-01-91 GJF No _popen(), _pclose() for Dosx32.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-24-91 JCR Added _snprintf, _vsnprintf
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 01-22-92 GJF Changed definition of _iob for users of crtdll.dll.
+* 02-14-92 GJF Replaced _NFILE by _NSTREAM_ for Win32. _NFILE is
+* still supported for now, for backwards compatibility.
+* 03-17-92 GJF Replaced __tmpnum field in _iobuf structure with
+* _tmpfname, altered L_tmpnam definition for Win32.
+* 03-30-92 DJM POSIX support.
+* 06-02-92 KRS Added Unicode printf versions.
+* 08-05-92 GJF Fun. calling type and var. type macro.
+* 08-20-92 GJF Some small changes for POSIX.
+* 08-20-92 GJF Some small changes for POSIX.
+* 09-04-92 GJF Merged changes from 8-5-92 on.
+* 11-05-92 GJF Replaced #ifndef __STDC__ with #if !__STDC__. Also,
+* undid my ill-advised change to _P_tmpdir.
+* 12-12-92 SRW Add L_cuserid constant for _POSIX_
+* 01-03-93 SRW Fold in ALPHA changes
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 01-25-93 GJF Cosmetic change to va_list definition.
+* 02-01-93 GJF Made FILENAME_MAX 260.
+* 03-18-93 CFW Changed BUFSIZ from 512 to 4096
+* 03-22-93 CFW Changed BUFSIZ from 4096 to 512 (binaries frozen).
+* 04-29-93 CFW Add wide char get/put support.
+* 04-30-93 CFW Fixed wide char get/put support.
+* 05-04-93 CFW Remove uneeded _filwbuf, _flswbuf protos.
+* 06-02-93 CFW Wide get/put use wint_t.
+* 10-04-93 SRW Fix ifdefs for MIPS and ALPHA to only check for _M_?????? defines
+*
+****/
+
+#ifndef _INC_STDIO
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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
+
+#ifdef _WIN32_
+/*
+ * Number of supported streams. _NFILE is confusing and obsolete, but
+ * supported anyway for backwards compatibility.
+ */
+#define _NFILE _NSTREAM_
+#ifdef MTHREAD
+#define _NSTREAM_ 40
+#else
+#define _NSTREAM_ 20
+#endif
+
+#else
+
+#ifdef MTHREAD
+#define _NFILE 40
+#else
+#define _NFILE 20
+#endif
+
+#endif
+
+#define EOF (-1)
+
+#ifndef _FILE_DEFINED
+struct _iobuf {
+ char *_ptr;
+ int _cnt;
+ char *_base;
+ int _flag;
+ int _file;
+ int _charbuf;
+ int _bufsiz;
+#ifdef _CRUISER_
+ int __tmpnum;
+#else /* ndef _CRUISER_ */
+ char *_tmpfname;
+#endif /* _CRUISER_ */
+ };
+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
+
+#ifdef _CRUISER_
+/* L_tmpnam size = size of P_tmpdir
+ * + 1 (in case P_tmpdir does not end in "/")
+ * + 6 (for the temp number string)
+ * + 1 (for the null terminator)
+ */
+#define L_tmpnam sizeof(_P_tmpdir)+8
+#else /* ndef _CRUISER_ */
+/* 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
+#endif /* _CRUISER_ */
+
+
+#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 * _CRTVAR1 _iob;
+#else
+extern FILE _CRTVAR1 _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 *);
+#ifndef _DOSX32_
+int _CRTAPI1 _pclose(FILE *);
+FILE * _CRTAPI1 _popen(const char *, const char *);
+#endif /* _DOSX32_ */
+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)
+
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+wint_t _CRTAPI1 _getwc_lk(FILE *); /* _MTHREAD_ONLY */
+wint_t _CRTAPI1 _putwc_lk(wint_t, FILE *); /* _MTHREAD_ONLY */
+wint_t _CRTAPI1 _ungetwc_lk(wint_t, FILE *); /* _MTHREAD_ONLY */
+ /* _MTHREAD_ONLY */
+#else /*MTHREAD */ /* _MTHREAD_ONLY */
+#define _getwc_lk(_stm) fgetwc(_stm) /* _MTHREAD_ONLY */
+#define _putwc_lk(_c,_stm) fputwc(_c,_stm) /* _MTHREAD_ONLY */
+#define _ungetwc_lk(_c,_stm) ungetwc(_c,_stm) /* _MTHREAD_ONLY */
+#endif /*MTHREAD */ /* _MTHREAD_ONLY */
+
+#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)
+ /* _MTHREAD_ONLY */
+#define _getc_lk(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream)) /* _MTHREAD_ONLY */
+#define _putc_lk(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream))) /* _MTHREAD_ONLY */
+#define _getchar_lk() _getc_lk(stdin) /* _MTHREAD_ONLY */
+#define _putchar_lk(_c) _putc_lk((_c),stdout) /* _MTHREAD_ONLY */
+
+
+#ifdef MTHREAD
+#undef getc
+#undef putc
+#undef getchar
+#undef putchar
+#endif
+ /* _MTHREAD_ONLY */
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+int _CRTAPI1 _fclose_lk(FILE *); /* _MTHREAD_ONLY */
+int _CRTAPI1 _fflush_lk(FILE *); /* _MTHREAD_ONLY */
+size_t _CRTAPI1 _fread_lk(void *, size_t, size_t, FILE *); /* _MTHREAD_ONLY */
+int _CRTAPI1 _fseek_lk(FILE *, long, int); /* _MTHREAD_ONLY */
+long _CRTAPI1 _ftell_lk(FILE *); /* _MTHREAD_ONLY */
+size_t _CRTAPI1 _fwrite_lk(const void *, size_t, size_t, FILE *); /* _MTHREAD_ONLY */
+char * _CRTAPI1 _tmpnam_lk(char *); /* _MTHREAD_ONLY */
+int _CRTAPI1 _ungetc_lk(int, FILE *); /* _MTHREAD_ONLY */
+#else /* not MTHREAD */ /* _MTHREAD_ONLY */
+#define _fclose_lk(_stream) fclose(_stream) /* _MTHREAD_ONLY */
+#define _fflush_lk(_stream) fflush(_stream) /* _MTHREAD_ONLY */
+#define _fread_lk(_buffer,_size,_count,_stream) fread(_buffer,_size,_count,_stream) /* _MTHREAD_ONLY */
+#define _fseek_lk(_stream,_offset,_origin) fseek(_stream,_offset,_origin) /* _MTHREAD_ONLY */
+#define _ftell_lk(_stream) ftell(_stream) /* _MTHREAD_ONLY */
+#define _fwrite_lk(_buffer,_size,_count,_stream) fwrite(_buffer,_size,_count,_stream) /* _MTHREAD_ONLY */
+#define _tmpnam_lk(_string) tmpnam(_string) /* _MTHREAD_ONLY */
+#define _ungetc_lk(_c,_stream) ungetc(_c,_stream) /* _MTHREAD_ONLY */
+#endif /* _MTHREAD_ONLY */
+
+#if !__STDC__ && !defined(_POSIX_)
+/* Non-ANSI names for compatibility */
+
+#define P_tmpdir _P_tmpdir
+#define SYS_OPEN _SYS_OPEN
+
+#ifndef _DOSX32_
+#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
+#else
+int _CRTAPI1 fcloseall(void);
+FILE * _CRTAPI1 fdopen(int, const char *);
+int _CRTAPI1 fgetchar(void);
+int _CRTAPI1 fileno(FILE *);
+int _CRTAPI1 flushall(void);
+int _CRTAPI1 fputchar(int);
+int _CRTAPI1 getw(FILE *);
+int _CRTAPI1 putw(int, FILE *);
+int _CRTAPI1 rmtmp(void);
+char * _CRTAPI1 tempnam(char *, char *);
+int _CRTAPI1 unlink(const char *);
+#endif
+
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STDIO
+#endif /* _INC_STDIO */
diff --git a/private/crt32/h/stdiostr.h b/private/crt32/h/stdiostr.h
new file mode 100644
index 000000000..ff71bfaba
--- /dev/null
+++ b/private/crt32/h/stdiostr.h
@@ -0,0 +1,59 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#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/crt32/h/stdlib.h b/private/crt32/h/stdlib.h
new file mode 100644
index 000000000..04595b01b
--- /dev/null
+++ b/private/crt32/h/stdlib.h
@@ -0,0 +1,552 @@
+/***
+*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]
+*
+*Revision History:
+* 06-03-87 JMB Added MSSDK_ONLY switch to OS2_MODE, DOS_MODE
+* 06-30-87 SKS Added MSSDK_ONLY switch to _osmode
+* 08-17-87 PHG Removed const from params to _makepath, _splitpath,
+* _searchenv to conform with spec and documentation.
+* 10/20/87 JCR Removed "MSC40_ONLY" entries and "MSSDK_ONLY" comments
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 01-04-88 WAJ Increased _MAX_PATH and _MAX_DIR
+* 01-21-88 JCR Removed _LOAD_DS from search routine declarations
+* 02-10-88 JCR Cleaned up white space
+* 05-31-88 SKS Added EXIT_SUCCESS and EXIT_FAILURE
+* 08-19-88 GJF Modified to also work for the 386 (small model only)
+* 09-29-88 JCR onexit/atexit user routines must be _loadds in DLL
+* 09-30-88 JCR environ is a routine for DLL (bug fix)
+* 12-08-88 JCR DLL environ is resolved directly (no __environ call)
+* 12-15-88 GJF Added definition of NULL (ANSI)
+* 12-27-88 JCR Added _fileinfo, also DLL support for _fmode entry
+* 05-03-89 JCR Corrected _osmajor/_osminor for 386
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 07-24-89 GJF Gave names to the structs for div_t and ldiv_t types
+* 08-01-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat
+* model). Also added parens to *_errno and *_doserrno
+* definitions (same as 11-14-88 change to CRT version).
+* 10-25-89 JCR Upgraded _MAX values for long filename support
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL", removed superfluous _DLL defs
+* 11-17-89 GJF Moved _fullpath prototype here (from direct.h). Also,
+* added const to appropriate arg types for _makepath(),
+* putenv(), _searchenv() and _splitpath().
+* 11-20-89 JCR Routines are now _cdecl in both single and multi-thread
+* 11-27-89 KRS Fixed _MAX_PATH etc. to match current OS/2 limits.
+* 03-02-90 GJF Added #ifndef _INC_STDLIB and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-22-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes and
+* with _VARTYPE1 in variable declarations.
+* 04-10-90 GJF Made _errno() and __doserrno() _CALLTYPE1.
+* 08-15-90 SBM Made MTHREAD _errno() and __doserrno() return int *
+* 10-31-90 JCR Added WINR_MODE and WINP_MODE for consistency
+* 11-12-90 GJF Changed NULL to (void *)0.
+* 11-30-90 GJF Conditioned definition of _doserrno on _CRUISER_ or
+* _WIN32_
+* 01-21-91 GJF ANSI naming.
+* 02-12-91 GJF Only #define NULL if it isn't #define-d.
+* 03-21-91 KRS Added wchar_t type, MB_CUR_MAX macro, and mblen,
+* mbtowc, mbstowcs, wctomb, and wcstombs functions.
+* 04-09-91 PNT Added _MAC_ definitions
+* 05-21-91 GJF #define onexit_t to _onexit_t if __STDC__ is not
+* not defined
+* 08-08-91 GJF Added prototypes for _atold and _strtold.
+* 08-20-91 JCR C++ and ANSI naming
+* 08-26-91 BWM Added prototypes for _beep, _sleep, _seterrormode.
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 11-15-91 GJF Changed definitions of min and max to agree with
+* windef.h
+* 01-22-92 GJF Fixed up definitions of global variables for build of,
+* and users of, crtdll.dll. Also, deleted declaration
+* of _psp (has no meaning outside of DOS).
+* 01-30-92 GJF Removed prototype for _strtold (no such function yet).
+* 03-30-92 DJM POSIX support.
+* 04-29-92 GJF Added _putenv_lk and _getenv_lk for Win32.
+* 06-16-92 KRS Added prototypes for wcstol and wcstod.
+* 06-29-92 GJF Removed bogus #define.
+* 08-05-92 GJF Function calling type and variable type macros. Also,
+* replaced ref. to i386 with ref to _M_IX86.
+* 08-18-92 KRS Add _mblen_lk.
+* 08-21-92 GJF Conditionally removed _atold for Win32 (no long double
+* in Win32).
+* 08-21-92 GJF Moved _mblen_lk into area that is stripped out by
+* release scripts.
+* 08-23-92 GJF Exposed _itoa, _ltoa, _ultoa, mblen, mbtowc, mbstowcs
+* for POSIX.
+* 08-26-92 SKS Add _osver, _winver, _winmajor, _winminor, _pgmptr
+* 09-03-92 GJF Merged changes from 8-5-92 on.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 03-01-93 SKS Add __argc and __argv
+* 03-30-93 CFW Protect with _MB_CUR_MAX_DEFINED, also defined in ctype.h.
+* 06-03-93 KRS Change _mbslen to _mbstrlen, returning type size_t.
+* 09-13-93 CFW Add _wtox and _xtow function prototypes.
+*
+****/
+
+#ifndef _INC_STDLIB
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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
+#ifdef CRTDLL
+#define __mb_cur_max __mb_cur_max_dll
+#endif
+#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 MTHREAD
+extern int * _CRTAPI1 _errno(void);
+#ifdef _CRUISER_
+extern int * _CRTAPI1 __doserrno(void);
+#else /* ndef _CRUISER_ */
+#ifdef _WIN32_
+extern unsigned long * _CRTAPI1 __doserrno(void);
+#else /* ndef _WIN32_ */
+#error ERROR - ONLY CRUISER OR WIN32 MTHREAD TARGET SUPPORTED!
+#endif /* _WIN32_ */
+#endif /* _CRUISER_ */
+#define errno (*_errno())
+#define _doserrno (*__doserrno())
+#else /* ndef MTHREAD */
+extern int _CRTVAR1 errno; /* XENIX style error number */
+#ifdef _CRUISER_
+extern int _CRTVAR1 _doserrno; /* OS system error value */
+#else /* ndef _CRUISER_ */
+#ifdef _WIN32_
+extern unsigned long _CRTVAR1 _doserrno; /* OS system error value */
+#else /* ndef _WIN32_ */
+#ifdef _MAC_
+extern int _CRTVAR1 _doserrno; /* OS system error value */
+#else /* ndef _MAC_ */
+#ifdef _POSIX_
+#else
+#error ERROR - ONLY CRUISER, WIN32, POSIX, OR MAC TARGET SUPPORTED!
+#endif /* _POSIX_ */
+#endif /* _MAC_ */
+#endif /* _WIN32_ */
+#endif /* _CRUISER_ */
+#endif /* MTHREAD */
+
+#ifdef _DLL
+
+extern char ** _CRTVAR1 _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 * _CRTVAR1 _sys_nerr_dll; /* # of entries in sys_errlist table */
+extern int * _CRTVAR1 __argc_dll; /* count of cmd line args */
+extern char *** _CRTVAR1 __argv_dll; /* pointer to table of cmd line args */
+extern char *** _CRTVAR1 _environ_dll; /* pointer to environment table */
+extern int * _CRTVAR1 _fmode_dll; /* default file translation mode */
+extern int * _CRTVAR1 _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 ** _CRTVAR1 _pgmptr_dll;
+
+extern unsigned int * _CRTVAR1 _osver_dll;
+extern unsigned int * _CRTVAR1 _winver_dll;
+extern unsigned int * _CRTVAR1 _winmajor_dll;
+extern unsigned int * _CRTVAR1 _winminor_dll;
+
+/* --------- The following block is OBSOLETE --------- */
+
+/* DOS major/minor version numbers */
+
+#define _osmajor (*_osmajor_dll)
+#define _osminor (*_osminor_dll)
+
+extern unsigned int * _CRTVAR1 _osmajor_dll;
+extern unsigned int * _CRTVAR1 _osminor_dll;
+
+/* --------- The preceding block is OBSOLETE --------- */
+
+#else
+
+#ifdef CRTDLL
+#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
+#define _pgmptr _pgmptr_dll
+#define _osver _osver_dll
+#define _winver _winver_dll
+#define _winmajor _winmajor_dll
+#define _winminor _winminor_dll
+/* --------- The following block is OBSOLETE --------- */
+#define _osmajor _osmajor_dll
+#define _osminor _osminor_dll
+/* --------- The preceding block is OBSOLETE --------- */
+#endif
+
+extern char * _CRTVAR1 _sys_errlist[]; /* perror error message table */
+extern int _CRTVAR1 _sys_nerr; /* # of entries in sys_errlist table */
+
+extern int _CRTVAR1 __argc; /* count of cmd line args */
+extern char ** _CRTVAR1 __argv; /* pointer to table of cmd line args */
+
+#ifdef _POSIX_
+extern char ** _CRTVAR1 environ; /* pointer to environment table */
+#else
+extern char ** _CRTVAR1 _environ; /* pointer to environment table */
+#endif
+
+extern int _CRTVAR1 _fmode; /* default file translation mode */
+extern int _CRTVAR1 _fileinfo; /* open file info mode (for spawn) */
+
+extern char * _CRTVAR1 _pgmptr; /* points to the module (EXE) name */
+
+/* Windows major/minor and O.S. version numbers */
+
+extern unsigned int _CRTVAR1 _osver;
+extern unsigned int _CRTVAR1 _winver;
+extern unsigned int _CRTVAR1 _winmajor;
+extern unsigned int _CRTVAR1 _winminor;
+
+/* --------- The following block is OBSOLETE --------- */
+
+/* DOS major/minor version numbers */
+
+extern unsigned int _CRTVAR1 _osmajor;
+extern unsigned int _CRTVAR1 _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 * _CRTVAR1 _osmode_dll;
+#else
+#ifdef CRTDLL
+#define _osmode _osmode_dll
+#endif
+extern unsigned char _CRTVAR1 _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 * _CRTVAR1 _cpumode_dll;
+#else
+#ifdef CRTDLL
+#define _cpumode _cpumode_dll
+#endif
+extern unsigned char _CRTVAR1 _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_
+#ifndef _WIN32_
+#ifdef _M_IX86
+long double _CRTAPI1 _atold(const char *);
+#endif
+#endif
+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 */
+
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+char * _CRTAPI1 _getenv_lk(const char *); /* _MTHREAD_ONLY */
+int _CRTAPI1 _putenv_lk(const char *); /* _MTHREAD_ONLY */
+int _CRTAPI1 _mblen_lk(const char *, size_t); /* _MTHREAD_ONLY */
+int _CRTAPI1 _mbtowc_lk(wchar_t*,const char*,size_t); /* _MTHREAD_ONLY */
+size_t _CRTAPI1 _mbstowcs_lk(wchar_t*,const char*,size_t); /* _MTHREAD_ONLY */
+int _CRTAPI1 _wctomb_lk(char*,wchar_t); /* _MTHREAD_ONLY */
+size_t _CRTAPI1 _wcstombs_lk(char*,const wchar_t*,size_t); /* _MTHREAD_ONLY */
+#else /* _MTHREAD_ONLY */
+#define _getenv_lk(envvar) getenv(envvar) /* _MTHREAD_ONLY */
+#define _putenv_lk(envvar) _putenv(envvar) /* _MTHREAD_ONLY */
+#define _mblen_lk(s,n) mblen(s,n) /* _MTHREAD_ONLY */
+#define _mbtowc_lk(pwc,s,n) mbtowc(pwc,s,n) /* _MTHREAD_ONLY */
+#define _mbstowcs_lk(pwcs,s,n) mbstowcs(pwcs,s,n) /* _MTHREAD_ONLY */
+#define _wctomb_lk(s,wchar) wctomb(s,wchar) /* _MTHREAD_ONLY */
+#define _wcstombs_lk(s,pwcs,n) wcstombs(s,pwcs,n) /* _MTHREAD_ONLY */
+#endif /* _MTHREAD_ONLY */
+
+#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
+
+#ifndef _DOSX32_
+#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
+#else
+char * _CRTAPI1 ecvt(double, int, int *, int *);
+char * _CRTAPI1 fcvt(double, int, int *, int *);
+char * _CRTAPI1 gcvt(double, int, char *);
+char * _CRTAPI1 itoa(int, char *, int);
+char * _CRTAPI1 ltoa(long, char *, int);
+onexit_t _CRTAPI1 onexit(onexit_t);
+int _CRTAPI1 putenv(const char *);
+void _CRTAPI1 swab(char *, char *, int);
+char * _CRTAPI1 ultoa(unsigned long, char *, int);
+#endif
+
+#endif /* !__STDC__ && !_POSIX_ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STDLIB
+#endif /* _INC_STDLIB */
diff --git a/private/crt32/h/streamb.h b/private/crt32/h/streamb.h
new file mode 100644
index 000000000..9c927e124
--- /dev/null
+++ b/private/crt32/h/streamb.h
@@ -0,0 +1,184 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 03-02-92 KRS Added locks for multithread support.
+* 06-03-92 KRS For convenience, add NULL here too.
+* 02-23-93 SKS Update copyright to 1993
+* 03-23-93 CFW Modified #pragma warnings.
+*
+****/
+
+#ifndef _INC_STREAMB
+#define _INC_STREAMB
+
+#ifndef _INTERNAL_IFSTRIP_
+#ifdef COMBOINC
+#if defined(_DLL) && !defined(MTHREAD)
+#error Cannot define _DLL without MTHREAD
+#endif
+#endif
+
+#endif /* !_INTERNAL_IFSTRIP_ */
+
+#include <ios.h> // need ios::seek_dir definition
+#ifdef MTHREAD // 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 MTHREAD
+ 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 MTHREAD
+ 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 MTHREAD
+ 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/crt32/h/string.h b/private/crt32/h/string.h
new file mode 100644
index 000000000..7d3fe1e9a
--- /dev/null
+++ b/private/crt32/h/string.h
@@ -0,0 +1,228 @@
+/***
+*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]
+*
+*Revision History:
+* 10/20/87 JCR Removed "MSC40_ONLY" entries
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-19-88 GJF Modified to also work for the 386 (small model only)
+* 03-22-88 JCR Added strcoll and strxfrm
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-03-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright, removed dummy args from strcoll and
+* strxfrm
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-17-89 GJF Added const to appropriate arg types for memccpy(),
+* memicmp() and _strerror().
+* 02-27-90 GJF Added #ifndef _INC_STRING, #include <cruntime.h>
+* and _CALLTYPE1 stuff. Also, some cleanup.
+* 03-21-90 GJF Got rid of movedata() prototype.
+* 08-14-90 SBM Added NULL definition for ANSI compliance
+* 11-12-90 GJF Changed NULL to (void *)0.
+* 01-18-91 GJF ANSI naming.
+* 02-12-91 GJF Only #define NULL if it isn't #define-d.
+* 03-21-91 KRS Added wchar_t type, also in stdlib.h and stddef.h.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 10-07-91 ETC Prototypes for wcs functions and _stricoll under _INTL.
+* 04-06-92 KRS Rip out _INTL switches again.
+* 06-23-92 GJF // is non-ANSI comment limiter.
+* 08-05-92 GJF Function calling type and variable type macros.
+* 08-18-92 KRS Activate wcstok.
+* 08-21-92 GJF Merged last two changes.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_STRING
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 */
+#ifndef _DOSX32_
+#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
+#else
+void * _CRTAPI1 memccpy(void *, const void *, int, unsigned int);
+int _CRTAPI1 memicmp(const void *, const void *, unsigned int);
+int _CRTAPI1 strcmpi(const char *, const char *);
+int _CRTAPI1 stricmp(const char *, const char *);
+char * _CRTAPI1 strdup(const char *);
+char * _CRTAPI1 strlwr(char *);
+int _CRTAPI1 strnicmp(const char *, const char *, size_t);
+char * _CRTAPI1 strnset(char *, int, size_t);
+char * _CRTAPI1 strrev(char *);
+char * _CRTAPI1 strset(char *, int);
+char * _CRTAPI1 strupr(char *);
+#endif /* !_DOSX32_ */
+
+#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/crt32/h/strstrea.h b/private/crt32/h/strstrea.h
new file mode 100644
index 000000000..0021d99df
--- /dev/null
+++ b/private/crt32/h/strstrea.h
@@ -0,0 +1,93 @@
+/***
+*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++]
+*
+*Revision History:
+* 01-23-92 KRS Ported from 16-bit version.
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#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/crt32/h/sys/locking.h b/private/crt32/h/sys/locking.h
new file mode 100644
index 000000000..d6a22a605
--- /dev/null
+++ b/private/crt32/h/sys/locking.h
@@ -0,0 +1,38 @@
+/***
+*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]
+*
+*Revision History:
+* 08-22-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 03-21-90 GJF Added #ifndef _INC_LOCKING stuff
+* 01-21-91 GJF ANSI naming.
+* 09-16-92 SKS Fix copyright, clean up backslash
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#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/crt32/h/sys/stat.h b/private/crt32/h/sys/stat.h
new file mode 100644
index 000000000..19e9b3fa1
--- /dev/null
+++ b/private/crt32/h/sys/stat.h
@@ -0,0 +1,151 @@
+/***
+*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]
+*
+*Revision History:
+* 07-28-87 SKS Fixed TIME_T_DEFINED to be _TIME_T_DEFINED
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 08-22-88 GJF Modified to also work for the 386 (small model only)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-22-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-09-90 GJF Added #ifndef _INC_STAT and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-21-90 GJF Replaced _cdecl with _CALLTYPE1.
+* 01-18-91 GJF ANSI naming.
+* 01-25-91 GJF Protect _stat struct with pack pragma.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 08-07-92 GJF Function calling type and variable type macros. Also
+* #include <types.h> (common user request).
+* 11-10-92 SKS Need #pragma pack(4) around definition of struct _stat
+* in case the user has specified non-default packing
+* 12-15-92 GJF Added _S_IFIFO for pipes (based on Unix/Posix def.
+* for FIFO special files and pipes).
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 04-07-93 GJF Changed type of first arg to _stat to const char *.
+* 09-27-93 SRW Make pack pragma conditional on MIPS and ALPHA too.
+*
+****/
+
+#ifndef _INC_STAT
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+#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
+#pragma pack(4)
+#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
+#pragma pack()
+#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
+
+#ifndef _DOSX32_
+#define fstat _fstat
+#define stat _stat
+#else
+int _CRTAPI1 fstat(int, struct stat *);
+int _CRTAPI1 stat(const char *, struct stat *);
+#endif
+
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_STAT
+#endif /* _INC_STAT */
diff --git a/private/crt32/h/sys/timeb.h b/private/crt32/h/sys/timeb.h
new file mode 100644
index 000000000..0ee9b414f
--- /dev/null
+++ b/private/crt32/h/sys/timeb.h
@@ -0,0 +1,129 @@
+/***
+*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]
+*
+*Revision History:
+* 07-28-87 SKS Fixed TIME_T_DEFINED to be _TIME_T_DEFINED
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-22-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-21-90 GJF Added #ifndef _INC_TIMEB stuff, added #include
+* <cruntime.h> and replaced _cdecl with _CALLTYPE1 in
+* prototype. Also, removed some (now) useless
+* preprocessor directives.
+* 01-21-91 GJF ANSI naming.
+* 08-20-91 JCR C++ and ANSI naming
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 01-23-92 GJF Had to change name of time zone field in timeb struct
+* to "tmzone" to make global time zone variable work in
+* crtdll.dll. INCOMPATIBLE CHANGE! OLD NAMING CANNOT BE
+* SUPPORTED BY A MACRO!
+* 08-07-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 06-08-93 SKS Change "tmzone" back to "timezone". This solution
+* was as much trouble as it was help. We simply cannot
+* support the old name "timezone" of the global variable
+* "_timezone", especially in CRTDLL model, where it must
+* be #defined to be (*_timezone_dll), because to do so
+* means that breaking the "struct _timeb" field names.
+*
+****/
+
+#ifndef _INC_TIMEB
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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
+#ifdef _WIN32_
+struct _timeb {
+ time_t time;
+ unsigned short millitm;
+ short timezone;
+ short dstflag;
+ };
+#else /* ndef _WIN32_ */
+struct _timeb {
+ time_t time;
+ unsigned short millitm;
+ short _timezone;
+ short dstflag;
+ };
+
+/* must be same name as extern declared in time.h */
+#define timezone _timezone
+
+#endif /* _WIN32_ */
+
+#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 */
+#ifndef _DOSX32_
+#define ftime _ftime
+#else
+void _CRTAPI1 ftime(struct timeb *);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_TIMEB
+#endif /* _INC_TIMEB */
diff --git a/private/crt32/h/sys/types.h b/private/crt32/h/sys/types.h
new file mode 100644
index 000000000..88c93f067
--- /dev/null
+++ b/private/crt32/h/sys/types.h
@@ -0,0 +1,58 @@
+/***
+*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]
+*
+*Revision History:
+* 07-28-87 SKS Fixed TIME_T_DEFINED to be _TIME_T_DEFINED
+* 08-22-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 03-21-90 GJF Added #ifndef _INC_TYPES stuff.
+* 01-18-91 GJF ANSI naming.
+* 01-20-91 JCR Fixed dev_t definition
+* 09-16-92 SKS Fix copyright, clean up backslash
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#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/crt32/h/sys/utime.h b/private/crt32/h/sys/utime.h
new file mode 100644
index 000000000..57b6712cf
--- /dev/null
+++ b/private/crt32/h/sys/utime.h
@@ -0,0 +1,106 @@
+/***
+*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.
+*
+*Revision History:
+* 07-28-87 SKS Fixed TIME_T_DEFINED to be _TIME_T_DEFINED
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 02-10-88 JCR Cleaned up white space
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-22-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 03-21-90 GJF Added #ifndef _INC_UTIME and #include <cruntime.h>
+* stuff, and replaced _cdecl with _CALLTYPE1 in the
+* prototype.
+* 01-22-91 GJF ANSI naming.
+* 08-20-91 JCR C++ and ANSI naming
+* 08-26-91 BWM Added prototype for _futime.
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 08-07-92 GJF Function calling type and variable type macros.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+*
+****/
+
+#ifndef _INC_UTIME
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 */
+#ifndef _DOSX32_
+#define utime _utime
+#else
+int _CRTAPI1 utime(char *, struct utimbuf *);
+#endif
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_UTIME
+#endif /* _INC_UTIME */
diff --git a/private/crt32/h/syserr.h b/private/crt32/h/syserr.h
new file mode 100644
index 000000000..86110449f
--- /dev/null
+++ b/private/crt32/h/syserr.h
@@ -0,0 +1,44 @@
+/***
+*syserr.h - constants/macros for error message routines
+*
+* Copyright (c) 1985-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file contains macros/constants for perror, strerror,
+* and _strerror.
+* [Internal]
+*
+*Revision History:
+* 08-15-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 03-02-90 GJF Added #ifndef _INC_SYSERR stuff
+* 01-22-91 GJF ANSI naming.
+* 01-23-92 GJF Added support for crtdll.dll (have to redefine
+* _sys_nerr).
+* 10-01-92 GJF Increased _SYS_MSGMAX.
+* 02-23-93 SKS Update copyright to 1993
+*
+****/
+
+#ifndef _INC_SYSERR
+
+#ifdef _DLL
+#define _sys_nerr (*_sys_nerr_dll)
+#else
+#ifdef CRTDLL
+#define _sys_nerr _sys_nerr_dll
+#endif
+#endif
+
+/* Macro for perror, strerror, and _strerror */
+
+#define _sys_err_msg(m) _sys_errlist[(((m)<0)||((m)>=_sys_nerr)?_sys_nerr:(m))]
+
+/* Maximum length of an error message.
+ NOTE: This parameter value must be correspond to the length of the longest
+ message in sys_errlist (source module syserr.c). */
+
+#define _SYS_MSGMAX 38
+
+#define _INC_SYSERR
+#endif /* _INC_SYSERR */
diff --git a/private/crt32/h/tchar.h b/private/crt32/h/tchar.h
new file mode 100644
index 000000000..6f20ac50e
--- /dev/null
+++ b/private/crt32/h/tchar.h
@@ -0,0 +1,587 @@
+/***
+*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.
+*
+*
+*
+*Revision History:
+* 11-21-91 ETC Created.
+* 12-13-91 ETC Changed names of formatted i/o functions.
+* 04-02-92 KRS Renamed file tchar.h to match ISO's wchar.h.
+* 06-03-92 KRS Add full printf family of functions. Remove _tflag.
+* 06-16-92 KRS Add strtol/strtod functions.
+* 07-06-92 KRS Put TCHAR typedef under switches.
+* 08-18-92 KRS Added _tscanf and _tcstok under _UNICODE switches.
+* 01-26-93 KRS Rip out _TSTART macro. Added _TEXT() macro.
+* 03-03-93 KRS Added _TEXT macro and _MBCS support.
+* 03-23-93 KRS Added model-independent string functions.
+* 04-06-93 KRS Added MBCS-specific functions.
+* 04-29-93 CFW Add/correct a few macros.
+* 05-12-93 KRS Change type TCHAR to _TCHAR if not __STDC__ for ANSI.
+* Added _tclen, _tccpy, use __inline.
+* 05-29-93 CFW Add another layer of indirection to _TEXT macros.
+* 06-03-93 KRS Change definition of _strinc/dec and tccpy.
+* 06-15-93 KRS Merge 16- and 32-bit versions.
+* 07-14-93 KRS Make _tcslen, all _tcsnxxx functions use _TCHARS, not
+* "logical characters". Add _tcsclen, tcsncxxx versions
+* for "logical char" versions.
+* 07-28-93 KRS Improve macros to eliminate /W4 warnings.
+* 08-11-93 CFW Grabbed from Ikura - currently *identical* to Ikura.
+* 09-28-93 SRW Protect RC compiler from #pragma
+* 10-13-93 GJF Merged NT and Cuda versions. Deleted old 16-bit
+* support. Replaced defined(__STDC__) with __STDC__ in
+* preprocessor statements.
+* 10-19-93 CFW Add missing mappings.
+* 10-19-93 CFW Fix _tcscspn bug.
+* 10-22-93 CFW Missing mappings use new functions.
+* 11-09-93 SRW Add definition lf wchar_t if needed.
+*
+****/
+
+#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/crt32/h/time.h b/private/crt32/h/time.h
new file mode 100644
index 000000000..038587f37
--- /dev/null
+++ b/private/crt32/h/time.h
@@ -0,0 +1,242 @@
+/***
+*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]
+*
+*Revision History:
+* 07-27-87 SKS Added _strdate(), _strtime()
+* 10-20-87 JCR Removed "MSC40_ONLY" entries
+* 12-11-87 JCR Added "_loadds" functionality
+* 12-18-87 JCR Added _FAR_ to declarations
+* 01-16-88 JCR Added function versions of daylight/timezone/tzset
+* 01-20-88 SKS Change _timezone(n) to _timezone(), _daylight()
+* 02-10-88 JCR Cleaned up white space
+* 12-07-88 JCR DLL timezone/daylight/tzname now directly refers to data
+* 03-14-89 JCR Added strftime() prototype and size_t definition
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-15-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright, removed dummy args from prototypes
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 11-20-89 JCR difftime() always _cdecl (not pascal even under mthread)
+* 03-02-90 GJF Added #ifndef _INC_TIME and #include <cruntime.h>
+* stuff. Also, removed some (now) useless preprocessor
+* directives.
+* 03-29-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes and with
+* _VARTYPE1 in variable declarations.
+* 08-16-90 SBM Added NULL definition for ANSI compliance
+* 11-12-90 GJF Changed NULL to (void *)0.
+* 01-21-91 GJF ANSI naming.
+* 02-12-91 GJF Only #define NULL if it isn't #define-d.
+* 08-20-91 JCR C++ and ANSI naming
+* 08-26-91 BWM Added prototypes for _getsystime and _setsystem.
+* 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
+* 01-22-92 GJF Fixed up definitions of global variables for build of,
+* and users of, crtdll.dll.
+* 03-25-92 DJM POSIX support.
+* 08-05-92 GJF Function calling type and variable type macros.
+* 08-24-92 PBS Support for Posix TZ variable.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 03-10-93 MJB Fixes for Posix TZ stuff.
+* 05-05-93 CFW Add wcsftime proto.
+* 06-08-93 SKS Cannot #define the old name "timezone" to "_timezone"
+* because of conflict conflict with the timezone field
+* in struct timeb in <sys/timeb.h>.
+*
+****/
+
+#ifndef _INC_TIME
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+/*
+ * 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 * _CRTVAR1 _daylight_dll;
+
+/* difference in seconds between GMT and local time */
+extern long * _CRTVAR1 _timezone_dll;
+
+/* standard/daylight savings time zone names */
+extern char ** _CRTVAR1 _tzname;
+
+#else
+
+#ifdef CRTDLL
+#define _daylight _daylight_dll
+#define _timezone _timezone_dll
+#endif
+
+#ifdef _POSIX_
+extern char _CRTVAR1 * _rule;
+#endif
+
+/* non-zero if daylight savings time is used */
+extern int _CRTVAR1 _daylight;
+
+/* difference in seconds between GMT and local time */
+extern long _CRTVAR1 _timezone;
+
+/* standard/daylight savings time zone names */
+#ifdef _POSIX_
+extern char * _VARTYPE1 tzname[2];
+#else
+extern char * _VARTYPE1 _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
+
+#ifndef _DOSX32_
+#define tzset _tzset
+#else
+void _CRTAPI1 tzset(void);
+#endif
+#endif /* _POSIX_ */
+
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_TIME
+#endif /* _INC_TIME */
diff --git a/private/crt32/h/timeb.inc b/private/crt32/h/timeb.inc
new file mode 100644
index 000000000..1f36f85a1
--- /dev/null
+++ b/private/crt32/h/timeb.inc
@@ -0,0 +1,37 @@
+;***
+;timeb.inc - definition of the C Run-Time Library "timeb" structure
+;
+; Copyright (c) 1992-1993, Microsoft Corporation. All rights reserved.
+;
+;Purpose:
+; Analog of <sys/timeb.h> for assembler routines.
+;
+;Notes:
+; This file must reflect the structure "timeb" defined in <sys/timeb.h>
+; and is dependent on the alignment characteristics of the Intel 386;
+; namely, that words ("shorts") are aligned on even addresses and
+; dwords ("longs") are aligned on quad addresses.
+;
+; Important: MIPS follows the Intel 386 convention as well.
+;
+;Revision History:
+; 03-13-92 SKS Initial version
+; 06-08-93 SKS Cosmetic change - _tmzone becomes _timezone_
+; to match the corrected C source code naming.
+;
+;******************************************************************************
+
+;struct _timeb {
+; time_t time;
+; unsigned short millitm;
+; short tmzone;
+; short dstflag;
+; };
+
+_timeb STRUC
+ _time dd ?
+ _millitm dw ?
+ _timezone_ dw ?
+ _dstflag dw ?
+ __padding__ dw ? ; pad the structure out to
+_timeb ENDS ; an even number of DWORDs
diff --git a/private/crt32/h/v2tov3.h b/private/crt32/h/v2tov3.h
new file mode 100644
index 000000000..12b573f2e
--- /dev/null
+++ b/private/crt32/h/v2tov3.h
@@ -0,0 +1,74 @@
+/***
+*v2tov3.h - macros for porting MS C v.2 to v.3 and later
+*
+* Copyright (c) 1985-1990, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* This file defines macros which can be used to ease the problems
+* of porting MS C version 2.0 programs to MS C versions 3.0 and later.
+* [Internal]
+*
+*Revision History:
+* 08-15-89 GJF Fixed copyright
+* 10-30-89 GJF Fixed copyright (again)
+* 03-02-90 GJF Added #ifndef _INC_V2TOV3 stuff
+*
+****/
+
+#ifndef _INC_V2TOV3
+
+/* macro to translate the names used to force binary mode for files */
+
+#define O_RAW O_BINARY
+
+/* macro to translate setnbuf calls to the equivalent setbuf call */
+
+#define setnbuf(stream) setbuf(stream, NULL)
+
+/* macro to translate stclen calls to the equivalent strlen call */
+
+#define stclen(s) strlen(s)
+
+/* macro to translate stscmp calls to the equivalent strcmp call */
+
+#define stscmp(s,t) strcmp(s,t)
+
+/* macro to translate stpchr calls to the equivalent strchr call */
+
+#define stpchr(s,c) strchr(s,c)
+
+/* macro to translate stpbrk calls to the equivalent strpbrk call */
+
+#define stpbrk(s,b) strpbrk(s,b)
+
+/* macro to translate stcis calls to the equivalent strspn call */
+
+#define stcis(s1,s2) strspn(s1,s2)
+
+/* macro to translate stcisn calls to the equivalent strcspn call */
+
+#define stcisn(s1,s2) strcspn(s1,s2)
+
+/* macro to translate setmem calls to the equivalent memset call */
+
+#define setmem(p, n, c) memset(p, c, n)
+
+/* macro to translate movmem calls to the equivalent memcpy call */
+
+#define movmem(s, d, n) memcpy(d, s, n)
+
+/* MS C version 2.0 min, max, and abs macros */
+
+#define max(a,b) (((a) > (b)) ? (a) : (b))
+#define min(a,b) (((a) < (b)) ? (a) : (b))
+#define abs(a) (((a) < 0) ? -(a) : (a))
+
+/* macros which implement MS C version 2.0's extended ctype macros, iscym and
+ * iscysmf
+ */
+
+#define iscsymf(c) (isalpha(c) || ((c) == '_'))
+#define iscsym(c) (isalnum(c) || ((c) == '_'))
+
+#define _INC_V2TOV3
+#endif /* _INC_V2TOV3 */
diff --git a/private/crt32/h/varargs.h b/private/crt32/h/varargs.h
new file mode 100644
index 000000000..d38029e36
--- /dev/null
+++ b/private/crt32/h/varargs.h
@@ -0,0 +1,160 @@
+/***
+*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]
+*
+*Revision History:
+* 08-22-88 GJF Modified to also work for the 386 (small model only)
+* 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
+* 08-15-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat model)
+* 10-30-89 GJF Fixed copyright
+* 11-02-89 JCR Changed "DLL" to "_DLL"
+* 01-05-90 JCR Added NULL definition
+* 03-02-90 GJF Added #ifndef _INC_VARARGS stuff. Also, removed some
+* (now) useless preprocessor directives.
+* 05-29-90 GJF Replaced sizeof() with _INTSIZEOF() and revised the
+* va_arg() macro (fixes PTM 60)
+* 05-31-90 GJF Revised va_end() macro (propagated 5-25-90 change to
+* crt7 version by WAJ)
+* 01-24-91 JCR Generate an error on ANSI compilations
+* 08-20-91 JCR C++ and ANSI naming
+* 11-01-91 GDP MIPS Compiler support
+* 10-16-92 SKS Replaced "#ifdef i386" with "#ifdef _M_IX86".
+* 11-03-92 GJF Fixed several conditionals, dropped _DOSX32_ support.
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 10-04-93 SRW Fix ifdefs for MIPS and ALPHA to only check for _M_?????? defines
+*
+****/
+
+#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 _WIN32_
+
+#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 // __WIN32__
+
+#endif /* _M_ALPHA */
+
+#ifdef __cplusplus
+}
+#endif
+
+#define _INC_VARARGS
+#endif /* _INC_VARARGS */
diff --git a/private/crt32/h/wchar.h b/private/crt32/h/wchar.h
new file mode 100644
index 000000000..8221eae95
--- /dev/null
+++ b/private/crt32/h/wchar.h
@@ -0,0 +1,352 @@
+/***
+*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.
+*
+*Revision History:
+* 04-06-92 KRS Created.
+* 06-02-92 KRS Added stdio wprintf functions.
+* 06-16-92 KRS Added stdlib wcstol/wcstod functions.
+* 08-05-92 GJF Function calling type and variable type macros.
+* 08-18-92 KRS Added stdio wscanf functions, wcstok.
+* 09-04-92 GJF Merged changes from 8-5-92 on.
+* 01-03-93 SRW Fold in ALPHA changes
+* 01-09-93 SRW Remove usage of MIPS and ALPHA to conform to ANSI
+* Use _MIPS_ and _ALPHA_ instead.
+* 01-19-03 CFW Move to _NEWCTYPETABLE, remove switch.
+* 01-21-93 GJF Removed support for C6-386's _cdecl.
+* 01-25-93 GJF Cosmetic change to va_list definition.
+* 02-17-93 CFW Removed incorrect UNDONE comment.
+* 02-18-93 CFW Clean up common _WCTYPE_DEFINED section.
+* 04-12-93 CFW Change isw* to evaluate args only once.
+* 04-29-93 CFW Add wide char get/put.
+* 04-30-93 CFW Fixed wide char get/put support.
+* 05-05-93 CFW Change is_wctype to iswctype as per ISO.
+* 05-10-93 CFW Remove uneeded _filwbuf, _flswbuf protos.
+* 06-02-93 CFW Wide get/put use wint_t.
+* 06-26-93 CFW Remove is_wctype macro.
+* 09-13-93 CFW Add _wtox and _xtow function prototypes.
+* 10-04-93 SRW Fix ifdefs for MIPS and ALPHA to only check for _M_?????? defines
+*
+****/
+
+#ifndef _INC_WCHAR
+#define _INC_WCHAR
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef _INTERNAL_IFSTRIP_
+#include <cruntime.h>
+#endif /* _INTERNAL_IFSTRIP_ */
+
+
+/*
+ * 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 * _CRTVAR1 _ctype;
+
+#define _pctype (*_pctype_dll)
+extern unsigned short **_pctype_dll;
+
+#define _pwctype (*_pwctype_dll)
+extern unsigned short **_pwctype_dll;
+
+#else /* _DLL */
+
+#ifdef CRTDLL
+#define _pctype _pctype_dll
+#define _pwctype _pwctype_dll
+#endif
+
+extern unsigned short _CRTVAR1 _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 */
+
+#ifdef _INTL
+#define _LEADBYTE 0x8000 /* multibyte leadbyte */
+#define _ALPHA (0x0100|_UPPER|_LOWER) /* alphabetic character */
+#else
+#define _ALPHA (_UPPER|_LOWER) /* alphabetic character */
+#endif
+
+
+/* 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);
+
+#ifdef _INTL
+int _CRTAPI1 _isctype(int, int);
+#endif /* _INTL */
+
+#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 )
+
+#ifdef _INTL
+/* note: MS-specific routine, may evaluate its arguments more than once */
+#define isleadbyte(_c) ((_c) < 256 ? _pctype[_c] & _LEADBYTE : 0)
+#else
+#define isleadbyte(_c) (0)
+#endif /* _INTL */
+
+
+#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)
+
+#ifdef MTHREAD /* _MTHREAD_ONLY */
+wint_t _CRTAPI1 _getwc_lk(FILE *); /* _MTHREAD_ONLY */
+wint_t _CRTAPI1 _putwc_lk(wint_t, FILE *); /* _MTHREAD_ONLY */
+wint_t _CRTAPI1 _ungetwc_lk(wint_t, FILE *); /* _MTHREAD_ONLY */
+ /* _MTHREAD_ONLY */
+#else /*MTHREAD */ /* _MTHREAD_ONLY */
+#define _getwc_lk(_stm) fgetwc(_stm) /* _MTHREAD_ONLY */
+#define _putwc_lk(_c,_stm) fputwc(_c,_stm) /* _MTHREAD_ONLY */
+#define _ungetwc_lk(_c,_stm) ungetwc(_c,_stm) /* _MTHREAD_ONLY */
+#endif /*MTHREAD */ /* _MTHREAD_ONLY */
+
+#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/crt32/h/winheap.h b/private/crt32/h/winheap.h
new file mode 100644
index 000000000..c636ad103
--- /dev/null
+++ b/private/crt32/h/winheap.h
@@ -0,0 +1,25 @@
+/***
+* winheap.h - Private include file for winheap directory.
+*
+* Copyright (c) 1988-1993, Microsoft Corporation. All rights reserved.
+*
+*Purpose:
+* Contains information needed by the C library heap code.
+* [Internal]
+*
+*Revision History:
+* 10-01-92 SRW Created.
+* 10-28-92 SRW Change winheap code to call Heap????Ex calls
+* 11-05-92 SKS Change name of variable "CrtHeap" to "_crtheap"
+* 11-07-92 SRW _NTIDW340 replaced by linkopts\betacmp.c
+* 02-23-93 SKS Update copyright to 1993
+*
+*******************************************************************************/
+
+#ifndef _INC_HEAP
+#define _INC_HEAP
+
+#include <windows.h>
+extern HANDLE _crtheap;
+
+#endif // _INC_HEAP