From b7b31cec92dfc9b1eb95c33646f269e1fe69eeb2 Mon Sep 17 00:00:00 2001 From: Boudewijn Dekker Date: Thu, 25 Feb 1999 22:51:47 +0000 Subject: [PATCH] added some header files svn path=/trunk/; revision=270 --- reactos/include/assert.h | 63 +++++++++++++ reactos/include/conio.h | 20 ++-- reactos/include/dir.h | 103 +++++++++++++++++++++ reactos/include/direct.h | 77 +++++++++++----- reactos/include/dirent.h | 61 +++++++++++++ reactos/include/dos.h | 186 ++++++++++--------------------------- reactos/include/errno.h | 121 ++++++++++++++++++++++++ reactos/include/float.h | 193 +++++++++++++++++++++++++++++++++++++++ reactos/include/io.h | 42 ++++----- reactos/include/math.h | 158 ++++++++++++++++++++++++++++++++ reactos/include/signal.h | 35 +++++++ reactos/include/stdlib.h | 35 +++---- 12 files changed, 888 insertions(+), 206 deletions(-) create mode 100644 reactos/include/assert.h create mode 100644 reactos/include/dir.h create mode 100644 reactos/include/dirent.h create mode 100644 reactos/include/errno.h create mode 100644 reactos/include/float.h create mode 100644 reactos/include/math.h create mode 100644 reactos/include/signal.h diff --git a/reactos/include/assert.h b/reactos/include/assert.h new file mode 100644 index 00000000000..55d3eb1a403 --- /dev/null +++ b/reactos/include/assert.h @@ -0,0 +1,63 @@ +/* + * assert.h + * + * Define the assert macro for debug output. + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/02/25 22:51:47 $ + * + */ + +#ifndef _ASSERT_H_ +#define _ASSERT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef NDEBUG + +/* + * If not debugging, assert does nothing. + */ +#define assert(x) ((void)0); + +#else /* debugging enabled */ + +/* + * CRTDLL nicely supplies a function which does the actual output and + * call to abort. + */ +void _assert (const char* szExpression, const char* szFileName, int nLine) +#ifdef __GNUC__ + __attribute__ ((noreturn)) +#endif + ; + +/* + * Definition of the assert macro. + */ +#define assert(x) if(!(x)) _assert( #x , __FILE__, __LINE__); +#endif /* NDEBUG */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/include/conio.h b/reactos/include/conio.h index 349d6ce6f18..4430f8e25d9 100644 --- a/reactos/include/conio.h +++ b/reactos/include/conio.h @@ -19,9 +19,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * $Author: ariadne $ - * $Date: 1999/02/21 17:43:45 $ + * $Date: 1999/02/25 22:51:47 $ * */ @@ -40,20 +40,20 @@ int _cprintf (const char* szFormat, ...); int _cputs (const char* szString); int _cscanf (char* szFormat, ...); -int _getch (); -int _getche (); -int _kbhit (); +int _getch (void); +int _getche (void); +int _kbhit (void); int _putch (int cPut); int _ungetch (int cUnget); #ifndef _NO_OLDNAMES -int getch (); -int getche (); -int kbhit (); -int putch (int cPut); -int ungetch (int cUnget); +#define getch _getch +#define getche _getche +#define kbhit _kbhit +#define putch _putch +#define ungetch _ungetch #endif /* Not _NO_OLDNAMES */ diff --git a/reactos/include/dir.h b/reactos/include/dir.h new file mode 100644 index 00000000000..23f2490f4d5 --- /dev/null +++ b/reactos/include/dir.h @@ -0,0 +1,103 @@ +/* + * dir.h + * + * Functions for working with directories and path names. + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/02/25 22:51:47 $ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _DIR_H_ +#define _DIR_H_ + +#include /* To get FILENAME_MAX... ugly. */ +#include /* To get time_t. */ + +#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 _FSIZE_T_DEFINED +#endif + +/* + * The following structure is filled in by _findfirst or _findnext when + * they succeed in finding a match. + */ +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. */ +}; + +/* + * Functions for searching for files. _findfirst returns -1 if no match + * is found. Otherwise it returns a handle to be used in _findnext and + * _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 _findfirst (const char* szFilespec, struct _finddata_t* find); +int _findnext (int nHandle, struct _finddata_t* find); +int _findclose (int nHandle); + +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); + + +#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); + +#endif /* Not _NO_OLDNAMES */ + + +#ifdef __cplusplus +} +#endif + +#endif /* Not _DIR_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/direct.h b/reactos/include/direct.h index dcf94619431..fcd43aa2ee5 100644 --- a/reactos/include/direct.h +++ b/reactos/include/direct.h @@ -1,28 +1,63 @@ -#ifndef __include_direct_h_ -#define __include_direct_h_ +/* + * direct.h + * + * Functions for manipulating paths and directories (included from dir.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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.3 $ + * $Author: ariadne $ + * $Date: 1999/02/25 22:51:47 $ + * + */ + +#ifndef __STRICT_ANSI__ + +#ifndef _DIRECT_H_ +#define _DIRECT_H_ + +#include + +#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 long total_clusters; + unsigned long avail_clusters; + unsigned long sectors_per_cluster; + unsigned long bytes_per_sector; }; +#define diskfree_t _diskfree_t + +/* + * You really shouldn't be using these. Use the Win32 API functions instead. + * However, it does make it easier to port older code. + */ -int _chdir(const char *_path); -int _chdrive( int drive ); -char *_getcwd( char *buffer, int maxlen ); -int _getdrive( void ); -unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace); -int _mkdir(const char *_path); -int _rmdir(const char *_path); - - -#define chdir _chdir -#define chdrive _chdrive -#define getcwd _getcwd -#define mkdir _mkdir -#define rmdir _rmdir - +int _chdrive (int nDrive); +char* _getdcwd (int nDrive, char* caBuffer, int nBufLen); +unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace); +#ifdef __cplusplus +} #endif + +#endif /* Not _DIRECT_H_ */ + +#endif /* Not __STRICT_ANSI__ */ diff --git a/reactos/include/dirent.h b/reactos/include/dirent.h new file mode 100644 index 00000000000..af876a5e229 --- /dev/null +++ b/reactos/include/dirent.h @@ -0,0 +1,61 @@ +/* + * DIRENT.H (formerly DIRLIB.H) + * + * by M. J. Weinstein Released to public domain 1-Jan-89 + * + * Because I have heard that this feature (opendir, readdir, closedir) + * it so useful for programmers coming from UNIX or attempting to port + * UNIX code, and because it is reasonably light weight, I have included + * it in the Mingw32 package. + * - Colin Peters + * + * This code is distributed in the hope that is will be useful but + * WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY + * DISCLAMED. This includeds but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/02/25 22:51:47 $ + * + */ + +#ifndef _STRICT_ANSI + +#ifndef _DIRENT_H_ +#define _DIRENT_H_ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct dirent +{ + long d_ino; + unsigned short d_reclen; + unsigned short d_namlen; + char d_name[FILENAME_MAX+1]; +}; + +typedef struct +{ + struct _finddata_t dd_dta; /* disk transfer area for this dir */ + struct dirent dd_dir; /* dirent struct to return from dir */ + long dd_handle; /* _findnext handle */ + short dd_stat; /* status return from last lookup */ + char dd_name[1]; /* full name of file (struct is extended */ +} DIR; + +DIR* opendir (const char* szPath); +struct dirent* readdir (DIR* dir); +int closedir (DIR* dir); + +#ifdef __cplusplus +} +#endif + +#endif _DIRENT_H_ + +#endif /* Not _STRICT_ANSI */ diff --git a/reactos/include/dos.h b/reactos/include/dos.h index 92670be4de9..795e7a7a470 100644 --- a/reactos/include/dos.h +++ b/reactos/include/dos.h @@ -1,158 +1,68 @@ -/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ -#ifndef __dj_include_h_ -#define __dj_include_h_ - -#ifndef __dj_ENFORCE_ANSI_FREESTANDING +/* + * dos.h + * + * Definitions for MS-DOS interface routines + * + * This header file is meant for use with CRTDLL.DLL as included with + * Windows 95(tm) and Windows NT(tm). In conjunction with other versions + * of the standard C library things may or may not work so well. + * + * Contributors: + * Created by J.J. van der Heijden + * + * 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. + */ #ifndef __STRICT_ANSI__ -#ifndef _POSIX_SOURCE +#ifndef _DOS_H_ +#define _DOS_H_ +#define __need_wchar_t +#include - -struct ftime { - unsigned ft_tsec:5; /* 0-29, double to get real seconds */ - unsigned ft_min:6; /* 0-59 */ - unsigned ft_hour:5; /* 0-23 */ - unsigned ft_day:5; /* 1-31 */ - unsigned ft_month:4; /* 1-12 */ - unsigned ft_year:7; /* since 1980 */ -}; - -struct date { - short da_year; - char da_day; - char da_mon; -}; - -struct time { - unsigned char ti_min; - unsigned char ti_hour; - unsigned char ti_hund; - unsigned char ti_sec; -}; - -struct dfree { - unsigned df_avail; - unsigned df_total; - unsigned df_bsec; - unsigned df_sclus; -}; +/* For DOS file attributes */ +#include #ifdef __cplusplus extern "C" { #endif -extern unsigned short _osmajor, _osminor; -extern const char * _os_flavor; +extern char** __imp__pgmptr_dll; +#define _pgmptr (*__imp__pgmptr_dll) -unsigned short _get_version(int); +/* Wide character equivalent */ +extern wchar_t** __imp__wpgmptr_dll; +#define _wpgmptr (*__imp__wpgmptr_dll) +/* These are obsolete, but some may find them useful */ +extern unsigned int* __imp__basemajor_dll; +extern unsigned int* __imp__baseminor_dll; +extern unsigned int* __imp__baseversion_dll; +extern unsigned int* __imp__osmajor_dll; +extern unsigned int* __imp__osminor_dll; +extern unsigned int* __imp__osversion_dll; - - -int getftime(int handle, struct ftime *ftimep); -int setftime(int handle, struct ftime *ftimep); - -int getcbrk(void); -int setcbrk(int new_value); - -void getdate(struct date *); -void gettime(struct time *); -void setdate(struct date *); -void settime(struct time *); - -void getdfree(unsigned char drive, struct dfree *ptr); - -void delay(unsigned msec); -/* int _get_default_drive(void); -void _fixpath(const char *, char *); */ - - -/* - * For compatibility with other DOS C compilers. - */ - -#define _A_NORMAL 0x00 /* Normal file - No read/write restrictions */ -#define _A_RDONLY 0x01 /* Read only file */ -#define _A_HIDDEN 0x02 /* Hidden file */ -#define _A_SYSTEM 0x04 /* System file */ -#define _A_VOLID 0x08 /* Volume ID file */ -#define _A_SUBDIR 0x10 /* Subdirectory */ -#define _A_ARCH 0x20 /* Archive file */ - -#define _enable enable -#define _disable disable - -struct date_t { - unsigned char day; /* 1-31 */ - unsigned char month; /* 1-12 */ - unsigned short year; /* 1980-2099 */ - unsigned char dayofweek; /* 0-6, 0=Sunday */ -}; -#define dosdate_t date_t - -struct time_t { - unsigned char hour; /* 0-23 */ - unsigned char minute; /* 0-59 */ - unsigned char second; /* 0-59 */ - unsigned char hsecond; /* 0-99 */ -}; -#define dostime_t time_t - - - -#define finddata_t _finddata_t - - -#define diskfree_t _diskfree_t - -struct _DOSERROR { - int exterror; - #ifdef __cplusplus - char errclass; - #else - char class; - #endif - char action; - char locus; -}; -#define DOSERROR _DOSERROR - - - - -void _getdate(struct date_t *_date); -unsigned int _setdate(struct date_t *_date); -void _gettime(struct time_t *_time); -unsigned int _settime(struct time_t *_time); - -unsigned int _getftime(int _handle, unsigned int *_p_date, unsigned int *_p_time); -unsigned int _setftime(int _handle, unsigned int _date, unsigned int _time); -unsigned int _getfileattr(const char *_filename, unsigned int *_p_attr); -unsigned int _setfileattr(const char *_filename, unsigned int _attr); - - -void _setdrive(unsigned int _drive, unsigned int *_p_drives); - - -int exterr(struct _DOSERROR *_p_error); -#define dosexterr(_ep) exterr(_ep) - -#include - -#define int386(_i, _ir, _or) int86(_i, _ir, _or) -#define int386x(_i, _ir, _or, _sr) int86x(_i, _ir, _or, _sr) +#define _basemajor (*__imp__basemajor_dll) +#define _baseminor (*__imp__baseminor_dll) +#define _baseversion (*__imp__baseversion_dll) +#define _osmajor (*__imp__osmajor_dll) +#define _osminor (*__imp__osminor_dll) +#define _osversion (*__imp__osversion_dll) #ifdef __cplusplus } #endif -#endif /* !_POSIX_SOURCE */ -#endif /* !__STRICT_ANSI__ */ -#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */ +#endif /* _DOS_H_ */ -#ifndef __dj_ENFORCE_FUNCTION_CALLS -#endif /* !__dj_ENFORCE_FUNCTION_CALLS */ +#endif /* Not __STRICT_ANSI__ */ -#endif /* !__dj_include_h_ */ diff --git a/reactos/include/errno.h b/reactos/include/errno.h new file mode 100644 index 00000000000..e9664efb664 --- /dev/null +++ b/reactos/include/errno.h @@ -0,0 +1,121 @@ +/* + * errno.h + * + * Error numbers and access to error reporting. + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/02/25 22:51:47 $ + * + */ + +#ifndef _ERRNO_H_ +#define _ERRNO_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Error numbers. + * TODO: Can't be sure of some of these assignments, I guessed from the + * names given by strerror and the defines in the Cygnus errno.h. A lot + * of the names from the Cygnus errno.h are not represented, and a few + * 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 */ +/* 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 */ +/* 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) */ +/* 35 - Unknown Error */ +#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 */ + +/* + * NOTE: ENAMETOOLONG and ENOTEMPTY conflict with definitions in the + * sockets.h header provided with windows32api-0.1.2. + * You should go and put an #if 0 ... #endif around the whole block + * of errors (look at the comment above them). + */ + +/* + * Definitions of macros for the 'variables' errno, _doserrno, sys_nerr and + * sys_errlist. + */ +int* _errno(void); +#define errno (*_errno(void)) + +int* __doserrno(void); +#define _doserrno (*__doserrno(void)) + +#if __MSVCRT__ +/* One of the MSVCRTxx libraries */ +extern int* __imp__sys_nerr; +#define sys_nerr (*__imp__sys_nerr) +#else +/* CRTDLL run time library */ +extern int* __imp__sys_nerr_dll; +#define sys_nerr (*__imp__sys_nerr_dll) +#endif + +extern char** __imp__sys_errlist; +#define sys_errlist (__imp__sys_errlist) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/reactos/include/float.h b/reactos/include/float.h new file mode 100644 index 00000000000..22f285dad79 --- /dev/null +++ b/reactos/include/float.h @@ -0,0 +1,193 @@ +/* + * float.h + * + * Constants related to floating point arithmetic. + * + * Also included here are some non-ANSI bits for accessing the floating + * point controller. + * + * NOTE: GCC provides float.h, and it is probably more accurate than this, + * but it doesn't include the non-standard stuff for accessing the + * fp controller. (TODO: Move those bits elsewhere?) Thus it is + * probably not a good idea to use the GCC supplied version instead + * of this header. + * + * 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/02/25 22:51:47 $ + * + */ + +#ifndef _FLOAT_H_ +#define _FLOAT_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#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 + +/* Decimal digits of precision. */ +#define FLT_DIG 6 + +/* Smallest number such that 1+x != 1 */ +#define FLT_EPSILON 1.19209290e-07F + +/* The number of base FLT_RADIX digits in the mantissa. */ +#define FLT_MANT_DIG 24 + +/* The maximum floating point number. */ +#define FLT_MAX 3.40282347e+38F + +/* Maximum n such that FLT_RADIX^n - 1 is representable. */ +#define FLT_MAX_EXP 128 + +/* Maximum n such that 10^n is representable. */ +#define FLT_MAX_10_EXP 38 + +/* Minimum normalized floating-point number. */ +#define FLT_MIN 1.17549435e-38F + +/* Minimum n such that FLT_RADIX^n is a normalized number. */ +#define FLT_MIN_EXP (-125) + +/* Minimum n such that 10^n is a normalized number. */ +#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) + + +/* + * 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) + + +/* + * Functions and definitions for controlling the FPU. + */ +#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 */ + +/* 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 + + +/* 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 _clearfp (); /* Clear the FPU status word */ +unsigned int _statusfp (); /* Report the FPU status word */ +#define _clear87 _clearfp +#define _status87 _statusfp + +void _fpreset (); /* Reset the FPU */ + +/* Global 'variable' for the current floating point error code. */ +int * __fpecode(); +#define _fpecode (*(__fpecode())) + +/* + * IEEE recommended functions + */ + +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); + +/* 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); + + +#endif /* Not __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _FLOAT_H_ */ diff --git a/reactos/include/io.h b/reactos/include/io.h index a1ec34fb1b2..888a13e9b35 100644 --- a/reactos/include/io.h +++ b/reactos/include/io.h @@ -18,9 +18,9 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * $Author: ariadne $ - * $Date: 1999/02/21 13:29:56 $ + * $Date: 1999/02/25 22:51:47 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ @@ -107,25 +107,25 @@ size_t _write(int _fd, const void *_buf, size_t _nbyte); * These functions live in libmoldname.a. */ -int access (const char* szFileName, int nAccessMode); -int chsize (int nHandle, long lnNewSize); -int close (int nHandle); -int creat (const char* szFileName, int nAccessMode); -int dup (int nHandle); -int dup2 (int nOldHandle, int nNewHandle); -int eof (int nHandle); -long filelength (int nHandle); -int fileno (FILE* fileGetHandle); -int isatty (int nHandle); -long lseek (int nHandle, long lnOffset, int nOrigin); -int open (const char* szFileName, int nFlags, ...); -int read (int nHandle, void* caBuffer, unsigned int nToRead); -int sopen (char* szFileName, int nAccess, int nFlag, int nMode); -long tell (int nHandle); -unsigned umask (unsigned unMode); -int unlink (const char* szFileName); -int write (int nHandle, const void* caBuffer, - unsigned int nToWrite); +#define access _access +#define chsize _chsize +#define close _close +#define creat _creat +#define dup _dup +#define dup2 _dup2 +#define eof _eof +#define filelength _filelength +#define fileno _fileno +#define isatty _isatty +#define lseek _lseek +#define open _open +#define read _read +#define sopen _sopen +#define tell _tell +#define umask _umask +#define unlink _unlink +#define write _write + #endif /* Not _NO_OLDNAMES */ diff --git a/reactos/include/math.h b/reactos/include/math.h new file mode 100644 index 00000000000..73300e30605 --- /dev/null +++ b/reactos/include/math.h @@ -0,0 +1,158 @@ +/* + * math.h + * + * Mathematical 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 + * DISCLAMED. This includes but is not limited to warranties of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * + * $Revision: 1.1 $ + * $Author: ariadne $ + * $Date: 1999/02/25 22:51:47 $ + * + */ + +#ifndef _MATH_H_ +#define _MATH_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * HUGE_VAL is returned by strtod when the value would overflow the + * representation of 'double'. There are other uses as well. + * + * __imp__HUGE is a pointer to the actual variable _HUGE in + * MSVCRT.DLL. If we used _HUGE directly we would get a pointer + * to a thunk function. + * + * NOTE: The CRTDLL version uses _HUGE_dll instead. + */ +#if __MSVCRT__ +extern double* __imp__HUGE; +#define HUGE_VAL (*__imp__HUGE) +#else +/* CRTDLL */ +extern double* __imp__HUGE_dll; +#define HUGE_VAL (*__imp__HUGE_dll) +#endif + + +struct _exception +{ + 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 */ + +/* + * 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); +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); +double fmod (double x, double y); + + +#ifndef __STRICT_ANSI__ + +/* Complex number (for cabs) */ +struct _complex +{ + 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); + +#ifndef _NO_OLDNAMES + +/* + * Non-underscored versions of non-ANSI functions. These reside in + * liboldnames.a. Provided for extra portability. + */ +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); + +#endif /* Not _NO_OLDNAMES */ + +#endif /* Not __STRICT_ANSI__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* Not _MATH_H_ */ + diff --git a/reactos/include/signal.h b/reactos/include/signal.h new file mode 100644 index 00000000000..34fa46f0df2 --- /dev/null +++ b/reactos/include/signal.h @@ -0,0 +1,35 @@ +/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ +#ifndef __dj_include_signal_h_ +#define __dj_include_signal_h_ + +#ifdef __cplusplus +extern "C" { +#endif + + +/* 256 software interrupts + 32 exceptions = 288 */ + +#define SIGABRT 288 +#define SIGFPE 289 +#define SIGILL 290 +#define SIGSEGV 291 +#define SIGTERM 292 +#define SIGINT 295 + +#define SIG_DFL ((void (*)(int))(0)) +#define SIG_ERR ((void (*)(int))(1)) +#define SIG_IGN ((void (*)(int))(-1)) + + +typedef int sig_atomic_t; + +int raise(int _sig); +void (*signal(int _sig, void (*_func)(int)))(int); + + + +#ifdef __cplusplus +} +#endif + +#endif /* !__dj_include_signal_h_ */ diff --git a/reactos/include/stdlib.h b/reactos/include/stdlib.h index b3a518c2086..f39b42aefe1 100644 --- a/reactos/include/stdlib.h +++ b/reactos/include/stdlib.h @@ -18,12 +18,13 @@ * DISCLAMED. This includes but is not limited to warranties of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * $Author: ariadne $ - * $Date: 1999/02/21 13:29:56 $ + * $Date: 1999/02/25 22:51:47 $ * */ /* Appropriated for Reactos Crtdll by Ariadne */ +/* added splitpath */ #ifndef _STDLIB_H_ #define _STDLIB_H_ @@ -100,8 +101,8 @@ void abort (void) _ATTRIB_NORETURN; void exit (int nStatus) _ATTRIB_NORETURN; int atexit (void (*pfuncExitProcessing)(void)); -int system (const char* szCommand); -char* getenv (const char* szVarName); +int system (const char* szCommand); // impl in process +char* getenv (const char* szVarName); // impl in stdio typedef int (*_pfunccmp_t)(const void*, const void*); @@ -146,6 +147,9 @@ 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); @@ -156,20 +160,19 @@ char* _gcvt (double dValue, int nDec, char* caBuf); char* _fullpath (char* caBuf, const char* szPath, size_t sizeMax); #ifndef _NO_OLDNAMES -void beep (unsigned int, unsigned int); -void seterrormode (int nMode); -void sleep (unsigned long ulTime); +#define beep _beep +#define seterrormode _seterrormode +#define sleep _sleep +#define putenv _putenv +#define searchenv _searchenv +#define splitpath _splitpath -int putenv (const char* szNameEqValue); -void searchenv (const char* szFileName, const char* szVar, - char* szFullPathBuf); +#define itoa _itoa +#define ltoa _ltoa -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); +#define ecvt _ecvt +#define fcvt _fcvt +#define gcvt _gcvt #endif /* Not _NO_OLDNAMES */ #endif /* Not __STRICT_ANSI__ */