Untangled crtdll/msvcrt header mess.

svn path=/trunk/; revision=2028
This commit is contained in:
Eric Kohl 2001-07-03 12:56:48 +00:00
parent 49ad46d964
commit 0bbf23c333
24 changed files with 1620 additions and 37 deletions

View file

@ -4,5 +4,5 @@
* This fcntl.h maps to the root fcntl.h
*/
#ifndef __STRICT_ANSI__
#include <fcntl.h>
#include <msvcrt/fcntl.h>
#endif

View file

@ -5,5 +5,5 @@
* TODO?
*/
#ifndef __STRICT_ANSI__
#include <fcntl.h>
#include <msvcrt/fcntl.h>
#endif

View file

@ -19,9 +19,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.4 $
* $Author: ariadne $
* $Date: 1999/04/03 10:41:29 $
* $Revision: 1.5 $
* $Author: ekohl $
* $Date: 2001/07/03 12:56:12 $
*
*/
@ -30,7 +30,7 @@
#ifndef _STAT_H_
#define _STAT_H_
#include <crtdll/sys/types.h>
#include <msvcrt/sys/types.h>
#ifdef __cplusplus
extern "C" {

View file

@ -1,3 +1,3 @@
#include <time.h>
#include <msvcrt/time.h>

View file

@ -4,6 +4,6 @@
* unistd.h maps (roughly) to io.h
*/
#ifndef __STRICT_ANSI__
#include <io.h>
#include <msvcrt/io.h>
#endif

View file

@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:07 $
* $Revision: 1.2 $
* $Author: ekohl $
* $Date: 2001/07/03 12:56:12 $
*
*/
@ -31,8 +31,8 @@
#define __need_wchar_t
#define __need_size_t
#include <stddef.h>
#include <crtdll/sys/types.h>
#include <msvcrt/stddef.h>
#include <msvcrt/sys/types.h>
#ifdef __cplusplus
extern "C" {

View file

@ -0,0 +1,77 @@
/*
* alloc.h
*
* Memory management functions. Because most of these functions are
* actually declared in stdlib.h I have decided to simply include that
* header file. This file is included by malloc.h. My head hurts...
*
* NOTE: In the version of the Standard C++ Library from Cygnus there
* is also an alloc.h which needs to be on your include path. Most of
* the time I think the most sensible option would be to get rid of
* this file.
*
* 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: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _ALLOC_H_
#define _ALLOC_H_
#include <msvcrt/stdlib.h>
#ifndef RC_INVOKED
#ifdef __cplusplus
extern "C" {
#endif
/*
* The structure used to walk through the heap with _heapwalk.
* TODO: This is a guess at the internals of this structure.
*/
typedef struct _heapinfo
{
void* ptr;
unsigned int size;
int in_use;
} _HEAPINFO;
int _heapwalk (_HEAPINFO* pHeapinfo);
void * _alloca(size_t size);
#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 _ALLOC_H_ */
#endif /* Not __STRICT_ANSI__ */

View file

@ -0,0 +1,69 @@
/*
* assert.h
*
* Define the assert macro for debug output.
*
* 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: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
#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.
*/
#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
;
/*
* Definition of the assert macro.
*/
#define assert(x) if(!(x)) _assert( #x , __FILE__, __LINE__);
#endif /* NDEBUG */
#ifdef __cplusplus
}
#endif
#endif

View file

@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Revision: 1.2 $
* $Author: ekohl $
* $Date: 2000/12/03 17:49:21 $
* $Date: 2001/07/03 12:56:48 $
*
*/
@ -74,7 +74,7 @@ int toupper(int c);
/*
* NOTE: The above are not old name type wrappers, but functions exported
* explicitly by CRTDLL. However, underscored versions are also exported.
* explicitly by MSVCRT. However, underscored versions are also exported.
*/
#ifndef __STRICT_ANSI__
int _tolower(int c);

View file

@ -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 <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: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _DIR_H_
#define _DIR_H_
#include <msvcrt/stdio.h> /* To get FILENAME_MAX... ugly. */
#include <msvcrt/sys/types.h> /* 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__ */

View file

@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Revision: 1.2 $
* $Author: ekohl $
* $Date: 2000/12/03 17:49:21 $
* $Date: 2001/07/03 12:56:48 $
*
*/
@ -101,7 +101,6 @@ int* _errno(void);
int* __doserrno(void);
#define _doserrno (*__doserrno())
#if __MSVCRT__
/* One of the MSVCRTxx libraries */
extern int* __imp__sys_nerr;
@ -110,20 +109,6 @@ extern int* __imp__sys_nerr;
extern char** __imp__sys_errlist;
#define sys_errlist (__imp__sys_errlist)
#else
/* CRTDLL run time library */
#define _sys_nerr (*_sys_nerr_dll)
extern int* _sys_nerr_dll;
#define sys_nerr (*_sys_nerr_dll)
extern const char* __sys_errlist[];
#define sys_errlist (__sys_errlist)
#endif
#ifdef __cplusplus
}

View file

@ -0,0 +1,125 @@
/*
* 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.1 $
* $Author: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
/* 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 <msvcrt/io.h>
/*
* This variable determines the default file mode.
* TODO: Which flags work?
*/
#if 0
#if __MSVCRT__
extern unsigned int* __imp__fmode;
#define _fmode (*__imp__fmode)
#else
/* CRTDLL */
extern unsigned int* _fmode_dll;
#define _fmode (*_fmode_dll)
#endif
#endif /* 0 */
/*
* NOTE: This is the correct definition to build crtdll.
* It is NOT valid outside of crtdll.
*/
extern unsigned int* _fmode_dll;
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
/* 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_ */

View file

@ -0,0 +1,33 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_libc_atexit_h__
#define __dj_include_libc_dosexec_h__
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
struct __atexit {
struct __atexit *__next;
void (*__function)(void);
};
extern struct __atexit *__atexit_ptr;
#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_dosexec_h__ */

View file

@ -0,0 +1,93 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_libc_file_h__
#define __dj_include_libc_file_h__
#include <msvcrt/stdio.h>
#include <msvcrt/fcntl.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef _POSIX_SOURCE
#ifndef _IORMONCL
#define _IORMONCL 004000 /* remove on close, for temp files */
#endif
/* if _flag & _IORMONCL, ._name_to_remove needs freeing */
#ifndef _IOUNGETC
#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 ) )
// 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);
int __set_errno(int err);
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 __fileno_setmode(int _fd, int _newmode);
int __fileno_close(int _fd);
void sigabort_handler(int sig);
#include <windows.h>
void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder );
time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder );
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#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];
} __file_rec;
extern __file_rec *__file_rec_list;
#ifdef __cplusplus
}
#endif
#endif /* __dj_include_libc_file_h__ */

140
reactos/include/msvcrt/io.h Normal file
View file

@ -0,0 +1,140 @@
/*
* io.h
*
* System level I/O functions and types.
*
* 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: ekohl $
* $Date: 2001/07/03 12:55: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__
#include <msvcrt/sys/types.h>
#include <msvcrt/sys/stat.h>
/* We need the definition of FILE anyway... */
#include <msvcrt/stdio.h>
/* MSVC's io.h contains the stuff from dir.h, so I will too.
* NOTE: This also defines off_t, the file offset type, through
* and inclusion of sys/types.h */
#include <msvcrt/dir.h>
/* TODO: Maximum number of open handles has not been tested, I just set
* it the same as 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 */
/* TODO: Is this safe? X_OK not supported directly... */
#define X_OK R_OK /* Check for execute permission */
#define D_OK 0x10
#ifdef __cplusplus
extern "C" {
#endif
int _access (const char* szFileName, int nAccessMode);
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);
int _fileno (FILE* fileGetHandle);
void* _get_osfhandle (int nHandle);
int _isatty (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);
#endif
/* LK_... locking commands defined in sys/locking.h. */
int _locking (int nHandle, int nCmd, long lnLockRegionLength);
off_t _lseek(int _fd, off_t _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);
/* SH_... flags for nFlag defined in share.h */
int _sopen (char* szFileName, int nAccess, int nFlag, int nMode);
long _tell (int nHandle);
unsigned _umask (unsigned unMode);
int _unlink (const char* szFileName);
size_t _write(int _fd, const void *_buf, size_t _nbyte);
#ifndef _NO_OLDNAMES
/*
* Non-underscored versions of non-ANSI functions to improve portability.
* These functions live in libmoldname.a.
*/
#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(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 */

View file

@ -0,0 +1,53 @@
/*
* malloc.h
*
* Support for programs which want to use malloc.h to get memory management
* functions. Unless you absolutely need some of these functions and they are
* not in the ANSI headers you should use the ANSI standard header files
* instead.
*
* 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: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _MALLOC_H_
#define _MALLOC_H_
#include <msvcrt/alloc.h>
#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);
#ifdef __cplusplus
}
#endif
#endif /* Not _MALLOC_H_ */
#endif /* Not __STRICT_ANSI__ */

View file

@ -0,0 +1,160 @@
/*
* process.h
*
* Function calls for spawning child processes.
*
* 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: ekohl $
* $Date: 2001/07/03 12:55: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__
#ifdef __cplusplus
extern "C" {
#endif
void _cexit(void);
void _c_exit(void);
/*
* 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);
/*
* 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);
/*
* The functions _beginthreadex and _endthreadex are not provided by CRTDLL.
* They are provided by MSVCRT.
*
* NOTE: Apparently _endthread calls CloseHandle on the handle of the thread,
* making for race conditions if you are not careful. Basically you have to
* make sure that no-one is going to do *anything* with the thread handle
* after the thread calls _endthread or returns from the thread function.
*
* NOTE: No old names for these functions. Use the underscore.
*/
unsigned long
_beginthread (void (__cdecl *pfuncStart)(void *),
unsigned unStackSize, void* pArgList);
void _endthread (void);
#if __MSVCRT__
unsigned long
_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);
unsigned long __threadid(void);
#define _threadid __threadid()
void * __threadhandle(void);
#ifndef _NO_OLDNAMES
#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 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 */
#ifdef __cplusplus
}
#endif
#endif /* Not __STRICT_ANSI__ */
#endif /* _PROCESS_H_ not defined */

View file

@ -0,0 +1,17 @@
#ifndef _include_share_h_
#define _include_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
#endif

View file

@ -0,0 +1,111 @@
/*
* 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.1 $
* $Author: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
/* added some extra signal constants */
#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
* 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
#define SIGNOFP 301
#define SIGTRAP 302
#define SIGTIMR 303 /* Internal for setitimer (SIGALRM, SIGPROF) */
#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
}
#endif
#endif

View file

@ -0,0 +1,107 @@
/*
* stdarg.h
*
* Provides facilities for stepping through a list of function arguments of
* an unknown number and type.
*
* NOTE: Gcc should provide stdarg.h, and I believe their version will work
* with crtdll. If necessary I think you can replace this with the GCC
* stdarg.h (or is it vararg.h).
*
* Note that the type used in va_arg is supposed to match the actual type
* *after default promotions*. Thus, va_arg (..., short) is not valid.
*
* 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: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
#ifndef _STDARG_H_
#define _STDARG_H_
/*
* Don't do any of this stuff for the resource compiler.
*/
#ifndef RC_INVOKED
/*
* I was told that Win NT likes this.
*/
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#endif
#ifndef _VA_LIST
#define _VA_LIST
typedef char* va_list;
#endif
/*
* 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))
/*
* Start variable argument list processing by setting AP to point to the
* argument after pN.
*/
#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.
*/
#define va_start(ap, pN) \
((ap) = ((va_list) __builtin_next_arg(pN)))
#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)))
#endif
/*
* End processing of variable argument list. In this case we do nothing.
*/
#define va_end(ap) ((void)0)
/*
* Increment ap to the next argument in the list while returing a
* pointer to what ap pointed to first, which is of type t.
*
* We cast to void* and then to t* because this avoids a warning about
* increasing the alignment requirement.
*/
#define va_arg(ap, t) \
(((ap) = (ap) + __va_argsiz(t)), \
*((t*) (void*) ((ap) - __va_argsiz(t))))
#endif /* Not RC_INVOKED */
#endif /* not _STDARG_H_ */

View file

@ -28,9 +28,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: dwelch $
* $Date: 2001/02/19 15:04:50 $
* $Revision: 1.3 $
* $Author: ekohl $
* $Date: 2001/07/03 12:56:48 $
*
*/
@ -55,7 +55,7 @@
* size_t is typedef'ed differently from what GCC expects it will give you
* warnings when you prototype functions like memcmp and memcpy. The values
* for __xxx_TYPE__ in this header file are the same as those given by GCC.
* Those values appear to work with the CRTDLL functions.
* Those values appear to work with the MSVCRT functions.
*/
/*

View file

@ -0,0 +1,359 @@
/*
* stdio.h
*
* Definitions of types and prototypes of functions for standard input and
* output.
*
* NOTE: The file manipulation functions provided by Microsoft seem to
* work with either slash (/) or backslash (\) as the path separator.
*
* 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: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
/* implemented clearerr feof ferror perror as macros */
/* added _IOCOMMIT */
/* added filbuf and flsbuf and fwalk */
#ifndef _STDIO_H_
#define _STDIO_H_
#ifdef __cplusplus
extern "C" {
#endif
#define __need_size_t
#define __need_NULL
#define __need_wchar_t
#define __need_wint_t
#include <msvcrt/stddef.h>
/* Some flags for the iobuf structure provided by djgpp stdio.h */
#define _IOREAD 0x000010
#define _IOWRT 0x000020
#define _IOMYBUF 0x000040
#define _IOEOF 0x000100
#define _IOERR 0x000200
#define _IOSTRG 0x000400
#define _IOAPPEND 0x002000
#define _IORMONCL 0x004000 /* remove on close, for temp files */
/* if _flag & _IORMONCL, ._name_to_remove needs freeing */
#define _IOUNGETC 0x010000 /* there is an ungetc'ed character in the buffer */
#define _IOCOMMIT 0x008000
#define _IODIRTY 0x000080
#define _IOAHEAD 0x000008
#define _IORW (_IOREAD | _IOWRITE )
/*
* I used to include stdarg.h at this point, in order to allow for the
* functions later on in the file which use va_list. That conflicts with
* using stdio.h and varargs.h in the same file, so I do the typedef myself.
*/
//#ifndef _VA_LIST
//#define _VA_LIST
//typedef char* va_list;
//#endif
#include <msvcrt/stdarg.h>
/*
* FILE should be used as a pointer to an opaque data type. Do not rely on
* anything else, especially the size or contents of this structure!
*/
#ifndef _FILE_DEFINED
typedef struct {
char *_ptr;
int _cnt;
char *_base;
int _flag;
int _file;
int _ungotchar;
int _bufsiz;
char *_name_to_remove;
} FILE;
#define _FILE_DEFINED
#endif
//#define _fillsize _bufsiz
/*
* 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])
/* Returned by various functions on end of file condition or error. */
#define EOF (-1)
/*
* The maximum length of a file name. You should use GetVolumeInformation
* instead of this constant. But hey, this works.
*
* 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)
/*
* 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)
/*
* File Operations
*/
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 _wremove (const wchar_t* szFileName);
int rename (const char* szOldFileName, const char* szNewFileName);
FILE* tmpfile (void);
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
* supplied buffer caName.
* NOTE: This has not been determined by experiment, but based on the
* maximum file name length above it is probably reasonable. I could be
* wrong...
*/
#define L_tmpnam (260)
char* tmpnam (char caName[]);
char* _tempnam (const char *szDir, const char *szPfx);
#ifndef _NO_OLDNAMES
#define tempnam _tempnam
#endif /* Not _NO_OLDNAMES */
/*
* The three possible buffering mode (nMode) values for setvbuf.
* 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);
/*
* The buffer size as used by setbuf such that it is equivalent to
* (void) setvbuf(fileSetBuffer, caBuffer, _IOFBF, BUFSIZ).
*/
#define BUFSIZ 512
void setbuf (FILE* fileSetBuffer, char* caBuffer);
/*
* Pipe Operations
*/
int _pclose (FILE* pipeClose);
FILE* _popen (const char* szPipeName, const char* szMode);
#define popen _popen
#define pclose _pclose
/* Wide character version */
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);
/* 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);
/*
* Formatted Input
*/
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, ...);
/*
* 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);
/* 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 _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 */
/* 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);
/*
* File Positioning Functions
*/
/* 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)
#endif
#ifndef SEEK_CUR
#define SEEK_CUR (1)
#endif
#ifndef SEEK_END
#define SEEK_END (2)
#endif
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
* this type are unknown, but we (the compiler) need to know the size
* because the programmer using fgetpos and fsetpos will be setting aside
* storage for fpos_t structres. Actually I tested using a byte array and
* 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);
/*
* Error Functions
*/
#if 0
void clearerr (FILE* fileClearErrors);
int feof (FILE* fileIsAtEnd);
int ferror (FILE* fileIsError);
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
*/
#ifndef __STRICT_ANSI__
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 */
#endif /* Not __STRICT_ANSI__ */
#ifdef __cplusplus
}
#endif
#endif /* _STDIO_H_ */

View file

@ -0,0 +1,119 @@
/*
* time.h
*
* Date and time functions and types.
*
* 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: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
#ifndef _TIME_H_
#define _TIME_H_
#define __need_wchar_t
#define __need_size_t
#include <msvcrt/stddef.h>
#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
/*
* 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.
*/
#include <msvcrt/sys/types.h>
/*
* A type for storing the current time and date. This is the number of
* seconds since midnight Jan 1, 1970.
* NOTE: Normally this is defined by the above include of sys/types.h
*/
#ifndef _TIME_T_
#define _TIME_T_
typedef long time_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;
};
clock_t clock (void);
time_t time (time_t* tp);
double difftime (time_t t2, time_t t1);
time_t mktime (struct tm* tmsp);
/*
* These functions write to and return pointers to static buffers that may
* be overwritten by other function calls. Yikes!
*
* NOTE: localtime, and perhaps the others of the four functions grouped
* below may return NULL if their argument is not 'acceptable'. Also note
* that calling asctime with a NULL pointer will produce an Invalid Page
* 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);
char* ctime (const time_t* tp);
struct tm* gmtime (const time_t* tm);
struct tm* localtime (const time_t* tm);
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);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,32 @@
/*
* wchar.h
*
* Defines of all functions for supporting wide characters. Actually it
* just includes all those headers, which is not a good thing to do from a
* processing time point of view, but it does mean that everything will be
* in sync.
*
* 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
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ekohl $
* $Date: 2001/07/03 12:55:00 $
*
*/
#include <msvcrt/ctype.h>
#include <msvcrt/stdio.h>
#include <msvcrt/stdlib.h>
#include <msvcrt/string.h>
#include <msvcrt/time.h>