no message

svn path=/trunk/; revision=329
This commit is contained in:
Boudewijn Dekker 1999-03-22 20:48:08 +00:00
parent 5bd64e22e4
commit 8bf8d53376
3 changed files with 415 additions and 0 deletions

115
reactos/include/fcntl.h Normal file
View file

@ -0,0 +1,115 @@
/*
* fcntl.h
*
* Access constants for _open. Note that the permissions constants are
* in sys/stat.h (ick).
*
* This code is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* 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
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.4 $
* $Author: ariadne $
* $Date: 1999/03/22 20:48:08 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
/* added _O_RANDOM_O_SEQUENTIAL _O_SHORT_LIVED*/
/* changed fmode_dll */
#ifndef _FCNTL_H_
#define _FCNTL_H_
/*
* It appears that fcntl.h should include io.h for compatibility...
*/
#include <io.h>
/*
* This variable determines the default file mode.
* TODO: Which flags work?
*/
#if __MSVCRT__
extern unsigned int* __imp__fmode;
#define _fmode (*__imp__fmode)
#else
/* CRTDLL */
extern unsigned int* _fmode_dll;
#define _fmode (*_fmode_dll)
#endif
/* Specifiy one of these flags to define the access mode. */
#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_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. */
/* 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_TEMPORARY 0x0040 /* Make the file dissappear after closing.
* WARNING: Even if not created by _open! */
#define _O_RANDOM 0x0010
#define _O_SEQUENTIAL _O_RANDOM
#define _O_SHORT_LIVED 0x1000
#ifndef __STRICT_ANSI__
#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_RANDOM _O_RANDOM
#define O_SEQUENTIAL _O_RANDOM
#define O_SHORT_LIVED _O_SHORT_LIVED
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
extern "C" {
#endif
int _setmode (int nHandle, int nAccessMode);
#ifndef _NO_OLDNAMES
int setmode (int nHandle, int nAccessMode);
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
}
#endif
#endif /* Not __STRICT_ANSI__ */
#endif /* Not _FCNTL_H_ */

107
reactos/include/limits.h Normal file
View file

@ -0,0 +1,107 @@
/*
* limits.h
*
* Defines constants for the sizes of integral types.
*
* NOTE: GCC should supply a version of this header and it should be safe to
* use that version instead of this one (maybe safer).
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* 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
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/03/22 20:48:08 $
*
*/
#ifndef _LIMITS_H_
#define _LIMITS_H_
/*
* File system limits
*
* TODO: NAME_MAX and OPEN_MAX are file system limits or not? Are they the
* same as FILENAME_MAX and FOPEN_MAX from stdio.h?
* NOTE: Apparently the actual size of PATH_MAX is 260, but a space is
* required for the NUL. TODO: Test?
*/
#define PATH_MAX (259)
/*
* Characteristics of the char data type.
*
* TODO: Is MB_LEN_MAX correct?
*/
#define CHAR_BIT 8
#define MB_LEN_MAX 2
#define SCHAR_MIN (-128)
#define SCHAR_MAX 127
#define UCHAR_MAX 255
/* TODO: Is this safe? I think it might just be testing the preprocessor,
* not the compiler itself... */
#if ('\x80' < 0)
#define CHAR_MIN SCHAR_MIN
#define CHAR_MAX SCHAR_MAX
#else
#define CHAR_MIN 0
#define CHAR_MAX UCHAR_MAX
#endif
/*
* Maximum and minimum values for ints.
*/
#define INT_MAX 2147483647
#define INT_MIN (-INT_MAX-1)
#define UINT_MAX (2U * INT_MAX + 1)
/*
* Maximum and minimum values for shorts.
*/
#define SHRT_MAX 32767
#define SHRT_MIN (-SHRT_MAX-1)
#define USHRT_MAX ((unsigned short) (2U * SHRT_MAX + 1))
/*
* Maximum and minimum values for longs and unsigned longs.
*
* TODO: This is not correct for Alphas, which have 64 bit longs.
*/
#define LONG_MAX 2147483647L
#define LONG_MIN (-LONG_MAX-1)
#define ULONG_MAX (2UL * LONG_MAX + 1)
/*
* The GNU C compiler also allows 'long long int'
*/
#if !defined(__STRICT_ANSI__) && defined(__GNUC__)
#define LONG_LONG_MAX 9223372036854775807LL
#define LONG_LONG_MIN (-LONG_LONG_MAX-1)
#define ULONG_LONG_MAX (2ULL * LONG_LONG_MAX + 1)
#endif /* Not Strict ANSI and GNU C compiler */
#endif /* not _LIMITS_H_ */

193
reactos/include/stdlib.h Normal file
View file

@ -0,0 +1,193 @@
/*
* stdlib.h
*
* Definitions for common types, variables, and functions.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* 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
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.5 $
* $Author: ariadne $
* $Date: 1999/03/22 20:48:08 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
/* added splitpath */
/* changed definition of environ and argc */
#ifndef _STDLIB_H_
#define _STDLIB_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* This seems like a convenient place to declare these variables, which
* give programs using WinMain (or main for that matter) access to main-ish
* 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)
#define __need_size_t
#define __need_wchar_t
#define __need_NULL
#include <stddef.h>
#ifdef __GNUC__
#define _ATTRIB_NORETURN __attribute__ ((noreturn))
#else /* Not __GNUC__ */
#define _ATTRIB_NORETURN
#endif /* __GNUC__ */
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);
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);
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);
/*
* 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* calloc (size_t sizeObjCnt, size_t sizeObject);
void* malloc (size_t sizeObject);
void* realloc (void* pObject, size_t sizeNew);
void free (void* pObject);
/* These values may be used as exit status codes. */
#define EXIT_SUCCESS 0
#define EXIT_FAILURE -1
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
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);
/*
* div_t and ldiv_t are structures used to return the results of div and
* ldiv.
*
* NOTE: div and ldiv appear not to work correctly unless
* -fno-pcc-struct-return is specified. This is included in the
* mingw32 specs file.
*/
typedef struct { int quot, rem; } div_t;
typedef struct { long quot, rem; } ldiv_t;
typedef struct { long long quot, rem; } lldiv_t;
div_t div (int nNumerator, int nDenominator);
ldiv_t ldiv (long lNumerator, long lDenominator);
lldiv_t lldiv (long long lNumerator, long long lDenominator);
#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* szNameEqValue);
void _searchenv (const char* szFileName, const char* szVar,
char* szFullPathBuf);
void _splitpath( const char *path, char *drive, char *dir,
char *fname, char *ext );
char* _itoa (int nValue, char* sz, int nRadix);
char* _ltoa (long lnValue, char* sz, int nRadix);
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);
#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
#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */
/*
* Undefine the no return attribute used in some function definitions
*/
#undef _ATTRIB_NORETURN
#ifdef __cplusplus
}
#endif
#endif /* _STDLIB_H_ */