Various changes to header files

svn path=/trunk/; revision=280
This commit is contained in:
Boudewijn Dekker 1999-03-07 13:35:11 +00:00
parent 1db33360e3
commit 9fd228d402
9 changed files with 327 additions and 73 deletions

View file

@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of * DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Author: ariadne $ * $Author: ariadne $
* $Date: 1999/02/21 17:43:45 $ * $Date: 1999/03/07 13:35:10 $
* *
*/ */
#ifndef _LINUX_CTYPE_H #ifndef _LINUX_CTYPE_H
@ -50,6 +50,10 @@
#define _ALPHA 0x0103 #define _ALPHA 0x0103
// additionally defined
#define _PRINT 0x0200
#define _GRAPH 0x0400
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@ -68,7 +72,7 @@ int isupper(int c);
int isxdigit(int c); int isxdigit(int c);
#ifndef __STRICT_ANSI__ #ifndef __STRICT_ANSI__
int _isctype (int c, int ctypeFlags); int _isctype (unsigned char c, int ctypeFlags);
#endif #endif
int tolower(int c); int tolower(int c);
@ -99,20 +103,20 @@ int _toupper(int c);
typedef int wctype_t; typedef int wctype_t;
/* Wide character equivalents */ /* Wide character equivalents */
int iswalnum(wint_t wc); int iswalnum(int wc);
int iswalpha(wint_t wc); int iswalpha(int wc);
int iswascii(wint_t wc); int iswascii(int wc);
int iswcntrl(wint_t wc); int iswcntrl(int wc);
int iswctype(wint_t wc, wctype_t wctypeFlags); int iswctype(unsigned short wc, int wctypeFlags);
int is_wctype(wint_t wc, wctype_t wctypeFlags); /* Obsolete! */ int is_wctype(unsigned short wc, int wctypeFlags); /* Obsolete! */
int iswdigit(wint_t wc); int iswdigit(int wc);
int iswgraph(wint_t wc); int iswgraph(int wc);
int iswlower(wint_t wc); int iswlower(int wc);
int iswprint(wint_t wc); int iswprint(int wc);
int iswpunct(wint_t wc); int iswpunct(int wc);
int iswspace(wint_t wc); int iswspace(int wc);
int iswupper(wint_t wc); int iswupper(int wc);
int iswxdigit(wint_t wc); int iswxdigit(int wc);
wchar_t towlower(wchar_t c); wchar_t towlower(wchar_t c);
wchar_t towupper(wchar_t c); wchar_t towupper(wchar_t c);
@ -126,10 +130,10 @@ int __iscsymf (int c); /* Valid first character in C symbol */
int __iscsym (int c); /* Valid character in C symbol (after first) */ int __iscsym (int c); /* Valid character in C symbol (after first) */
#ifndef _NO_OLDNAMES #ifndef _NO_OLDNAMES
int isascii (int c); #define isascii(c) (!((c)&(~0x7f)))
int toascii (int c); #define toascii(c) ((unsigned)(c) &0x7F)
int iscsymf (int c); #define iscsymf(c) (isalpha(c) || ( c == '_' ))
int iscsym (int c); #define iscsym(c) (isalnum(c) || ( c == '_' ))
#endif /* Not _NO_OLDNAMES */ #endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */ #endif /* Not __STRICT_ANSI__ */

121
reactos/include/excpt.h Normal file
View file

@ -0,0 +1,121 @@
/*
* excpt.h
*
* Support for operating system level structured exception handling.
*
* NOTE: This is very preliminary stuff. I am also pretty sure it is
* completely Intel specific.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
* Based on code by Mikey <jeffdb@netzone.com>
*
* 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/07 13:35:10 $
*
*/
#ifndef _EXCPT_H_
#define _EXCPT_H_
#ifndef __STRICT_ANSI__
#include <windows.h>
/*
* NOTE: The constants structs and typedefs below should be defined in the
* Win32 API headers.
*/
#define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10
#ifndef RC_INVOKED
typedef enum {
ExceptionContinueExecution,
ExceptionContinueSearch,
ExceptionNestedException,
ExceptionCollidedUnwind
} EXCEPTION_DISPOSITION;
/*
* End of stuff that should be in the Win32 API files.
*/
#ifdef __cplusplus
extern "C" {
#endif
/*
* The type of function that is expected as an exception handler to be
* installed with _try1.
*/
typedef EXCEPTION_DISPOSITION (*PEXCEPTION_HANDLER)
(struct _EXCEPTION_RECORD*, void*, struct _CONTEXT*, void*);
/*
* This is not entirely necessary, but it is the structure installed by
* the _try1 primitive below.
*/
typedef struct _EXCEPTION_REGISTRATION
{
struct _EXCEPTION_REGISTRATION* prev;
PEXCEPTION_HANDLER handler;
} EXCEPTION_REGISTRATION, *PEXCEPTION_REGISTRATION;
typedef EXCEPTION_REGISTRATION EXCEPTION_REGISTRATION_RECORD;
typedef PEXCEPTION_REGISTRATION PEXCEPTION_REGISTRATION_RECORD;
/*
* A macro which installs the supplied exception handler.
* Push the pointer to the new handler onto the stack,
* then push the pointer to the old registration structure (at fs:0)
* onto the stack, then put a pointer to the new registration
* structure (i.e. the current stack pointer) at fs:0.
*/
#define __try1(pHandler) \
__asm__ ("pushl %0;pushl %%fs:0;movl %%esp,%%fs:0;" : : "g" (pHandler));
/*
* A macro which (dispite its name) *removes* an installed
* exception handler. Should be used only in conjunction with the above
* install routine __try1.
* Move the pointer to the old reg. struct (at the current stack
* position) to fs:0, replacing the pointer we installed above,
* then add 8 to the stack pointer to get rid of the space we
* used when we pushed on our new reg. struct above. Notice that
* the stack must be in the exact state at this point that it was
* after we did _try1 or this will smash things.
*/
#define __except1 \
__asm__ ("movl (%%esp),%%eax;movl %%eax,%%fs:0;addl $8,%%esp;" \
: : : "%eax");
#ifdef __cplusplus
}
#endif
#endif /* Not RC_INVOKED */
#endif /* Not strict ANSI */
#endif /* _EXCPT_H_ not defined */

View file

@ -27,9 +27,9 @@
* DISCLAMED. This includes but is not limited to warranties of * DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Revision: 1.1 $ * $Revision: 1.2 $
* $Author: ariadne $ * $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $ * $Date: 1999/03/07 13:35:10 $
* *
*/ */
@ -146,15 +146,15 @@ unsigned int _controlfp (unsigned int unNew, unsigned int unMask);
unsigned int _control87 (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 _clearfp (void); /* Clear the FPU status word */
unsigned int _statusfp (); /* Report the FPU status word */ unsigned int _statusfp (void); /* Report the FPU status word */
#define _clear87 _clearfp #define _clear87 _clearfp
#define _status87 _statusfp #define _status87 _statusfp
void _fpreset (); /* Reset the FPU */ void _fpreset (void); /* Reset the FPU */
/* Global 'variable' for the current floating point error code. */ /* Global 'variable' for the current floating point error code. */
int * __fpecode(); int * __fpecode(void);
#define _fpecode (*(__fpecode())) #define _fpecode (*(__fpecode()))
/* /*

View file

@ -18,14 +18,15 @@
* DISCLAMED. This includes but is not limited to warranties of * DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Author: ariadne $ * $Author: ariadne $
* $Date: 1999/02/25 22:51:47 $ * $Date: 1999/03/07 13:35:10 $
* *
*/ */
/* Appropriated for Reactos Crtdll by Ariadne */ /* Appropriated for Reactos Crtdll by Ariadne */
/* added D_OK */ /* added D_OK */
/* changed get_osfhandle and open_osfhandle */ /* changed get_osfhandle and open_osfhandle */
/* added fileno as macro */
#ifndef _IO_H_ #ifndef _IO_H_
#define _IO_H_ #define _IO_H_
@ -67,6 +68,7 @@ extern "C" {
int _access (const char* szFileName, int nAccessMode); int _access (const char* szFileName, int nAccessMode);
int _chsize (int nHandle, long lnNewSize); int _chsize (int nHandle, long lnNewSize);
int _close (int nHandle); int _close (int nHandle);
int _commit(int _fd);
int _creat (const char* szFileName, int nAccessMode); int _creat (const char* szFileName, int nAccessMode);
int _dup (int nHandle); int _dup (int nHandle);
int _dup2 (int nOldHandle, int nNewHandle); int _dup2 (int nOldHandle, int nNewHandle);
@ -115,13 +117,13 @@ size_t _write(int _fd, const void *_buf, size_t _nbyte);
#define dup2 _dup2 #define dup2 _dup2
#define eof _eof #define eof _eof
#define filelength _filelength #define filelength _filelength
#define fileno _fileno #define fileno(f) ((f)->_file)
#define isatty _isatty #define isatty _isatty
#define lseek _lseek #define lseek _lseek
#define open _open #define open _open
#define read _read #define read _read
#define sopen _sopen #define sopen(path,access,shflag,mode) _open((path), (access)|(shflag), (mode))
#define tell _tell #define tell(file) _lseek(_file, 0, SEEK_CUR)
#define umask _umask #define umask _umask
#define unlink _unlink #define unlink _unlink
#define write _write #define write _write

View file

@ -7,8 +7,6 @@
#include <fcntl.h> #include <fcntl.h>
//#include <libc/dosio.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -36,21 +34,19 @@ void _fwalk(void (*)(FILE *));
char __is_text_file(FILE *p); char __is_text_file(FILE *p);
int __fileno_alloc(void *hFile, int mode);
int _doprnt(const char *fmt, va_list args, FILE *f); int _doprnt(const char *fmt, va_list args, FILE *f);
int _dowprnt(const char *fmt, va_list args, FILE *f); int _dowprnt(const char *fmt, va_list args, FILE *f);
int _doscan(FILE *iop, const char *fmt, void **argp); int _doscan(FILE *iop, const char *fmt, void **argp);
int _dowscan(FILE *iop, const wchar_t *fmt, void **argp);
void *filehnd(int fileno);
int __fileno_dup2( int handle1, int handle2 ); int __fileno_dup2( int handle1, int handle2 );
int __fileno_setmode(int _fd, int _newmode); int __fileno_setmode(int _fd, int _newmode);
int __fileno_close(int _fd); int __fileno_close(int _fd);
#undef fileno
#define fileno(f) (f->_file)
#undef feof
#define feof(f) (((f)->_flag&_IOEOF)!=0)
#undef ferror
#define ferror(f) (((f)->_flag&_IOERR)!=0)
#endif /* !_POSIX_SOURCE */ #endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */ #endif /* !__STRICT_ANSI__ */

View file

@ -0,0 +1,46 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_libc_ieee_h__
#define __dj_include_libc_ieee_h__
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
typedef struct {
unsigned mantissa:23;
unsigned exponent:8;
unsigned sign:1;
} float_t;
typedef struct {
unsigned mantissal:32;
unsigned mantissah:20;
unsigned exponent:11;
unsigned sign:1;
} double_t;
typedef struct {
unsigned mantissal:32;
unsigned mantissah:32;
unsigned exponent:15;
unsigned sign:1;
} long_double_t;
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* __dj_include_libc_ieee_h__ */

View file

@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of * DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Revision: 1.2 $ * $Revision: 1.3 $
* $Author: ariadne $ * $Author: ariadne $
* $Date: 1999/02/21 13:29:56 $ * $Date: 1999/03/07 13:35:10 $
* *
*/ */
/* Appropriated for Reactos Crtdll by Ariadne */ /* Appropriated for Reactos Crtdll by Ariadne */
@ -120,6 +120,9 @@ void _endthreadex (unsigned unExitCode);
#endif #endif
void *_loaddll (char *name);
int _unloaddll(void *handle);
#ifndef _NO_OLDNAMES #ifndef _NO_OLDNAMES
#define cwait _cwait #define cwait _cwait

View file

@ -1,35 +1,111 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */ /*
#ifndef __dj_include_signal_h_ * signal.h
#define __dj_include_signal_h_ *
* A way to set handlers for exceptional conditions (also known as signals).
*
* 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.2 $
* $Author: ariadne $
* $Date: 1999/03/07 13:35:10 $
*
*/
/* added some extra signal constants */
#ifndef _SIGNAL_H_
#define _SIGNAL_H_
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #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.
*/
/* 256 software interrupts + 32 exceptions = 288 */ /*
* 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);
#define SIGABRT 288 /*
#define SIGFPE 289 * These are special values of signal handler pointers which are
#define SIGILL 290 * used to send a signal to the default handler (SIG_DFL), ignore
#define SIGSEGV 291 * the signal (SIG_IGN), or indicate an error return (SIG_ERR).
#define SIGTERM 292 */
#define SIGINT 295 #define SIG_DFL ((_p_sig_fn_t) 0)
#define SIG_IGN ((_p_sig_fn_t) 1)
#define SIG_ERR ((_p_sig_fn_t) -1)
#define SIG_DFL ((void (*)(int))(0)) /*
#define SIG_ERR ((void (*)(int))(1)) * The actual signal values. Using other values with signal
#define SIG_IGN ((void (*)(int))(-1)) * produces a SIG_ERR return value.
*
* NOTE: SIGINT is produced when the user presses Ctrl-C.
* SIGILL has not been tested.
* SIGFPE doesn't seem to work?
* SIGSEGV does not catch writing to a NULL pointer (that shuts down
* your app; can you say "segmentation violation core dump"?).
* SIGTERM comes from what kind of termination request exactly?
* SIGBREAK is indeed produced by pressing Ctrl-Break.
* SIGABRT is produced by calling abort.
* TODO: The above results may be related to not installing an appropriate
* 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 SIGALRM 293
#define SIGHUP 294
/* SIGINT is ansi */
#define SIGKILL 296
#define SIGPIPE 297
#define SIGQUIT 298
#define SIGUSR1 299
#define SIGUSR2 300
typedef int sig_atomic_t; #define SIGNOFP 301
#define SIGTRAP 302
int raise(int _sig); #define SIGTIMR 303 /* Internal for setitimer (SIGALRM, SIGPROF) */
void (*signal(int _sig, void (*_func)(int)))(int); #define SIGPROF 304
#define SIGMAX 320
/*
* 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);
/*
* Raise the signal indicated by sig. Returns non-zero on success.
*/
int raise (int sig);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* !__dj_include_signal_h_ */ #endif

View file

@ -22,13 +22,13 @@
* DISCLAMED. This includes but is not limited to warranties of * DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* *
* $Revision: 1.4 $ * $Revision: 1.5 $
* $Author: ariadne $ * $Author: ariadne $
* $Date: 1999/02/21 13:29:56 $ * $Date: 1999/03/07 13:35:10 $
* *
*/ */
/* Appropriated for Reactos Crtdll by Ariadne */ /* Appropriated for Reactos Crtdll by Ariadne */
/* modified _iob */ /* implemented clearerr feof ferror perror as macros */
#ifndef _STDIO_H_ #ifndef _STDIO_H_
#define _STDIO_H_ #define _STDIO_H_
@ -90,7 +90,7 @@ typedef struct {
* NOTE: These will go to the bit-bucket silently in GUI applications! * NOTE: These will go to the bit-bucket silently in GUI applications!
*/ */
extern FILE (*__imp__iob)[]; /* A pointer to an array of FILE */ extern FILE (*__imp__iob)[]; /* A pointer to an array of FILE */
extern FILE _iob[]; /* An array of FILE */ #define _iob (*__imp__iob) /* An array of FILE */
#define stdin (&_iob[0]) #define stdin (&_iob[0])
#define stdout (&_iob[1]) #define stdout (&_iob[1])
#define stderr (&_iob[2]) #define stderr (&_iob[2])
@ -211,7 +211,7 @@ int sscanf (const char* szReadFrom, const char* szFormat, ...);
/* Wide character versions */ /* Wide character versions */
int fwscanf (FILE* fileReadFrom, const wchar_t* wsFormat, ...); int fwscanf (FILE* fileReadFrom, const wchar_t* wsFormat, ...);
int wscanf (const wchar_t* wsFormat, ...); int wscanf (const wchar_t* wsFormat, ...);
int swscanf (wchar_t* wsReadFrom, const wchar_t* wsFormat, ...); int swscanf (const wchar_t* wsReadFrom, const wchar_t* wsFormat, ...);
/* /*
* Character Input and Output Functions * Character Input and Output Functions
@ -222,7 +222,7 @@ char* fgets (char* caBuffer, int nBufferSize, FILE* fileRead);
int fputc (int c, FILE* fileWrite); int fputc (int c, FILE* fileWrite);
int fputs (const char* szOutput, FILE* fileWrite); int fputs (const char* szOutput, FILE* fileWrite);
int getc (FILE* fileRead); int getc (FILE* fileRead);
//int getchar (); int getchar (void);
char* gets (char* caBuffer); /* Unsafe: how does gets know how long the char* gets (char* caBuffer); /* Unsafe: how does gets know how long the
* buffer is? */ * buffer is? */
int putc (int c, FILE* fileWrite); int putc (int c, FILE* fileWrite);
@ -301,12 +301,18 @@ int fsetpos (FILE* fileSetPosition, fpos_t* pfpos);
/* /*
* Error Functions * Error Functions
*/ */
#if 0
void clearerr (FILE* fileClearErrors); void clearerr (FILE* fileClearErrors);
int feof (FILE* fileIsAtEnd); int feof (FILE* fileIsAtEnd);
int ferror (FILE* fileIsError); int ferror (FILE* fileIsError);
void perror (const char* szErrorMessage); void perror (const char* szErrorMessage);
#endif
#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 * Non ANSI functions
*/ */
@ -317,9 +323,9 @@ int _fputchar (int c);
FILE* _fdopen (int nHandle, char* szMode); FILE* _fdopen (int nHandle, char* szMode);
#ifndef _NO_OLDNAMES #ifndef _NO_OLDNAMES
//int fgetchar (); #define fgetchar _fgetchar
int fputchar (int c); #define fputchar _fputchar
FILE* fdopen (int nHandle, char* szMode); #define fdopen _fdopen
#endif /* Not _NO_OLDNAMES */ #endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */ #endif /* Not __STRICT_ANSI__ */