--- mstools/h/stdlib.h 2018/08/09 18:20:01 1.1 +++ mstools/h/stdlib.h 2018/08/09 18:20:26 1.1.1.2 @@ -1,7 +1,7 @@ /*** *stdlib.h - declarations/definitions for commonly used library functions * -* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved. +* Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved. * *Purpose: * This include file contains the function declarations for @@ -19,9 +19,11 @@ extern "C" { #endif +#ifndef MIPS #if (_MSC_VER <= 600) #define __cdecl _cdecl #endif +#endif #ifndef _SIZE_T_DEFINED typedef unsigned int size_t; @@ -83,8 +85,15 @@ typedef struct _ldiv_t { #define RAND_MAX 0x7fff -extern unsigned short __mb_cur_max; /* max mb-len for current locale */ -#define MB_CUR_MAX __mb_cur_max +/* max mb-len for current locale */ +#ifdef _DLL +#define __mb_cur_max (*__mb_cur_max_dll) +#define MB_CUR_MAX (*__mb_cur_max_dll) +extern unsigned short *__mb_cur_max_dll; +#else +#define MB_CUR_MAX __mb_cur_max +extern unsigned short __mb_cur_max; +#endif /* min and max macros */ @@ -121,21 +130,52 @@ extern unsigned long * __doserrno(void); extern int errno; /* XENIX style error number */ extern unsigned long _doserrno; /* OS system error value */ #endif /* _MT */ + +#ifdef _DLL + +extern char ** _sys_errlist; /* perror error message table */ + +#define _sys_nerr (*_sys_nerr_dll) +#define _environ (*_environ_dll) +#define _fmode (*_fmode_dll) +#define _fileinfo (*_fileinfo_dll) + +extern int * _sys_nerr_dll; /* # of entries in sys_errlist table */ +extern char *** _environ_dll; /* pointer to environment table */ +extern int * _fmode_dll; /* default file translation mode */ +extern int * _fileinfo_dll; /* open file info mode (for spawn) */ + +/* DOS major/minor version numbers */ + +#define _osmajor (*_osmajor_dll) +#define _osminor (*_osminor_dll) + +extern unsigned int * _osmajor_dll; +extern unsigned int * _osminor_dll; + +#else + + extern char * _sys_errlist[]; /* perror error message table */ extern int _sys_nerr; /* # of entries in sys_errlist table */ +#ifdef _POSIX_ +extern char ** environ; /* pointer to environment table */ +#else extern char ** _environ; /* pointer to environment table */ +#endif + extern int _fmode; /* default file translation mode */ extern int _fileinfo; /* open file info mode (for spawn) */ -extern unsigned int _psp; /* Program Segment Prefix */ - - /* DOS major/minor version numbers */ extern unsigned int _osmajor; extern unsigned int _osminor; +#endif + + /* OS API mode */ #define _DOS_MODE 0 /* DOS */ @@ -143,8 +183,14 @@ extern unsigned int _osminor; #define _WIN_MODE 2 /* Windows */ #define _OS2_20_MODE 3 /* OS/2 2.0 */ #define _DOSX32_MODE 4 /* DOSX32 */ +#define _POSIX_MODE_ 5 /* POSIX */ +#ifdef _DLL +#define _osmode (*_osmode_dll) +extern unsigned char * _osmode_dll; +#else extern unsigned char _osmode; +#endif /* CPU addressing mode */ @@ -152,8 +198,12 @@ extern unsigned char _osmode; #define _PROT_MODE 1 /* protect mode */ #define _FLAT_MODE 2 /* flat mode */ +#ifdef _DLL +#define _cpumode (*_cpumode_dll) +extern unsigned char * _cpumode_dll; +#else extern unsigned char _cpumode; - +#endif /* function prototypes */ @@ -163,59 +213,59 @@ int atexit(void (*)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); -#if defined(i386) -long double _atold(const char *); -#endif void * bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); void * calloc(size_t, size_t); div_t div(int, int); -char * _ecvt(double, int, int *, int *); void exit(int); +void free(void *); +char * getenv(const char *); +long labs(long); +ldiv_t ldiv(long, long); +void * malloc(size_t); +void qsort(void *, size_t, size_t, int (*) + (const void *, const void *)); +int rand(void); +void * realloc(void *, size_t); +void srand(unsigned int); +double strtod(const char *, char **); +long strtol(const char *, char **, int); +unsigned long strtoul(const char *, char **, int); +int system(const char *); +int wctomb(char *, wchar_t); +size_t wcstombs(char *, const wchar_t *, size_t); + +#ifndef _POSIX_ +#if defined(i386) +long double _atold(const char *); +#endif +char * _ecvt(double, int, int *, int *); void _exit(int); char * _fcvt(double, int, int *, int *); -void free(void *); char * _fullpath(char *, const char *, size_t); char * _gcvt(double, int, char *); -char * getenv(const char *); char * _itoa(int, char *, int); -long labs(long); -ldiv_t ldiv(long, long); unsigned long _lrotl(unsigned long, int); unsigned long _lrotr(unsigned long, int); char * _ltoa(long, char *, int); void _makepath(char *, const char *, const char *, const char *, const char *); -void * malloc(size_t); _onexit_t _onexit(_onexit_t); void perror(const char *); int _putenv(const char *); -void qsort(void *, size_t, size_t, int (*) - (const void *, const void *)); unsigned int _rotl(unsigned int, int); unsigned int _rotr(unsigned int, int); -int rand(void); -void * realloc(void *, size_t); void _searchenv(const char *, const char *, char *); void _splitpath(const char *, char *, char *, char *, char *); -void srand(unsigned int); -double strtod(const char *, char **); -long strtol(const char *, char **, int); -#if defined(i386) -long double _strtold(const char *, char **); -#endif -unsigned long strtoul(const char *, char **, int); void _swab(char *, char *, int); -int system(const char *); char * _ultoa(unsigned long, char *, int); int mblen(const char *, size_t); int mbtowc(wchar_t *, const char *, size_t); -int wctomb(char *, wchar_t); size_t mbstowcs(wchar_t *, const char *, size_t); -size_t wcstombs(char *, const wchar_t *, size_t); void _seterrormode(int); void _beep(unsigned, unsigned); void _sleep(unsigned long); +#endif #ifndef tolower /* tolower has been undefined - use function */ int tolower(int); @@ -225,7 +275,7 @@ int tolower(int); int toupper(int); #endif /* toupper */ -#if !__STDC__ +#if (!__STDC__ && !defined(_POSIX_)) /* Non-ANSI names for compatibility */ #ifndef __cplusplus @@ -250,7 +300,7 @@ int toupper(int); #define swab _swab #define ultoa _ultoa -#endif /* __STDC__ */ +#endif /* !__STDC__ && !_POSIX_ */ #ifdef __cplusplus }