From 1b66fde7663138e2c6d9d5343071acb5ac6f562e Mon Sep 17 00:00:00 2001 From: Robert Dickenson Date: Sun, 24 Nov 2002 18:06:01 +0000 Subject: [PATCH] Result of three way diffing with include/crtdll and the winapi2 headers. reactos/include/crtdll now unused and to be deprecated. svn path=/trunk/; revision=3775 --- reactos/include/msvcrt/alloc.h | 57 +++-- reactos/include/msvcrt/assert.h | 40 +-- reactos/include/msvcrt/conio.h | 58 ++--- reactos/include/msvcrt/ctype.h | 159 ++++++------ reactos/include/msvcrt/dir.h | 141 +++++----- reactos/include/msvcrt/direct.h | 77 ++++-- reactos/include/msvcrt/errno.h | 118 ++++----- reactos/include/msvcrt/fcntl.h | 104 ++++---- reactos/include/msvcrt/float.h | 213 +++++++++------- reactos/include/msvcrt/internal/atexit.h | 6 +- reactos/include/msvcrt/internal/file.h | 56 ++-- reactos/include/msvcrt/internal/ieee.h | 24 +- reactos/include/msvcrt/internal/rterror.h | 42 +-- reactos/include/msvcrt/internal/stdio.h | 6 +- reactos/include/msvcrt/internal/tls.h | 21 +- reactos/include/msvcrt/io.h | 165 ++++++------ reactos/include/msvcrt/locale.h | 77 +++--- reactos/include/msvcrt/malloc.h | 22 +- reactos/include/msvcrt/math.h | 179 +++++++------ reactos/include/msvcrt/mbctype.h | 67 +++-- reactos/include/msvcrt/mbstring.h | 184 ++++++------- reactos/include/msvcrt/msvcrtdbg.h | 21 ++ reactos/include/msvcrt/process.h | 180 ++++++------- reactos/include/msvcrt/share.h | 53 +++- reactos/include/msvcrt/signal.h | 100 ++++---- reactos/include/msvcrt/stdarg.h | 39 +-- reactos/include/msvcrt/stddef.h | 56 ++-- reactos/include/msvcrt/stdio.h | 298 +++++++++++----------- reactos/include/msvcrt/stdlib.h | 283 ++++++++++---------- reactos/include/msvcrt/string.h | 218 ++++++++-------- reactos/include/msvcrt/sys/locking.h | 35 ++- reactos/include/msvcrt/sys/stat.h | 145 ++++++----- reactos/include/msvcrt/sys/timeb.h | 43 ++-- reactos/include/msvcrt/sys/types.h | 70 ++--- reactos/include/msvcrt/sys/utime.h | 55 ++-- reactos/include/msvcrt/time.h | 113 ++++---- reactos/include/msvcrt/wchar.h | 15 +- 37 files changed, 1860 insertions(+), 1680 deletions(-) diff --git a/reactos/include/msvcrt/alloc.h b/reactos/include/msvcrt/alloc.h index c0d36b4a425..a56b9b247d2 100644 --- a/reactos/include/msvcrt/alloc.h +++ b/reactos/include/msvcrt/alloc.h @@ -22,25 +22,25 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:30 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ #ifndef __STRICT_ANSI__ -#ifndef _ALLOC_H_ -#define _ALLOC_H_ +#ifndef _ALLOC_H_ +#define _ALLOC_H_ #include #ifndef RC_INVOKED -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -48,38 +48,39 @@ extern "C" { * The structure used to walk through the heap with _heapwalk. * TODO: This is a guess at the internals of this structure. */ -typedef struct _heapinfo +typedef struct _heapinfo { - void* ptr; - unsigned int size; - int in_use; + void* ptr; + unsigned int size; + int in_use; } _HEAPINFO; -int _heapwalk (_HEAPINFO* pHeapinfo); +int _heapwalk(_HEAPINFO* pHeapinfo); #ifdef __GNUC__ #ifdef USE_C_ALLOCA -void * C_alloca(size_t size); -#define _alloca(x) C_alloca(x) -#else /* USE_C_ALLOCA */ -#define _alloca(x) __builtin_alloca(x) -#endif /* USE_C_ALLOCA */ -#else /* __GNUC__ */ -void * _alloca(size_t size); -#endif /* __GNUC__ */ +void* C_alloca(size_t size); +#define _alloca(x) C_alloca(x) +#else /* USE_C_ALLOCA */ +#define _alloca(x) __builtin_alloca(x) +#endif /* USE_C_ALLOCA */ +#else /* __GNUC__ */ +void* _alloca(size_t size); +#endif /* __GNUC__ */ -#ifndef _NO_OLDNAMES -#define heapwalk(x) _heapwalk(x) -#define alloca(s) _alloca(s) -#endif /* Not _NO_OLDNAMES */ -#ifdef __cplusplus +#ifndef _NO_OLDNAMES +#define heapwalk(x) _heapwalk(x) +#define alloca(s) _alloca(s) +#endif /* Not _NO_OLDNAMES */ + +#ifdef __cplusplus } #endif -#endif /* Not RC_INVOKED */ +#endif /* Not RC_INVOKED */ -#endif /* Not _ALLOC_H_ */ +#endif /* Not _ALLOC_H_ */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/msvcrt/assert.h b/reactos/include/msvcrt/assert.h index 5b830376b7a..5e7527fa9f6 100644 --- a/reactos/include/msvcrt/assert.h +++ b/reactos/include/msvcrt/assert.h @@ -15,19 +15,20 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:30 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ #ifndef _ASSERT_H_ -#define _ASSERT_H_ +#define _ASSERT_H_ -#ifdef __cplusplus + +#ifdef __cplusplus extern "C" { #endif @@ -36,7 +37,7 @@ extern "C" { /* * If not debugging, assert does nothing. */ -#define assert(x) ((void)0); +#define assert(x) ((void)0) #else /* debugging enabled */ @@ -44,26 +45,25 @@ extern "C" { * CRTDLL nicely supplies a function which does the actual output and * call to abort. */ -#ifndef __ATTRIB_NORETURN -#ifdef __GNUC__ -#define _ATTRIB_NORETURN __attribute__ ((noreturn)) -#else /* Not __GNUC__ */ -#define _ATTRIB_NORETURN -#endif /* __GNUC__ */ +#ifndef __ATTRIB_NORETURN +#ifdef __GNUC__ +#define _ATTRIB_NORETURN __attribute__ ((noreturn)) +#else /* Not __GNUC__ */ +#define _ATTRIB_NORETURN +#endif /* __GNUC__ */ #endif -void _assert (const char* szExpression, const char* szFileName, int nLine) -_ATTRIB_NORETURN -; +void _assert(const char* szExpression, const char* szFileName, int nLine) _ATTRIB_NORETURN; /* * Definition of the assert macro. */ -#define assert(x) if(!(x)) _assert( #x , __FILE__, __LINE__); -#endif /* NDEBUG */ +#define assert(x) if(!(x)) _assert( #x , __FILE__, __LINE__); +#endif /* NDEBUG */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif +#endif /* Not _ASSERT_H_ */ + diff --git a/reactos/include/msvcrt/conio.h b/reactos/include/msvcrt/conio.h index 66491cd6991..2dd82941c8e 100644 --- a/reactos/include/msvcrt/conio.h +++ b/reactos/include/msvcrt/conio.h @@ -16,52 +16,48 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:30 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ -#ifndef _CONIO_H_ -#define _CONIO_H_ +#ifndef _CONIO_H_ +#define _CONIO_H_ -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -char* _cgets (char* szBuffer); -int _cprintf (const char* szFormat, ...); -int _cputs (const char* szString); -int _cscanf (char* szFormat, ...); +char* _cgets(char*); +int _cprintf(const char*, ...); +int _cputs(const char*); +int _cscanf(char*, ...); +int _getch(void); +int _getche(void); +int _kbhit(void); +int _putch(int); +int _ungetch(int); -int _getch (void); -int _getche (void); -int _kbhit (void); -int _putch (int cPut); -int _ungetch (int cUnget); +#ifndef _NO_OLDNAMES +#define getch _getch +#define getche _getche +#define kbhit _kbhit +#define putch(cPut) _putch(cPut) +#define ungetch(cUnget) _ungetch(cUnget) +#endif /* Not _NO_OLDNAMES */ -#ifndef _NO_OLDNAMES - -#define getch _getch -#define getche _getche -#define kbhit _kbhit -#define putch(cPut) _putch(cPut) -#define ungetch(cUnget) _ungetch(cUnget) - -#endif /* Not _NO_OLDNAMES */ - - -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not _CONIO_H_ */ +#endif /* Not _CONIO_H_ */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/msvcrt/ctype.h b/reactos/include/msvcrt/ctype.h index 45f6356993b..f4db364f849 100644 --- a/reactos/include/msvcrt/ctype.h +++ b/reactos/include/msvcrt/ctype.h @@ -15,20 +15,20 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:30 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ #ifndef _CTYPE_H_ #define _CTYPE_H_ -#define __need_wchar_t -#define __need_wint_t +#define __need_wchar_t +#define __need_wint_t #include @@ -36,53 +36,55 @@ * The following flags are used to tell iswctype and _isctype what character * types you are looking for. */ -#define _UPPER 0x0001 -#define _LOWER 0x0002 -#define _DIGIT 0x0004 -#define _SPACE 0x0008 -#define _PUNCT 0x0010 -#define _CONTROL 0x0020 -#define _BLANK 0x0040 -#define _HEX 0x0080 +#define _UPPER 0x0001 +#define _LOWER 0x0002 +#define _DIGIT 0x0004 +#define _SPACE 0x0008 /* HT LF VT FF CR SP */ +#define _PUNCT 0x0010 +#define _CONTROL 0x0020 +#define _BLANK 0x0040 /* this is SP only, not SP and HT as in C99 */ +#define _HEX 0x0080 +#define _LEADBYTE 0x8000 -#define _ALPHA 0x0103 -#define _LEADBYTE 0x8000 +#define _ALPHA 0x0103 #ifdef __cplusplus extern "C" { #endif -int isalnum(int c); -int isalpha(int c); -int iscntrl(int c); -int isdigit(int c); -int isgraph(int c); -int islower(int c); -int isprint(int c); -int ispunct(int c); -int isspace(int c); -int isupper(int c); -int isxdigit(int c); - -#ifndef __STRICT_ANSI__ -int _isctype (unsigned int c, int ctypeFlags); +int isalnum(int); +int isalpha(int); +int iscntrl(int); +int isdigit(int); +int isgraph(int); +int islower(int); +int isprint(int); +int ispunct(int); +int isspace(int); +int isupper(int); +int isxdigit(int); + +#ifndef __STRICT_ANSI__ +int _isctype (unsigned int, int); #endif -int tolower(int c); -int toupper(int c); +/* These are the ANSI versions, with correct checking of argument */ +int tolower(int); +int toupper(int); /* * NOTE: The above are not old name type wrappers, but functions exported - * explicitly by MSVCRT. However, underscored versions are also exported. + * explicitly by MSVCRT/CRTDLL. However, underscored versions are also + * exported. */ -#ifndef __STRICT_ANSI__ -int _tolower(int c); -int _toupper(int c); -#endif - -#ifndef WEOF -#define WEOF (wchar_t)(0xFFFF) +#ifndef __STRICT_ANSI__ +/* + * These are the cheap non-std versions: The return values are undefined + * if the argument is not ASCII char or is not of appropriate case + */ +int _tolower(int); +int _toupper(int); #endif /* @@ -94,46 +96,51 @@ int _toupper(int c); * problems under the current Cygwin compiler distribution. */ -typedef int wctype_t; +typedef int wctype_t; + /* Wide character equivalents */ -int iswalnum(wint_t wc); -int iswalpha(wint_t wc); -int iswascii(wint_t wc); -int iswcntrl(wint_t wc); -int iswctype(wint_t wc, wctype_t wctypeFlags); -int is_wctype(wint_t wc, wctype_t wctypeFlags); /* Obsolete! */ -int iswdigit(wint_t wc); -int iswgraph(wint_t wc); -int iswlower(wint_t wc); -int iswprint(wint_t wc); -int iswpunct(wint_t wc); -int iswspace(wint_t wc); -int iswupper(wint_t wc); -int iswxdigit(wint_t wc); - -wchar_t towlower(wchar_t c); -wchar_t towupper(wchar_t c); - -int isleadbyte (int c); - -#ifndef __STRICT_ANSI__ -int __isascii (int c); -int __toascii (int c); -int __iscsymf (int c); /* Valid first character in C symbol */ -int __iscsym (int c); /* Valid character in C symbol (after first) */ - -#ifndef _NO_OLDNAMES -#define isascii(c) __isascii(c) -#define toascii(c) _toascii(c) -#define iscsymf(c) __iscsymf(c) -#define iscsym(c) __iscsym(c) -#endif /* Not _NO_OLDNAMES */ - -#endif /* Not __STRICT_ANSI__ */ +#ifndef WEOF +#define WEOF (wchar_t)(0xFFFF) +#endif + +int iswalnum(wint_t); +int iswalpha(wint_t); +int iswascii(wint_t); +int iswcntrl(wint_t); +int iswctype(wint_t, wctype_t); +int is_wctype(wint_t, wctype_t); /* Obsolete! */ +int iswdigit(wint_t); +int iswgraph(wint_t); +int iswlower(wint_t); +int iswprint(wint_t); +int iswpunct(wint_t); +int iswspace(wint_t); +int iswupper(wint_t); +int iswxdigit(wint_t); + +wchar_t towlower(wchar_t); +wchar_t towupper(wchar_t); + +int isleadbyte(int); + +#ifndef __STRICT_ANSI__ +int __isascii(int); +int __toascii(int); +int __iscsymf(int); /* Valid first character in C symbol */ +int __iscsym(int); /* Valid character in C symbol (after first) */ + +#ifndef _NO_OLDNAMES +#define isascii(c) __isascii(c) +#define toascii(c) _toascii(c) +#define iscsymf(c) __iscsymf(c) +#define iscsym(c) __iscsym(c) +#endif /* Not _NO_OLDNAMES */ + +#endif /* Not __STRICT_ANSI__ */ #ifdef __cplusplus } #endif -#endif /* Not _CTYPE_H_ */ +#endif /* Not _CTYPE_H_ */ diff --git a/reactos/include/msvcrt/dir.h b/reactos/include/msvcrt/dir.h index 5b51ee4bb59..a439186963c 100644 --- a/reactos/include/msvcrt/dir.h +++ b/reactos/include/msvcrt/dir.h @@ -2,6 +2,8 @@ * dir.h * * Functions for working with directories and path names. + * This file OBSOLESCENT and only provided for backward compatibility. + * Please use io.h instead. * * This file is part of the Mingw32 package. * @@ -15,40 +17,40 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.5 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:30 $ + * $Revision: 1.6 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ #ifndef __STRICT_ANSI__ #ifndef _DIR_H_ -#define _DIR_H_ +#define _DIR_H_ -#include /* To get FILENAME_MAX... ugly. */ -#include /* To get time_t. */ +#include /* To get FILENAME_MAX... ugly. */ +#include /* To get time_t. */ -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif /* * Attributes of files as returned by _findfirst et al. */ -#define _A_NORMAL 0x00000000 -#define _A_RDONLY 0x00000001 -#define _A_HIDDEN 0x00000002 -#define _A_SYSTEM 0x00000004 -#define _A_VOLID 0x00000008 -#define _A_SUBDIR 0x00000010 -#define _A_ARCH 0x00000020 - -#ifndef _FSIZE_T_DEFINED -typedef unsigned long _fsize_t; +#define _A_NORMAL 0x00000000 +#define _A_RDONLY 0x00000001 +#define _A_HIDDEN 0x00000002 +#define _A_SYSTEM 0x00000004 +#define _A_VOLID 0x00000008 +#define _A_SUBDIR 0x00000010 +#define _A_ARCH 0x00000020 + +#ifndef _FSIZE_T_DEFINED +typedef unsigned long _fsize_t; #define _FSIZE_T_DEFINED #endif @@ -58,42 +60,42 @@ typedef unsigned long _fsize_t; */ struct _finddata_t { - unsigned attrib; /* Attributes, see constants above. */ - time_t time_create; - time_t time_access; /* always midnight local time */ - time_t time_write; - _fsize_t size; - char name[FILENAME_MAX]; /* may include spaces. */ + unsigned attrib; /* Attributes, see constants above. */ + time_t time_create; + time_t time_access; /* always midnight local time */ + time_t time_write; + _fsize_t size; + char name[FILENAME_MAX]; /* may include spaces. */ }; struct _finddatai64_t { - unsigned attrib; /* Attributes, see constants above. */ - time_t time_create; - time_t time_access; /* always midnight local time */ - time_t time_write; - __int64 size; - char name[FILENAME_MAX]; /* may include spaces. */ + unsigned attrib; /* Attributes, see constants above. */ + time_t time_create; + time_t time_access; /* always midnight local time */ + time_t time_write; + __int64 size; + char name[FILENAME_MAX]; /* may include spaces. */ }; struct _wfinddata_t { - unsigned attrib; /* Attributes, see constants above. */ - time_t time_create; - time_t time_access; /* always midnight local time */ - time_t time_write; - _fsize_t size; - wchar_t name[FILENAME_MAX]; /* may include spaces. */ + unsigned attrib; /* Attributes, see constants above. */ + time_t time_create; + time_t time_access; /* always midnight local time */ + time_t time_write; + _fsize_t size; + wchar_t name[FILENAME_MAX]; /* may include spaces. */ }; struct _wfinddatai64_t { - unsigned attrib; /* Attributes, see constants above. */ - time_t time_create; - time_t time_access; /* always midnight local time */ - time_t time_write; - __int64 size; - wchar_t name[FILENAME_MAX]; /* may include spaces. */ + unsigned attrib; /* Attributes, see constants above. */ + time_t time_create; + time_t time_access; /* always midnight local time */ + time_t time_write; + __int64 size; + wchar_t name[FILENAME_MAX]; /* may include spaces. */ }; /* @@ -102,47 +104,46 @@ struct _wfinddatai64_t * _findclose calls. _findnext also returns -1 if no match could be found, * and 0 if a match was found. Call _findclose when you are finished. */ -int _findclose (int nHandle); -int _findfirst (const char* szFilespec, struct _finddata_t* find); -int _findfirsti64 (const char* szFilespec, struct _finddatai64_t* find); -int _findnext (int nHandle, struct _finddata_t* find); -int _findnexti64 (int nHandle, struct _finddatai64_t* find); - -int _chdir (const char* szPath); -char* _getcwd (char* caBuffer, int nBufferSize); -int _mkdir (const char* szPath); -char* _mktemp (char* szTemplate); -int _rmdir (const char* szPath); +int _findclose(int nHandle); +int _findfirst(const char* szFilespec, struct _finddata_t* find); +int _findnext(int nHandle, struct _finddata_t* find); +int _findfirsti64(const char* szFilespec, struct _finddatai64_t* find); +int _findnexti64(int nHandle, struct _finddatai64_t* find); +/* Wide character versions */ +int _wfindfirst(const wchar_t *_name, struct _wfinddata_t *result); +int _wfindfirsti64(const wchar_t *_name, struct _wfinddatai64_t *result); +int _wfindnext(int handle, struct _wfinddata_t *result); +int _wfindnexti64(int handle, struct _wfinddatai64_t *result); +int _chdir(const char* szPath); +char* _getcwd(char* caBuffer, int nBufferSize); +int _mkdir(const char* szPath); +char* _mktemp(char* szTemplate); +int _rmdir(const char* szPath); /* Wide character versions */ -int _wfindfirst(const wchar_t *_name, struct _wfinddata_t *result); -int _wfindfirsti64(const wchar_t *_name, struct _wfinddatai64_t *result); -int _wfindnext(int handle, struct _wfinddata_t *result); -int _wfindnexti64(int handle, struct _wfinddatai64_t *result); - -int _wchdir(const wchar_t *szPath); +int _wchdir(const wchar_t *szPath); wchar_t* _wgetcwd(wchar_t *buffer, int maxlen); -int _wmkdir(const wchar_t *_path); -wchar_t* _wmktemp (wchar_t *_template); -int _wrmdir(const wchar_t *_path); +int _wmkdir(const wchar_t *_path); +wchar_t* _wmktemp(wchar_t *_template); +int _wrmdir(const wchar_t *_path); #ifndef _NO_OLDNAMES -int chdir (const char* szPath); -char* getcwd (char* caBuffer, int nBufferSize); -int mkdir (const char* szPath); -char* mktemp (char* szTemplate); -int rmdir (const char* szPath); +int chdir(const char* szPath); +char* getcwd(char* caBuffer, int nBufferSize); +int mkdir(const char* szPath); +char* mktemp(char* szTemplate); +int rmdir(const char* szPath); #endif /* Not _NO_OLDNAMES */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not _DIR_H_ */ +#endif /* Not _DIR_H_ */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/msvcrt/direct.h b/reactos/include/msvcrt/direct.h index e1849eca811..fafd72e1cab 100644 --- a/reactos/include/msvcrt/direct.h +++ b/reactos/include/msvcrt/direct.h @@ -1,3 +1,30 @@ +/* + * direct.h + * + * Functions for manipulating paths and directories (included from io.h) + * plus functions for setting the current drive. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ + * + */ + #ifndef _DIRECT_H_ #define _DIRECT_H_ @@ -11,36 +38,44 @@ typedef unsigned int size_t; #define _SIZE_T_ #endif +#ifdef __cplusplus +extern "C" { +#endif + struct _diskfree_t { - unsigned short total_clusters; - unsigned short avail_clusters; - unsigned short sectors_per_cluster; - unsigned short bytes_per_sector; + unsigned short total_clusters; + unsigned short avail_clusters; + unsigned short sectors_per_cluster; + unsigned short bytes_per_sector; }; -unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace); +int _getdrive(void); +int _chdrive(int); +char* _getcwd(char*, int); -int _chdrive( int drive ); -int _getdrive( void ); +unsigned int _getdiskfree(unsigned int, struct _diskfree_t*); -char *_getcwd( char *buffer, int maxlen ); -char *_getdcwd (int nDrive, char* caBuffer, int nBufLen); +int _chdir(const char*); +int _mkdir(const char*); +int _rmdir(const char*); -int _chdir(const char *_path); -int _mkdir(const char *_path); -int _rmdir(const char *_path); - -#define chdir _chdir +#define chdir _chdir #define getcwd _getcwd -#define mkdir _mkdir -#define rmdir _rmdir +#define mkdir _mkdir +#define rmdir _rmdir +char* _getdcwd(int nDrive, char* caBuffer, int nBufLen); -wchar_t *_wgetcwd( wchar_t *buffer, int maxlen ); -wchar_t *_wgetdcwd (int nDrive, wchar_t* caBuffer, int nBufLen); +wchar_t* _wgetcwd(wchar_t *buffer, int maxlen); +wchar_t* _wgetdcwd(int nDrive, wchar_t* caBuffer, int nBufLen); -int _wchdir(const wchar_t *_path); -int _wmkdir(const wchar_t *_path); -int _wrmdir(const wchar_t *_path); +int _wchdir(const wchar_t* _path); +int _wmkdir(const wchar_t* _path); +int _wrmdir(const wchar_t* _path); +#ifdef __cplusplus +} #endif + +#endif /* Not _DIRECT_H_ */ + diff --git a/reactos/include/msvcrt/errno.h b/reactos/include/msvcrt/errno.h index 6c8cd9c9236..5b6c3e53ccd 100644 --- a/reactos/include/msvcrt/errno.h +++ b/reactos/include/msvcrt/errno.h @@ -15,21 +15,17 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.6 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:30 $ + * $Revision: 1.7 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ #ifndef _ERRNO_H_ -#define _ERRNO_H_ - -#ifdef __cplusplus -extern "C" { -#endif +#define _ERRNO_H_ /* * Error numbers. @@ -39,50 +35,50 @@ extern "C" { * of the descriptions returned by strerror do not obviously match * their error naming. */ -#define EPERM 1 /* Operation not permitted */ -#define ENOFILE 2 /* No such file or directory */ -#define ENOENT 2 -#define ESRCH 3 /* No such process */ -#define EINTR 4 /* Interrupted function call */ -#define EIO 5 /* Input/output error */ -#define ENXIO 6 /* No such device or address */ -#define E2BIG 7 /* Arg list too long */ -#define ENOEXEC 8 /* Exec format error */ -#define EBADF 9 /* Bad file descriptor */ -#define ECHILD 10 /* No child processes */ -#define EAGAIN 11 /* Resource temporarily unavailable */ -#define ENOMEM 12 /* Not enough space */ -#define EACCES 13 /* Permission denied */ -#define EFAULT 14 /* Bad address */ +#define EPERM 1 /* Operation not permitted */ +#define ENOFILE 2 /* No such file or directory */ +#define ENOENT 2 +#define ESRCH 3 /* No such process */ +#define EINTR 4 /* Interrupted function call */ +#define EIO 5 /* Input/output error */ +#define ENXIO 6 /* No such device or address */ +#define E2BIG 7 /* Arg list too long */ +#define ENOEXEC 8 /* Exec format error */ +#define EBADF 9 /* Bad file descriptor */ +#define ECHILD 10 /* No child processes */ +#define EAGAIN 11 /* Resource temporarily unavailable */ +#define ENOMEM 12 /* Not enough space */ +#define EACCES 13 /* Permission denied */ +#define EFAULT 14 /* Bad address */ /* 15 - Unknown Error */ -#define EBUSY 16 /* strerror reports "Resource device" */ -#define EEXIST 17 /* File exists */ -#define EXDEV 18 /* Improper link (cross-device link?) */ -#define ENODEV 19 /* No such device */ -#define ENOTDIR 20 /* Not a directory */ -#define EISDIR 21 /* Is a directory */ -#define EINVAL 22 /* Invalid argument */ -#define ENFILE 23 /* Too many open files in system */ -#define EMFILE 24 /* Too many open files */ -#define ENOTTY 25 /* Inappropriate I/O control operation */ +#define EBUSY 16 /* strerror reports "Resource device" */ +#define EEXIST 17 /* File exists */ +#define EXDEV 18 /* Improper link (cross-device link?) */ +#define ENODEV 19 /* No such device */ +#define ENOTDIR 20 /* Not a directory */ +#define EISDIR 21 /* Is a directory */ +#define EINVAL 22 /* Invalid argument */ +#define ENFILE 23 /* Too many open files in system */ +#define EMFILE 24 /* Too many open files */ +#define ENOTTY 25 /* Inappropriate I/O control operation */ /* 26 - Unknown Error */ -#define EFBIG 27 /* File too large */ -#define ENOSPC 28 /* No space left on device */ -#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */ -#define EROFS 30 /* Read-only file system */ -#define EMLINK 31 /* Too many links */ -#define EPIPE 32 /* Broken pipe */ -#define EDOM 33 /* Domain error (math functions) */ -#define ERANGE 34 /* Result too large (possibly too small) */ +#define EFBIG 27 /* File too large */ +#define ENOSPC 28 /* No space left on device */ +#define ESPIPE 29 /* Invalid seek (seek on a pipe?) */ +#define EROFS 30 /* Read-only file system */ +#define EMLINK 31 /* Too many links */ +#define EPIPE 32 /* Broken pipe */ +#define EDOM 33 /* Domain error (math functions) */ +#define ERANGE 34 /* Result too large (possibly too small) */ /* 35 - Unknown Error */ -#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */ -#define EDEADLK 36 +#define EDEADLOCK 36 /* Resource deadlock avoided (non-Cyg) */ +#define EDEADLK 36 /* 37 - Unknown Error */ -#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */ -#define ENOLCK 39 /* No locks available (46 in Cyg?) */ -#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */ -#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */ -#define EILSEQ 42 /* Illegal byte sequence */ +#define ENAMETOOLONG 38 /* Filename too long (91 in Cyg?) */ +#define ENOLCK 39 /* No locks available (46 in Cyg?) */ +#define ENOSYS 40 /* Function not implemented (88 in Cyg?) */ +#define ENOTEMPTY 41 /* Directory not empty (90 in Cyg?) */ +#define EILSEQ 42 /* Illegal byte sequence */ /* * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the @@ -91,30 +87,34 @@ extern "C" { * of errors (look at the comment above them). */ +#ifdef __cplusplus +extern "C" { +#endif + /* * Definitions of macros for the 'variables' errno, _doserrno, sys_nerr and * sys_errlist. */ -int* _errno(void); -#define errno (*_errno()) +int* _errno(void); +#define errno (*_errno()) -int* __doserrno(void); -#define _doserrno (*__doserrno()) +int* __doserrno(void); +#define _doserrno (*__doserrno()) /* One of the MSVCRTxx libraries */ -extern int* __imp__sys_nerr; +extern int* __imp__sys_nerr; #ifndef sys_nerr -#define sys_nerr (*__imp__sys_nerr) +#define sys_nerr (*__imp__sys_nerr) #endif -extern char** __imp__sys_errlist; +extern char** __imp__sys_errlist; #ifndef sys_errlist -#define sys_errlist (__imp__sys_errlist) +#define sys_errlist (__imp__sys_errlist) #endif -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif +#endif /* Not _ERRNO_H_ */ diff --git a/reactos/include/msvcrt/fcntl.h b/reactos/include/msvcrt/fcntl.h index 07e1d3e1b02..365a8d82b9f 100644 --- a/reactos/include/msvcrt/fcntl.h +++ b/reactos/include/msvcrt/fcntl.h @@ -16,16 +16,16 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:30 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ -/* added _O_RANDOM_O_SEQUENTIAL _O_SHORT_LIVED*/ +/* added _O_RANDOM_O_SEQUENTIAL _O_SHORT_LIVED*/ /* changed fmode_dll */ #ifndef _FCNTL_H_ @@ -41,13 +41,13 @@ * TODO: Which flags work? */ #if 0 -#if __MSVCRT__ +#ifdef __MSVCRT__ // || _MSVCRT_LIB_ extern unsigned int* __imp__fmode; -#define _fmode (*__imp__fmode) +#define _fmode (*__imp__fmode) #else /* CRTDLL */ extern unsigned int* _fmode_dll; -#define _fmode (*_fmode_dll) +#define _fmode (*_fmode_dll) #endif #endif /* 0 */ @@ -60,68 +60,70 @@ extern unsigned int _fmode; /* Specifiy one of these flags to define the access mode. */ -#define _O_RDONLY 0 -#define _O_WRONLY 1 -#define _O_RDWR 2 +#define _O_RDONLY 0 +#define _O_WRONLY 1 +#define _O_RDWR 2 /* Mask for access mode bits in the _open flags. */ -#define _O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) +#define _O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR) -#define _O_APPEND 0x0008 /* Writes will add to the end of the file. */ -#define _O_CREAT 0x0100 /* Create the file if it does not exist. */ -#define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */ -#define _O_EXCL 0x0400 /* Open only if the file does not exist. */ +#define _O_APPEND 0x0008 /* Writes will add to the end of the file. */ +#define _O_RANDOM 0x0010 +#define _O_SEQUENTIAL _O_RANDOM +#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing. + * WARNING: Even if not created by _open! */ +#define _O_NOINHERIT 0x0080 -/* NOTE: Text is the default even if the given _O_TEXT bit is not on. */ -#define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */ -#define _O_BINARY 0x8000 /* Input and output is not translated. */ -#define _O_RAW _O_BINARY +#define _O_CREAT 0x0100 /* Create the file if it does not exist. */ +#define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */ +#define _O_EXCL 0x0400 /* Open only if the file does not exist. */ -#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing. - * WARNING: Even if not created by _open! */ -#define _O_NOINHERIT 0x0080 +#define _O_SHORT_LIVED 0x1000 +/* NOTE: Text is the default even if the given _O_TEXT bit is not on. */ +#define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */ +#define _O_BINARY 0x8000 /* Input and output is not translated. */ +#define _O_RAW _O_BINARY -#define _O_RANDOM 0x0010 -#define _O_SEQUENTIAL _O_RANDOM -#define _O_SHORT_LIVED 0x1000 #ifndef __STRICT_ANSI__ -#ifndef _NO_OLDNAMES +#ifndef _NO_OLDNAMES /* POSIX/Non-ANSI names for increased portability */ -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_RDWR _O_RDWR -#define O_ACCMODE _O_ACCMODE -#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_TEMPORARY _O_TEMPORARY -#define O_NOINHERIT _O_NOINHERIT - -#define O_RANDOM _O_RANDOM -#define O_SEQUENTIAL _O_RANDOM +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_RDWR _O_RDWR +#define O_ACCMODE _O_ACCMODE +#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_TEMPORARY _O_TEMPORARY +#define O_NOINHERIT _O_NOINHERIT + +#define O_RANDOM _O_RANDOM +#define O_SEQUENTIAL _O_RANDOM #define O_SHORT_LIVED _O_SHORT_LIVED -#endif /* Not _NO_OLDNAMES */ +#endif /* Not _NO_OLDNAMES */ -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -int _setmode (int nHandle, int nAccessMode); +int _setmode (int, int); -#ifndef _NO_OLDNAMES -int setmode (int nHandle, int nAccessMode); -#endif /* Not _NO_OLDNAMES */ +#ifndef _NO_OLDNAMES +int setmode (int, int); +#endif /* Not _NO_OLDNAMES */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not __STRICT_ANSI__ */ -#endif /* Not _FCNTL_H_ */ +#endif /* Not __STRICT_ANSI__ */ + +#endif /* Not _FCNTL_H_ */ + diff --git a/reactos/include/msvcrt/float.h b/reactos/include/msvcrt/float.h index 426237043c4..39b0edb5784 100644 --- a/reactos/include/msvcrt/float.h +++ b/reactos/include/msvcrt/float.h @@ -24,176 +24,191 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ #ifndef _FLOAT_H_ #define _FLOAT_H_ -#ifdef __cplusplus -extern "C" { -#endif -#define FLT_ROUNDS 1 -#define FLT_GUARD 1 -#define FLT_NORMALIZE 1 +#define FLT_ROUNDS 1 +#define FLT_GUARD 1 +#define FLT_NORMALIZE 1 /* * The characteristics of float. */ /* The radix for floating point representation. */ -#define FLT_RADIX 2 +#define FLT_RADIX 2 /* Decimal digits of precision. */ -#define FLT_DIG 6 +#define FLT_DIG 6 /* Smallest number such that 1+x != 1 */ -#define FLT_EPSILON 1.19209290e-07F +#define FLT_EPSILON 1.19209290e-07F /* The number of base FLT_RADIX digits in the mantissa. */ -#define FLT_MANT_DIG 24 +#define FLT_MANT_DIG 24 /* The maximum floating point number. */ -#define FLT_MAX 3.40282347e+38F +#define FLT_MAX 3.40282347e+38F /* Maximum n such that FLT_RADIX^n - 1 is representable. */ -#define FLT_MAX_EXP 128 +#define FLT_MAX_EXP 128 /* Maximum n such that 10^n is representable. */ -#define FLT_MAX_10_EXP 38 +#define FLT_MAX_10_EXP 38 /* Minimum normalized floating-point number. */ -#define FLT_MIN 1.17549435e-38F +#define FLT_MIN 1.17549435e-38F /* Minimum n such that FLT_RADIX^n is a normalized number. */ -#define FLT_MIN_EXP (-125) +#define FLT_MIN_EXP (-125) /* Minimum n such that 10^n is a normalized number. */ -#define FLT_MIN_10_EXP (-37) +#define FLT_MIN_10_EXP (-37) /* * The characteristics of double. */ -#define DBL_DIG 15 -#define DBL_EPSILON 1.1102230246251568e-16 -#define DBL_MANT_DIG 53 -#define DBL_MAX 1.7976931348623157e+308 -#define DBL_MAX_EXP 1024 -#define DBL_MAX_10_EXP 308 -#define DBL_MIN 2.2250738585072014e-308 -#define DBL_MIN_EXP (-1021) -#define DBL_MIN_10_EXP (-307) +#define DBL_DIG 15 +#define DBL_EPSILON 1.1102230246251568e-16 +#define DBL_MANT_DIG 53 +#define DBL_MAX 1.7976931348623157e+308 +#define DBL_MAX_EXP 1024 +#define DBL_MAX_10_EXP 308 +#define DBL_MIN 2.2250738585072014e-308 +#define DBL_MIN_EXP (-1021) +#define DBL_MIN_10_EXP (-307) /* * The characteristics of long double. * NOTE: long double is the same as double. */ -#define LDBL_DIG 15 -#define LDBL_EPSILON 1.1102230246251568e-16L -#define LDBL_MANT_DIG 53 -#define LDBL_MAX 1.7976931348623157e+308L -#define LDBL_MAX_EXP 1024 -#define LDBL_MAX_10_EXP 308 -#define LDBL_MIN 2.2250738585072014e-308L -#define LDBL_MIN_EXP (-1021) -#define LDBL_MIN_10_EXP (-307) +#define LDBL_DIG 15 +#define LDBL_EPSILON 1.1102230246251568e-16L +#define LDBL_MANT_DIG 53 +#define LDBL_MAX 1.7976931348623157e+308L +#define LDBL_MAX_EXP 1024 +#define LDBL_MAX_10_EXP 308 +#define LDBL_MIN 2.2250738585072014e-308L +#define LDBL_MIN_EXP (-1021) +#define LDBL_MIN_10_EXP (-307) /* * Functions and definitions for controlling the FPU. */ -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ /* TODO: These constants are only valid for x86 machines */ /* Control word masks for unMask */ -#define _MCW_EM 0x0008001F /* Error masks */ -#define _MCW_IC 0x00040000 /* Infinity */ -#define _MCW_RC 0x00000300 /* Rounding */ -#define _MCW_PC 0x00030000 /* Precision */ +#define _MCW_EM 0x0008001F /* Error masks */ +#define _MCW_IC 0x00040000 /* Infinity */ +#define _MCW_RC 0x00000300 /* Rounding */ +#define _MCW_PC 0x00030000 /* Precision */ /* Control word values for unNew (use with related unMask above) */ -#define _EM_INVALID 0x00000010 -#define _EM_DENORMAL 0x00080000 -#define _EM_ZERODIVIDE 0x00000008 -#define _EM_OVERFLOW 0x00000004 -#define _EM_UNDERFLOW 0x00000002 -#define _EM_INEXACT 0x00000001 -#define _IC_AFFINE 0x00040000 -#define _IC_PROJECTIVE 0x00000000 -#define _RC_CHOP 0x00000300 -#define _RC_UP 0x00000200 -#define _RC_DOWN 0x00000100 -#define _RC_NEAR 0x00000000 -#define _PC_24 0x00020000 -#define _PC_53 0x00010000 -#define _PC_64 0x00000000 +#define _EM_INVALID 0x00000010 +#define _EM_DENORMAL 0x00080000 +#define _EM_ZERODIVIDE 0x00000008 +#define _EM_OVERFLOW 0x00000004 +#define _EM_UNDERFLOW 0x00000002 +#define _EM_INEXACT 0x00000001 +#define _IC_AFFINE 0x00040000 +#define _IC_PROJECTIVE 0x00000000 +#define _RC_CHOP 0x00000300 +#define _RC_UP 0x00000200 +#define _RC_DOWN 0x00000100 +#define _RC_NEAR 0x00000000 +#define _PC_24 0x00020000 +#define _PC_53 0x00010000 +#define _PC_64 0x00000000 + +/* Return values for fpclass. */ +#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ +#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ +#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ +#define _FPCLASS_NN 0x0008 /* Negative Normal */ +#define _FPCLASS_ND 0x0010 /* Negative Denormal */ +#define _FPCLASS_NZ 0x0020 /* Negative Zero */ +#define _FPCLASS_PZ 0x0040 /* Positive Zero */ +#define _FPCLASS_PD 0x0080 /* Positive Denormal */ +#define _FPCLASS_PN 0x0100 /* Positive Normal */ +#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ + + +#ifdef __cplusplus +extern "C" { +#endif /* Set the FPU control word as cw = (cw & ~unMask) | (unNew & unMask), * i.e. change the bits in unMask to have the values they have in unNew, * leaving other bits unchanged. */ -unsigned int _controlfp (unsigned int unNew, unsigned int unMask); -unsigned int _control87 (unsigned int unNew, unsigned int unMask); +unsigned int _controlfp(unsigned int unNew, unsigned int unMask); +unsigned int _control87(unsigned int unNew, unsigned int unMask); -unsigned int _clearfp (void); /* Clear the FPU status word */ -unsigned int _statusfp (void); /* Report the FPU status word */ -#define _clear87 _clearfp -#define _status87 _statusfp +unsigned int _clearfp(void); /* Clear the FPU status word */ +unsigned int _statusfp(void); /* Report the FPU status word */ +#define _clear87 _clearfp +#define _status87 _statusfp -void _fpreset (void); /* Reset the FPU */ + +/* + MSVCRT.dll _fpreset initializes the control register to 0x27f, + the status register to zero and the tag word to 0FFFFh. + This differs from asm instruction finit/fninit which set control + word to 0x37f (64 bit mantissa precison rather than 53 bit). + By default, the mingw version of _fpreset sets fp control as + per fninit. To use the MSVCRT.dll _fpreset, include CRT_fp8.o when + building your application. +*/ +void _fpreset(void); /* Reset the FPU */ /* Global 'variable' for the current floating point error code. */ -extern int * __fpecode(void); -#define _fpecode (*(__fpecode())) +int* __fpecode(void); +#define _fpecode (*(__fpecode())) /* - * IEEE recommended functions + * IEEE recommended functions. MS puts them in float.h + * but they really belong in math.h. */ -double _chgsign (double x); -double _copysign (double dTo, double dFrom); -double _logb (double x); -double _nextafter (double x, double y); -double _scalb (double x, long n); +double _chgsign (double); +double _copysign (double, double); +double _logb (double); +double _nextafter (double, double); +double _scalb (double, long); -/* Return values for fpclass. */ -#define _FPCLASS_SNAN 0x0001 /* Signaling "Not a Number" */ -#define _FPCLASS_QNAN 0x0002 /* Quiet "Not a Number" */ -#define _FPCLASS_NINF 0x0004 /* Negative Infinity */ -#define _FPCLASS_NN 0x0008 /* Negative Normal */ -#define _FPCLASS_ND 0x0010 /* Negative Denormal */ -#define _FPCLASS_NZ 0x0020 /* Negative Zero */ -#define _FPCLASS_PZ 0x0040 /* Positive Zero */ -#define _FPCLASS_PD 0x0080 /* Positive Denormal */ -#define _FPCLASS_PN 0x0100 /* Positive Normal */ -#define _FPCLASS_PINF 0x0200 /* Positive Infinity */ - -int _finite (double x); -int _fpclass (double x); -int _isnan (double x); -int _isinf (double x); // not exported - -int _isnanl (long double x); // not exported -int _isinfl (long double x); // not exported - -#define isnan(x) _isnan(x) -#define isinf(x) _isinf(x) - -#endif /* Not __STRICT_ANSI__ */ - -#ifdef __cplusplus +int _finite (double); +int _fpclass (double); +int _isnan (double); + +int _isinf (double); // not exported +int _isnanl (long double); // not exported +int _isinfl (long double); // not exported + +#define isnan(x) _isnan(x) +#define isinf(x) _isinf(x) + + +#ifdef __cplusplus } #endif +#endif /* Not __STRICT_ANSI__ */ + #endif /* _FLOAT_H_ */ + diff --git a/reactos/include/msvcrt/internal/atexit.h b/reactos/include/msvcrt/internal/atexit.h index b3a9f0103ad..f2a1fccae24 100644 --- a/reactos/include/msvcrt/internal/atexit.h +++ b/reactos/include/msvcrt/internal/atexit.h @@ -13,11 +13,11 @@ extern "C" { #ifndef _POSIX_SOURCE struct __atexit { - struct __atexit *__next; - void (*__function)(void); + struct __atexit* __next; + void (*__function)(void); }; -extern struct __atexit *__atexit_ptr; +extern struct __atexit* __atexit_ptr; #endif /* !_POSIX_SOURCE */ #endif /* !__STRICT_ANSI__ */ diff --git a/reactos/include/msvcrt/internal/file.h b/reactos/include/msvcrt/internal/file.h index cb17b08c2e2..4507cf1cd0f 100644 --- a/reactos/include/msvcrt/internal/file.h +++ b/reactos/include/msvcrt/internal/file.h @@ -12,9 +12,7 @@ extern "C" { #endif #ifndef __dj_ENFORCE_ANSI_FREESTANDING - #ifndef __STRICT_ANSI__ - #ifndef _POSIX_SOURCE #ifndef _IORMONCL @@ -26,45 +24,32 @@ extern "C" { #define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */ #endif - // might need check for IO_APPEND aswell -#define OPEN4WRITING(f) ((((f)->_flag & _IOWRT) == _IOWRT ) ) - -#define OPEN4READING(f) ((((f)->_flag & _IOREAD) == _IOREAD ) ) +#define OPEN4WRITING(f) ((((f)->_flag & _IOWRT) == _IOWRT)) +#define OPEN4READING(f) ((((f)->_flag & _IOREAD) == _IOREAD)) // might need check for IO_APPEND aswell -#define WRITE_STREAM(f) ((((f)->_flag & _IOWRT) == _IOWRT ) ) - -#define READ_STREAM(f) ((((f)->_flag & _IOREAD) == _IOREAD ) ) - - -char __validfp (FILE *f); +#define WRITE_STREAM(f) ((((f)->_flag & _IOWRT) == _IOWRT)) +#define READ_STREAM(f) ((((f)->_flag & _IOREAD) == _IOREAD)) +char __validfp(FILE*); int __set_errno(int err); -int __set_doserrno (int error); - -void *filehnd(int fn); - -char __is_text_file(FILE *p); - -int __fileno_alloc(void *hFile, int mode); - -int _doprnt(const char *fmt, va_list args, FILE *f); -int _doscan(FILE *iop, const char *fmt, va_list argp); - - -int __fileno_dup2( int handle1, int handle2 ); +int __set_doserrno(int error); +void* filehnd(int fn); +char __is_text_file(FILE*); +int __fileno_alloc(void* hFile, int mode); +int _doprnt(const char* fmt, va_list args, FILE *); +int _doscan(FILE* iop, const char* fmt, va_list argp); +int __fileno_dup2(int handle1, int handle2); int __fileno_getmode(int _fd); int __fileno_setmode(int _fd, int _newmode); int __fileno_close(int _fd); - void sigabort_handler(int sig); #include -void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder ); -time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ); - +void UnixTimeToFileTime(time_t unix_time, FILETIME* filetime, DWORD remainder); +time_t FileTimeToUnixTime(const FILETIME* filetime, DWORD *remainder); #endif /* !_POSIX_SOURCE */ #endif /* !__STRICT_ANSI__ */ @@ -73,24 +58,19 @@ time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder ); #ifndef __dj_ENFORCE_FUNCTION_CALLS #endif /* !__dj_ENFORCE_FUNCTION_CALLS */ - #define __FILE_REC_MAX 20 typedef struct __file_rec { - struct __file_rec *next; - int count; - FILE *files[__FILE_REC_MAX]; + struct __file_rec* next; + int count; + FILE* files[__FILE_REC_MAX]; } __file_rec; -extern __file_rec *__file_rec_list; +extern __file_rec* __file_rec_list; #ifdef __cplusplus } #endif - #endif /* __dj_include_libc_file_h__ */ - - - diff --git a/reactos/include/msvcrt/internal/ieee.h b/reactos/include/msvcrt/internal/ieee.h index 788908bdb2e..e6188c23fe0 100644 --- a/reactos/include/msvcrt/internal/ieee.h +++ b/reactos/include/msvcrt/internal/ieee.h @@ -2,24 +2,24 @@ #define _IEEE_H typedef struct { - unsigned int mantissa:23; - unsigned int exponent:8; - unsigned int sign:1; + unsigned int mantissa:23; + unsigned int exponent:8; + unsigned int sign:1; } float_t; typedef struct { - unsigned int mantissal:32; - unsigned int mantissah:20; - unsigned int exponent:11; - unsigned int sign:1; + unsigned int mantissal:32; + unsigned int mantissah:20; + unsigned int exponent:11; + unsigned int sign:1; } double_t; typedef struct { - unsigned int mantissal:32; - unsigned int mantissah:32; - unsigned int exponent:15; - unsigned int sign:1; - unsigned int empty:16; + unsigned int mantissal:32; + unsigned int mantissah:32; + unsigned int exponent:15; + unsigned int sign:1; + unsigned int empty:16; } long_double_t; #endif diff --git a/reactos/include/msvcrt/internal/rterror.h b/reactos/include/msvcrt/internal/rterror.h index 6979abedb0c..b32bc7faae8 100644 --- a/reactos/include/msvcrt/internal/rterror.h +++ b/reactos/include/msvcrt/internal/rterror.h @@ -3,27 +3,29 @@ #ifndef __MSVCRT_INTERNAL_RTERROR_H #define __MSVCRT_INTERNAL_RTERROR_H -#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 */ -#define _RT_SPACEARG 4 /* not enough space for arguments */ -#define _RT_SPACEENV 5 /* not enough space for environment */ -#define _RT_ABORT 6 /* abnormal program termination */ -#define _RT_THREAD 7 /* not enough space for thread data */ -#define _RT_LOCK 8 /* unexpected multi-thread lock error */ -#define _RT_HEAP 9 /* unexpected heap error */ -#define _RT_OPENCON 10 /* unable to open console device */ -#define _RT_NONCONT 11 /* non-continuable exception */ -#define _RT_INVALDISP 12 /* invalid disposition of exception */ -#define _RT_ONEXIT 13 /* insufficient heap to allocate - * initial table of function pointers - * used by _onexit()/atexit(). */ -#define _RT_PUREVIRT 14 /* pure virtual function call attempted - * (C++ error) */ -#define _RT_STDIOINIT 15 /* not enough space for stdio initialization */ -#define _RT_LOWIOINIT 16 /* not enough space for lowio initialization */ + +#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 */ +#define _RT_SPACEARG 4 /* not enough space for arguments */ +#define _RT_SPACEENV 5 /* not enough space for environment */ +#define _RT_ABORT 6 /* abnormal program termination */ +#define _RT_THREAD 7 /* not enough space for thread data */ +#define _RT_LOCK 8 /* unexpected multi-thread lock error */ +#define _RT_HEAP 9 /* unexpected heap error */ +#define _RT_OPENCON 10 /* unable to open console device */ +#define _RT_NONCONT 11 /* non-continuable exception */ +#define _RT_INVALDISP 12 /* invalid disposition of exception */ +#define _RT_ONEXIT 13 /* insufficient heap to allocate + * initial table of function pointers + * used by _onexit()/atexit(). */ +#define _RT_PUREVIRT 14 /* pure virtual function call attempted + * (C++ error) */ +#define _RT_STDIOINIT 15 /* not enough space for stdio initialization */ +#define _RT_LOWIOINIT 16 /* not enough space for lowio initialization */ void _amsg_exit (int errnum); + #endif /* __MSVCRT_INTERNAL_RTERROR_H */ diff --git a/reactos/include/msvcrt/internal/stdio.h b/reactos/include/msvcrt/internal/stdio.h index b2721363e32..8b84ced4934 100644 --- a/reactos/include/msvcrt/internal/stdio.h +++ b/reactos/include/msvcrt/internal/stdio.h @@ -3,9 +3,9 @@ #ifndef __MSVCRT_INTERNAL_STDIO_H #define __MSVCRT_INTERNAL_STDIO_H -int __vfscanf (FILE *s, const char *format, va_list argptr); -int __vscanf (const char *format, va_list arg); -int __vsscanf (const char *s,const char *format,va_list arg); +int __vfscanf(FILE* s, const char* format, va_list argptr); +int __vscanf(const char* format, va_list arg); +int __vsscanf(const char* s,const char* format, va_list arg); #endif /* __MSVCRT_INTERNAL_STDIO_H */ diff --git a/reactos/include/msvcrt/internal/tls.h b/reactos/include/msvcrt/internal/tls.h index bbc21e99d5a..b1ec17d456e 100644 --- a/reactos/include/msvcrt/internal/tls.h +++ b/reactos/include/msvcrt/internal/tls.h @@ -3,25 +3,26 @@ #ifndef __MSVCRT_INTERNAL_TLS_H #define __MSVCRT_INTERNAL_TLS_H +#include #include typedef struct _ThreadData { - int terrno; /* *nix error code */ - unsigned long tdoserrno; /* Win32 error code (for I/O only) */ - unsigned long long tnext; /* used by rand/srand */ + int terrno; /* *nix error code */ + unsigned long tdoserrno; /* Win32 error code (for I/O only) */ + unsigned LONGLONG tnext; /* used by rand/srand */ - char *lasttoken; /* used by strtok */ - wchar_t *wlasttoken; /* used by wcstok */ + char *lasttoken; /* used by strtok */ + wchar_t *wlasttoken; /* used by wcstok */ - int fpecode; /* fp exception code */ + int fpecode; /* fp exception code */ /* qsort variables */ - int (*qcmp)(const void *, const void *); /* the comparison routine */ - int qsz; /* size of each record */ - int thresh; /* THRESHold in chars */ - int mthresh; /* MTHRESHold in chars */ + int (*qcmp)(const void *, const void *); /* the comparison routine */ + int qsz; /* size of each record */ + int thresh; /* THRESHold in chars */ + int mthresh; /* MTHRESHold in chars */ } THREADDATA, *PTHREADDATA; diff --git a/reactos/include/msvcrt/io.h b/reactos/include/msvcrt/io.h index 70522fab69a..8daa249a63b 100644 --- a/reactos/include/msvcrt/io.h +++ b/reactos/include/msvcrt/io.h @@ -15,22 +15,23 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ /* added D_OK */ /* changed get_osfhandle and open_osfhandle */ /* added fileno as macro */ -#ifndef _IO_H_ -#define _IO_H_ -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ + +#ifndef _IO_H_ +#define _IO_H_ #include @@ -47,109 +48,121 @@ /* TODO: Maximum number of open handles has not been tested, I just set * it the same as FOPEN_MAX. */ -#define HANDLE_MAX FOPEN_MAX +#define HANDLE_MAX FOPEN_MAX /* Some defines for _access nAccessMode (MS doesn't define them, but * it doesn't seem to hurt to add them). */ -#define F_OK 0 /* Check for file existence */ -#define W_OK 2 /* Check for write permission */ -#define R_OK 4 /* Check for read permission */ +#define F_OK 0 /* Check for file existence */ +#define W_OK 2 /* Check for write permission */ +#define R_OK 4 /* Check for read permission */ /* TODO: Is this safe? X_OK not supported directly... */ -#define X_OK R_OK /* Check for execute permission */ -#define D_OK 0x10 +#define X_OK R_OK /* Check for execute permission */ +#define D_OK 0x10 -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -int _access (const char* szFileName, int nAccessMode); -int _chmod (const char* szPath, int nMode); -int _chsize (int nHandle, long lnNewSize); -int _close (int nHandle); -int _commit(int _fd); -int _creat (const char* szFileName, int nAccessMode); -int _dup (int nHandle); -int _dup2 (int nOldHandle, int nNewHandle); -long _filelength (int nHandle); -__int64 _filelengthi64(int nHandle); -int _fileno (FILE* fileGetHandle); -void* _get_osfhandle (int nHandle); -int _isatty (int nHandle); +int _access (const char*, int); +int _chsize (int, long); +int _close (int); +int _commit(int); + +/* NOTE: The only significant bit in unPermissions appears to be bit 7 (0x80), + * the "owner write permission" bit (on FAT). */ +int _creat (const char*, int); +int _dup (int); +int _dup2 (int, int); +long _filelength (int); +int _fileno (FILE*); +void* _get_osfhandle (int); +int _isatty (int); + +int _chmod (const char* szPath, int nMode); +__int64 _filelengthi64(int nHandle); /* In a very odd turn of events this function is excluded from those * files which define _STREAM_COMPAT. This is required in order to * build GNU libio because of a conflict with _eof in streambuf.h * line 107. Actually I might just be able to change the name of * the enum member in streambuf.h... we'll see. TODO */ -#ifndef _STREAM_COMPAT -int _eof (int nHandle); +#ifndef _STREAM_COMPAT +int _eof (int); #endif /* LK_... locking commands defined in sys/locking.h. */ -int _locking (int nHandle, int nCmd, long lnLockRegionLength); +int _locking (int, int, long); -off_t _lseek(int _fd, off_t _offset, int _whence); -__int64 _lseeki64(int _fildes, __int64 _offset, int _whence); -int _open (const char* szFileName, int nFlags, ...); -int _open_osfhandle (void *lnOSHandle, int nFlags); -int _pipe (int *naHandles, unsigned int unSize, int nMode); -size_t _read(int _fd, void *_buf, size_t _nbyte); +off_t _lseek(int, off_t, int); -/* SH_... flags for nFlag defined in share.h */ -int _sopen (char* szFileName, int nAccess, int nFlag, int nMode); +/* Optional third argument is unsigned unPermissions. */ +int _open (const char*, int, ...); -long _tell(int nHandle); -__int64 _telli64(int nHandle); -unsigned _umask(unsigned unMode); -int _unlink(const char* szFileName); -size_t _write(int _fd, const void *_buf, size_t _nbyte); +int _open_osfhandle (void*, int); +int _pipe (int*, unsigned int, int); +size_t _read(int, void*, size_t); +/* SH_... flags for nShFlags defined in share.h + * Optional fourth argument is unsigned unPermissions */ +int _sopen (char*, int, int, int); -/* wide character functions */ -int _waccess(const wchar_t *_path, int _amode); -int _wchmod(const wchar_t *filename, int mode); -int _wcreat(const wchar_t *filename, int mode); +long _tell(int); +/* Should umask be in sys/stat.h and/or sys/types.h instead? */ +unsigned _umask(unsigned); +int _unlink(const char*); +size_t _write(int, const void*, size_t); -int _wopen(const wchar_t *_path, int _oflag,...); -int _wsopen(wchar_t *path, int access, int shflag, int mode); -int _wunlink(const wchar_t *filename); +__int64 _lseeki64(int _fildes, __int64 _offset, int _whence); +__int64 _telli64(int nHandle); +/* Wide character versions. Also declared in wchar.h. */ +/* Not in crtdll.dll */ +int _waccess(const wchar_t*, int); +int _wchmod(const wchar_t*, int); +int _wcreat(const wchar_t*, int); -#ifndef _NO_OLDNAMES +int _wunlink(const wchar_t*); +int _wopen(const wchar_t*, int, ...); +int _wsopen(wchar_t*, int, int, int); + + +#ifndef _NO_OLDNAMES /* * Non-underscored versions of non-ANSI functions to improve portability. * These functions live in libmoldname.a. */ -#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 fileno(f) ((f)->_file) -#define isatty _isatty -#define lseek _lseek -#define open _open -#define read _read -#define sopen(path,access,shflag,mode) _open((path), (access)|(shflag), (mode)) -#define tell(file) _lseek(_file, 0, SEEK_CUR) -#define umask _umask -#define unlink _unlink -#define write _write - -#endif /* Not _NO_OLDNAMES */ - -#ifdef __cplusplus +#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 fileno(f) ((f)->_file) +#define isatty _isatty +#define lseek _lseek +#define open _open +#define read _read +#define sopen(path,access,shflag,mode) _open((path), (access)|(shflag), (mode)) +#define tell(file) _lseek(_file, 0, SEEK_CUR) +#define umask _umask +#define unlink _unlink +#define write _write + + +#endif /* Not _NO_OLDNAMES */ + +#ifdef __cplusplus } #endif -#endif /* Not strict ANSI */ +#endif /* _IO_H_ not defined */ + +#endif /* Not strict ANSI */ -#endif /* _IO_H_ not defined */ diff --git a/reactos/include/msvcrt/locale.h b/reactos/include/msvcrt/locale.h index 3cdc303b76e..9ba4bd9f661 100644 --- a/reactos/include/msvcrt/locale.h +++ b/reactos/include/msvcrt/locale.h @@ -16,21 +16,18 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ -#ifndef _LOCALE_H_ -#define _LOCALE_H_ +#ifndef _LOCALE_H_ +#define _LOCALE_H_ -#ifdef __cplusplus -extern "C" { -#endif /* * NOTE: I have tried to test this, but I am limited by my knowledge of @@ -41,44 +38,50 @@ extern "C" { * of the system). */ -#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_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 /* * The structure returned by 'localeconv'. */ 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; + 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; }; -char* setlocale (int nCategory, const char* locale); -struct lconv* localeconv (void); +#ifdef __cplusplus +extern "C" { +#endif + +char* setlocale(int, const char*); +struct lconv* localeconv(void); -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif +#endif /* Not _LOCALE_H_ */ diff --git a/reactos/include/msvcrt/malloc.h b/reactos/include/msvcrt/malloc.h index 2b47986a6d5..a15deca5fb1 100644 --- a/reactos/include/msvcrt/malloc.h +++ b/reactos/include/msvcrt/malloc.h @@ -18,31 +18,31 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ #ifndef _MALLOC_H_ #define _MALLOC_H_ #include -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif -void * _expand( void *memblock, size_t size ); -int _heapchk (void); /* Verify heap integrety. */ -int _heapmin (void); /* Return unused heap to the OS. */ -int _heapset (unsigned int unFill); -size_t _msize (void* pBlock); +int _heapchk(void); /* Verify heap integrety. */ +int _heapmin(void); /* Return unused heap to the OS. */ +int _heapset(unsigned int); +size_t _msize(void*); +void* _expand(void*, size_t); #ifdef __cplusplus } diff --git a/reactos/include/msvcrt/math.h b/reactos/include/msvcrt/math.h index 51bdf2ca90b..0f56a8c3d90 100644 --- a/reactos/include/msvcrt/math.h +++ b/reactos/include/msvcrt/math.h @@ -15,12 +15,12 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ // added modfl @@ -28,6 +28,8 @@ #ifndef _MATH_H_ #define _MATH_H_ +#include + #ifdef __cplusplus extern "C" { #endif @@ -42,99 +44,99 @@ extern "C" { * * NOTE: The CRTDLL version uses _HUGE_dll instead. */ -#if __MSVCRT__ -extern double* __imp__HUGE; -#define HUGE_VAL (*__imp__HUGE) +#ifdef _MSVCRT_LIB_ +extern double* __imp__HUGE; +#define HUGE_VAL (*__imp__HUGE) #else /* CRTDLL */ -extern double* _HUGE_dll; -#define HUGE_VAL (*_HUGE_dll) +extern double* _HUGE_dll; +#define HUGE_VAL (*_HUGE_dll) #endif struct _exception { - int type; - char *name; - double arg1; - double arg2; - double retval; + int type; + char *name; + double arg1; + double arg2; + double retval; }; /* * Types for the above _exception structure. */ -#define _DOMAIN 1 /* domain error in argument */ -#define _SING 2 /* singularity */ -#define _OVERFLOW 3 /* range overflow */ -#define _UNDERFLOW 4 /* range underflow */ -#define _TLOSS 5 /* total loss of precision */ -#define _PLOSS 6 /* partial loss of precision */ +#define _DOMAIN 1 /* domain error in argument */ +#define _SING 2 /* singularity */ +#define _OVERFLOW 3 /* range overflow */ +#define _UNDERFLOW 4 /* range underflow */ +#define _TLOSS 5 /* total loss of precision */ +#define _PLOSS 6 /* partial loss of precision */ /* * Exception types with non-ANSI names for compatibility. */ -#ifndef __STRICT_ANSI__ -#ifndef _NO_OLDNAMES - -#define DOMAIN _DOMAIN -#define SING _SING -#define OVERFLOW _OVERFLOW -#define UNDERFLOW _UNDERFLOW -#define TLOSS _TLOSS -#define PLOSS _PLOSS - -#endif /* Not _NO_OLDNAMES */ -#endif /* Not __STRICT_ANSI__ */ - - -double sin (double x); -double cos (double x); -double tan (double x); -double sinh (double x); -double cosh (double x); -double tanh (double x); -double asin (double x); -double acos (double x); -double atan (double x); -double atan2 (double y, double x); -double exp (double x); -double log (double x); -double log10 (double x); -double pow (double x, double y); -long double powl (long double x,long double y); -double sqrt (double x); -double ceil (double x); -double floor (double x); -double fabs (double x); -double ldexp (double x, int n); -double frexp (double x, int* exp); -double modf (double x, double* ip); +#ifndef __STRICT_ANSI__ +#ifndef _NO_OLDNAMES + +#define DOMAIN _DOMAIN +#define SING _SING +#define OVERFLOW _OVERFLOW +#define UNDERFLOW _UNDERFLOW +#define TLOSS _TLOSS +#define PLOSS _PLOSS + +#endif /* Not _NO_OLDNAMES */ +#endif /* Not __STRICT_ANSI__ */ + + +double sin (double x); +double cos (double x); +double tan (double x); +double sinh (double x); +double cosh (double x); +double tanh (double x); +double asin (double x); +double acos (double x); +double atan (double x); +double atan2 (double y, double x); +double exp (double x); +double log (double x); +double log10 (double x); +double pow (double x, double y); +long double powl (long double x,long double y); +double sqrt (double x); +double ceil (double x); +double floor (double x); +double fabs (double x); +double ldexp (double x, int n); +double frexp (double x, int* exp); +double modf (double x, double* ip); long double modfl (long double x,long double* ip); -double fmod (double x, double y); +double fmod (double x, double y); -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ /* Complex number (for cabs) */ struct _complex { - double x; /* Real part */ - double y; /* Imaginary part */ + double x; /* Real part */ + double y; /* Imaginary part */ }; -double _cabs (struct _complex x); -double _hypot (double x, double y); -double _j0 (double x); -double _j1 (double x); -double _jn (int n, double x); -double _y0 (double x); -double _y1 (double x); -double _yn (int n, double x); +double _cabs (struct _complex x); +double _hypot (double x, double y); +double _j0 (double x); +double _j1 (double x); +double _jn (int n, double x); +double _y0 (double x); +double _y1 (double x); +double _yn (int n, double x); -#ifndef _NO_OLDNAMES +#ifndef _NO_OLDNAMES /* * Non-underscored versions of non-ANSI functions. These reside in @@ -149,13 +151,48 @@ double y0 (double x); double y1 (double x); double yn (int n, double x); -#endif /* Not _NO_OLDNAMES */ +#endif /* Not _NO_OLDNAMES */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ #ifdef __cplusplus } #endif + +#ifdef __MSVCRT__ +double linkme_sin(double x); +double linkme_cos(double x); +double linkme_tan(double x); +double linkme_sinh(double x); +double linkme_cosh(double x); +double linkme_tanh(double x); +double linkme_asin(double x); +double linkme_acos(double x); +double linkme_atan(double x); +double linkme_atan2(double y, double x); +double linkme_exp(double x); +double linkme_log(double x); +double linkme_log10(double x); +double linkme_pow(double x, double y); +long double linkme_powl(long double x,long double y); +double linkme_sqrt(double x); +double linkme_ceil(double x); +double linkme_floor(double x); +double linkme_fabs(double x); +double linkme_ldexp(double x, int n); +double linkme_frexp(double x, int* exp); +double linkme_modf(double x, double* ip); +long double linkme_modfl(long double x,long double* ip); +double linkme_fmod(double x, double y); + +//linkme_log2 +//linkme_floor +//linkme_ldexp +//linkme_pow + +#endif + + #endif /* Not _MATH_H_ */ diff --git a/reactos/include/msvcrt/mbctype.h b/reactos/include/msvcrt/mbctype.h index 686b3639dd8..dc672d85fbc 100644 --- a/reactos/include/msvcrt/mbctype.h +++ b/reactos/include/msvcrt/mbctype.h @@ -1,24 +1,48 @@ -#ifndef _MBCTYPE_H -#define _MBCTYPE_H +/* + * mbctype.h + * + * Functions for testing multibyte character types and converting characters. + * + * This file is part of the Mingw32 package. + * + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ -#ifdef __cplusplus -extern "C" { -#endif +#ifndef _MBCTYPE_H_ +#define _MBCTYPE_H_ -//#define _MS 0x01 -//#define _MP 0x02 -//#define _M1 0x04 -//#define _M2 0x08 -#define _MBC_SINGLE 0 -#define _MBC_LEAD 1 -#define _MBC_TRAIL 2 -#define _MBC_ILLEGAL -1 +/* return values for _mbsbtype and _mbbtype in mbstring.h */ +#define _MBC_SINGLE 0 +#define _MBC_LEAD 1 +#define _MBC_TRAIL 2 +#define _MBC_ILLEGAL (-1) +/* args for setmbcp (in lieu of actual codepage) */ #define _MB_CP_SBCS 0 -#define _MB_CP_OEM -2 -#define _MB_CP_ANSI -3 -#define _MB_CP_LOCALE -4 +#define _MB_CP_OEM (-2) +#define _MB_CP_ANSI (-3) +#define _MB_CP_LOCALE (-4) + +/* TODO: bit masks */ +/* +//#define _MS 0x01 +//#define _MP 0x02 +//#define _M1 0x04 +//#define _M2 0x08 +#define _SBUP +#define _SBLOW +*/ #define _KNJ_M ((char)0x01) /* Non-punctuation of Kana-set */ #define _KNJ_P ((char)0x02) /* Punctuation of Kana-set */ @@ -35,15 +59,20 @@ extern "C" { #define _M2 (_M_|__2) #define _P2 (_P_|__2) +#ifdef __cplusplus +extern "C" { +#endif + extern char _jctype[257]; -int _ismbbkalnum( unsigned int c ); -int _ismbbkana( unsigned char c ); +int _ismbbkana(unsigned char); +int _ismbbkalnum(unsigned int); #ifdef __cplusplus } #endif -#endif +#endif /* Not _MCTYPE_H_ */ + diff --git a/reactos/include/msvcrt/mbstring.h b/reactos/include/msvcrt/mbstring.h index a7bc5ba2af8..e331606f70d 100644 --- a/reactos/include/msvcrt/mbstring.h +++ b/reactos/include/msvcrt/mbstring.h @@ -1,108 +1,114 @@ +/* + * mbstring.h + * + * Protototypes for string functions supporting multibyte characters. + * + * This file is part of the Mingw32 package. + * + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + */ + #ifndef _MBSTRING_H_ #define _MBSTRING_H_ -#ifdef __cplusplus -extern "C" { -#endif - #include -size_t _mbstrlen(const char *str); - - - - -int _mbbtype(unsigned char c, int type); -int _mbsbtype( const unsigned char *str, size_t n ); - -unsigned int _mbbtombc(unsigned int c); -unsigned int _mbctombb(unsigned int c); - -unsigned char * _mbscat(unsigned char *dst, const unsigned char *src); -unsigned char * _mbschr(unsigned char *str, unsigned char* c); -int _mbscmp(const unsigned char *, const unsigned char *); -int _mbscoll(const unsigned char *, const unsigned char *); -unsigned char * _mbscpy(unsigned char *, const unsigned char *); -size_t _mbscspn(const unsigned char *, const unsigned char *); -unsigned char * _mbsdup(const unsigned char *str); -int _mbsicmp(const unsigned char *, const unsigned char *); -int _mbsicoll(const unsigned char *, const unsigned char *); -size_t _mbslen(const unsigned char *str); - -unsigned char * _mbsncat(unsigned char *, const unsigned char *, size_t); -unsigned char * _mbsnbcat(unsigned char *, const unsigned char *, size_t); - - -int _mbsncmp(const unsigned char *, const unsigned char *, size_t); -int _mbsnbcmp(const unsigned char *, const unsigned char *, size_t); - -int _mbsncoll(const unsigned char *, const unsigned char *, size_t); -int _mbsnbcoll(const unsigned char *, const unsigned char *, size_t); - -unsigned char * _mbsncpy(unsigned char *, const unsigned char *, size_t); -unsigned char * _mbsnbcpy(unsigned char *, const unsigned char *, size_t); - -int _mbsnicmp(const unsigned char *, const unsigned char *, size_t); -int _mbsnbicmp(const unsigned char *, const unsigned char *, size_t); - -int _mbsnicoll(const unsigned char *, const unsigned char *, size_t); -int _mbsnbicoll(const unsigned char *, const unsigned char *, size_t); - -unsigned char * _mbsnset(unsigned char *, unsigned int, size_t); -unsigned char * _mbsnbset(unsigned char *, unsigned int, size_t); - -size_t _mbsnccnt(const unsigned char *, size_t); - - -unsigned char * _mbspbrk(const unsigned char *, const unsigned char *); -unsigned char * _mbsrchr(const unsigned char *, unsigned int); -unsigned char * _mbsrev(unsigned char *); -unsigned char * _mbsset(unsigned char *, unsigned int); -size_t _mbsspn(const unsigned char *, const unsigned char *); - -unsigned char * _mbsstr(const unsigned char *, const unsigned char *); -unsigned char * _mbstok(unsigned char *, unsigned char *); - -unsigned char * _mbslwr(unsigned char *str); -unsigned char * _mbsupr(unsigned char *str); - -size_t _mbclen(const unsigned char *); -void _mbccpy(unsigned char *, const unsigned char *); - -/* tchar routines */ +#ifdef __cplusplus +extern "C" { +#endif -unsigned char * _mbsdec(const unsigned char *, const unsigned char *); -unsigned char * _mbsinc(const unsigned char *); -size_t _mbsnbcnt(const unsigned char *, size_t); -unsigned int _mbsnextc (const unsigned char *); -unsigned char * _mbsninc(const unsigned char *, size_t); -unsigned char * _mbsspnp(const unsigned char *, const unsigned char *); /* character routines */ - -int _ismbcalnum(unsigned int c); -int _ismbcalpha(unsigned int c); -int _ismbcdigit(unsigned int c); -int _ismbcgraph(unsigned int c); -int _ismbclegal(unsigned int c); -int _ismbclower(unsigned int c); -int _ismbcprint(unsigned int c); -int _ismbcpunct(unsigned int c); -int _ismbcspace(unsigned int c); -int _ismbcupper(unsigned int c); +int _ismbcalnum(unsigned int); +int _ismbcalpha(unsigned int); +int _ismbcdigit(unsigned int); +int _ismbcgraph(unsigned int); +int _ismbcprint(unsigned int); +int _ismbcpunct(unsigned int); +int _ismbcspace(unsigned int); +int _ismbclower(unsigned int); +int _ismbcupper(unsigned int); +int _ismbclegal(unsigned int); + +int _ismbblead(unsigned int); +int _ismbbtrail(unsigned int); +int _ismbslead(const unsigned char*, const unsigned char*); +int _ismbstrail(const unsigned char*, const unsigned char*); unsigned int _mbctolower(unsigned int); unsigned int _mbctoupper(unsigned int); +void _mbccpy(unsigned char*, const unsigned char*); +size_t _mbclen(const unsigned char*); + +unsigned int _mbbtombc(unsigned int); +unsigned int _mbctombb(unsigned int); + +/* Return value constants for these are defined in mbctype.h. */ +int _mbbtype(unsigned char, int); +int _mbsbtype(const unsigned char*, size_t); + +unsigned char* _mbscpy(unsigned char*, const unsigned char*); +unsigned char* _mbsncpy(unsigned char*, const unsigned char*, size_t); +unsigned char* _mbsnbcpy(unsigned char*, const unsigned char*, size_t); +unsigned char* _mbsset(unsigned char*, unsigned int); +unsigned char* _mbsnset(unsigned char*, unsigned int, size_t); +unsigned char* _mbsnbset(unsigned char*, unsigned int, size_t); + +unsigned char* _mbsdup(const unsigned char*); +unsigned char* _mbsrev(unsigned char*); +unsigned char* _mbscat(unsigned char*, const unsigned char*); +unsigned char* _mbsncat(unsigned char*, const unsigned char*, size_t); +unsigned char* _mbsnbcat(unsigned char*, const unsigned char*, size_t); +size_t _mbslen(const unsigned char*); +size_t _mbsnbcnt(const unsigned char*, size_t); +size_t _mbsnccnt(const unsigned char*, size_t); +unsigned char* _mbschr(unsigned char*, unsigned char*); +unsigned char* _mbsrchr(const unsigned char*, unsigned int); +size_t _mbsspn(const unsigned char*, const unsigned char*); +size_t _mbscspn(const unsigned char*, const unsigned char*); +unsigned char* _mbsspnp(const unsigned char*, const unsigned char*); +unsigned char* _mbspbrk(const unsigned char*, const unsigned char*); +int _mbscmp(const unsigned char*, const unsigned char*); +int _mbsicmp(const unsigned char*, const unsigned char*); +int _mbsncmp(const unsigned char*, const unsigned char*, size_t); +int _mbsnicmp(const unsigned char*, const unsigned char*, size_t); +int _mbsnbcmp(const unsigned char*, const unsigned char*, size_t); +int _mbsnbicmp(const unsigned char*, const unsigned char*, size_t); +int _mbscoll(const unsigned char*, const unsigned char*); +int _mbsicoll(const unsigned char*, const unsigned char*); +int _mbsncoll(const unsigned char*, const unsigned char*, size_t); +int _mbsnicoll(const unsigned char*, const unsigned char*, size_t); +int _mbsnbcoll(const unsigned char*, const unsigned char*, size_t); + +int _mbsnbicoll(const unsigned char*, const unsigned char*, size_t); + +unsigned char* _mbsinc(const unsigned char*); +unsigned char* _mbsninc(const unsigned char*, size_t); +unsigned char* _mbsdec(const unsigned char*, const unsigned char*); +unsigned int _mbsnextc (const unsigned char*); +unsigned char* _mbslwr(unsigned char*); +unsigned char* _mbsupr(unsigned char*); +unsigned char* _mbstok(unsigned char*, unsigned char*); + +unsigned char* _mbsstr(const unsigned char*, const unsigned char*); +size_t _mbstrlen(const char*str); -int _ismbblead( unsigned int c); -int _ismbbtrail( unsigned int c); -int _ismbslead( const unsigned char *s, const unsigned char *c); -int _ismbstrail( const unsigned char *s, const unsigned char *c); #ifdef __cplusplus } #endif -#endif +#endif /* Not _MBSTRING_H_ */ + diff --git a/reactos/include/msvcrt/msvcrtdbg.h b/reactos/include/msvcrt/msvcrtdbg.h index 3916f9ad63d..bbc042e0628 100644 --- a/reactos/include/msvcrt/msvcrtdbg.h +++ b/reactos/include/msvcrt/msvcrtdbg.h @@ -17,6 +17,7 @@ #define __MSVCRT_DEBUG #include +#include #if 0 #ifdef NDEBUG @@ -28,7 +29,11 @@ #define DPRINT1(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0); #define CHECKPOINT1 do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0); #else +#ifdef __GNUC__ #define DPRINT1(args...) +#else +#define DPRINT DbgPrint +#endif #define CHECKPOINT1 #endif @@ -36,8 +41,24 @@ #define DPRINT(args...) do { DbgPrint("(MSVCRT:%s:%d) ",__FILE__,__LINE__); DbgPrint(args); } while(0); #define CHECKPOINT do { DbgPrint("MSVCRT:%s:%d\n",__FILE__,__LINE__); } while(0); #else +#ifdef __GNUC__ #define DPRINT(args...) +#else +#define DPRINT DbgPrint +#endif #define CHECKPOINT #endif /* NDEBUG */ +//ULONG CDECL DbgPrint(PCH Format, ...); +//ULONG DbgPrint(PCH Format,...); +//unsigned long DbgPrint(const char* Format, ...); + + + +//#define TRACE 0 ? (void)0 : Trace + +//void Trace(TCHAR* lpszFormat, ...); + + + #endif /* __MSVCRT_DEBUG */ diff --git a/reactos/include/msvcrt/process.h b/reactos/include/msvcrt/process.h index fbe12b1fe3d..a2efa76ad54 100644 --- a/reactos/include/msvcrt/process.h +++ b/reactos/include/msvcrt/process.h @@ -15,82 +15,82 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ /* changed second argument of cwait from nPID to hProc */ -#ifndef _PROCESS_H_ -#define _PROCESS_H_ +#ifndef __STRICT_ANSI__ -#ifndef __STRICT_ANSI__ - -#ifdef __cplusplus -extern "C" { -#endif - -void _cexit(void); -void _c_exit(void); +#ifndef _PROCESS_H_ +#define _PROCESS_H_ /* * Constants for cwait actions. * Obsolete for Win32. */ -#define _WAIT_CHILD 0 -#define _WAIT_GRANDCHILD 1 - -#ifndef _NO_OLDNAMES -#define WAIT_CHILD _WAIT_CHILD -#define WAIT_GRANDCHILD _WAIT_GRANDCHILD -#endif /* Not _NO_OLDNAMES */ - -int _cwait (int* pnStatus, int hProc, int nAction); - -int _getpid(void); - -int _execl (const char* szPath, const char* szArgv0, ...); -int _execle (const char* szPath, const char* szArgv0, ...); -int _execlp (const char* szPath, const char* szArgv0, ...); -int _execlpe (const char* szPath, const char* szArgv0, ...); -int _execv (const char* szPath, char* const* szaArgv); -int _execve (const char* szPath, char* const* szaArgv, char* const* szaEnv); -int _execvp (const char* szPath, char* const* szaArgv); -int _execvpe (const char* szPath, char* const* szaArgv, char* const* szaEnv); +#define _WAIT_CHILD 0 +#define _WAIT_GRANDCHILD 1 +#ifndef _NO_OLDNAMES +#define WAIT_CHILD _WAIT_CHILD +#define WAIT_GRANDCHILD _WAIT_GRANDCHILD +#endif /* Not _NO_OLDNAMES */ /* * Mode constants for spawn functions. */ -#define _P_WAIT 0 -#define _P_NOWAIT 1 -#define _P_OVERLAY 2 -#define _OLD_P_OVERLAY _P_OVERLAY -#define _P_NOWAITO 3 -#define _P_DETACH 4 - -#ifndef _NO_OLDNAMES -#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 -#endif /* Not _NO_OLDNAMES */ - -int _spawnl (int nMode, const char* szPath, const char* szArgv0, ...); -int _spawnle (int nMode, const char* szPath, const char* szArgv0,...); -int _spawnlp (int nMode, const char* szPath, const char* szArgv0,...); -int _spawnlpe (int nMode, const char* szPath, const char* szArgv0,...); -int _spawnv (int nMode, const char* szPath, char* const* szaArgv); -int _spawnve (int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv); -int _spawnvp (int nMode, const char* szPath, char* const* szaArgv); -int _spawnvpe (int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv); +#define _P_WAIT 0 +#define _P_NOWAIT 1 +#define _P_OVERLAY 2 +#define _OLD_P_OVERLAY _P_OVERLAY +#define _P_NOWAITO 3 +#define _P_DETACH 4 + +#ifndef _NO_OLDNAMES +#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 +#endif /* Not _NO_OLDNAMES */ + + +#ifdef __cplusplus +extern "C" { +#endif + +void _cexit(void); +void _c_exit(void); + +int _cwait (int* pnStatus, int hProc, int nAction); + +int _getpid(void); + +int _execl (const char* szPath, const char* szArgv0, ...); +int _execle (const char* szPath, const char* szArgv0, ...); +int _execlp (const char* szPath, const char* szArgv0, ...); +int _execlpe (const char* szPath, const char* szArgv0, ...); +int _execv (const char* szPath, char* const* szaArgv); +int _execve (const char* szPath, char* const* szaArgv, char* const* szaEnv); +int _execvp (const char* szPath, char* const* szaArgv); +int _execvpe (const char* szPath, char* const* szaArgv, char* const* szaEnv); + +int _spawnl (int nMode, const char* szPath, const char* szArgv0, ...); +int _spawnle (int nMode, const char* szPath, const char* szArgv0,...); +int _spawnlp (int nMode, const char* szPath, const char* szArgv0,...); +int _spawnlpe (int nMode, const char* szPath, const char* szArgv0,...); +int _spawnv (int nMode, const char* szPath, char* const* szaArgv); +int _spawnve (int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv); +int _spawnvp (int nMode, const char* szPath, char* const* szaArgv); +int _spawnvpe (int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv); /* * The functions _beginthreadex and _endthreadex are not provided by CRTDLL. * They are provided by MSVCRT. @@ -103,58 +103,58 @@ int _spawnvpe (int nMode, const char* szPath, char* const* szaArgv, char* const* * NOTE: No old names for these functions. Use the underscore. */ unsigned long - _beginthread (void (__cdecl *pfuncStart)(void *), - unsigned unStackSize, void* pArgList); -void _endthread (void); + _beginthread(void (__cdecl *pfuncStart)(void*), + unsigned unStackSize, void* pArgList); +void _endthread (void); -#if __MSVCRT__ +#ifdef __MSVCRT__ unsigned long - _beginthreadex (void *pSecurity, unsigned unStackSize, - unsigned (__stdcall *pfuncStart)(void*), void* pArgList, - unsigned unInitFlags, unsigned* pThreadAddr); -void _endthreadex (unsigned unExitCode); + _beginthreadex(void* pSecurity, unsigned unStackSize, + unsigned (__stdcall *pfuncStart)(void*), void* pArgList, + unsigned unInitFlags, unsigned* pThreadAddr); +void _endthreadex(unsigned unExitCode); #endif -void *_loaddll (char *name); -int _unloaddll(void *handle); +void* _loaddll(char* name); +int _unloaddll(void* handle); unsigned long __threadid(void); -#define _threadid __threadid() -void * __threadhandle(void); +#define _threadid __threadid() +void* __threadhandle(void); -#ifndef _NO_OLDNAMES +#ifndef _NO_OLDNAMES -#define cwait _cwait -#define getpid _getpid -#define execl _execl -#define execle _execle -#define execlp _execlp -#define execlpe _execlpe +#define cwait _cwait +#define getpid _getpid +#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 execv _execv +#define execve _execve +#define execvp _execvp +#define execvpe _execvpe -#define spawnl _spawnl -#define spawnle _spawnle -#define spawnlp _spawnlp -#define spawnlpe _spawnlpe +#define spawnl _spawnl +#define spawnle _spawnle +#define spawnlp _spawnlp +#define spawnlpe _spawnlpe #define spawnv _spawnv #define spawnve _spawnve #define spawnvp _spawnvp #define spawnvpe _spawnvpe +#endif /* Not _NO_OLDNAMES */ -#endif /* Not _NO_OLDNAMES */ - -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not __STRICT_ANSI__ */ +#endif /* _PROCESS_H_ not defined */ + +#endif /* Not __STRICT_ANSI__ */ -#endif /* _PROCESS_H_ not defined */ diff --git a/reactos/include/msvcrt/share.h b/reactos/include/msvcrt/share.h index 8e3af3f29ed..f71d5287da2 100644 --- a/reactos/include/msvcrt/share.h +++ b/reactos/include/msvcrt/share.h @@ -1,17 +1,44 @@ -#ifndef _include_share_h_ -#define _include_share_h_ +/* + * share.h + * + * Constants for file sharing functions. + * + * This file is part of the Mingw32 package. + * + * Contributors: + * Created by Colin Peters + * + * THIS SOFTWARE IS NOT COPYRIGHTED + * + * This source code is offered for use in the public domain. You may + * use, modify or distribute it freely. + * + * This code is distributed in the hope that it will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAIMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ + * + */ +#ifndef _SHARE_H_ +#define _SHARE_H_ -#define SH_COMPAT 0x0000 -#define SH_DENYRW 0x0010 -#define SH_DENYWR 0x0020 -#define SH_DENYRD 0x0030 -#define SH_DENYNO 0x0040 -#define _SH_COMPAT SH_COMPAT -#define _SH_DENYRW SH_DENYRW -#define _SH_DENYWR SH_DENYWR -#define _SH_DENYRD SH_DENYRD -#define _SH_DENYNO SH_DENYNO +#define SH_COMPAT 0x0000 +#define SH_DENYRW 0x0010 +#define SH_DENYWR 0x0020 +#define SH_DENYRD 0x0030 +#define SH_DENYNO 0x0040 -#endif +#define _SH_COMPAT SH_COMPAT +#define _SH_DENYRW SH_DENYRW +#define _SH_DENYWR SH_DENYWR +#define _SH_DENYRD SH_DENYRD +#define _SH_DENYNO SH_DENYNO + + +#endif /* Not _SHARE_H_ */ diff --git a/reactos/include/msvcrt/signal.h b/reactos/include/msvcrt/signal.h index 5aa281151ae..a30f2d45974 100644 --- a/reactos/include/msvcrt/signal.h +++ b/reactos/include/msvcrt/signal.h @@ -15,42 +15,18 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* added some extra signal constants */ -#ifndef _SIGNAL_H_ -#define _SIGNAL_H_ +#ifndef _SIGNAL_H_ +#define _SIGNAL_H_ -#ifdef __cplusplus -extern "C" { -#endif - -/* - * The prototypes (below) are the easy part. The hard part is figuring - * out what signals are available and what numbers they are assigned - * along with appropriate values of SIG_DFL and SIG_IGN. - */ - -/* - * A pointer to a signal handler function. A signal handler takes a - * single int, which is the signal it handles. - */ -typedef void (*_p_sig_fn_t)(int nSig); - -/* - * These are special values of signal handler pointers which are - * used to send a signal to the default handler (SIG_DFL), ignore - * the signal (SIG_IGN), or indicate an error return (SIG_ERR). - */ -#define SIG_DFL ((_p_sig_fn_t) 0) -#define SIG_IGN ((_p_sig_fn_t) 1) -#define SIG_ERR ((_p_sig_fn_t) -1) /* * The actual signal values. Using other values with signal @@ -68,44 +44,70 @@ typedef void (*_p_sig_fn_t)(int nSig); * structured exception handling frame. Results may be better if I ever * manage to get the SEH stuff down. */ -#define SIGINT 2 /* Interactive attention */ -#define SIGILL 4 /* Illegal instruction */ -#define SIGFPE 8 /* Floating point error */ -#define SIGSEGV 11 /* Segmentation violation */ -#define SIGTERM 15 /* Termination request */ -#define SIGBREAK 21 /* Control-break */ -#define SIGABRT 22 /* Abnormal termination (abort) */ +#define SIGINT 2 /* Interactive attention */ +#define SIGILL 4 /* Illegal instruction */ +#define SIGFPE 8 /* Floating point error */ +#define SIGSEGV 11 /* Segmentation violation */ +#define SIGTERM 15 /* Termination request */ +#define SIGBREAK 21 /* Control-break */ +#define SIGABRT 22 /* Abnormal termination (abort) */ -#define SIGALRM 293 -#define SIGHUP 294 +#define SIGALRM 293 +#define SIGHUP 294 /* SIGINT is ansi */ -#define SIGKILL 296 -#define SIGPIPE 297 -#define SIGQUIT 298 -#define SIGUSR1 299 -#define SIGUSR2 300 +#define SIGKILL 296 +#define SIGPIPE 297 +#define SIGQUIT 298 +#define SIGUSR1 299 +#define SIGUSR2 300 #define SIGNOFP 301 #define SIGTRAP 302 -#define SIGTIMR 303 /* Internal for setitimer (SIGALRM, SIGPROF) */ +#define SIGTIMR 303 /* Internal for setitimer (SIGALRM, SIGPROF) */ #define SIGPROF 304 #define SIGMAX 320 +/* + * The prototypes (below) are the easy part. The hard part is figuring + * out what signals are available and what numbers they are assigned + * along with appropriate values of SIG_DFL and SIG_IGN. + */ + +/* + * A pointer to a signal handler function. A signal handler takes a + * single int, which is the signal it handles. + */ +typedef void (*_p_sig_fn_t)(int); + +/* + * These are special values of signal handler pointers which are + * used to send a signal to the default handler (SIG_DFL), ignore + * the signal (SIG_IGN), or indicate an error return (SIG_ERR). + */ +#define SIG_DFL ((_p_sig_fn_t) 0) +#define SIG_IGN ((_p_sig_fn_t) 1) +#define SIG_ERR ((_p_sig_fn_t) -1) + +#ifdef __cplusplus +extern "C" { +#endif + + /* * Call signal to set the signal handler for signal sig to the * function pointed to by handler. Returns a pointer to the * previous handler, or SIG_ERR if an error occurs. Initially * unhandled signals defined above will return SIG_DFL. */ -_p_sig_fn_t signal(int sig, _p_sig_fn_t func); +_p_sig_fn_t signal(int sig, _p_sig_fn_t func); /* * Raise the signal indicated by sig. Returns non-zero on success. */ -int raise (int sig); +int raise(int); -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif +#endif /* Not _SIGNAL_H_ */ diff --git a/reactos/include/msvcrt/stdarg.h b/reactos/include/msvcrt/stdarg.h index 661e0dfdb16..4db9491acbd 100644 --- a/reactos/include/msvcrt/stdarg.h +++ b/reactos/include/msvcrt/stdarg.h @@ -23,12 +23,12 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ @@ -48,7 +48,7 @@ #define _VA_LIST_DEFINED #endif -#ifndef _VA_LIST +#ifndef _VA_LIST #define _VA_LIST typedef char* va_list; #endif @@ -58,31 +58,33 @@ typedef char* va_list; * Amount of space required in an argument list (ie. the stack) for an * argument of type t. */ -#define __va_argsiz(t) \ - (((sizeof(t) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) +#define __va_argsiz(t) \ + (((sizeof(t) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) /* * Start variable argument list processing by setting AP to point to the * argument after pN. */ -#ifdef __GNUC__ +#ifdef __GNUC__ /* * In GNU the stack is not necessarily arranged very neatly in order to * pack shorts and such into a smaller argument list. Fortunately a * neatly arranged version is available through the use of __builtin_next_arg. */ #ifndef va_start -#define va_start(ap, pN) \ - ((ap) = ((va_list) __builtin_next_arg(pN))) +#define va_start(ap, pN) \ + ((ap) = ((va_list) __builtin_next_arg(pN))) #endif #else /* * For a simple minded compiler this should work (it works in GNU too for * vararg lists that don't follow shorts and such). */ -#define va_start(ap, pN) \ - ((ap) = ((va_list) (&pN) + __va_argsiz(pN))) +#ifndef va_start +#define va_start(ap, pN) \ + ((ap) = ((va_list) (&pN) + __va_argsiz(pN))) +#endif #endif @@ -90,9 +92,9 @@ typedef char* va_list; * End processing of variable argument list. In this case we do nothing. */ #ifndef va_end -#define va_end(ap) ((void)0) +#define va_end(ap) ((void)0) #endif - + /* * Increment ap to the next argument in the list while returing a @@ -103,12 +105,11 @@ typedef char* va_list; */ #ifndef va_arg -#define va_arg(ap, t) \ - (((ap) = (ap) + __va_argsiz(t)), \ - *((t*) (void*) ((ap) - __va_argsiz(t)))) +#define va_arg(ap, t) \ + (((ap) = (ap) + __va_argsiz(t)), \ + *((t*) (void*) ((ap) - __va_argsiz(t)))) #endif - + #endif /* Not RC_INVOKED */ #endif /* not _STDARG_H_ */ - diff --git a/reactos/include/msvcrt/stddef.h b/reactos/include/msvcrt/stddef.h index f209f8a2ca3..fe321f2037a 100644 --- a/reactos/include/msvcrt/stddef.h +++ b/reactos/include/msvcrt/stddef.h @@ -25,12 +25,12 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.5 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.6 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ @@ -42,8 +42,8 @@ * wants us just to define one data type. So don't define * the symbols that indicate this file's entire job has been done. */ -#if (!defined(__need_wchar_t) && !defined(__need_wint_t) \ - && !defined(__need_size_t) && !defined(__need_ptrdiff_t) \ +#if (!defined(__need_wchar_t) && !defined(__need_wint_t) \ + && !defined(__need_size_t) && !defined(__need_ptrdiff_t) \ && !defined(__need_NULL)) #define __MSVCRT_STDDEF_H_ #endif @@ -69,13 +69,13 @@ #ifndef _PTRDIFF_T_ #define _PTRDIFF_T_ #ifndef __PTRDIFF_TYPE__ -#define __PTRDIFF_TYPE__ int +#define __PTRDIFF_TYPE__ int #endif -typedef __PTRDIFF_TYPE__ ptrdiff_t; +typedef __PTRDIFF_TYPE__ ptrdiff_t; #endif /* If this symbol has done its job, get rid of it. */ -#undef __need_ptrdiff_t +#undef __need_ptrdiff_t #endif /* __MSVCRT_STDDEF_H_ or __need_ptrdiff_t. */ @@ -93,12 +93,12 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t; #define SIZE_T_DEFINED #define _SIZE_T #ifndef __SIZE_TYPE__ -#define __SIZE_TYPE__ unsigned int +#define __SIZE_TYPE__ unsigned int #endif -typedef __SIZE_TYPE__ size_t; +typedef __SIZE_TYPE__ size_t; #endif -#undef __need_size_t +#undef __need_size_t #endif /* __MSVCRT_STDDEF_H_ or __need_size_t. */ @@ -116,16 +116,16 @@ typedef __SIZE_TYPE__ size_t; #define _WCHAR_T #define _WCHAR_T_DEFINED #ifndef __WCHAR_TYPE__ -#define __WCHAR_TYPE__ short unsigned int +#define __WCHAR_TYPE__ short unsigned int #endif #ifndef __cplusplus -typedef __WCHAR_TYPE__ wchar_t; -#endif /* C++ */ -#endif /* wchar_t not already defined */ +typedef __WCHAR_TYPE__ wchar_t; +#endif /* C++ */ +#endif /* wchar_t not already defined */ -#undef __need_wchar_t +#undef __need_wchar_t -#endif /* __MSVCRT_STDDEF_H_ or __need_wchar_t. */ +#endif /* __MSVCRT_STDDEF_H_ or __need_wchar_t. */ /* * wint_t, the equivalent of int in wchar ctype functions. @@ -134,17 +134,17 @@ typedef __WCHAR_TYPE__ wchar_t; #ifndef _WINT_T_ #define _WINT_T_ -#define _WINT_T /* To satisfy libstdc++ */ +#define _WINT_T /* To satisfy libstdc++ */ #ifndef __WINT_TYPE__ -#define __WINT_TYPE__ short int -#endif /* Not defined __WINT_TYPE__ */ +#define __WINT_TYPE__ short int +#endif /* Not defined __WINT_TYPE__ */ -typedef __WINT_TYPE__ wint_t; -#endif /* Not defined _WINT_T_ */ +typedef __WINT_TYPE__ wint_t; +#endif /* Not defined _WINT_T_ */ -#undef __need_wint_t +#undef __need_wint_t -#endif /* __MSVCRT_STDDEF_H_ or __need_wint_t. */ +#endif /* __MSVCRT_STDDEF_H_ or __need_wint_t. */ /* @@ -157,7 +157,7 @@ typedef __WINT_TYPE__ wint_t; #define NULL (0) #endif /* __MSVCRT_STDDEF_H_ or __need_NULL */ -#undef __need_NULL +#undef __need_NULL /* @@ -167,8 +167,8 @@ typedef __WINT_TYPE__ wint_t; */ #if defined (__MSVCRT_STDDEF_H_) -#define offsetof(TYPE, MEMBER) ((size_t) &( ((TYPE *) 0)->MEMBER )) -#endif /* __MSVCRT_STDDEF_H_ */ +#define offsetof(TYPE, MEMBER) ((size_t) &( ((TYPE *) 0)->MEMBER )) +#endif /* __MSVCRT_STDDEF_H_ */ #endif /* not __MSVCRT_STDDEF_H_ */ diff --git a/reactos/include/msvcrt/stdio.h b/reactos/include/msvcrt/stdio.h index 47f5229ea6d..537e6f5d390 100644 --- a/reactos/include/msvcrt/stdio.h +++ b/reactos/include/msvcrt/stdio.h @@ -19,12 +19,12 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ @@ -33,7 +33,7 @@ /* added filbuf and flsbuf and fwalk */ #ifndef _STDIO_H_ -#define _STDIO_H_ +#define _STDIO_H_ #ifdef __cplusplus extern "C" { @@ -54,6 +54,9 @@ extern "C" { #define _IOERR 0x000200 #define _IOSTRG 0x000400 +#define _IOBINARY 0x000800 +#define _IOTEXT 0x000000 + #define _IOAPPEND 0x002000 #define _IORMONCL 0x004000 /* remove on close, for temp files */ /* if _flag & _IORMONCL, ._name_to_remove needs freeing */ @@ -72,7 +75,7 @@ extern "C" { */ //#ifndef _VA_LIST //#define _VA_LIST -//typedef char* va_list; +//typedef char* va_list; //#endif #include @@ -82,14 +85,14 @@ extern "C" { */ #ifndef _FILE_DEFINED typedef struct { - char *_ptr; - int _cnt; - char *_base; - int _flag; - int _file; - int _ungotchar; - int _bufsiz; - char *_name_to_remove; + char* _ptr; + int _cnt; + char* _base; + int _flag; + int _file; + int _ungotchar; + int _bufsiz; + char* _name_to_remove; } FILE; #define _FILE_DEFINED #endif @@ -100,16 +103,15 @@ typedef struct { * The three standard file pointers provided by the run time library. * NOTE: These will go to the bit-bucket silently in GUI applications! */ -extern FILE _iob[]; /* an array of FILE */ -#define stdin (&_iob[0]) -#define stdout (&_iob[1]) -#define stderr (&_iob[2]) -#define stdaux (&_iob[3]) -#define stdprn (&_iob[4]) +extern FILE _iob[]; /* an array of FILE */ +#define stdin (&_iob[0]) +#define stdout (&_iob[1]) +#define stderr (&_iob[2]) +#define stdaux (&_iob[3]) +#define stdprn (&_iob[4]) /* Returned by various functions on end of file condition or error. */ -#define EOF (-1) - +#define EOF (-1) /* * The maximum length of a file name. You should use GetVolumeInformation @@ -118,45 +120,39 @@ extern FILE _iob[]; /* an array of FILE */ * NOTE: This is used in the structure _finddata_t (see dir.h) so changing it * is probably not a good idea. */ -#define FILENAME_MAX (260) +#define FILENAME_MAX (260) /* * The maximum number of files that may be open at once. I have set this to * a conservative number. The actual value may be higher. */ -#define FOPEN_MAX (20) - +#define FOPEN_MAX (20) /* * File Operations */ -FILE* _fdopen(int handle, char *mode); -FILE* _wfdopen(int handle, wchar_t *mode); - -FILE* fopen (const char* szFileName, const char* szMode); -FILE* _wfopen(const wchar_t *file, const wchar_t *mode); - -FILE* freopen(const char* szNewFileName, const char* szNewMode, - FILE* fileChangeAssociation); -FILE* _wfreopen(const wchar_t *file, const wchar_t *mode, FILE *f); - -FILE* _fsopen(const char *file, const char *mode, int shflag); -FILE* _wfsopen(const wchar_t *file, const wchar_t *mode, int shflag); - -int fflush(FILE* fileFlush); -int fclose(FILE* fileClose); -#define fcloseall _fcloseall -int remove(const char* szFileName); -int _wremove(const wchar_t* szFileName); -int rename(const char* szOldFileName, const char* szNewFileName); -int _wrename(const wchar_t *oldName, const wchar_t *newName); -FILE* tmpfile(void); - -int _filbuf(FILE *f); -int _flsbuf(int c, FILE *f); -void _fwalk(void (*func)(FILE *)); // not exported -int _fcloseall(void); - +FILE* fopen(const char* szFileName, const char* szMode); +FILE* freopen(const char* szNewFileName, const char* szNewMode, FILE* fileChangeAssociation); +int fflush(FILE* fileFlush); +int fclose(FILE* fileClose); +#define fcloseall _fcloseall +int remove(const char* szFileName); +int rename(const char* szOldFileName, const char* szNewFileName); +FILE* tmpfile(void); + +FILE* _fdopen(int handle, char *mode); +FILE* _wfdopen(int handle, wchar_t *mode); +FILE* _wfopen(const wchar_t *file, const wchar_t *mode); +FILE* _wfreopen(const wchar_t *file, const wchar_t *mode, FILE *f); +FILE* _fsopen(const char *file, const char *mode, int shflag); +FILE* _wfsopen(const wchar_t *file, const wchar_t *mode, int shflag); +int _wremove(const wchar_t* szFileName); +int _wrename(const wchar_t *oldName, const wchar_t *newName); + +int _filbuf(FILE* f); +int _flsbuf(int c, FILE* f); +void _fwalk(void (*func)(FILE*)); // not exported +int _fcloseall(void); /* * The maximum size of name (including NUL) that will be put in the user @@ -165,16 +161,16 @@ int _fcloseall(void); * maximum file name length above it is probably reasonable. I could be * wrong... */ -#define L_tmpnam (260) +#define L_tmpnam (260) -char* tmpnam (char caName[]); -wchar_t* _wtmpnam(wchar_t *s); +char* tmpnam(char caName[]); +char* _tempnam(const char *szDir, const char *szPfx); -char* _tempnam (const char *szDir, const char *szPfx); +wchar_t* _wtmpnam(wchar_t *s); wchar_t *_wtempnam(const wchar_t *dir,const wchar_t *prefix); #ifndef _NO_OLDNAMES -#define tempnam _tempnam +#define tempnam _tempnam #endif /* Not _NO_OLDNAMES */ /* @@ -182,120 +178,118 @@ wchar_t *_wtempnam(const wchar_t *dir,const wchar_t *prefix); * NOTE: _IOFBF works, but _IOLBF seems to work like unbuffered... * maybe I'm testing it wrong? */ -#define _IOFBF 0 /* fully buffered */ -#define _IOLBF 1 /* line buffered */ -#define _IONBF 2 /* unbuffered */ - -int setvbuf (FILE* fileSetBuffer, char* caBuffer, int nMode, - size_t sizeBuffer); +#define _IOFBF 0 /* fully buffered */ +#define _IOLBF 1 /* line buffered */ +#define _IONBF 2 /* unbuffered */ +int setvbuf(FILE* fileSetBuffer, char* caBuffer, int nMode, size_t sizeBuffer); /* * The buffer size as used by setbuf such that it is equivalent to * (void) setvbuf(fileSetBuffer, caBuffer, _IOFBF, BUFSIZ). */ -#define BUFSIZ 512 +#define BUFSIZ 512 -void setbuf (FILE* fileSetBuffer, char* caBuffer); +void setbuf(FILE* fileSetBuffer, char* caBuffer); /* * Pipe Operations */ -int _pclose (FILE* pipeClose); -FILE* _popen (const char* szPipeName, const char* szMode); -FILE* _wpopen (const wchar_t *cm, const wchar_t *md); +int _pclose(FILE* pipeClose); +FILE* _popen(const char* szPipeName, const char* szMode); +FILE* _wpopen(const wchar_t *cm, const wchar_t *md); -#define popen _popen -#define pclose _pclose +#define popen _popen +#define pclose _pclose /* Wide character version */ -FILE* _wpopen (const wchar_t* szPipeName, const wchar_t* szMode); +FILE* _wpopen(const wchar_t* szPipeName, const wchar_t* szMode); /* * Formatted Output */ -int fprintf (FILE* filePrintTo, const char* szFormat, ...); -int printf (const char* szFormat, ...); -int sprintf (char* caBuffer, const char* szFormat, ...); -int vfprintf (FILE* filePrintTo, const char* szFormat, va_list varg); -int vprintf (const char* szFormat, va_list varg); -int vsprintf (char* caBuffer, const char* szFormat, va_list varg); +int fprintf(FILE* filePrintTo, const char* szFormat, ...); +int printf(const char* szFormat, ...); +int sprintf(char* caBuffer, const char* szFormat, ...); +int vfprintf(FILE* filePrintTo, const char* szFormat, va_list varg); +int vprintf(const char* szFormat, va_list varg); +int vsprintf(char* caBuffer, const char* szFormat, va_list varg); /* Wide character versions */ -int fwprintf (FILE* filePrintTo, const wchar_t* wsFormat, ...); -int wprintf (const wchar_t* wsFormat, ...); -int swprintf (wchar_t* wcaBuffer, const wchar_t* wsFormat, ...); -int vfwprintf (FILE* filePrintTo, const wchar_t* wsFormat, va_list varg); -int vwprintf (const wchar_t* wsFormat, va_list varg); -int vswprintf (wchar_t* wcaBuffer, const wchar_t* wsFormat, va_list varg); +int fwprintf(FILE* filePrintTo, const wchar_t* wsFormat, ...); +int wprintf(const wchar_t* wsFormat, ...); +int swprintf(wchar_t* wcaBuffer, const wchar_t* wsFormat, ...); +int vfwprintf(FILE* filePrintTo, const wchar_t* wsFormat, va_list varg); +int vwprintf(const wchar_t* wsFormat, va_list varg); +int vswprintf(wchar_t* wcaBuffer, const wchar_t* wsFormat, va_list varg); /* * Formatted Input */ -int fscanf (FILE* fileReadFrom, const char* szFormat, ...); -int scanf (const char* szFormat, ...); -int sscanf (const char* szReadFrom, const char* szFormat, ...); +int fscanf(FILE* fileReadFrom, const char* szFormat, ...); +int scanf(const char* szFormat, ...); +int sscanf(const char* szReadFrom, const char* szFormat, ...); /* Wide character versions */ -int fwscanf (FILE* fileReadFrom, const wchar_t* wsFormat, ...); -int wscanf (const wchar_t* wsFormat, ...); -int swscanf (const wchar_t* wsReadFrom, const wchar_t* wsFormat, ...); +int fwscanf(FILE* fileReadFrom, const wchar_t* wsFormat, ...); +int wscanf(const wchar_t* wsFormat, ...); +int swscanf(const wchar_t* wsReadFrom, const wchar_t* wsFormat, ...); /* * Character Input and Output Functions */ -int fgetc (FILE* fileRead); -char* fgets (char* caBuffer, int nBufferSize, FILE* fileRead); -int fputc (int c, FILE* fileWrite); -int fputs (const char* szOutput, FILE* fileWrite); -int getc (FILE* fileRead); -int getchar (void); -char* gets (char* caBuffer); /* Unsafe: how does gets know how long the - * buffer is? */ -int putc (int c, FILE* fileWrite); -int putchar (int c); -int puts (const char* szOutput); -int ungetc (int c, FILE* fileWasRead); +int fgetc(FILE* fileRead); +char* fgets(char* caBuffer, int nBufferSize, FILE* fileRead); +int fputc(int c, FILE* fileWrite); +int fputs(const char* szOutput, FILE* fileWrite); +int getc(FILE* fileRead); +int getchar(void); +char* gets(char* caBuffer); /* Unsafe: how does gets know how long the buffer is? */ +int putc(int c, FILE* fileWrite); +int putchar(int c); +int puts(const char* szOutput); +int ungetc(int c, FILE* fileWasRead); /* Wide character versions */ -wint_t fgetwc (FILE* fileRead); -wint_t fputwc (wchar_t wc, FILE* fileWrite); -wint_t getwc (FILE *fileRead); -wint_t putwc (wint_t wc, FILE* fileWrite); -wint_t putwchar (wint_t c); -int _putws (const wchar_t* ws); -wint_t ungetwc (wchar_t wc, FILE* fileWasRead); +wint_t fgetwc(FILE* fileRead); +wint_t fputwc(wchar_t wc, FILE* fileWrite); +wint_t getwc(FILE *fileRead); // not exported from crtdll + +// TODO: check type wint_t, why doesn't compare to WEOF correctly ??? +//wint_t putwc(wint_t wc, FILE* fileWrite); +int putwc(wint_t wc, FILE* fileWrite); + +wint_t putwchar(wint_t c); +int _putws(const wchar_t* ws); -wint_t _filwbuf(FILE *f); -wint_t _flswbuf(wchar_t c, FILE *f); +wint_t ungetwc(wchar_t wc, FILE* fileWasRead); + +wint_t _filwbuf(FILE *f); +wint_t _flswbuf(wchar_t c, FILE *f); /* * Not exported by CRTDLL.DLL included for reference purposes. */ #if 0 -wchar_t* fgetws (wchar_t* wcaBuffer, int nBufferSize, FILE* fileRead); -int fputws (const wchar_t* wsOutput, FILE* fileWrite); -int getwc (FILE* fileRead); -int getwchar (); -wchar_t* getws (wchar_t* wcaBuffer); -#endif /* 0 */ +wchar_t* fgetws(wchar_t* wcaBuffer, int nBufferSize, FILE* fileRead); +int fputws(const wchar_t* wsOutput, FILE* fileWrite); +int getwc(FILE* fileRead); +int getwchar(); +wchar_t* getws(wchar_t* wcaBuffer); +#endif /* 0 */ /* NOTE: putchar has no wide char equivalent even in tchar.h */ - /* * Direct Input and Output Functions */ -size_t fread (void* pBuffer, size_t sizeObject, size_t sizeObjCount, - FILE* fileRead); -size_t fwrite (const void* pObjArray, size_t sizeObject, size_t sizeObjCount, - FILE* fileWrite); - +size_t fread(void* pBuffer, size_t sizeObject, size_t sizeObjCount, FILE* fileRead); +size_t fwrite(const void* pObjArray, size_t sizeObject, size_t sizeObjCount, FILE* fileWrite); /* * File Positioning Functions @@ -304,21 +298,21 @@ size_t fwrite (const void* pObjArray, size_t sizeObject, size_t sizeObjCount, /* Constants for nOrigin indicating the position relative to which fseek * sets the file position. Enclosed in ifdefs because io.h could also * define them. (Though not anymore since io.h includes this file now.) */ -#ifndef SEEK_SET -#define SEEK_SET (0) +#ifndef SEEK_SET +#define SEEK_SET (0) #endif -#ifndef SEEK_CUR -#define SEEK_CUR (1) +#ifndef SEEK_CUR +#define SEEK_CUR (1) #endif -#ifndef SEEK_END -#define SEEK_END (2) +#ifndef SEEK_END +#define SEEK_END (2) #endif -int fseek (FILE* fileSetPosition, long lnOffset, int nOrigin); -long ftell (FILE* fileGetPosition); -void rewind (FILE* fileRewind); +int fseek(FILE* fileSetPosition, long lnOffset, int nOrigin); +long ftell(FILE* fileGetPosition); +void rewind(FILE* fileRewind); /* * An opaque data type used for storing file positions... The contents of @@ -328,45 +322,45 @@ void rewind (FILE* fileRewind); * it is fairly evident that the fpos_t type is a long (in CRTDLL.DLL). * Perhaps an unsigned long? TODO? */ -typedef long fpos_t; - -int fgetpos (FILE* fileGetPosition, fpos_t* pfpos); -int fsetpos (FILE* fileSetPosition, const fpos_t* pfpos); +typedef long fpos_t; +int fgetpos(FILE* fileGetPosition, fpos_t* pfpos); +int fsetpos(FILE* fileSetPosition, const fpos_t* pfpos); /* * Error Functions */ #if 0 -void clearerr (FILE* fileClearErrors); -int feof (FILE* fileIsAtEnd); -int ferror (FILE* fileIsError); -void perror (const char* szErrorMessage); - +void clearerr(FILE* fileClearErrors); +int feof(FILE* fileIsAtEnd); +int ferror(FILE* fileIsError); +void perror(const char* szErrorMessage); #endif + void _wperror(const wchar_t *s); +#define clearerr(f) (((f)->_flag) &= ~(_IOERR|_IOEOF)) +#define feof(f) (((f)->_flag&_IOEOF)!=0) +//#define ferror(f) (((f)->_flag&_IOERR)!=0) +int ferror(FILE* fileIsError); +#define perror(s) (fprintf(stderr, "%s: %s\n", (s), _strerror(NULL))) -#define clearerr(f) (((f)->_flag) &= ~(_IOERR|_IOEOF)) -#define feof(f) (((f)->_flag&_IOEOF)!=0) -#define ferror(f) (((f)->_flag&_IOERR)!=0) -#define perror(s) (fprintf(stderr, "%s: %s\n", (s), _strerror(NULL))) /* * Non ANSI functions */ #ifndef __STRICT_ANSI__ -int _fgetchar (void); -int _fputchar (int c); -FILE* _fdopen (int nHandle, char* szMode); +int _fgetchar(void); +int _fputchar(int c); +FILE* _fdopen(int nHandle, char* szMode); #ifndef _NO_OLDNAMES -#define fgetchar _fgetchar -#define fputchar _fputchar -#define fdopen _fdopen -#endif /* Not _NO_OLDNAMES */ +#define fgetchar _fgetchar +#define fputchar _fputchar +#define fdopen _fdopen +#endif /* Not _NO_OLDNAMES */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ #ifdef __cplusplus } diff --git a/reactos/include/msvcrt/stdlib.h b/reactos/include/msvcrt/stdlib.h index 80bf0e3a535..366da9577e3 100644 --- a/reactos/include/msvcrt/stdlib.h +++ b/reactos/include/msvcrt/stdlib.h @@ -15,12 +15,12 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ @@ -30,6 +30,23 @@ #ifndef _STDLIB_H_ #define _STDLIB_H_ +#define __need_size_t +#define __need_wchar_t +#define __need_NULL +#include + +/* + * RAND_MAX is the maximum value that may be returned by rand. + * The minimum is zero. + */ +#define RAND_MAX 0x7FFF + +/* + * These values may be used as exit status codes. + */ +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE -1 + #ifdef __cplusplus extern "C" { #endif @@ -40,92 +57,69 @@ extern "C" { * argc and argv. environ is a pointer to a table of environment variables. * NOTE: Strings in _argv and environ are ANSI strings. */ -extern int* __argc_dll; -extern char*** __argv_dll; -extern char*** _environ_dll; -#define __argc (*__argc_dll) -#define __argv (*__argv_dll) -#define _environ (*_environ_dll) +extern int* __argc_dll; +extern char*** __argv_dll; +extern char*** _environ_dll; +#define __argc (*__argc_dll) +#define __argv (*__argv_dll) +#define _environ (*_environ_dll) -#define __need_size_t -#define __need_wchar_t -#define __need_NULL -#include #include -#ifndef __ATTRIB_NORETURN -#ifdef __GNUC__ -#define _ATTRIB_NORETURN __attribute__ ((noreturn)) -#ifndef __int64 -#define __int64 long long -#endif /* Not __int64 */ -#else /* Not __GNUC__ */ -#define _ATTRIB_NORETURN -#endif /* __GNUC__ */ +#ifndef __ATTRIB_NORETURN +#ifdef __GNUC__ +#define _ATTRIB_NORETURN __attribute__ ((noreturn)) +#ifndef __int64 +#define __int64 long long +#endif /* Not __int64 */ +#else /* Not __GNUC__ */ +#define _ATTRIB_NORETURN +#endif /* __GNUC__ */ #endif -double atof (const char* szNumber); -int atoi (const char* szNumber); -long atol (const char* szNumber); - +double atof(const char* szNumber); +int atoi(const char* szNumber); +long atol(const char* szNumber); -double strtod (const char* szNumber, char** pszAfterNumber); -double wcstod (const wchar_t* wsNumber, wchar_t** pwsAfterNumber); -long strtol (const char* szNumber, char** pszAfterNumber, int nBase); -long wcstol (const wchar_t* wsNumber, wchar_t** pwsAfterNumber, int nBase); +double strtod(const char* szNumber, char** pszAfterNumber); +double wcstod(const wchar_t* wsNumber, wchar_t** pwsAfterNumber); +long strtol(const char* szNumber, char** pszAfterNumber, int nBase); +long wcstol(const wchar_t* wsNumber, wchar_t** pwsAfterNumber, int nBase); -unsigned long strtoul (const char* szNumber, char** pszAfterNumber, - int nBase); -unsigned long wcstoul (const wchar_t* wsNumber, wchar_t** pwsAfterNumber, - int nBase); +unsigned long strtoul(const char* szNumber, char** pszAfterNumber, int nBase); +unsigned long wcstoul(const wchar_t* wsNumber, wchar_t** pwsAfterNumber, int nBase); -size_t wcstombs (char* mbsDest, const wchar_t* wsConvert, size_t size); -int wctomb (char* mbDest, wchar_t wc); +size_t wcstombs(char* mbsDest, const wchar_t* wsConvert, size_t size); +int wctomb(char* mbDest, wchar_t wc); +int mblen(const char* mbs, size_t sizeString); +size_t mbstowcs(wchar_t* wcaDest, const char* mbsConvert, size_t size); +int mbtowc(wchar_t* wcDest, const char* mbConvert, size_t size); -int mblen (const char* mbs, size_t sizeString); -size_t mbstowcs (wchar_t* wcaDest, const char* mbsConvert, - size_t size); -int mbtowc (wchar_t* wcDest, const char* mbConvert, size_t size); +int rand(void); +void srand(unsigned int nSeed); +void* calloc(size_t sizeObjCnt, size_t sizeObject); +void* malloc(size_t sizeObject); +void* realloc(void* pObject, size_t sizeNew); +void free(void* pObject); -/* - * RAND_MAX is the maximum value that may be returned by rand. - * The minimum is zero. - */ -#define RAND_MAX 0x7FFF - -int rand (void); -void srand (unsigned int nSeed); +void abort(void) _ATTRIB_NORETURN; +void exit(int nStatus) _ATTRIB_NORETURN; +int atexit(void (*pfuncExitProcessing)(void)); +int system(const char* szCommand); // impl in process +char* getenv(const char* szVarName); // impl in stdio ??? +wchar_t* _wgetenv(const wchar_t* szVarName); -void* calloc (size_t sizeObjCnt, size_t sizeObject); -void* malloc (size_t sizeObject); -void* realloc (void* pObject, size_t sizeNew); -void free (void* pObject); +typedef int (*_pfunccmp_t)(const void*, const void*); -/* These values may be used as exit status codes. */ -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE -1 +void* bsearch(const void* pKey, const void* pBase, size_t cntObjects, size_t sizeObject, _pfunccmp_t pfuncCmp); +void qsort(const void* pBase, size_t cntObjects, size_t sizeObject, _pfunccmp_t pfuncCmp); -void abort (void) _ATTRIB_NORETURN; -void exit (int nStatus) _ATTRIB_NORETURN; -int atexit (void (*pfuncExitProcessing)(void)); - -int system (const char* szCommand); // impl in process -char* getenv (const char* szVarName); -wchar_t* _wgetenv (const wchar_t* szVarName); - -typedef int (*_pfunccmp_t)(const void*, const void*); - -void* bsearch (const void* pKey, const void* pBase, size_t cntObjects, - size_t sizeObject, _pfunccmp_t pfuncCmp); -void qsort (const void* pBase, size_t cntObjects, size_t sizeObject, - _pfunccmp_t pfuncCmp); - -int abs (int n); -long labs (long n); +int abs(int n); +long labs(long n); /* * div_t and ldiv_t are structures used to return the results of div and @@ -137,96 +131,99 @@ long labs (long n); */ typedef struct { int quot, rem; } div_t; typedef struct { long quot, rem; } ldiv_t; + +#ifdef __GNUC__ // robd typedef struct { long long quot, rem; } lldiv_t; +#else +typedef struct { double quot, rem; } lldiv_t; +#endif -div_t div (int nNumerator, int nDenominator); -ldiv_t ldiv (long lNumerator, long lDenominator); -lldiv_t lldiv (long long lNumerator, long long lDenominator); +div_t div(int nNumerator, int nDenominator); +ldiv_t ldiv(long lNumerator, long lDenominator); + +#ifdef __GNUC__ // robd +lldiv_t lldiv(long long lNumerator, long long lDenominator); +#else +lldiv_t lldiv(double lNumerator, double lDenominator); +#endif -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ /* * NOTE: Officially the three following functions are obsolete. The Win32 API * functions SetErrorMode, Beep and Sleep are their replacements. */ -void _beep (unsigned int, unsigned int); -void _seterrormode (int nMode); -void _sleep (unsigned long ulTime); - -void _exit (int nStatus) _ATTRIB_NORETURN; - -int _putenv (const char *val); -int _wputenv(const wchar_t *val); -void _searchenv (const char *file, const char *var, char *path); -void _wsearchenv (const wchar_t *file, const wchar_t *var, wchar_t *path); - -void _makepath( char *path, const char *drive, const char *dir, - const char *fname, const char *ext ); -void _wmakepath( wchar_t *path, const wchar_t *drive, const wchar_t *dir, - const wchar_t *fname, const wchar_t *ext ); -void _splitpath( const char *path, char *drive, char *dir, - char *fname, char *ext ); -char* _fullpath( char* caBuf, const char* szPath, size_t sizeMax ); -wchar_t *_wfullpath( wchar_t *absPath, const wchar_t *relPath, size_t maxLength ); - -char* _itoa (int nValue, char* sz, int nRadix); -char* _i64toa(__int64 value, char *string, int radix); -char* _ltoa (long lnValue, char* sz, int nRadix); -char* _ultoa(unsigned long value, char *string, int radix); -char* _ui64toa(unsigned __int64 value, char *string, int radix); - -wchar_t* _itow (int nValue, wchar_t* sz, int nRadix); -wchar_t* _i64tow(__int64 value, wchar_t *string, int radix); -wchar_t* _ltow (long lnValue, wchar_t* sz, int nRadix); -wchar_t* _ultow(unsigned long value, wchar_t *string, int radix); -wchar_t* _ui64tow(unsigned __int64 value, wchar_t *string, int radix); +void _beep(unsigned int, unsigned int); +void _seterrormode(int nMode); +void _sleep(unsigned long ulTime); -char* _ecvt (double dValue, int nDig, int* pnDec, int* pnSign); -char* _fcvt (double dValue, int nDig, int* pnDec, int* pnSign); -char* _gcvt (double dValue, int nDec, char* caBuf); +void _exit(int nStatus) _ATTRIB_NORETURN; -void _swab (const char* caFrom, char* caTo, size_t sizeToCopy); +int _putenv(const char *val); +void _searchenv(const char *file, const char *var, char *path); +void _splitpath(const char *path, char *drive, char *dir, char *fname, char *ext); -unsigned int _rotl( unsigned int value, int shift ); -unsigned int _rotr( unsigned int value, int shift ); -unsigned long _lrotl( unsigned long value, int shift ); -unsigned long _lrotr( unsigned long value, int shift ); +char* _itoa(int nValue, char* sz, int nRadix); +char* _ltoa(long lnValue, char* sz, int nRadix); -__int64 _atoi64(const char *szNumber); +int _wputenv(const wchar_t *val); +void _wsearchenv(const wchar_t *file, const wchar_t *var, wchar_t *path); +void _makepath(char *path, const char *drive, const char *dir, const char *fname, const char *ext); +void _wmakepath(wchar_t *path, const wchar_t *drive, const wchar_t *dir, const wchar_t *fname, const wchar_t *ext); +wchar_t* _wfullpath(wchar_t *absPath, const wchar_t *relPath, size_t maxLength); +char* _i64toa(__int64 value, char *string, int radix); +char* _ultoa(unsigned long value, char *string, int radix); +char* _ui64toa(unsigned __int64 value, char *string, int radix); -int _wtoi( const wchar_t *str ); -__int64 _wtoi64(const wchar_t *str); -long _wtol( const wchar_t *str ); - - -#ifndef _NO_OLDNAMES -#define beep _beep -#define seterrormode _seterrormode -#define sleep _sleep -#define putenv _putenv -#define searchenv _searchenv -#define splitpath _splitpath - -#define itoa _itoa -#define ltoa _ltoa - -#define ecvt _ecvt -#define fcvt _fcvt -#define gcvt _gcvt - -#define swab _swab -#endif /* Not _NO_OLDNAMES */ - -#endif /* Not __STRICT_ANSI__ */ +wchar_t* _itow(int nValue, wchar_t* sz, int nRadix); +wchar_t* _i64tow(__int64 value, wchar_t *string, int radix); +wchar_t* _ltow(long lnValue, wchar_t* sz, int nRadix); +wchar_t* _ultow(unsigned long value, wchar_t *string, int radix); +wchar_t* _ui64tow(unsigned __int64 value, wchar_t *string, int radix); +__int64 _atoi64(const char *szNumber); +int _wtoi(const wchar_t *str); +__int64 _wtoi64(const wchar_t *str); +long _wtol(const wchar_t *str); + +char* _ecvt(double dValue, int nDig, int* pnDec, int* pnSign); +char* _fcvt(double dValue, int nDig, int* pnDec, int* pnSign); +char* _gcvt(double dValue, int nDec, char* caBuf); +char* _fullpath(char* caBuf, const char* szPath, size_t sizeMax); +void _swab(const char* caFrom, char* caTo, size_t sizeToCopy); + +unsigned int _rotl(unsigned int value, int shift); +unsigned int _rotr(unsigned int value, int shift); +unsigned long _lrotl(unsigned long value, int shift); +unsigned long _lrotr(unsigned long value, int shift); + + +#ifndef _NO_OLDNAMES +#define beep _beep +#define seterrormode _seterrormode +#define sleep _sleep +#define putenv _putenv +#define searchenv _searchenv +#define splitpath _splitpath +#define itoa _itoa +#define ltoa _ltoa +#define ecvt _ecvt +#define fcvt _fcvt +#define gcvt _gcvt +#define swab _swab +#endif /* Not _NO_OLDNAMES */ + + +#endif /* Not __STRICT_ANSI__ */ /* * Undefine the no return attribute used in some function definitions */ -#undef _ATTRIB_NORETURN +#undef _ATTRIB_NORETURN #ifdef __cplusplus } #endif -#endif /* _STDLIB_H_ */ +#endif /* Not _STDLIB_H_ */ + diff --git a/reactos/include/msvcrt/string.h b/reactos/include/msvcrt/string.h index 4c63cdb26b1..ac866dc88fd 100644 --- a/reactos/include/msvcrt/string.h +++ b/reactos/include/msvcrt/string.h @@ -15,12 +15,12 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ @@ -29,124 +29,118 @@ #ifndef _STRING_H_ -#define _STRING_H_ +#define _STRING_H_ -#ifdef __cplusplus -extern "C" { -#endif /* * Define size_t, wchar_t and NULL */ #define __need_size_t #define __need_wchar_t -#define __need_NULL +#define __need_NULL #include +#ifdef __cplusplus +extern "C" { +#endif + char * ___strtok; // removed extern specifier 02-06-98, BD /* * Prototypes of the ANSI Standard C library string functions. */ -void* memchr (const void* p, int cSearchFor, size_t sizeSearch); -int memcmp (const void* p1, const void* p2, size_t sizeSearch); -void* memcpy (void* pCopyTo, const void* pSource, size_t sizeSource); -void* memmove (void* pMoveTo, const void* pSource, size_t sizeSource); -void* memset (void* p, int cFill, size_t sizeRepeatCount); -char* strcat (char* szAddTo, const char* szAdd); -char* strchr (const char* szSearch, int cFor); -int strcmp (const char* sz1, const char* sz2); -int strcoll (const char* sz1, const char* sz2); /* Compare using locale */ -char* strcpy (char* szCopyTo, const char* szSource); -size_t strcspn (const char* szGetPrefix, const char* szNotIncluding); -char* strerror (int nError); /* NOTE: NOT an old name wrapper. */ +void* memchr(const void* p, int cSearchFor, size_t sizeSearch); +int memcmp(const void* p1, const void* p2, size_t sizeSearch); +void* memcpy(void* pCopyTo, const void* pSource, size_t sizeSource); +void* memmove(void* pMoveTo, const void* pSource, size_t sizeSource); +void* memset(void* p, int cFill, size_t sizeRepeatCount); +char* strcat(char* szAddTo, const char* szAdd); +char* strchr(const char* szSearch, int cFor); +int strcmp(const char* sz1, const char* sz2); +int strcoll(const char* sz1, const char* sz2); /* Compare using locale */ +char* strcpy(char* szCopyTo, const char* szSource); +size_t strcspn(const char* szGetPrefix, const char* szNotIncluding); +char* strerror(int nError); /* NOTE: NOT an old name wrapper. */ char * _strerror(const char *s); -size_t strlen (const char* sz); -size_t strnlen (const char* sz, size_t count); // not exported -char* strncat (char* szAddTo, const char* szAdd, size_t sizeMaxAdd); -int strncmp (const char* sz1, const char* sz2, size_t sizeMaxCompare); -char* strncpy (char* szCopyTo, const char* szSource, size_t sizeMaxCopy); -char* strpbrk (const char* szSearch, const char* szAnyOf); -char* strrchr (const char* szSearch, int cFor); -size_t strspn (const char* szGetPrefix, const char *szIncluding); -char* strstr (const char* szSearch, const char *szFor); -char* strtok (char* szTokenize, const char* szDelimiters); -size_t strxfrm (char* szTransformed, const char *szSource, - size_t sizeTransform); +size_t strlen(const char* sz); +size_t strnlen(const char* sz, size_t count); // not exported +char* strncat(char* szAddTo, const char* szAdd, size_t sizeMaxAdd); +int strncmp(const char* sz1, const char* sz2, size_t sizeMaxCompare); +char* strncpy(char* szCopyTo, const char* szSource, size_t sizeMaxCopy); +char* strpbrk(const char* szSearch, const char* szAnyOf); +char* strrchr(const char* szSearch, int cFor); +size_t strspn(const char* szGetPrefix, const char *szIncluding); +char* strstr(const char* szSearch, const char *szFor); +char* strtok(char* szTokenize, const char* szDelimiters); +size_t strxfrm(char* szTransformed, const char *szSource, size_t sizeTransform); #ifndef __STRICT_ANSI__ /* * Extra non-ANSI functions provided by the CRTDLL library */ -void* _memccpy (void* pCopyTo, const void* pSource, int cTerminator, - size_t sizeMaxCopy); -int _memicmp (const void* p1, const void* p2, size_t sizeSearch); -char* _strdup (const char *szDuplicate); -int _strcmpi (const char* sz1, const char* sz2); -int _stricmp (const char* sz1, const char* sz2); -int _stricoll (const char* sz1, const char* sz2); -char* _strlwr (char* szToConvert); -int _strnicmp (const char* sz1, const char* sz2, - size_t sizeMaxCompare); -char* _strnset (char* szToFill, int cFill, size_t sizeMaxFill); -char* _strrev (char* szToReverse); -char* _strset (char* szToFill, int cFill); -char* _strupr (char* szToConvert); - - -#endif /* Not __STRICT_ANSI__ */ +void* _memccpy(void* pCopyTo, const void* pSource, int cTerminator, size_t sizeMaxCopy); +int _memicmp(const void* p1, const void* p2, size_t sizeSearch); +char* _strdup(const char *szDuplicate); +int _strcmpi(const char* sz1, const char* sz2); +int _stricmp(const char* sz1, const char* sz2); +int _stricoll(const char* sz1, const char* sz2); +char* _strlwr(char* szToConvert); +int _strnicmp(const char* sz1, const char* sz2, size_t sizeMaxCompare); +char* _strnset(char* szToFill, int cFill, size_t sizeMaxFill); +char* _strrev(char* szToReverse); +char* _strset(char* szToFill, int cFill); +char* _strupr(char* szToConvert); + +#endif /* Not __STRICT_ANSI__ */ /* * Unicode versions of the standard calls. */ -wchar_t* wcscat (wchar_t* wsAddTo, const wchar_t* wsAdd); -wchar_t* wcschr (const wchar_t* wsSearch, wchar_t wcFor); -int wcscmp (const wchar_t* ws1, const wchar_t* ws2); -int wcscoll (const wchar_t* ws1, const wchar_t* ws2); -wchar_t* wcscpy (wchar_t* wsCopyTo, const wchar_t* wsSource); -size_t wcscspn (const wchar_t* wsGetPrefix, const wchar_t* wsNotIncluding); +wchar_t* wcscat(wchar_t* wsAddTo, const wchar_t* wsAdd); +wchar_t* wcschr(const wchar_t* wsSearch, wchar_t wcFor); +int wcscmp(const wchar_t* ws1, const wchar_t* ws2); +int wcscoll(const wchar_t* ws1, const wchar_t* ws2); +wchar_t* wcscpy(wchar_t* wsCopyTo, const wchar_t* wsSource); +size_t wcscspn(const wchar_t* wsGetPrefix, const wchar_t* wsNotIncluding); /* Note: No wcserror in CRTDLL. */ -size_t wcslen (const wchar_t* ws); -wchar_t* wcsncat (wchar_t* wsAddTo, const wchar_t* wsAdd, size_t sizeMaxAdd); -int wcsncmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare); -wchar_t* wcsncpy(wchar_t* wsCopyTo, const wchar_t* wsSource, - size_t sizeMaxCopy); +size_t wcslen(const wchar_t* ws); +wchar_t* wcsncat(wchar_t* wsAddTo, const wchar_t* wsAdd, size_t sizeMaxAdd); +int wcsncmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare); +wchar_t* wcsncpy(wchar_t* wsCopyTo, const wchar_t* wsSource, size_t sizeMaxCopy); wchar_t* wcspbrk(const wchar_t* wsSearch, const wchar_t* wsAnyOf); wchar_t* wcsrchr(const wchar_t* wsSearch, wchar_t wcFor); -size_t wcsspn(const wchar_t* wsGetPrefix, const wchar_t* wsIncluding); +size_t wcsspn(const wchar_t* wsGetPrefix, const wchar_t* wsIncluding); wchar_t* wcsstr(const wchar_t* wsSearch, const wchar_t* wsFor); wchar_t* wcstok(wchar_t* wsTokenize, const wchar_t* wsDelimiters); -size_t wcsxfrm(wchar_t* wsTransformed, const wchar_t *wsSource, - size_t sizeTransform); +size_t wcsxfrm(wchar_t* wsTransformed, const wchar_t *wsSource, size_t sizeTransform); -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ /* * Unicode versions of non-ANSI functions provided by CRTDLL. */ /* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */ -#define _wcscmpi _wcsicmp +#define _wcscmpi _wcsicmp -wchar_t* _wcsdup (const wchar_t* wsToDuplicate); -int _wcsicmp (const wchar_t* ws1, const wchar_t* ws2); -int _wcsicoll (const wchar_t* ws1, const wchar_t* ws2); -int _wcsncoll (const wchar_t *s1, const wchar_t *s2, size_t c); -int _wcsnicoll (const wchar_t *s1, const wchar_t *s2, size_t c); -wchar_t* _wcslwr (wchar_t* wsToConvert); -int _wcsnicmp (const wchar_t* ws1, const wchar_t* ws2, - size_t sizeMaxCompare); -wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill); -wchar_t* _wcsrev (wchar_t* wsToReverse); -wchar_t* _wcsset (wchar_t* wsToFill, wchar_t wcToFill); -wchar_t* _wcsupr (wchar_t* wsToConvert); +wchar_t* _wcsdup(const wchar_t* wsToDuplicate); +int _wcsicmp(const wchar_t* ws1, const wchar_t* ws2); +int _wcsicoll(const wchar_t* ws1, const wchar_t* ws2); +int _wcsncoll(const wchar_t *s1, const wchar_t *s2, size_t c); +int _wcsnicoll(const wchar_t *s1, const wchar_t *s2, size_t c); +wchar_t* _wcslwr(wchar_t* wsToConvert); +int _wcsnicmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare); +wchar_t* _wcsnset(wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill); +wchar_t* _wcsrev(wchar_t* wsToReverse); +wchar_t* _wcsset(wchar_t* wsToFill, wchar_t wcToFill); +wchar_t* _wcsupr(wchar_t* wsToConvert); -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ -#ifndef __STRICT_ANSI__ -#ifndef _NO_OLDNAMES +#ifndef __STRICT_ANSI__ +#ifndef _NO_OLDNAMES /* * Non-underscored versions of non-ANSI functions. They live in liboldnames.a @@ -154,41 +148,41 @@ wchar_t* _wcsupr (wchar_t* wsToConvert); * strcasecmp. */ -void* memccpy (void* pCopyTo, const void* pSource, int cTerminator, - size_t sizeMaxCopy); -int memicmp (const void* p1, const void* p2, size_t sizeSearch); -#define strdup(szDuplicate) _strdup(szDuplicate) -int strcmpi (const char* sz1, const char* sz2); -int stricmp (const char* sz1, const char* sz2); -int strcasecmp (const char* sz1, const char* sz2); -int stricoll (const char* sz1, const char* sz2); -char* strlwr (char* szToConvert); -int strnicmp (const char* sz1, const char* sz2, size_t sizeMaxCompare); -int strncasecmp (const char* sz1, const char* sz2, size_t sizeMaxCompare); -char* strnset (char* szToFill, int cFill, size_t sizeMaxFill); -char* strrev (char* szToReverse); -char* strset (char* szToFill, int cFill); -char* strupr (char* szToConvert); +void* memccpy(void* pCopyTo, const void* pSource, int cTerminator, size_t sizeMaxCopy); +int memicmp(const void* p1, const void* p2, size_t sizeSearch); +#define strdup(szDuplicate) _strdup(szDuplicate) +int strcmpi(const char* sz1, const char* sz2); +int stricmp(const char* sz1, const char* sz2); +int strcasecmp(const char* sz1, const char* sz2); +int stricoll(const char* sz1, const char* sz2); +char* strlwr(char* szToConvert); +int strnicmp(const char* sz1, const char* sz2, size_t sizeMaxCompare); +int strncasecmp(const char* sz1, const char* sz2, size_t sizeMaxCompare); +char* strnset(char* szToFill, int cFill, size_t sizeMaxFill); +char* strrev(char* szToReverse); +char* strset(char* szToFill, int cFill); +char* strupr(char* szToConvert); /* NOTE: There is no _wcscmpi, but this is for compatibility. */ -int wcscmpi (const wchar_t* ws1, const wchar_t* ws2); -wchar_t* wcsdup (const wchar_t* wsToDuplicate); -int wcsicmp (const wchar_t* ws1, const wchar_t* ws2); -int wcsicoll (const wchar_t* ws1, const wchar_t* ws2); -wchar_t* wcslwr (wchar_t* wsToConvert); -int wcsnicmp (const wchar_t* ws1, const wchar_t* ws2, - size_t sizeMaxCompare); -wchar_t* wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill); -wchar_t* wcsrev (wchar_t* wsToReverse); -wchar_t* wcsset (wchar_t* wsToFill, wchar_t wcToFill); -wchar_t* wcsupr (wchar_t* wsToConvert); - -#endif /* Not _NO_OLDNAMES */ -#endif /* Not strict ANSI */ +int wcscmpi(const wchar_t* ws1, const wchar_t* ws2); +wchar_t* wcsdup(const wchar_t* wsToDuplicate); +int wcsicmp(const wchar_t* ws1, const wchar_t* ws2); +int wcsicoll(const wchar_t* ws1, const wchar_t* ws2); +wchar_t* wcslwr(wchar_t* wsToConvert); +int wcsnicmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare); +wchar_t* wcsnset(wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill); +wchar_t* wcsrev(wchar_t* wsToReverse); +wchar_t* wcsset(wchar_t* wsToFill, wchar_t wcToFill); +wchar_t* wcsupr(wchar_t* wsToConvert); + +#endif /* Not _NO_OLDNAMES */ +#endif /* Not strict ANSI */ -#endif #ifdef __cplusplus -extern "C" } +} #endif + +#endif /* Not _STRING_H_ */ + diff --git a/reactos/include/msvcrt/sys/locking.h b/reactos/include/msvcrt/sys/locking.h index 815638ebb37..4b9056f75c7 100644 --- a/reactos/include/msvcrt/sys/locking.h +++ b/reactos/include/msvcrt/sys/locking.h @@ -15,24 +15,35 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 11:16:44 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:01 $ * */ -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ -#ifndef _LOCKING_H_ -#define _LOCKING_H_ +#ifndef _LOCKING_H_ +#define _LOCKING_H_ -/* - * TODO: Define LK_... constants. - */ -#endif /* Not _LOCKING_H_ */ +#define _LK_UNLCK 0 /* Unlock */ +#define _LK_LOCK 1 /* Lock */ +#define _LK_NBLCK 2 /* Non-blocking lock */ +#define _LK_RLCK 3 /* Lock for read only */ +#define _LK_NBRLCK 4 /* Non-blocking lock for read only */ + +#ifndef NO_OLDNAMES +#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 /* Not NO_OLDNAMES */ + +#endif /* Not _LOCKING_H_ */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/msvcrt/sys/stat.h b/reactos/include/msvcrt/sys/stat.h index f5bd2647d85..80260198fa7 100644 --- a/reactos/include/msvcrt/sys/stat.h +++ b/reactos/include/msvcrt/sys/stat.h @@ -16,12 +16,12 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.5 $ - * $Author: chorns $ - * $Date: 2002/09/08 11:16:44 $ + * $Revision: 1.6 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:01 $ * */ @@ -32,52 +32,49 @@ #include -#ifdef __cplusplus -extern "C" { -#endif #ifndef _WCHAR_T_ #define _WCHAR_T_ #define _WCHAR_T #define _WCHAR_T_DEFINED #ifndef __WCHAR_TYPE__ -#define __WCHAR_TYPE__ short unsigned int +#define __WCHAR_TYPE__ short unsigned int #endif #ifndef __cplusplus -typedef __WCHAR_TYPE__ wchar_t; -#endif /* C++ */ -#endif /* wchar_t not already defined */ +typedef __WCHAR_TYPE__ wchar_t; +#endif /* C++ */ +#endif /* wchar_t not already defined */ /* * Constants for the stat st_mode member. */ -#define S_IFIFO 0x1000 /* FIFO */ -#define S_IFCHR 0x2000 /* Character */ -#define S_IFBLK 0x3000 /* Block */ -#define S_IFDIR 0x4000 /* Directory */ -#define S_IFREG 0x8000 /* Regular */ +#define S_IFIFO 0x1000 /* FIFO */ +#define S_IFCHR 0x2000 /* Character */ +#define S_IFBLK 0x3000 /* Block */ +#define S_IFDIR 0x4000 /* Directory */ +#define S_IFREG 0x8000 /* Regular */ -#define S_IFMT 0xF000 /* File type mask */ +#define S_IFMT 0xF000 /* File type mask */ -#define S_IEXEC 0x0040 -#define S_IWRITE 0x0080 -#define S_IREAD 0x0100 +#define S_IEXEC 0x0040 +#define S_IWRITE 0x0080 +#define S_IREAD 0x0100 -#define S_ISDIR(m) ((m) & S_IFDIR) -#define S_ISFIFO(m) ((m) & S_IFIFO) -#define S_ISCHR(m) ((m) & S_IFCHR) -#define S_ISBLK(m) ((m) & S_IFBLK) -#define S_ISREG(m) ((m) & S_IFREG) +#define S_ISDIR(m) ((m) & S_IFDIR) +#define S_ISFIFO(m) ((m) & S_IFIFO) +#define S_ISCHR(m) ((m) & S_IFCHR) +#define S_ISBLK(m) ((m) & S_IFBLK) +#define S_ISREG(m) ((m) & S_IFREG) -#define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC) -#define S_IXUSR S_IEXEC -#define S_IWUSR S_IWRITE -#define S_IRUSR S_IREAD +#define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC) +#define S_IXUSR S_IEXEC +#define S_IWUSR S_IWRITE +#define S_IRUSR S_IREAD -#define _S_IEXEC S_IEXEC -#define _S_IREAD S_IREAD -#define _S_IWRITE S_IWRITE +#define _S_IEXEC S_IEXEC +#define _S_IREAD S_IREAD +#define _S_IWRITE S_IWRITE /* * The structure manipulated and returned by stat and fstat. @@ -88,55 +85,65 @@ typedef __WCHAR_TYPE__ wchar_t; */ struct stat { - long st_dev; /* Equivalent to drive number 0=A 1=B ... */ - short st_ino; /* Always zero ? */ - short st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - int st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - short st_rdev; /* Seems useless (not even filled in) */ - long st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ +#ifdef _MSVCRT_LIB_ + long st_dev; /* Equivalent to drive number 0=A 1=B ... */ +#else + short st_dev; /* Equivalent to drive number 0=A 1=B ... */ + short st_padding; /* Pad structure to equal msvcrt version req */ +#endif + short st_ino; /* Always zero ? */ + short st_mode; /* See above constants */ + short st_nlink; /* Number of links. */ + int st_uid; /* User: Maybe significant on NT ? */ + short st_gid; /* Group: Ditto */ + short st_rdev; /* Seems useless (not even filled in) */ + long st_size; /* File size in bytes */ + time_t st_atime; /* Accessed date (always 00:00 hrs local on FAT) */ + time_t st_mtime; /* Modified time */ + time_t st_ctime; /* Creation time */ }; + struct _stati64 { - short st_dev; /* Equivalent to drive number 0=A 1=B ... */ - short st_ino; /* Always zero ? */ - short st_mode; /* See above constants */ - short st_nlink; /* Number of links. */ - int st_uid; /* User: Maybe significant on NT ? */ - short st_gid; /* Group: Ditto */ - short st_rdev; /* Seems useless (not even filled in) */ - __int64 st_size; /* File size in bytes */ - time_t st_atime; /* Accessed date (always 00:00 hrs local - * on FAT) */ - time_t st_mtime; /* Modified time */ - time_t st_ctime; /* Creation time */ + short st_dev; /* Equivalent to drive number 0=A 1=B ... */ + short st_ino; /* Always zero ? */ + short st_mode; /* See above constants */ + short st_nlink; /* Number of links. */ + int st_uid; /* User: Maybe significant on NT ? */ + short st_gid; /* Group: Ditto */ + short st_rdev; /* Seems useless (not even filled in) */ + __int64 st_size; /* File size in bytes */ + time_t st_atime; /* Accessed date (always 00:00 hrs local on FAT) */ + time_t st_mtime; /* Modified time */ + time_t st_ctime; /* Creation time */ }; -int _fstat (int nFileNo, struct stat* pstat); -__int64 _fstati64 (int nFileNo, struct _stati64* pstat); -int _stat (const char* szPath, struct stat* pstat); -__int64 _stati64 (const char* szPath, struct _stati64* pstat); -int _wstat (const wchar_t* szPath, struct stat* pstat); -__int64 _wstati64 (const wchar_t* szPath, struct _stati64* pstat); +#ifdef __cplusplus +extern "C" { +#endif + +int _fstat(int, struct stat*); +int _stat(const char*, struct stat*); + +__int64 _fstati64(int nFileNo, struct _stati64* pstat); +__int64 _stati64(const char* szPath, struct _stati64* pstat); +int _wstat(const wchar_t* szPath, struct stat* pstat); +__int64 _wstati64(const wchar_t* szPath, struct _stati64* pstat); + -#ifndef _NO_OLDNAMES +#ifndef _NO_OLDNAMES -#define fstat(nFileNo, pstat) _fstat(nFileNo, pstat) -#define stat(szPath,pstat) _stat(szPath,pstat) +#define fstat(nFileNo, pstat) _fstat(nFileNo, pstat) +#define stat(szPath,pstat) _stat(szPath,pstat) -#endif /* Not _NO_OLDNAMES */ +#endif /* Not _NO_OLDNAMES */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not _STAT_H_ */ +#endif /* Not _STAT_H_ */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/msvcrt/sys/timeb.h b/reactos/include/msvcrt/sys/timeb.h index 0342481f4fa..518046494f7 100644 --- a/reactos/include/msvcrt/sys/timeb.h +++ b/reactos/include/msvcrt/sys/timeb.h @@ -15,46 +15,47 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 11:16:44 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:01 $ * */ -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ -#ifndef _TIMEB_H_ -#define _TIMEB_H_ +#ifndef _TIMEB_H_ +#define _TIMEB_H_ -#ifdef __cplusplus -extern "C" { -#endif /* * TODO: Structure not tested. */ struct timeb { - long time; - short millitm; - short _timezone; - short dstflag; + long time; + short millitm; + short _timezone; + short dstflag; }; +#ifdef __cplusplus +extern "C" { +#endif + /* TODO: Not tested. */ -void _ftime (struct timeb* timebBuffer); +void _ftime(struct timeb*); -#ifndef _NO_OLDNAMES -void ftime (struct timeb* timebBuffer); -#endif /* Not _NO_OLDNAMES */ +#ifndef _NO_OLDNAMES +void ftime(struct timeb*); +#endif /* Not _NO_OLDNAMES */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not _TIMEB_H_ */ +#endif /* Not _TIMEB_H_ */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/msvcrt/sys/types.h b/reactos/include/msvcrt/sys/types.h index 0e710b9a7cb..0ccd1b49123 100644 --- a/reactos/include/msvcrt/sys/types.h +++ b/reactos/include/msvcrt/sys/types.h @@ -15,68 +15,54 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warrenties of + * DISCLAIMED. This includes but is not limited to warrenties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 11:16:44 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:01 $ * */ -#ifndef _TYPES_H_ -#define _TYPES_H_ +#ifndef _TYPES_H_ +#define _TYPES_H_ -#ifdef __GNUC__ -#undef __int64 -#define __int64 long long +#ifdef __GNUC__ +#undef __int64 +#define __int64 long long #endif -#ifndef _TIME_T_ -#define _TIME_T_ -typedef long time_t; +#ifndef _TIME_T_ +#define _TIME_T_ +typedef long time_t; #endif +#ifndef __STRICT_ANSI__ -#ifndef __STRICT_ANSI__ - -#ifndef _OFF_T_DEFINED +#ifndef _OFF_T_DEFINED typedef long _off_t; - -#ifndef _NO_OLDNAMES -#define off_t _off_t +#ifndef _NO_OLDNAMES +#define off_t _off_t #endif - -#define _OFF_T_DEFINED - -#endif /* Not _OFF_T_DEFINED */ - +#define _OFF_T_DEFINED +#endif /* Not _OFF_T_DEFINED */ #ifndef _DEV_T_DEFINED typedef short _dev_t; - -#ifndef _NO_OLDNAMES -#define dev_t _dev_t +#ifndef _NO_OLDNAMES +#define dev_t _dev_t #endif - -#define _DEV_T_DEFINED - -#endif /* Not _DEV_T_DEFINED */ - +#define _DEV_T_DEFINED +#endif /* Not _DEV_T_DEFINED */ #ifndef _INO_T_DEFINED typedef short _ino_t; - -#ifndef _NO_OLDNAMES -#define ino_t _ino_t +#ifndef _NO_OLDNAMES +#define ino_t _ino_t #endif +#define _INO_T_DEFINED +#endif /* Not _INO_T_DEFINED */ -#define _INO_T_DEFINED - -#endif /* Not _INO_T_DEFINED */ - - -#endif /* Not __STRICT_ANSI__ */ - +#endif /* Not __STRICT_ANSI__ */ -#endif /* Not _TYPES_H_ */ +#endif /* Not _TYPES_H_ */ diff --git a/reactos/include/msvcrt/sys/utime.h b/reactos/include/msvcrt/sys/utime.h index f8fa5f3147a..de152920b8d 100644 --- a/reactos/include/msvcrt/sys/utime.h +++ b/reactos/include/msvcrt/sys/utime.h @@ -15,61 +15,66 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.4 $ - * $Author: chorns $ - * $Date: 2002/09/08 11:16:44 $ + * $Revision: 1.5 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:01 $ * */ -#ifndef __STRICT_ANSI__ +#ifndef __STRICT_ANSI__ -#ifndef _UTIME_H_ -#define _UTIME_H_ +#ifndef _UTIME_H_ +#define _UTIME_H_ #define __need_wchar_t #define __need_size_t #include #include -#ifdef __cplusplus -extern "C" { -#endif /* * Structure used by _utime function. */ struct _utimbuf { - time_t actime; /* Access time */ - time_t modtime; /* Modification time */ + time_t actime; /* Access time */ + time_t modtime; /* Modification time */ }; -int _utime (const char* szFileName, struct _utimbuf* pTimes); -int _futime (int nHandle, struct _utimbuf *pTimes); -/* Wide character version */ -int _wutime (const wchar_t *szFileName, struct _utimbuf *times); - -#ifndef _NO_OLDNAMES +#ifndef _NO_OLDNAMES /* NOTE: Must be the same as _utimbuf above. */ struct utimbuf { - time_t actime; - time_t modtime; + time_t actime; + time_t modtime; }; +#endif /* Not _NO_OLDNAMES */ + + +#ifdef __cplusplus +extern "C" { +#endif + +int _utime(const char*, struct _utimbuf*); +int _futime(int, struct _utimbuf*); -int utime (const char* szFileName, struct utimbuf* pTimes); +/* The wide character version, only available for MSVCRT versions of the + * C runtime library. */ +int _wutime(const wchar_t*, struct _utimbuf*); -#endif /* Not _NO_OLDNAMES */ +#ifndef _NO_OLDNAMES +int utime(const char*, struct utimbuf*); +#endif /* Not _NO_OLDNAMES */ -#ifdef __cplusplus +#ifdef __cplusplus } #endif -#endif /* Not _UTIME_H_ */ -#endif /* Not __STRICT_ANSI__ */ +#endif /* Not _UTIME_H_ */ +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/msvcrt/time.h b/reactos/include/msvcrt/time.h index 672f06fc6c3..6311106733b 100644 --- a/reactos/include/msvcrt/time.h +++ b/reactos/include/msvcrt/time.h @@ -15,40 +15,30 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.5 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.6 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ -#ifndef _TIME_H_ -#define _TIME_H_ +#ifndef _TIME_H_ +#define _TIME_H_ #define __need_wchar_t #define __need_size_t #include -#ifdef __cplusplus -extern "C" { -#endif /* * Number of clock ticks per second. A clock tick is the unit by which * processor time is measured and is returned by 'clock'. */ -#define CLOCKS_PER_SEC 1000.0 -#define CLK_TICK CLOCKS_PER_SEC +#define CLOCKS_PER_SEC 1000.0 +#define CLK_TICK CLOCKS_PER_SEC -/* - * A type for measuring processor time (in clock ticks). - */ -#ifndef _CLOCK_T_ -#define _CLOCK_T_ -typedef long clock_t; -#endif /* * Need a definition of time_t. @@ -61,34 +51,46 @@ typedef long clock_t; * NOTE: Normally this is defined by the above include of sys/types.h */ #ifndef _TIME_T_ +typedef long time_t; #define _TIME_T_ -typedef long time_t; +#endif + +/* + * A type for measuring processor time (in clock ticks). + */ +#ifndef _CLOCK_T_ +typedef long clock_t; +#define _CLOCK_T_ #endif /* * A structure for storing all kinds of useful information about the * current (or another) time. */ -struct tm { - int tm_sec; - int tm_min; - int tm_hour; - int tm_mday; - int tm_mon; - int tm_year; - int tm_wday; - int tm_yday; - int tm_isdst; - char *tm_zone; - int tm_gmtoff; +struct tm +{ + int tm_sec; /* Seconds: 0-59 (K&R says 0-61?) */ + int tm_min; /* Minutes: 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 Jan. 1: 0-365 */ + int tm_isdst; /* +1 Daylight Savings Time, 0 No DST, + * -1 don't know */ + char *tm_zone; + int tm_gmtoff; }; +#ifdef __cplusplus +extern "C" { +#endif - -clock_t clock (void); -time_t time (time_t* tp); -double difftime (time_t t2, time_t t1); -time_t mktime (struct tm* tmsp); +clock_t clock(void); +time_t time(time_t*); +double difftime(time_t, time_t); +time_t mktime(struct tm*); /* * These functions write to and return pointers to static buffers that may @@ -100,27 +102,24 @@ time_t mktime (struct tm* tmsp); * Fault and crap out your program. Guess how I know. Hint: stat called on * a directory gives 'invalid' times in st_atime etc... */ -char* asctime (const struct tm* tmsp); -wchar_t* _wasctime(const struct tm *timeptr); -char* ctime (const time_t* tp); -wchar_t* _wctime(const time_t * const timep); -struct tm* gmtime (const time_t* tm); -struct tm* localtime (const time_t* tm); - -char* _strdate(const char *datestr); -wchar_t* _wstrdate(const wchar_t *datestr); - -size_t strftime (char* caBuffer, size_t sizeMax, const char* szFormat, - const struct tm* tpPrint); - -size_t wcsftime (wchar_t* wcaBuffer, size_t sizeMax, - const wchar_t* wsFormat, const struct tm* tpPrint); - -char* _strtime(char* buf); -wchar_t* _wstrtime(wchar_t* buf); - -#ifdef __cplusplus +char* asctime(const struct tm*); +char* ctime(const time_t*); +struct tm* gmtime(const time_t*); +struct tm* localtime(const time_t*); + +size_t strftime(char*, size_t, const char*, const struct tm*); +size_t wcsftime(wchar_t*, size_t, const wchar_t*, const struct tm*); + +wchar_t* _wasctime(const struct tm *timeptr); +wchar_t* _wctime(const time_t * const timep); +char* _strdate(const char *datestr); +wchar_t* _wstrdate(const wchar_t *datestr); +char* _strtime(char* buf); +wchar_t* _wstrtime(wchar_t* buf); + +#ifdef __cplusplus } #endif -#endif +#endif /* Not _TIME_H_ */ + diff --git a/reactos/include/msvcrt/wchar.h b/reactos/include/msvcrt/wchar.h index 380069b516e..d3afbd962e6 100644 --- a/reactos/include/msvcrt/wchar.h +++ b/reactos/include/msvcrt/wchar.h @@ -15,18 +15,25 @@ * * This code is distributed in the hope that it will be useful but * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY - * DISCLAMED. This includes but is not limited to warranties of + * DISCLAIMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ - * $Author: chorns $ - * $Date: 2002/09/08 10:22:31 $ + * $Revision: 1.4 $ + * $Author: robd $ + * $Date: 2002/11/24 18:06:00 $ * */ +#ifndef _WCHAR_H_ +#define _WCHAR_H_ + + #include #include #include #include #include + +#endif /* not _WCHAR_H_ */ + -- 2.17.1