moved some header files from top level to crtdll directory

svn path=/trunk/; revision=365
This commit is contained in:
Boudewijn Dekker 1999-04-02 21:44:11 +00:00
parent de56bed16d
commit e8cbdde2a7
319 changed files with 4225 additions and 1740 deletions

View file

@ -0,0 +1,74 @@
/*
* 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: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _ALLOC_H_
#define _ALLOC_H_
#include <crtdll/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);
#ifndef _NO_OLDNAMES
int heapwalk (_HEAPINFO* pHeapinfo);
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
}
#endif
#endif /* Not RC_INVOKED */
#endif /* Not _ALLOC_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.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:07 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
@ -44,11 +44,17 @@ extern "C" {
* CRTDLL nicely supplies a function which does the actual output and
* call to abort.
*/
void _assert (const char* szExpression, const char* szFileName, int nLine)
#ifndef __ATTRIB_NORETURN
#ifdef __GNUC__
__attribute__ ((noreturn))
#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.

View file

@ -1,111 +1,67 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_conio_h_
#define __dj_include_conio_h_
/*
* conio.h
*
* Low level console I/O functions. Pretty please try to use the ANSI
* standard ones if you are writing new code.
*
* 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.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
#ifdef __cplusplus
#ifndef __STRICT_ANSI__
#ifndef _CONIO_H_
#define _CONIO_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
char* _cgets (char* szBuffer);
int _cprintf (const char* szFormat, ...);
int _cputs (const char* szString);
int _cscanf (char* szFormat, ...);
#ifndef _POSIX_SOURCE
int _getch (void);
int _getche (void);
int _kbhit (void);
int _putch (int cPut);
int _ungetch (int cUnget);
extern int directvideo; /* ignored by gppconio */
extern int _wscroll;
#ifndef _NO_OLDNAMES
#define _NOCURSOR 0
#define _SOLIDCURSOR 1
#define _NORMALCURSOR 2
#define getch _getch
#define getche _getche
#define kbhit _kbhit
#define putch (cPut) _putch(cPut)
#define ungetch (cUnget) _ungetch(cUnget)
struct text_info {
unsigned char winleft;
unsigned char wintop;
unsigned char winright;
unsigned char winbottom;
unsigned char attribute;
unsigned char normattr;
unsigned char currmode;
unsigned char screenheight;
unsigned char screenwidth;
unsigned char curx;
unsigned char cury;
};
#endif /* Not _NO_OLDNAMES */
enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
enum COLORS {
/* dark colors */
BLACK,
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
BROWN,
LIGHTGRAY,
/* light colors */
DARKGRAY,
LIGHTBLUE,
LIGHTGREEN,
LIGHTCYAN,
LIGHTRED,
LIGHTMAGENTA,
YELLOW,
WHITE
};
#define BLINK 0x80 /* blink bit */
void blinkvideo(void);
char * cgets(char *_str);
void clreol(void);
void clrscr(void);
int _conio_kbhit(void); /* checks for ungetch char */
//int cprintf(const char *_format, ...) __attribute__((format(printf,1,2)));
int cputs(const char *_str);
//int cscanf(const char *_format, ...) __attribute__((format(scanf,1,2)));
void delline(void);
int getch(void);
int getche(void);
int gettext(int _left, int _top, int _right, int _bottom, void *_destin);
void gettextinfo(struct text_info *_r);
void gotoxy(int _x, int _y);
void gppconio_init(void);
void highvideo(void);
void insline(void);
void intensevideo(void);
void lowvideo(void);
int movetext(int _left, int _top, int _right, int _bottom, int _destleft, int _desttop);
void normvideo(void);
int putch(int _c);
int puttext(int _left, int _top, int _right, int _bottom, void *_source);
void _setcursortype(int _type);
void _set_screen_lines(int _nlines);
void textattr(int _attr);
void textbackground(int _color);
void textcolor(int _color);
void textmode(int _mode);
int ungetch(int);
unsigned int wherex(void);
unsigned int wherey(void);
void window(int _left, int _top, int _right, int _bottom);
#define kbhit _conio_kbhit /* Who ever includes gppconio.h probably
also wants _conio_kbhit and not kbhit
from libc */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_conio_h_ */
#endif /* Not _CONIO_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.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:07 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
#ifndef _LINUX_CTYPE_H
@ -31,7 +31,7 @@
#define __need_wchar_t
#define __need_wint_t
#include <stddef.h>
#include <crtdll/stddef.h>
/*
@ -46,22 +46,11 @@
#define _CONTROL 0x0020
#define _BLANK 0x0040
#define _HEX 0x0080
#define _ALPHA 0x0103
#define _GRAPH 0x0200 // added
#define _PRINT 0x0400 // added
#define _LEADBYTE 0x8000
#define _ALPHA 0x0103
/* from DJGPP, see appropriate licence */
#define __dj_ISALNUM 0x0001
#define __dj_ISALPHA 0x0002
#define __dj_ISCNTRL 0x0004
#define __dj_ISDIGIT 0x0008
#define __dj_ISGRAPH 0x0010
#define __dj_ISLOWER 0x0020
#define __dj_ISPRINT 0x0040
#define __dj_ISPUNCT 0x0080
#define __dj_ISSPACE 0x0100
#define __dj_ISUPPER 0x0200
#define __dj_ISXDIGIT 0x0400
#ifdef __cplusplus
extern "C" {

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.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:07 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
@ -29,8 +29,8 @@
#ifndef _DIR_H_
#define _DIR_H_
#include <stdio.h> /* To get FILENAME_MAX... ugly. */
#include <sys/types.h> /* To get time_t. */
#include <crtdll/stdio.h> /* To get FILENAME_MAX... ugly. */
#include <crtdll/sys/types.h> /* To get time_t. */
#ifdef __cplusplus
extern "C" {

View file

@ -14,9 +14,9 @@
* DISCLAMED. This includeds but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:07 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
@ -25,7 +25,7 @@
#ifndef _DIRENT_H_
#define _DIRENT_H_
#include <dir.h>
#include <crtdll/dir.h>
#ifdef __cplusplus
extern "C" {

View file

@ -139,7 +139,7 @@ void _setdrive(unsigned int _drive, unsigned int *_p_drives);
int exterr(struct _DOSERROR *_p_error);
#define dosexterr(_ep) exterr(_ep)
#include <direct.h>
#include <crtdll/direct.h>
#define int386(_i, _ir, _or) int86(_i, _ir, _or)
#define int386x(_i, _ir, _or, _sr) int86x(_i, _ir, _or, _sr)

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.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:07 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
@ -103,17 +103,28 @@ int* __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)
#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
}
#endif

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/04/02 21:42:06 $
*
*/
#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

@ -1,164 +1,115 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_fcntl_h_
#define __dj_include_fcntl_h_
/*
* 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.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
/* added _O_RANDOM_O_SEQUENTIAL _O_SHORT_LIVED*/
/* changed fmode_dll */
#ifdef __cplusplus
#ifndef _FCNTL_H_
#define _FCNTL_H_
/*
* It appears that fcntl.h should include io.h for compatibility...
*/
#include <crtdll/io.h>
/*
* This variable determines the default file mode.
* TODO: Which flags work?
*/
#if __MSVCRT__
extern unsigned int* __imp__fmode;
#define _fmode (*__imp__fmode)
#else
/* CRTDLL */
extern unsigned int* _fmode_dll;
#define _fmode (*_fmode_dll)
#endif
/* Specifiy one of these flags to define the access mode. */
#define _O_RDONLY 0
#define _O_WRONLY 1
#define _O_RDWR 2
/* Mask for access mode bits in the _open flags. */
#define _O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
#define _O_APPEND 0x0008 /* Writes will add to the end of the file. */
#define _O_CREAT 0x0100 /* Create the file if it does not exist. */
#define _O_TRUNC 0x0200 /* Truncate the file if it does exist. */
#define _O_EXCL 0x0400 /* Open only if the file does not exist. */
/* NOTE: Text is the default even if the given _O_TEXT bit is not on. */
#define _O_TEXT 0x4000 /* CR-LF in file becomes LF in memory. */
#define _O_BINARY 0x8000 /* Input and output is not translated. */
#define _O_RAW _O_BINARY
#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing.
* WARNING: Even if not created by _open! */
#define _O_RANDOM 0x0010
#define _O_SEQUENTIAL _O_RANDOM
#define _O_SHORT_LIVED 0x1000
#ifndef __STRICT_ANSI__
#ifndef _NO_OLDNAMES
/* POSIX/Non-ANSI names for increased portability */
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
#define O_ACCMODE _O_ACCMODE
#define O_APPEND _O_APPEND
#define O_CREAT _O_CREAT
#define O_TRUNC _O_TRUNC
#define O_EXCL _O_EXCL
#define O_TEXT _O_TEXT
#define O_BINARY _O_BINARY
#define O_TEMPORARY _O_TEMPORARY
#define O_RANDOM _O_RANDOM
#define O_SEQUENTIAL _O_RANDOM
#define O_SHORT_LIVED _O_SHORT_LIVED
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
extern "C" {
#endif
#define _IOREAD 000010
#define _IOWRT 000020
#define _IOMYBUF 000040
#define _IOEOF 000100
#define _IOERR 000200
#define _IOSTRG 000400
#define _IORW 001000
#define _IOAPPEND 002000
#define _IORMONCL 004000 /* remove on close, for temp files */
/* if _flag & _IORMONCL, ._name_to_remove needs freeing */
#define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */
int _setmode (int nHandle, int nAccessMode);
#ifndef _NO_OLDNAMES
int setmode (int nHandle, int nAccessMode);
#endif /* Not _NO_OLDNAMES */
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#define FD_CLOEXEC 0x0001
#define F_DUPFD 1
#define F_GETFD 2
#define F_GETFL 3
#define F_GETLK 4
#define F_SETFD 5
#define F_SETFL 6
#define F_SETLK 7
#define F_SETLKW 8
#define F_UNLCK 0
#define F_RDLCK 1
#define F_WRLCK 2
#define O_RDONLY 0x0000
#define O_WRONLY 0x0001
#define O_RDWR 0x0002
#define O_ACCMODE 0x0003
#define O_BINARY 0x0004 /* must fit in char, reserved by dos */
#define O_TEXT 0x0008 /* must fit in char, reserved by dos */
#define O_RANDOM 0x0010
#define O_SEQUENTIAL 0x0020
#define O_TEMPORARY 0x0040
/* temporary access hint */
/* sequential/random access hints */
#define O_NOINHERIT 0x0080 /* DOS-specific */
#define O_CREAT 0x0100 /* second byte, away from DOS bits */
#define O_EXCL 0x0200
#define O_NOCTTY 0x0400
#define O_TRUNC 0x0800
#define O_APPEND 0x1000
#define O_NONBLOCK 0x2000
#define O_SHORT_LIVED 0x1000
//#include <sys/types.h>
#include <sys/stat.h>
//typedef int dev_t;
//typedef int ino_t;
//typedef int mode_t;
//typedef int nlink_t;
#include <io.h>
struct flock {
off_t l_len;
pid_t l_pid;
off_t l_start;
short l_type;
short l_whence;
};
extern int _fmode; /* O_TEXT or O_BINARY */
//int open(const char *_path, int _oflag, ...);
//int creat(const char *_path, int _mode);
int fcntl(int _fildes, int _cmd, ...);
#ifndef _POSIX_SOURCE
#define S_IREAD S_IRUSR
#define S_IWRITE S_IWUSR
#define S_IEXEC S_IXUSR
/*
* For compatibility with other DOS C compilers.
*/
#define _O_RDONLY O_RDONLY
#define _O_WRONLY O_WRONLY
#define _O_RDWR O_RDWR
#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_NOINHERIT O_NOINHERIT
#define _O_RANDOM O_RANDOM
#define _O_SEQUENTIAL O_RANDOM
#define _O_SHORT_LIVED O_SHORT_LIVED
#define _O_TEMPORARY O_TEMPORARY
#define _S_IREAD S_IRUSR
#define _S_IWRITE S_IWUSR
#define _S_IEXEC S_IXUSR
/*
* Support for advanced filesystems (Windows 9x VFAT, NTFS, LFN etc.)
*/
#define _FILESYS_UNKNOWN 0x80000000U
#define _FILESYS_CASE_SENSITIVE 0x0001
#define _FILESYS_CASE_PRESERVED 0x0002
#define _FILESYS_UNICODE 0x0004
#define _FILESYS_LFN_SUPPORTED 0x4000
#define _FILESYS_VOL_COMPRESSED 0x8000
unsigned _get_volume_info (const char *_path, int *_max_file_len, int *_max_path_len, char *_filesystype);
char _use_lfn (const char *_path);
char *_lfn_gen_short_fname (const char *_long_fname, char *_short_fname);
#define _LFN_CTIME 1
#define _LFN_ATIME 2
unsigned _lfn_get_ftime (int _handle, int _which);
char _preserve_fncase (void);
#define _USE_LFN _use_lfn(0) /* assume it's the same on ALL drives */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_fcntl_h_ */
#endif /* Not __STRICT_ANSI__ */
#endif /* Not _FCNTL_H_ */

View file

@ -27,9 +27,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:07 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
@ -146,15 +146,15 @@ 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 */
unsigned int _clearfp (void); /* Clear the FPU status word */
unsigned int _statusfp (void); /* Report the FPU status word */
#define _clear87 _clearfp
#define _status87 _statusfp
void _fpreset (); /* Reset the FPU */
void _fpreset (void); /* Reset the FPU */
/* Global 'variable' for the current floating point error code. */
int * __fpecode();
int * __fpecode(void);
#define _fpecode (*(__fpecode()))
/*

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,62 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_libc_file_h__
#define __dj_include_libc_file_h__
#include <crtdll/stdio.h>
#include <crtdll/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
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 _dowscan(FILE *iop, const wchar_t *fmt, va_list argp);
int __fileno_dup2( int handle1, int handle2 );
int __fileno_setmode(int _fd, int _newmode);
int __fileno_close(int _fd);
#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 */
#ifdef __cplusplus
}
#endif
#endif /* __dj_include_libc_file_h__ */

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.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:07 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
@ -32,18 +32,18 @@
#ifndef __STRICT_ANSI__
#include <sys/types.h>
#include <crtdll/sys/types.h>
#include <sys/stat.h>
#include <crtdll/sys/stat.h>
/* We need the definition of FILE anyway... */
#include <stdio.h>
#include <crtdll/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 <dir.h>
#include <crtdll/dir.h>
/* TODO: Maximum number of open handles has not been tested, I just set
* it the same as FOPEN_MAX. */

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: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _MALLOC_H_
#define _MALLOC_H_
#include <crtdll/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

@ -18,9 +18,9 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:07 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
@ -46,8 +46,8 @@ extern double* __imp__HUGE;
#define HUGE_VAL (*__imp__HUGE)
#else
/* CRTDLL */
extern double* __imp__HUGE_dll;
#define HUGE_VAL (*__imp__HUGE_dll)
extern double* _HUGE_dll;
#define HUGE_VAL (*_HUGE_dll)
#endif

View file

@ -18,12 +18,13 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:09 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
/* changed second argument of cwait from nPID to hProc */
#ifndef _PROCESS_H_
#define _PROCESS_H_
@ -49,21 +50,18 @@ void _c_exit(void);
#define WAIT_GRANDCHILD _WAIT_GRANDCHILD
#endif /* Not _NO_OLDNAMES */
int _cwait (int* pnStatus, int nPID, int nAction);
int _cwait (int* pnStatus, int hProc, int nAction);
int _getpid(void);
int _execl(const char *_path, const char *_argv0, ...);
int _execle(const char *_path, const char *_argv0, ... /*, char *const _envp[] */);
int _execlp(const char *_path, const char *_argv0, ...);
int _execlpe(const char *_path, const char *_argv0, ... /*, char *const _envp[] */);
int _execv(const char *_path,const char *const _argv[]);
int _execve(const char *_path,const char *const _argv[],const char *const _envp[]);
int _execvp(const char *_path,const char *const _argv[]);
int _execvpe(const char *_path,const char *const _argv[],const char *const _envp[]);
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);
/*
@ -85,16 +83,14 @@ int _execvpe(const char *_path,const char *const _argv[],const char *const _envp
#define P_DETACH _P_DETACH
#endif /* Not _NO_OLDNAMES */
int _spawnl(int _mode, const char *_path, const char *_argv0, ...);
int _spawnle(int _mode, const char *_path, const char *_argv0, ... /*, char *const _envp[] */);
int _spawnlp(int _mode, const char *_path, const char *_argv0, ...);
int _spawnlpe(int _mode, const char *_path, const char *_argv0, ... /*, char *const _envp[] */);
int _spawnv(int _mode, const char *_path,const char *const _argv[]);
int _spawnve(int _mode, const char *_path,const char *const _argv[],const char *const _envp[]);
int _spawnvp(int _mode, const char *_path,const char *const _argv[]);
int _spawnvpe(int _mode, const char *_path,const char *const _argv[],const char *const _envp[]);
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.
@ -123,6 +119,11 @@ void _endthreadex (unsigned unExitCode);
void *_loaddll (char *name);
int _unloaddll(void *handle);
unsigned long __threadid(void);
#define _threadid __threadid()
void * __threadhandle(void);
#ifndef _NO_OLDNAMES
#define cwait _cwait

View file

@ -0,0 +1,35 @@
#ifndef _SEARCH_H_
#define _SEARCH_H_
//char *key
//void *data
//enum { FIND, ENTER } ACTION;
//enum { preorder, postorder, endorder, leaf } VISIT;
#include <crtdll/stddef.h>
#include <crtdll/sys/types.h>
//The Single UNIX ® Specification, Version 2 Copyright © 1997 The Open Group
//int hcreate(size_t);
//void hdestroy(void);
//ENTRY *hsearch(ENTRY, ACTION);
//void insque(void *, void *);
void *_lfind(const void *, const void *, size_t *,
size_t, int (*)(const void *, const void *));
void *_lsearch(const void *, void *, size_t *,
size_t, int (*)(const void *, const void *));
//void remque(void *);
//void *tdelete(const void *, void **,
// int(*)(const void *, const void *));
//void *tfind(const void *, void *const *,
// int(*)(const void *, const void *));
//void *tsearch(const void *, void **,
// int(*)(const void *, const void *));
//void twalk(const void *,
// void (*)(const void *, VISIT, int ));
#endif

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: rex $
* $Date: 1999/03/19 05:55:09 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
@ -169,4 +169,5 @@ typedef __WINT_TYPE__ wint_t;
#define offsetof(TYPE, MEMBER) ((size_t) &( ((TYPE *) 0)->MEMBER ))
#endif /* _STDDEF_H_ */
#endif /* not _STDDEF_H_ */

View file

@ -1,34 +1,51 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
/*
* 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.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
/* implemented clearerr feof ferror perror as macros */
/* added _IOCOMMIT */
/* added filbuf and flsbuf and fwalk */
#ifndef __dj_include_stdio_h_
#define __dj_include_stdio_h_
#ifndef _STDIO_H_
#define _STDIO_H_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#define __need_size_t
#define __need_NULL
#define __need_wchar_t
#include <crtdll/stddef.h>
#include <sys/djtypes.h>
#define _IOFBF 00001
#define _IONBF 00002
#define _IOLBF 00004
#define BUFSIZ 16384
#define EOF (-1)
#define FILENAME_MAX 260
#define FOPEN_MAX 20
#define L_tmpnam 260
#ifndef NULL
#define NULL 0
#endif
#define TMP_MAX 999999
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
/* Some flags for the iobuf structure provided by djgpp stdio.h */
#define _IOREAD 000010
#define _IOWRT 000020
#define _IOMYBUF 000040
@ -40,14 +57,23 @@ extern "C" {
#define _IORMONCL 004000 /* remove on close, for temp files */
/* if _flag & _IORMONCL, ._name_to_remove needs freeing */
#define _IOUNGETC 010000 /* there is an ungetc'ed character in the buffer */
#define _IOCOMMIT 0x4000
#include <internal/types.h>
__DJ_va_list
#undef __DJ_va_list
#define __DJ_va_list
/*
* 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
/*
* 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;
@ -62,96 +88,260 @@ typedef struct {
#define _FILE_DEFINED
#endif
typedef unsigned long fpos_t;
extern FILE _iob[];
/*
* 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 (*__imp__iob)[]; /* A pointer to an array of FILE */
#define _iob (*__imp__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])
void clearerr(FILE *_stream);
int fclose(FILE *_stream);
int feof(FILE *_stream);
int ferror(FILE *_stream);
int fflush(FILE *_stream);
int fgetc(FILE *_stream);
int fgetpos(FILE *_stream, fpos_t *_pos);
char * fgets(char *_s, int _n, FILE *_stream);
FILE * fopen(const char *_filename, const char *_mode);
int fprintf(FILE *_stream, const char *_format, ...);
int fputc(int _c, FILE *_stream);
int fputs(const char *_s, FILE *_stream);
size_t fread(void *_ptr, size_t _size, size_t _nelem, FILE *_stream);
FILE * freopen(const char *_filename, const char *_mode, FILE *_stream);
int fscanf(FILE *_stream, const char *_format, ...);
int fseek(FILE *_stream, long _offset, int _mode);
int fsetpos(FILE *_stream, const fpos_t *_pos);
long ftell(FILE *_stream);
size_t fwrite(const void *_ptr, size_t _size, size_t _nelem, FILE *_stream);
int getc(FILE *_stream);
int getchar(void);
char * gets(char *_s);
void perror(const char *_s);
int printf(const char *_format, ...);
int putc(int _c, FILE *_stream);
int putchar(int _c);
int puts(const char *_s);
int remove(const char *_filename);
int rename(const char *_old, const char *_new);
void rewind(FILE *_stream);
int scanf(const char *_format, ...);
void setbuf(FILE *_stream, char *_buf);
int setvbuf(FILE *_stream, char *_buf, int _mode, size_t _size);
int sprintf(char *_s, const char *_format, ...);
int sscanf(const char *_s, const char *_format, ...);
FILE * tmpfile(void);
char * tmpnam(char *_s);
char * _tmpnam(char *_s);
int ungetc(int _c, FILE *_stream);
int vfprintf(FILE *_stream, const char *_format, va_list _ap);
int vprintf(const char *_format, va_list _ap);
int vsprintf(char *_s, const char *_format, va_list _ap);
/* 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 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 */
int fgetwc (FILE* fileRead);
int fputwc (wchar_t wc, FILE* fileWrite);
int ungetwc (wchar_t wc, FILE* fileWasRead);
/*
* 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);
int putwc (wchar_t wc, FILE* fileWrite);
int putws (const wchar_t* wsOutput);
#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);
#define L_ctermid
#define L_cusrid
/* #define STREAM_MAX 20 - DOS can change this */
#ifndef _NO_OLDNAMES
#define fgetchar _fgetchar
#define fputchar _fputchar
#define fdopen _fdopen
#endif /* Not _NO_OLDNAMES */
int fileno(FILE *_stream);
int _fileno(FILE *_stream);
FILE * fdopen(int _fildes, const char *_type);
int pclose(FILE *_pf);
FILE * popen(const char *_command, const char *_mode);
#ifndef _POSIX_SOURCE
void _djstat_describe_lossage(FILE *_to_where);
int _doprnt(const char *_fmt, va_list _args, FILE *_f);
int _doscan(FILE *_f, const char *_fmt, void **_argp);
int _doscan_low(FILE *, int (*)(FILE *_get), int (*_unget)(int, FILE *), const char *_fmt, void **_argp);
int fpurge(FILE *_f);
int getw(FILE *_f);
int mkstemp(char *_template);
char * mktemp(char *_template);
int putw(int _v, FILE *_f);
void setbuffer(FILE *_f, void *_buf, int _size);
void setlinebuf(FILE *_f);
char * tempnam(const char *_dir, const char *_prefix);
int _rename(const char *_old, const char *_new); /* Simple (no directory) */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#endif /* Not __STRICT_ANSI__ */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_stdio_h_ */
#endif /* _STDIO_H_ */

View file

@ -18,13 +18,15 @@
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:09 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
/* added splitpath */
/* changed definition of environ and argc */
/* moved prototype for swab from string.h to stdlib.h */
#ifndef _STDLIB_H_
#define _STDLIB_H_
@ -38,21 +40,26 @@ extern "C" {
* argc and argv. environ is a pointer to a table of environment variables.
* NOTE: Strings in _argv and environ are ANSI strings.
*/
extern int _argc;
extern char** _argv;
extern char** environ;
extern int* __argc_dll;
extern char*** __argv_dll;
extern char*** _environ_dll;
#define __argc (*__argc_dll)
#define __argv (*__argv_dll)
#define _environ (*_environ_dll)
#define __need_size_t
#define __need_wchar_t
#define __need_NULL
#include <stddef.h>
#include <crtdll/stddef.h>
#ifndef __ATTRIB_NORETURN
#ifdef __GNUC__
#define _ATTRIB_NORETURN __attribute__ ((noreturn))
#else /* Not __GNUC__ */
#define _ATTRIB_NORETURN
#endif /* __GNUC__ */
#endif
double atof (const char* szNumber);
int atoi (const char* szNumber);
@ -97,7 +104,7 @@ void free (void* pObject);
#define EXIT_SUCCESS 0
#define EXIT_FAILURE -1
void abort (void) _ATTRIB_NORETURN;
void abort (void) _ATTRIB_NORETURN;
void exit (int nStatus) _ATTRIB_NORETURN;
int atexit (void (*pfuncExitProcessing)(void));
@ -159,6 +166,8 @@ char* _gcvt (double dValue, int nDec, char* caBuf);
char* _fullpath (char* caBuf, const char* szPath, size_t sizeMax);
void _swab (const char* caFrom, char* caTo, size_t sizeToCopy);
#ifndef _NO_OLDNAMES
#define beep _beep
#define seterrormode _seterrormode
@ -173,6 +182,8 @@ char* _fullpath (char* caBuf, const char* szPath, size_t sizeMax);
#define ecvt _ecvt
#define fcvt _fcvt
#define gcvt _gcvt
#define swab _swab
#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */

View file

@ -0,0 +1,922 @@
/*
* string.h
*
* Definitions for memory and string functions.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
/* changed prototype for _strerror */
/* moved prototype for swab from string.h to stdlib.h */
#ifndef _LINUX_WSTRING_H_
#define _LINUX_WSTRING_H_
#ifndef _LINUX_STRING_H_
#define _LINUX_STRING_H_
#ifndef _STRING_H_
#define _STRING_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* Define size_t, wchar_t and NULL
*/
#define __need_size_t
#define __need_wchar_t
#define __need_NULL
#include <crtdll/stddef.h>
char * ___strtok; // removed extern specifier 02-06-98, BD
/*
* Prototypes of the ANSI Standard C library string functions.
*/
void* memchr (const void* p, int cSearchFor, size_t sizeSearch);
int memcmp (const void* p1, const void* p2, size_t sizeSearch);
void* memcpy (void* pCopyTo, const void* pSource, size_t sizeSource);
void* memmove (void* pMoveTo, const void* pSource, size_t sizeSource);
void* memset (void* p, int cFill, size_t sizeRepeatCount);
char* strcat (char* szAddTo, const char* szAdd);
char* strchr (const char* szSearch, int cFor);
int strcmp (const char* sz1, const char* sz2);
int strcoll (const char* sz1, const char* sz2); /* Compare using locale */
char* strcpy (char* szCopyTo, const char* szSource);
size_t strcspn (const char* szGetPrefix, const char* szNotIncluding);
char* strerror (int nError); /* NOTE: NOT an old name wrapper. */
char * _strerror(const char *s);
size_t strlen (const char* sz);
char* strncat (char* szAddTo, const char* szAdd, size_t sizeMaxAdd);
int strncmp (const char* sz1, const char* sz2, size_t sizeMaxCompare);
char* strncpy (char* szCopyTo, const char* szSource, size_t sizeMaxCopy);
char* strpbrk (const char* szSearch, const char* szAnyOf);
char* strrchr (const char* szSearch, int cFor);
size_t strspn (const char* szGetPrefix, const char *szIncluding);
char* strstr (const char* szSearch, const char *szFor);
char* strtok (char* szTokenize, const char* szDelimiters);
size_t strxfrm (char* szTransformed, const char *szSource,
size_t sizeTransform);
#ifndef __STRICT_ANSI__
/*
* Extra non-ANSI functions provided by the CRTDLL library
*/
void* _memccpy (void* pCopyTo, const void* pSource, int cTerminator,
size_t sizeMaxCopy);
int _memicmp (const void* p1, const void* p2, size_t sizeSearch);
char* _strdup (const char *szDuplicate);
int _strcmpi (const char* sz1, const char* sz2);
int _stricmp (const char* sz1, const char* sz2);
int _stricoll (const char* sz1, const char* sz2);
char* _strlwr (char* szToConvert);
int _strnicmp (const char* sz1, const char* sz2,
size_t sizeMaxCompare);
char* _strnset (char* szToFill, int cFill, size_t sizeMaxFill);
char* _strrev (char* szToReverse);
char* _strset (char* szToFill, int cFill);
char* _strupr (char* szToConvert);
#endif /* Not __STRICT_ANSI__ */
/*
* Unicode versions of the standard calls.
*/
wchar_t* wcscat (wchar_t* wsAddTo, const wchar_t* wsAdd);
wchar_t* wcschr (const wchar_t* wsSearch, wchar_t wcFor);
int wcscmp (const wchar_t* ws1, const wchar_t* ws2);
int wcscoll (const wchar_t* ws1, const wchar_t* ws2);
wchar_t* wcscpy (wchar_t* wsCopyTo, const wchar_t* wsSource);
size_t wcscspn (const wchar_t* wsGetPrefix, const wchar_t* wsNotIncluding);
/* Note: No wcserror in CRTDLL. */
size_t wcslen (const wchar_t* ws);
wchar_t* wcsncat (wchar_t* wsAddTo, const wchar_t* wsAdd, size_t sizeMaxAdd);
int wcsncmp(const wchar_t* ws1, const wchar_t* ws2, size_t sizeMaxCompare);
wchar_t* wcsncpy(wchar_t* wsCopyTo, const wchar_t* wsSource,
size_t sizeMaxCopy);
wchar_t* wcspbrk(const wchar_t* wsSearch, const wchar_t* wsAnyOf);
wchar_t* wcsrchr(const wchar_t* wsSearch, wchar_t wcFor);
size_t wcsspn(const wchar_t* wsGetPrefix, const wchar_t* wsIncluding);
wchar_t* wcsstr(const wchar_t* wsSearch, const wchar_t* wsFor);
wchar_t* wcstok(wchar_t* wsTokenize, const wchar_t* wsDelimiters);
size_t wcsxfrm(wchar_t* wsTransformed, const wchar_t *wsSource,
size_t sizeTransform);
#ifndef __STRICT_ANSI__
/*
* Unicode versions of non-ANSI functions provided by CRTDLL.
*/
/* NOTE: _wcscmpi not provided by CRTDLL, this define is for portability */
#define _wcscmpi _wcsicmp
wchar_t* _wcsdup (const wchar_t* wsToDuplicate);
int _wcsicmp (const wchar_t* ws1, const wchar_t* ws2);
int _wcsicoll (const wchar_t* ws1, const wchar_t* ws2);
wchar_t* _wcslwr (wchar_t* wsToConvert);
int _wcsnicmp (const wchar_t* ws1, const wchar_t* ws2,
size_t sizeMaxCompare);
wchar_t* _wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
wchar_t* _wcsrev (wchar_t* wsToReverse);
wchar_t* _wcsset (wchar_t* wsToFill, wchar_t wcToFill);
wchar_t* _wcsupr (wchar_t* wsToConvert);
#endif /* Not __STRICT_ANSI__ */
#ifndef __STRICT_ANSI__
#ifndef _NO_OLDNAMES
/*
* Non-underscored versions of non-ANSI functions. They live in liboldnames.a
* and provide a little extra portability. Also a few extra UNIX-isms like
* strcasecmp.
*/
void* memccpy (void* pCopyTo, const void* pSource, int cTerminator,
size_t sizeMaxCopy);
int memicmp (const void* p1, const void* p2, size_t sizeSearch);
#define strdup(szDuplicate) _strdup(szDuplicate)
int strcmpi (const char* sz1, const char* sz2);
int stricmp (const char* sz1, const char* sz2);
int strcasecmp (const char* sz1, const char* sz2);
int stricoll (const char* sz1, const char* sz2);
char* strlwr (char* szToConvert);
int strnicmp (const char* sz1, const char* sz2, size_t sizeMaxCompare);
int strncasecmp (const char* sz1, const char* sz2, size_t sizeMaxCompare);
char* strnset (char* szToFill, int cFill, size_t sizeMaxFill);
char* strrev (char* szToReverse);
char* strset (char* szToFill, int cFill);
char* strupr (char* szToConvert);
/* NOTE: There is no _wcscmpi, but this is for compatibility. */
int wcscmpi (const wchar_t* ws1, const wchar_t* ws2);
wchar_t* wcsdup (const wchar_t* wsToDuplicate);
int wcsicmp (const wchar_t* ws1, const wchar_t* ws2);
int wcsicoll (const wchar_t* ws1, const wchar_t* ws2);
wchar_t* wcslwr (wchar_t* wsToConvert);
int wcsnicmp (const wchar_t* ws1, const wchar_t* ws2,
size_t sizeMaxCompare);
wchar_t* wcsnset (wchar_t* wsToFill, wchar_t wcFill, size_t sizeMaxFill);
wchar_t* wcsrev (wchar_t* wsToReverse);
wchar_t* wcsset (wchar_t* wsToFill, wchar_t wcToFill);
wchar_t* wcsupr (wchar_t* wsToConvert);
#endif /* Not _NO_OLDNAMES */
#endif /* Not strict ANSI */
/*
* Include machine specific inline routines
*/
#ifndef _I386_STRING_H_
#define _I386_STRING_H_
/*
* On a 486 or Pentium, we are better off not using the
* byte string operations. But on a 386 or a PPro the
* byte string ops are faster than doing it by hand
* (MUCH faster on a Pentium).
*
* Also, the byte strings actually work correctly. Forget
* the i486 routines for now as they may be broken..
*/
#if FIXED_486_STRING && (CPU == 486 || CPU == 586)
#include <crtdll/asm/string-486.h>
#else
/*
* This string-include defines all string functions as inline
* functions. Use gcc. It also assumes ds=es=data space, this should be
* normal. Most of the string-functions are rather heavily hand-optimized,
* see especially strtok,strstr,str[c]spn. They should work, but are not
* very easy to understand. Everything is done entirely within the register
* set, making the functions fast and clean. String instructions have been
* used through-out, making for "slightly" unclear code :-)
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#define __HAVE_ARCH_STRCPY
extern inline char * strcpy(char * dest,const char *src)
{
__asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
: /* no output */
:"S" (src),"D" (dest):"si","di","ax","memory");
return dest;
}
#define __HAVE_ARCH_STRNCPY
extern inline char * strncpy(char * dest,const char *src,size_t count)
{
__asm__ __volatile__(
"cld\n"
"1:\tdecl %2\n\t"
"js 2f\n\t"
"lodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"rep\n\t"
"stosb\n"
"2:"
: /* no output */
:"S" (src),"D" (dest),"c" (count):"si","di","ax","cx","memory");
return dest;
}
#define __HAVE_ARCH_STRCAT
extern inline char * strcat(char * dest,const char * src)
{
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"decl %1\n"
"1:\tlodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b"
: /* no output */
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff):"si","di","ax","cx");
return dest;
}
#define __HAVE_ARCH_STRNCAT
extern inline char * strncat(char * dest,const char * src,size_t count)
{
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"decl %1\n\t"
"movl %4,%3\n"
"1:\tdecl %3\n\t"
"js 2f\n\t"
"lodsb\n\t"
"stosb\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n"
"2:\txorl %2,%2\n\t"
"stosb"
: /* no output */
:"S" (src),"D" (dest),"a" (0),"c" (0xffffffff),"g" (count)
:"si","di","ax","cx","memory");
return dest;
}
#define __HAVE_ARCH_STRCMP
extern inline int strcmp(const char * cs,const char * ct)
{
register int __res;
__asm__ __volatile__(
"cld\n"
"1:\tlodsb\n\t"
"scasb\n\t"
"jne 2f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"jmp 3f\n"
"2:\tsbbl %%eax,%%eax\n\t"
"orb $1,%%eax\n"
"3:"
:"=a" (__res):"S" (cs),"D" (ct):"si","di");
return __res;
}
#define __HAVE_ARCH_STRNCMP
extern inline int strncmp(const char * cs,const char * ct,size_t count)
{
register int __res;
__asm__ __volatile__(
"cld\n"
"1:\tdecl %3\n\t"
"js 2f\n\t"
"lodsb\n\t"
"scasb\n\t"
"jne 3f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n"
"2:\txorl %%eax,%%eax\n\t"
"jmp 4f\n"
"3:\tsbbl %%eax,%%eax\n\t"
"orb $1,%%al\n"
"4:"
:"=a" (__res):"S" (cs),"D" (ct),"c" (count):"si","di","cx");
return __res;
}
#define __HAVE_ARCH_STRCHR
extern inline char * strchr(const char * s, int c)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movb %%al,%%ah\n"
"1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t"
"je 2f\n\t"
"testb %%al,%%al\n\t"
"jne 1b\n\t"
"movl $1,%1\n"
"2:\tmovl %1,%0\n\t"
"decl %0"
:"=a" (__res):"S" (s),"0" (c):"si");
return __res;
}
#define __HAVE_ARCH_STRRCHR
extern inline char * strrchr(const char * s, int c)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movb %%al,%%ah\n"
"1:\tlodsb\n\t"
"cmpb %%ah,%%al\n\t"
"jne 2f\n\t"
"leal -1(%%esi),%0\n"
"2:\ttestb %%al,%%al\n\t"
"jne 1b"
:"=d" (__res):"0" (0),"S" (s),"a" (c):"ax","si");
return __res;
}
#define __HAVE_ARCH_STRSPN
extern inline size_t strspn(const char * cs, const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"je 1b\n"
"2:\tdecl %0"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res-cs;
}
#define __HAVE_ARCH_STRCSPN
extern inline size_t strcspn(const char * cs, const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 1b\n"
"2:\tdecl %0"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res-cs;
}
#define __HAVE_ARCH_STRPBRK
extern inline char * strpbrk(const char * cs,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"movl %%ecx,%%edx\n"
"1:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 2f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 1b\n\t"
"decl %0\n\t"
"jmp 3f\n"
"2:\txorl %0,%0\n"
"3:"
:"=S" (__res):"a" (0),"c" (0xffffffff),"0" (cs),"g" (ct)
:"ax","cx","dx","di");
return __res;
}
#define __HAVE_ARCH_STRSTR
extern inline char * strstr(const char * cs,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"cld\n\t" \
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t" /* NOTE! This also sets Z if searchstring='' */
"movl %%ecx,%%edx\n"
"1:\tmovl %4,%%edi\n\t"
"movl %%esi,%%eax\n\t"
"movl %%edx,%%ecx\n\t"
"repe\n\t"
"cmpsb\n\t"
"je 2f\n\t" /* also works for empty string, see above */
"xchgl %%eax,%%esi\n\t"
"incl %%esi\n\t"
"cmpb $0,-1(%%eax)\n\t"
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"2:"
:"=a" (__res):"0" (0),"c" (0xffffffff),"S" (cs),"g" (ct)
:"cx","dx","di","si");
return __res;
}
#define __HAVE_ARCH_STRLEN
extern inline size_t strlen(const char * s)
{
register int __res;
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"notl %0\n\t"
"decl %0"
:"=c" (__res):"D" (s),"a" (0),"0" (0xffffffff):"di");
return __res;
}
#define __HAVE_ARCH_STRTOK
extern inline char * strtok(char * s,const char * ct)
{
register char * __res;
__asm__ __volatile__(
"testl %1,%1\n\t"
"jne 1f\n\t"
"testl %0,%0\n\t"
"je 8f\n\t"
"movl %0,%1\n"
"1:\txorl %0,%0\n\t"
"movl $-1,%%ecx\n\t"
"xorl %%eax,%%eax\n\t"
"cld\n\t"
"movl %4,%%edi\n\t"
"repne\n\t"
"scasb\n\t"
"notl %%ecx\n\t"
"decl %%ecx\n\t"
"je 7f\n\t" /* empty delimiter-string */
"movl %%ecx,%%edx\n"
"2:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 7f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"je 2b\n\t"
"decl %1\n\t"
"cmpb $0,(%1)\n\t"
"je 7f\n\t"
"movl %1,%0\n"
"3:\tlodsb\n\t"
"testb %%al,%%al\n\t"
"je 5f\n\t"
"movl %4,%%edi\n\t"
"movl %%edx,%%ecx\n\t"
"repne\n\t"
"scasb\n\t"
"jne 3b\n\t"
"decl %1\n\t"
"cmpb $0,(%1)\n\t"
"je 5f\n\t"
"movb $0,(%1)\n\t"
"incl %1\n\t"
"jmp 6f\n"
"5:\txorl %1,%1\n"
"6:\tcmpb $0,(%0)\n\t"
"jne 7f\n\t"
"xorl %0,%0\n"
"7:\ttestl %0,%0\n\t"
"jne 8f\n\t"
"movl %0,%1\n"
"8:"
:"=b" (__res),"=S" (___strtok)
:"0" (___strtok),"1" (s),"g" (ct)
:"ax","cx","dx","di","memory");
return __res;
}
#define __HAVE_ARCH_STRICMP
extern inline int stricmp(const char* cs,const char * ct)
{
register int __res;
__asm__ __volatile__(
"cld\n"
"1:\tmovb (%%esi), %%eax\n\t"
"movb (%%edi), %%dl \n\t"
"cmpb $0x5A, %%al\n\t"
"ja 2f\t\n"
"cmpb $0x40, %%al\t\n"
"jbe 2f\t\n"
"addb $0x20, %%al\t\n"
"2:\t cmpb $0x5A, %%dl\t\n"
"ja 3f\t\n"
"cmpb $0x40, %%dl\t\n"
"jbe 3f\t\n"
"addb $0x20, %%dl\t\n"
"3:\t inc %%esi\t\n"
"inc %%edi\t\n"
"cmpb %%al, %%dl\t\n"
"jne 4f\n\t"
"cmpb $00, %%al\n\t"
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"jmp 5f\n"
"4:\tsbbl %%eax,%%eax\n\t"
"orb $1,%%eax\n"
"5:"
:"=a" (__res):"S" (cs),"D" (ct):"si","di");
return __res;
}
#define __HAVE_ARCH_STRNICMP
extern inline int strnicmp(const char* cs,const char * ct, size_t count)
{
register int __res;
__asm__ __volatile__(
"cld\n"
"1:\t decl %3\n\t"
"js 6f\n\t"
"movb (%%esi), %%al\n\t"
"movb (%%edi), %%dl \n\t"
"cmpb $0x5A, %%al\n\t"
"ja 2f\t\n"
"cmpb $0x40, %%al\t\n"
"jbe 2f\t\n"
"addb $0x20, %%al\t\n"
"2:\t cmpb $0x5A, %%dl\t\n"
"ja 3f\t\n"
"cmpb $0x40, %%dl\t\n"
"jbe 3f\t\n"
"addb $0x20, %%dl\t\n"
"3:\t inc %%esi\t\n"
"inc %%edi\t\n"
"cmpb %%al, %%dl\t\n"
"jne 4f\n\t"
"cmpb $00, %%al\n\t"
"jne 1b\n\t"
"6:xorl %%eax,%%eax\n\t"
"jmp 5f\n"
"4:\tsbbl %%eax,%%eax\n\t"
"orb $1,%%eax\n"
"5:"
:"=a" (__res):"S" (cs),"D" (ct), "c" (count):"si","di", "cx");
return __res;
}
extern inline void * __memcpy(void * to, const void * from, size_t n)
{
__asm__ __volatile__(
"cld\n\t"
"rep ; movsl\n\t"
"testb $2,%b1\n\t"
"je 1f\n\t"
"movsw\n"
"1:\ttestb $1,%b1\n\t"
"je 2f\n\t"
"movsb\n"
"2:"
: /* no output */
:"c" (n/4), "q" (n),"D" ((long) to),"S" ((long) from)
: "cx","di","si","memory");
return (to);
}
/*
* This looks horribly ugly, but the compiler can optimize it totally,
* as the count is constant.
*/
extern inline void * __constant_memcpy(void * to, const void * from, size_t n)
{
switch (n) {
case 0:
return to;
case 1:
*(unsigned char *)to = *(const unsigned char *)from;
return to;
case 2:
*(unsigned short *)to = *(const unsigned short *)from;
return to;
case 3:
*(unsigned short *)to = *(const unsigned short *)from;
*(2+(unsigned char *)to) = *(2+(const unsigned char *)from);
return to;
case 4:
*(unsigned long *)to = *(const unsigned long *)from;
return to;
case 8:
*(unsigned long *)to = *(const unsigned long *)from;
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
return to;
case 12:
*(unsigned long *)to = *(const unsigned long *)from;
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
return to;
case 16:
*(unsigned long *)to = *(const unsigned long *)from;
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
*(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
return to;
case 20:
*(unsigned long *)to = *(const unsigned long *)from;
*(1+(unsigned long *)to) = *(1+(const unsigned long *)from);
*(2+(unsigned long *)to) = *(2+(const unsigned long *)from);
*(3+(unsigned long *)to) = *(3+(const unsigned long *)from);
*(4+(unsigned long *)to) = *(4+(const unsigned long *)from);
return to;
}
#define COMMON(x) \
__asm__("cld\n\t" \
"rep ; movsl" \
x \
: /* no outputs */ \
: "c" (n/4),"D" ((long) to),"S" ((long) from) \
: "cx","di","si","memory");
switch (n % 4) {
case 0: COMMON(""); return to;
case 1: COMMON("\n\tmovsb"); return to;
case 2: COMMON("\n\tmovsw"); return to;
case 3: COMMON("\n\tmovsw\n\tmovsb"); return to;
}
#undef COMMON
}
#define __HAVE_ARCH_MEMCPY
#define memcpy(t, f, n) \
(__builtin_constant_p(n) ? \
__constant_memcpy((t),(f),(n)) : \
__memcpy((t),(f),(n)))
#define __HAVE_ARCH_MEMMOVE
extern inline void * memmove(void * dest,const void * src, size_t n)
{
if (dest<src)
__asm__ __volatile__(
"cld\n\t"
"rep\n\t"
"movsb"
: /* no output */
:"c" (n),"S" (src),"D" (dest)
:"cx","si","di");
else
__asm__ __volatile__(
"std\n\t"
"rep\n\t"
"movsb\n\t"
"cld"
: /* no output */
:"c" (n),
"S" (n-1+(const char *)src),
"D" (n-1+(char *)dest)
:"cx","si","di","memory");
return dest;
}
#define memcmp __builtin_memcmp
#define __HAVE_ARCH_MEMCHR
extern inline void * memchr(const void * cs,int c,size_t count)
{
register void * __res;
if (!count)
return NULL;
__asm__ __volatile__(
"cld\n\t"
"repne\n\t"
"scasb\n\t"
"je 1f\n\t"
"movl $1,%0\n"
"1:\tdecl %0"
:"=D" (__res):"a" (c),"D" (cs),"c" (count)
:"cx");
return __res;
}
extern inline void * __memset_generic(void * s, char c,size_t count)
{
__asm__ __volatile__(
"cld\n\t"
"rep\n\t"
"stosb"
: /* no output */
:"a" (c),"D" (s),"c" (count)
:"cx","di","memory");
return s;
}
/* we might want to write optimized versions of these later */
#define __constant_count_memset(s,c,count) __memset_generic((s),(c),(count))
/*
* memset(x,0,y) is a reasonably common thing to do, so we want to fill
* things 32 bits at a time even when we don't know the size of the
* area at compile-time..
*/
extern inline void * __constant_c_memset(void * s, unsigned long c, size_t count)
{
__asm__ __volatile__(
"cld\n\t"
"rep ; stosl\n\t"
"testb $2,%b1\n\t"
"je 1f\n\t"
"stosw\n"
"1:\ttestb $1,%b1\n\t"
"je 2f\n\t"
"stosb\n"
"2:"
: /* no output */
:"a" (c), "q" (count), "c" (count/4), "D" ((long) s)
:"cx","di","memory");
return (s);
}
/* Added by Gertjan van Wingerde to make minix and sysv module work */
#define __HAVE_ARCH_STRNLEN
extern inline size_t strnlen(const char * s, size_t count)
{
register int __res;
__asm__ __volatile__(
"movl %1,%0\n\t"
"jmp 2f\n"
"1:\tcmpb $0,(%0)\n\t"
"je 3f\n\t"
"incl %0\n"
"2:\tdecl %2\n\t"
"cmpl $-1,%2\n\t"
"jne 1b\n"
"3:\tsubl %1,%0"
:"=a" (__res)
:"c" (s),"d" (count)
:"dx");
return __res;
}
/* end of additional stuff */
/*
* This looks horribly ugly, but the compiler can optimize it totally,
* as we by now know that both pattern and count is constant..
*/
extern inline void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
{
switch (count) {
case 0:
return s;
case 1:
*(unsigned char *)s = pattern;
return s;
case 2:
*(unsigned short *)s = pattern;
return s;
case 3:
*(unsigned short *)s = pattern;
*(2+(unsigned char *)s) = pattern;
return s;
case 4:
*(unsigned long *)s = pattern;
return s;
}
#define COMMON(x) \
__asm__("cld\n\t" \
"rep ; stosl" \
x \
: /* no outputs */ \
: "a" (pattern),"c" (count/4),"D" ((long) s) \
: "cx","di","memory")
switch (count % 4) {
case 0: COMMON(""); return s;
case 1: COMMON("\n\tstosb"); return s;
case 2: COMMON("\n\tstosw"); return s;
case 3: COMMON("\n\tstosw\n\tstosb"); return s;
}
#undef COMMON
}
#define __constant_c_x_memset(s, c, count) \
(__builtin_constant_p(count) ? \
__constant_c_and_count_memset((s),(c),(count)) : \
__constant_c_memset((s),(c),(count)))
#define __memset(s, c, count) \
(__builtin_constant_p(count) ? \
__constant_count_memset((s),(c),(count)) : \
__memset_generic((s),(c),(count)))
#define __HAVE_ARCH_MEMSET
#define memset(s, c, count) \
(__builtin_constant_p(c) ? \
__constant_c_x_memset((s),(0x01010101UL*(unsigned char)c),(count)) : \
__memset((s),(c),(count)))
/*
* find the first occurrence of byte 'c', or 1 past the area if none
*/
#define __HAVE_ARCH_MEMSCAN
extern inline void * memscan(void * addr, int c, size_t size)
{
if (!size)
return addr;
__asm__("cld
repnz; scasb
jnz 1f
dec %%edi
1: "
: "=D" (addr), "=c" (size)
: "0" (addr), "1" (size), "a" (c));
return addr;
}
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* _STRING_H_ */
#endif
#endif

View file

@ -1,26 +0,0 @@
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#ifndef __DJ_sys_djtypes_h_
#define __DJ_sys_djtypes_h_
#define __DJ_clock_t typedef int clock_t;
#define __DJ_gid_t typedef int gid_t;
#define __DJ_off_t typedef int off_t;
#define __DJ_pid_t typedef int pid_t;
#define __DJ_size_t typedef long unsigned int size_t;
#define __DJ_ssize_t typedef int ssize_t;
#define __DJ_time_t typedef unsigned int time_t;
#define __DJ_uid_t typedef int uid_t;
#define __DJ_va_list typedef void *va_list;
#if defined(__cplusplus) && ( (__GNUC_MINOR__ >= 8 && __GNUC__ == 2 ) || __GNUC__ >= 3 )
/* wchar_t is now a keyword in C++ */
#define __DJ_wchar_t
#else
/* but remains a typedef in C */
#define __DJ_wchar_t typedef int wchar_t;
#endif
#define __DJ_wint_t typedef int wint_t;
#endif

View file

@ -0,0 +1,8 @@
/*
* This file is part of the Mingw32 package.
*
* This fcntl.h maps to the root fcntl.h
*/
#ifndef __STRICT_ANSI__
#include <fcntl.h>
#endif

View file

@ -0,0 +1,9 @@
/*
* This file is part of the Mingw32 package.
*
* This file.h maps to the root fcntl.h
* TODO?
*/
#ifndef __STRICT_ANSI__
#include <fcntl.h>
#endif

View file

@ -0,0 +1,38 @@
/*
* locking.h
*
* Constants for the mode parameter of the locking function.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:07 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _LOCKING_H_
#define _LOCKING_H_
/*
* TODO: Define LK_... constants.
*/
#endif /* Not _LOCKING_H_ */
#endif /* Not __STRICT_ANSI__ */

View file

@ -1,128 +1,114 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_sys_stat_h_
#define __dj_include_sys_stat_h_
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
/*
* stat.h
*
* Symbolic constants for opening and creating files, also stat, fstat and
* chmod functions.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:07 $
*
*/
#ifndef __STRICT_ANSI__
#define S_ISBLK(m) (((m) & 0xf000) == 0x1000)
#define S_ISCHR(m) (((m) & 0xf000) == 0x2000)
#define S_ISDIR(m) (((m) & 0xf000) == 0x3000)
#define S_ISFIFO(m) (((m) & 0xf000) == 0x4000)
#define S_ISREG(m) (((m) & 0xf000) == 0x0000)
#ifndef _STAT_H_
#define _STAT_H_
#define S_ISUID 0x80000000
#define S_ISGID 0x40000000
#include <crtdll/sys/types.h>
#define S_IRUSR 00400
#define S_IRGRP 00040
#define S_IROTH 00004
#define S_IWUSR 00200
#define S_IWGRP 00020
#define S_IWOTH 00002
#define S_IXUSR 00100
#define S_IXGRP 00010
#define S_IXOTH 00001
#define S_IRWXU 00700
#define S_IRWXG 00070
#define S_IRWXO 00007
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#include <internal/types.h>
//#include <sys/djtypes.h>
__DJ_time_t
#undef __DJ_time_t
#define __DJ_time_t
/*
* Constants for the stat st_mode member.
*/
#define S_IFIFO 0x1000 /* FIFO */
#define S_IFCHR 0x2000 /* Character */
#define S_IFBLK 0x3000 /* Block */
#define S_IFDIR 0x4000 /* Directory */
#define S_IFREG 0x8000 /* Regular */
struct stat {
time_t st_atime;
time_t st_ctime;
dev_t st_dev;
gid_t st_gid;
ino_t st_ino;
mode_t st_mode;
time_t st_mtime;
nlink_t st_nlink;
off_t st_size;
off_t st_blksize;
uid_t st_uid;
dev_t st_rdev; /* unused */
#define S_IFMT 0xF000 /* File type mask */
#define S_IEXEC 0x0040
#define S_IWRITE 0x0080
#define S_IREAD 0x0100
#define S_ISDIR(m) ((m) & S_IFDIR)
#define S_ISFIFO(m) ((m) & S_IFIFO)
#define S_ISCHR(m) ((m) & S_IFCHR)
#define S_ISBLK(m) ((m) & S_IFBLK)
#define S_ISREG(m) ((m) & S_IFREG)
#define S_IRWXU (S_IREAD | S_IWRITE | S_IEXEC)
#define S_IXUSR S_IEXEC
#define S_IWUSR S_IWRITE
#define S_IRUSR S_IREAD
#define _S_IEXEC S_IEXEC
#define _S_IREAD S_IREAD
#define _S_IWRITE S_IWRITE
/*
* The structure manipulated and returned by stat and fstat.
*
* NOTE: If called on a directory the values in the time fields are not only
* invalid, they will cause localtime et. al. to return NULL. And calling
* asctime with a NULL pointer causes an Invalid Page Fault. So watch it!
*/
struct stat
{
short st_dev; /* Equivalent to drive number 0=A 1=B ... */
short st_ino; /* Always zero ? */
short st_mode; /* See above constants */
short st_nlink; /* Number of links. */
int st_uid; /* User: Maybe significant on NT ? */
short st_gid; /* Group: Ditto */
short st_rdev; /* Seems useless (not even filled in) */
long st_size; /* File size in bytes */
time_t st_atime; /* Accessed date (always 00:00 hrs local
* on FAT) */
time_t st_mtime; /* Modified time */
time_t st_ctime; /* Creation time */
};
int chmod(const char *_path, mode_t _mode);
int fstat(int _fildes, struct stat *_buf);
//int mkdir(const char *_path, mode_t _mode);
int mkfifo(const char *_path, mode_t _mode);
int stat(const char *_path, struct stat *_buf);
mode_t umask(mode_t _cmask);
#ifndef _POSIX_SOURCE
int _fstat (int nHandle, struct stat* pstat);
int _chmod (const char* szPath, int nMode);
int _stat (const char* szPath, struct stat* pstat);
/* POSIX.1 doesn't mention these at all */
#define S_IFMT 0xf000
#ifndef _NO_OLDNAMES
#define S_IFREG 0x0000
#define S_IFBLK 0x1000
#define S_IFCHR 0x2000
#define S_IFDIR 0x3000
#define S_IFIFO 0x4000
#define S_IFFIFO S_IFIFO
/* These functions live in liboldnames.a. */
int fstat (int nHandle, struct stat* pstat);
int chmod (const char* szPath, int nMode);
int stat (const char* szPath, struct stat* pstat);
#define S_IFLABEL 0x5000
#define S_ISLABEL(m) (((m) & 0xf000) == 0x5000)
#endif /* Not _NO_OLDNAMES */
void _fixpath(const char *, char *);
unsigned short _get_magic(const char *, int);
int _is_executable(const char *, int, const char *);
int mknod(const char *_path, mode_t _mode, dev_t _dev);
char * _truename(const char *, char *);
/* Bit-mapped variable _djstat_flags describes what expensive
f?stat() features our application needs. If you don't need a
feature, set its bit in the variable. By default, all the
bits are cleared (i.e., you get the most expensive code). */
#define _STAT_INODE 1 /* should we bother getting inode numbers? */
#define _STAT_EXEC_EXT 2 /* get execute bits from file extension? */
#define _STAT_EXEC_MAGIC 4 /* get execute bits from magic signature? */
#define _STAT_DIRSIZE 8 /* compute directory size? */
#define _STAT_ROOT_TIME 0x10 /* try to get root dir time stamp? */
#define _STAT_WRITEBIT 0x20 /* fstat() needs write bit? */
extern unsigned short _djstat_flags;
/* Bit-mapped variable _djstat_fail_bits describes which individual
undocumented features f?stat() failed to use. To get a human-
readable description of the bits, call _djstat_describe_lossage(). */
#define _STFAIL_SDA 1 /* Get SDA call failed */
#define _STFAIL_OSVER 2 /* Unsupported DOS version */
#define _STFAIL_BADSDA 4 /* Bad pointer to SDA */
#define _STFAIL_TRUENAME 8 /* _truename() failed */
#define _STFAIL_HASH 0x10 /* inode defaults to hashing */
#define _STFAIL_LABEL 0x20 /* Root dir, but no volume label */
#define _STFAIL_DCOUNT 0x40 /* dirent_count ridiculously large */
#define _STFAIL_WRITEBIT 0x80 /* fstat() failed to get write access bit */
#define _STFAIL_DEVNO 0x100 /* fstat() failed to get device number */
#define _STFAIL_BADSFT 0x200 /* SFT entry found, but can't be trusted */
#define _STFAIL_SFTIDX 0x400 /* bad SFT index in JFT */
#define _STFAIL_SFTNF 0x800 /* file entry not found in SFT array */
extern unsigned short _djstat_fail_bits;
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_sys_stat_h_ */
#endif /* Not _STAT_H_ */
#endif /* Not __STRICT_ANSI__ */

View file

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

View file

@ -0,0 +1,60 @@
/*
* timeb.h
*
* Support for the UNIX System V ftime system call.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:07 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _TIMEB_H_
#define _TIMEB_H_
#ifdef __cplusplus
extern "C" {
#endif
/*
* TODO: Structure not tested.
*/
struct timeb
{
long time;
short millitm;
short _timezone;
short dstflag;
};
/* TODO: Not tested. */
void _ftime (struct timeb* timebBuffer);
#ifndef _NO_OLDNAMES
void ftime (struct timeb* timebBuffer);
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
}
#endif
#endif /* Not _TIMEB_H_ */
#endif /* Not __STRICT_ANSI__ */

View file

@ -1,67 +1,77 @@
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_sys_types_h_
#define __dj_include_sys_types_h_
/*
* types.h
*
* The definition of constants, data types and global variables.
*
* 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 WARRENTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warrenties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:07 $
*
*/
#ifdef __cplusplus
extern "C" {
#ifndef _TYPES_H_
#define _TYPES_H_
#ifndef _TIME_T_
#define _TIME_T_
typedef long time_t;
#endif
#ifndef __dj_ENFORCE_ANSI_FREESTANDING
#ifndef __STRICT_ANSI__
#ifndef __STRICT_ANSI__
#include <sys/djtypes.h>
typedef int dev_t;
typedef int ino_t;
typedef int mode_t;
typedef int nlink_t;
#ifndef _OFF_T_DEFINED
typedef long _off_t;
__DJ_gid_t
#undef __DJ_gid_t
#define __DJ_gid_t
__DJ_off_t
#undef __DJ_off_t
#define __DJ_off_t
__DJ_pid_t
#undef __DJ_pid_t
#define __DJ_pid_t
//__DJ_size_t
#undef __DJ_size_t
#define __DJ_size_t
__DJ_ssize_t
#undef __DJ_ssize_t
#define __DJ_ssize_t
__DJ_uid_t
#undef __DJ_uid_t
#define __DJ_uid_t
#ifndef _POSIX_SOURCE
/* Allow including program to override. */
#ifndef FD_SETSIZE
#define FD_SETSIZE 256
#ifndef _NO_OLDNAMES
#define off_t _off_t
#endif
typedef struct fd_set {
unsigned char fd_bits [((FD_SETSIZE) + 7) / 8];
} fd_set;
#define _OFF_T_DEFINED
#define FD_SET(n, p) ((p)->fd_bits[(n) / 8] |= (1 << ((n) & 7)))
#define FD_CLR(n, p) ((p)->fd_bits[(n) / 8] &= ~(1 << ((n) & 7)))
#define FD_ISSET(n, p) ((p)->fd_bits[(n) / 8] & (1 << ((n) & 7)))
#define FD_ZERO(p) memset ((void *)(p), 0, sizeof (*(p)))
#endif /* Not _OFF_T_DEFINED */
#endif /* !_POSIX_SOURCE */
#endif /* !__STRICT_ANSI__ */
#endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifndef _DEV_T_DEFINED
typedef short _dev_t;
#ifdef __cplusplus
}
#ifndef _NO_OLDNAMES
#define dev_t _dev_t
#endif
#endif /* !__dj_include_sys_types_h_ */
#define _DEV_T_DEFINED
#endif /* Not _DEV_T_DEFINED */
#ifndef _INO_T_DEFINED
typedef short _ino_t;
#ifndef _NO_OLDNAMES
#define ino_t _ino_t
#endif
#define _INO_T_DEFINED
#endif /* Not _INO_T_DEFINED */
#endif /* Not __STRICT_ANSI__ */
#endif /* Not _TYPES_H_ */

View file

@ -0,0 +1,9 @@
/*
* This file is part of the Mingw32 package.
*
* unistd.h maps (roughly) to io.h
*/
#ifndef __STRICT_ANSI__
#include <io.h>
#endif

View file

@ -0,0 +1,75 @@
/*
* utime.h
*
* Support for the utime function.
*
* This file is part of the Mingw32 package.
*
* Contributors:
* Created by Colin Peters <colin@bird.fu.is.saga-u.ac.jp>
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* $Revision: 1.1 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:07 $
*
*/
#ifndef __STRICT_ANSI__
#ifndef _UTIME_H_
#define _UTIME_H_
#define __need_wchar_t
#define __need_size_t
#include <stddef.h>
#include <crtdll/sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
/*
* Structure used by _utime function.
*/
struct _utimbuf
{
time_t actime; /* Access time */
time_t modtime; /* Modification time */
};
int _utime (const char* szFileName, struct _utimbuf* pTimes);
int _futime (int nHandle, struct _utimbuf *pTimes);
/* Wide character version */
int _wutime (const wchar_t *szFileName, struct _utimbuf *times);
#ifndef _NO_OLDNAMES
/* NOTE: Must be the same as _utimbuf above. */
struct utimbuf
{
time_t actime;
time_t modtime;
};
int utime (const char* szFileName, struct utimbuf* pTimes);
#endif /* Not _NO_OLDNAMES */
#ifdef __cplusplus
}
#endif
#endif /* Not _UTIME_H_ */
#endif /* Not __STRICT_ANSI__ */

View file

@ -0,0 +1,231 @@
/*
* tchar.h
*
* Unicode mapping layer for the standard C library. By including this
* file and using the 't' names for string functions
* (eg. _tprintf) you can make code which can be easily adapted to both
* Unicode and non-unicode environments. In a unicode enabled compile define
* _UNICODE before including tchar.h, otherwise the standard non-unicode
* library functions will be used.
*
* Note that you still need to include string.h or stdlib.h etc. to define
* the appropriate functions. Also note that there are several defines
* included for non-ANSI functions which are commonly available (but using
* the convention of prepending an underscore to non-ANSI library function
* 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: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
#ifndef _TCHAR_H_
#define _TCHAR_H_
/*
* NOTE: This tests _UNICODE, which is different from the UNICODE define
* used to differentiate Win32 API calls.
*/
#ifdef _UNICODE
/*
* Use TCHAR instead of char or wchar_t. It will be appropriately translated
* if _UNICODE is correctly defined (or not).
*/
#ifndef _TCHAR_DEFINED
#ifndef RC_INVOKED
typedef wchar_t TCHAR;
#endif /* Not RC_INVOKED */
#define _TCHAR_DEFINED
#endif
/*
* Enclose constant strings and literal characters in the _TEXT and _T macro to make
* them unicode constant strings when _UNICODE is defined.
*/
#define _TEXT(x) L ## x
#define _T(x) L ## x
/*
* Unicode functions
*/
#define _tprintf wprintf
#define _ftprintf fwprintf
#define _stprintf swprintf
#define _sntprintf _snwprintf
#define _vtprintf vwprintf
#define _vftprintf vfwprintf
#define _vstprintf vswprintf
#define _vsntprintf _vsnwprintf
#define _tscanf wscanf
#define _ftscanf fwscanf
#define _stscanf swscanf
#define _fgettc fgetwc
#define _fgettchar _fgetwchar
#define _fgetts fgetws
#define _fputtc fputwc
#define _fputtchar _fputwchar
#define _fputts fputws
#define _gettc getwc
#define _getts getws
#define _puttc putwc
#define _putts putws
#define _ungettc ungetwc
#define _tcstod wcstod
#define _tcstol wcstol
#define _tcstoul wcstoul
#define _tcscat wcscat
#define _tcschr wcschr
#define _tcscmp wcscmp
#define _tcscpy wcscpy
#define _tcscspn wcscspn
#define _tcslen wcslen
#define _tcsncat wcsncat
#define _tcsncmp wcsncmp
#define _tcsncpy wcsncpy
#define _tcspbrk wcspbrk
#define _tcsrchr wcsrchr
#define _tcsspn wcsspn
#define _tcsstr wcsstr
#define _tcstok wcstok
#define _tcsdup _wcsdup
#define _tcsicmp _wcsicmp
#define _tcsnicmp _wcsnicmp
#define _tcsnset _wcsnset
#define _tcsrev _wcsrev
#define _tcsset _wcsset
#define _tcslwr _wcslwr
#define _tcsupr _wcsupr
#define _tcsxfrm wcsxfrm
#define _tcscoll wcscoll
#define _tcsicoll _wcsicoll
#define _istalpha iswalpha
#define _istupper iswupper
#define _istlower iswlower
#define _istdigit iswdigit
#define _istxdigit iswxdigit
#define _istspace iswspace
#define _istpunct iswpunct
#define _istalnum iswalnum
#define _istprint iswprint
#define _istgraph iswgraph
#define _istcntrl iswcntrl
#define _istascii iswascii
#define _totupper towupper
#define _totlower towlower
#define _ttoi _wtoi
#define _tcsftime wcsftime
#else /* Not _UNICODE */
/*
* TCHAR, the type you should use instead of char.
*/
#ifndef _TCHAR_DEFINED
#ifndef RC_INVOKED
typedef char TCHAR;
#endif
#define _TCHAR_DEFINED
#endif
/*
* Enclose constant strings and characters in the _TEXT and _T macro.
*/
#define _TEXT(x) x
#define _T(x) x
/*
* Non-unicode (standard) functions
*/
#define _tprintf printf
#define _ftprintf fprintf
#define _stprintf sprintf
#define _sntprintf _snprintf
#define _vtprintf vprintf
#define _vftprintf vfprintf
#define _vstprintf vsprintf
#define _vsntprintf _vsnprintf
#define _tscanf scanf
#define _ftscanf fscanf
#define _stscanf sscanf
#define _fgettc fgetc
#define _fgettchar _fgetchar
#define _fgetts fgets
#define _fputtc fputc
#define _fputtchar _fputchar
#define _fputts fputs
#define _gettc getc
#define _getts gets
#define _puttc putc
#define _putts puts
#define _ungettc ungetc
#define _tcstod strtod
#define _tcstol strtol
#define _tcstoul strtoul
#define _tcscat strcat
#define _tcschr strchr
#define _tcscmp strcmp
#define _tcscpy strcpy
#define _tcscspn strcspn
#define _tcslen strlen
#define _tcsncat strncat
#define _tcsncmp strncmp
#define _tcsncpy strncpy
#define _tcspbrk strpbrk
#define _tcsrchr strrchr
#define _tcsspn strspn
#define _tcsstr strstr
#define _tcstok strtok
#define _tcsdup _strdup
#define _tcsicmp _stricmp
#define _tcsnicmp _strnicmp
#define _tcsnset _strnset
#define _tcsrev _strrev
#define _tcsset _strset
#define _tcslwr _strlwr
#define _tcsupr _strupr
#define _tcsxfrm strxfrm
#define _tcscoll strcoll
#define _tcsicoll _stricoll
#define _istalpha isalpha
#define _istupper isupper
#define _istlower islower
#define _istdigit isdigit
#define _istxdigit isxdigit
#define _istspace isspace
#define _istpunct ispunct
#define _istalnum isalnum
#define _istprint isprint
#define _istgraph isgraph
#define _istcntrl iscntrl
#define _istascii isascii
#define _totupper toupper
#define _totlower tolower
#define _ttoi atoi
#define _tcsftime strftime
#endif /* Not _UNICODE */
#endif /* Not _TCHAR_H_ */

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.2 $
* $Author: rex $
* $Date: 1999/03/19 05:55:10 $
* $Revision: 1.3 $
* $Author: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
/* Appropriated for Reactos Crtdll by Ariadne */
@ -29,7 +29,7 @@
#define __need_wchar_t
#define __need_size_t
#include <stddef.h>
#include <crtdll/stddef.h>
#ifdef __cplusplus
extern "C" {
@ -53,7 +53,7 @@ typedef long clock_t;
/*
* Need a definition of time_t.
*/
#include <sys/types.h>
#include <crtdll/sys/types.h>
/*
* A type for storing the current time and date. This is the number of

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: ariadne $
* $Date: 1999/04/02 21:42:06 $
*
*/
#include <crtdll/ctype.h>
#include <crtdll/stdio.h>
#include <crtdll/stdlib.h>
#include <crtdll/string.h>
#include <crtdll/time.h>

View file

@ -1,13 +1,13 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <assert.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include <crtdll/assert.h>
#include <crtdll/stdio.h>
#include <crtdll/stdlib.h>
void _assert(const char *msg, const char *file, int line)
void _assert(const char *msg, const char *file, int line)
{
/* Assertion failed at foo.c line 45: x<y */
fprintf(stderr, "Assertion failed at %s line %d: %s\n", file, line, msg);
raise(SIGABRT);
// raise(SIGABRT);
exit(1);
for(;;);
}

View file

@ -1,4 +1,4 @@
#include <conio.h>
#include <crtdll/conio.h>
char *

View file

@ -1,5 +1,5 @@
#include <stdio.h>
#include <conio.h>
#include <crtdll/stdio.h>
#include <crtdll/conio.h>
int
cprintf(const char *fmt, ...)

View file

@ -8,10 +8,10 @@
* 28/12/98: Created
*/
#include <windows.h>
#include <conio.h>
#include <string.h>
#include <crtdll/conio.h>
#include <crtdll/string.h>
int cputs(const char *_str)
int _cputs(const char *_str)
{
int len = strlen(_str);
int written = 0;

View file

@ -1,4 +1,4 @@
#include <conio.h>
#include <crtdll/conio.h>
/*

View file

@ -7,10 +7,10 @@
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <conio.h>
#include <stdio.h>
#include <windows.h>
#include <io.h>
#include <crtdll/conio.h>
#include <crtdll/stdio.h>
#include <crtdll/io.h>
extern int char_avail;
extern int ungot_char;

View file

@ -10,8 +10,8 @@
* 28/12/98: Created
*/
#include <process.h>
#include <conio.h>
#include <crtdll/process.h>
#include <crtdll/conio.h>
extern int char_avail;

View file

@ -7,7 +7,7 @@
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <conio.h>
#include <crtdll/conio.h>
#include <windows.h>
int _putch( int c )

View file

@ -10,7 +10,7 @@
* 28/12/98: Created
*/
#include <process.h>
#include <crtdll/process.h>
#define EOF -1
int char_avail = 0;

View file

@ -17,9 +17,9 @@
; DISCLAMED. This includes but is not limited to warrenties of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
;
; $Revision: 1.3 $
; $Author: dwelch $
; $Date: 1999/01/17 17:27:24 $
; $Revision: 1.4 $
; $Author: ariadne $
; $Date: 1999/04/02 21:43:45 $
;
; These three functions appear to be name mangled in some way, so GCC is
; probably not going to be able to use them in any case.
@ -28,6 +28,13 @@
; ??3@YAXPAX@Z
; ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z
;
; Added functionallt equivalent placeholders:
;
; __builtin_new
; __builtin_delete
; _set_new_handler__FPFUi_i
;
;
; These are functions for which I have not yet written prototypes or
; otherwise set up (they are still included below though unlike those
; first three).
@ -193,6 +200,9 @@
; _wtol
;
EXPORTS
__builtin_new
__builtin_delete
_set_new_handler__FPFUi_i
_CIacos
_CIasin
_CIatan

View file

@ -7,7 +7,7 @@
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <ctype.h>
#include <crtdll/ctype.h>
#undef isalnum
@ -17,7 +17,7 @@ int isalnum(int c)
}
#undef iswalnum
int iswalnum(int c)
int iswalnum(wint_t c)
{
return iswctype(c,_ALPHA | _DIGIT);
}

View file

@ -8,7 +8,7 @@
* 28/12/98: Created
*/
#include <ctype.h>
#include <crtdll/ctype.h>
#undef isalpha
int isalpha(int c)
@ -17,7 +17,7 @@ int isalpha(int c)
}
#undef iswalpha
int iswalpha(int c)
int iswalpha(wint_t c)
{
return iswctype(c,_ALPHA);
}

View file

@ -8,14 +8,14 @@
* 28/12/98: Created
*/
#include <ctype.h>
#include <crtdll/ctype.h>
int __isascii(int c)
{
return (!((c)&(~0x7f))) ;
}
int iswascii(int c)
int iswascii(wint_t c)
{
return __isascii(c);
}

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef iscntrl
int iscntrl(int c)
@ -8,7 +8,7 @@ int iscntrl(int c)
}
#undef iswcntrl
int iswcntrl(int c)
int iswcntrl(wint_t c)
{
return iswctype(c,_CONTROL);
}

View file

@ -8,7 +8,7 @@
* 28/12/98: Created
*/
#include <ctype.h>
#include <crtdll/ctype.h>
int __iscsymf(int c)
{
@ -18,4 +18,4 @@ int __iscsymf(int c)
int __iscsym(int c)
{
return (isalnum(c) || ( c == '_' )) ;
}
}

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#define __dj_ISUPPER _UPPER
@ -12,11 +12,8 @@
#define __dj_ISXDIGIT _HEX
#define __dj_ISALPHA _ALPHA
#define __dj_ISPRINT _PRINT
#define __dj_ISALNUM ( _ALPHA | _DIGIT )
#define __dj_ISGRAPH _GRAPH
int __mb_cur_max = 2;
// removed the first value
unsigned short _pctype_dll[] = {
@ -68,16 +65,16 @@ unsigned short _pctype_dll[] = {
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `-', 0x2d */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `.', 0x2e */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `/', 0x2f */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `0', 0x30 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `1', 0x31 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `2', 0x32 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `3', 0x33 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `4', 0x34 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `5', 0x35 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `6', 0x36 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `7', 0x37 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `8', 0x38 */
__dj_ISALNUM | __dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `9', 0x39 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `0', 0x30 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `1', 0x31 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `2', 0x32 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `3', 0x33 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `4', 0x34 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `5', 0x35 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `6', 0x36 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `7', 0x37 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `8', 0x38 */
__dj_ISDIGIT | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISXDIGIT, /* `9', 0x39 */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `:', 0x3a */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `;', 0x3b */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `<', 0x3c */
@ -85,64 +82,64 @@ unsigned short _pctype_dll[] = {
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `>', 0x3e */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `?', 0x3f */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `@', 0x40 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `A', 0x41 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `B', 0x42 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `C', 0x43 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `D', 0x44 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `E', 0x45 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `F', 0x46 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `G', 0x47 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `H', 0x48 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `I', 0x49 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `J', 0x4a */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `K', 0x4b */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `L', 0x4c */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `M', 0x4d */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `N', 0x4e */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `O', 0x4f */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `P', 0x50 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Q', 0x51 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `R', 0x52 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `S', 0x53 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `T', 0x54 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `U', 0x55 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `V', 0x56 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `W', 0x57 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `X', 0x58 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Y', 0x59 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Z', 0x5a */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `A', 0x41 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `B', 0x42 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `C', 0x43 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `D', 0x44 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `E', 0x45 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER | __dj_ISXDIGIT, /* `F', 0x46 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `G', 0x47 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `H', 0x48 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `I', 0x49 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `J', 0x4a */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `K', 0x4b */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `L', 0x4c */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `M', 0x4d */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `N', 0x4e */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `O', 0x4f */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `P', 0x50 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Q', 0x51 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `R', 0x52 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `S', 0x53 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `T', 0x54 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `U', 0x55 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `V', 0x56 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `W', 0x57 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `X', 0x58 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Y', 0x59 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISPRINT | __dj_ISUPPER, /* `Z', 0x5a */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `[', 0x5b */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* 0x5c */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `]', 0x5d */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `^', 0x5e */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `_', 0x5f */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* 0x60 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `a', 0x61 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `b', 0x62 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `c', 0x63 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `d', 0x64 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `e', 0x65 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `f', 0x66 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `g', 0x67 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `h', 0x68 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `i', 0x69 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `j', 0x6a */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `k', 0x6b */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `l', 0x6c */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `m', 0x6d */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `n', 0x6e */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `o', 0x6f */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `p', 0x70 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `q', 0x71 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `r', 0x72 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `s', 0x73 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `t', 0x74 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `u', 0x75 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `v', 0x76 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `w', 0x77 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `x', 0x78 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `y', 0x79 */
__dj_ISALNUM | __dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `z', 0x7a */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `a', 0x61 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `b', 0x62 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `c', 0x63 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `d', 0x64 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `e', 0x65 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT | __dj_ISXDIGIT, /* `f', 0x66 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `g', 0x67 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `h', 0x68 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `i', 0x69 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `j', 0x6a */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `k', 0x6b */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `l', 0x6c */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `m', 0x6d */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `n', 0x6e */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `o', 0x6f */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `p', 0x70 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `q', 0x71 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `r', 0x72 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `s', 0x73 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `t', 0x74 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `u', 0x75 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `v', 0x76 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `w', 0x77 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `x', 0x78 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `y', 0x79 */
__dj_ISALPHA | __dj_ISGRAPH | __dj_ISLOWER | __dj_ISPRINT, /* `z', 0x7a */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `{', 0x7b */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `|', 0x7c */
__dj_ISGRAPH | __dj_ISPRINT | __dj_ISPUNCT, /* `}', 0x7d */
@ -281,23 +278,23 @@ unsigned short _pctype_dll[] = {
unsigned short *_ctype = _pctype_dll -1; // unused
unsigned short *_pwctype_dll = _pctype_dll;
int _isctype(unsigned char c, int t)
int _isctype (unsigned int c, int ctypeFlags)
{
return ((_pctype_dll[(c & 0xFF)]&t) == t );
return ((_pctype_dll[(unsigned char)(c & 0xFF)]&ctypeFlags) == ctypeFlags );
}
int iswctype(unsigned short c, int t)
int iswctype(wint_t wc, wctype_t wctypeFlags)
{
return ((_pwctype_dll[(c & 0xFF)]&t) == t );
return ((_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags );
}
// obsolete
int is_wctype(unsigned short c, int t)
int is_wctype(wint_t wc, wctype_t wctypeFlags)
{
return ((_pctype_dll[(c & 0xFF)]&t) == t );
return ((_pwctype_dll[(unsigned char)(wc & 0xFF)]&wctypeFlags) == wctypeFlags );
}

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef isdigit
int isdigit(int c)
@ -8,7 +8,7 @@ int isdigit(int c)
}
#undef iswdigit
int iswdigit(int c)
int iswdigit(wint_t c)
{
return iswctype(c,_DIGIT);
}

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef isgraph
int isgraph(int c)
@ -8,7 +8,7 @@ int isgraph(int c)
}
#undef iswgraph
int iswgraph(int c)
int iswgraph(wint_t c)
{
return iswctype(c,_GRAPH);
}

View file

@ -1,13 +1,13 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef islower
int islower(int c)
{
return _isctype((unsigned char)c,_LOWER);
return _isctype(c,_LOWER);
}
int iswlower(int c)
int iswlower(wint_t c)
{
return iswctype((unsigned short)c,_LOWER);
}
return iswctype(c,_LOWER);
}

View file

@ -1,13 +1,13 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef isprint
int isprint(int c)
{
return _isctype((unsigned char)c,_PRINT);
return _isctype(c,_PRINT);
}
int iswprint(int c)
int iswprint(wint_t c)
{
return iswctype((unsigned short)c,_PRINT);
}
}

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef ispunct
int ispunct(int c)
@ -8,7 +8,7 @@ int ispunct(int c)
}
#undef iswpunct
int iswpunct(int c)
int iswpunct(wint_t c)
{
return iswctype(c,_PUNCT);
}

View file

@ -7,16 +7,16 @@
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <ctype.h>
#include <crtdll/ctype.h>
#undef isspace
int isspace(int c)
{
return _isctype((unsigned char)c,_SPACE);
return _isctype(c,_SPACE);
}
#undef iswspace
int iswspace(int c)
int iswspace(wint_t c)
{
return iswctype((unsigned short)c,_SPACE);
return iswctype(c,_SPACE);
}

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef isupper
int isupper(int c)
@ -7,7 +7,7 @@ int isupper(int c)
return _isctype(c,_UPPER);
}
int iswupper(int c)
int iswupper(wint_t c)
{
return iswctype(c,_UPPER);
}

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef isxdigit
int isxdigit(int c)
@ -8,7 +8,7 @@ int isxdigit(int c)
}
#undef iswxdigit
int iswxdigit(int c)
int iswxdigit(wint_t c)
{
return iswctype(c,_HEX);
}

View file

@ -1,6 +1,6 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
int __toascii(int c)

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <crtdll/ctype.h>
#undef tolower
int tolower(int c)
{

View file

@ -1,6 +1,6 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <ctype.h>
#include <wchar.h>
#include <crtdll/ctype.h>
#include <crtdll/wchar.h>
#undef toupper
int toupper(int c)

View file

@ -1,6 +1,6 @@
#include <direct.h>
#include <crtdll/direct.h>
#include <windows.h>
#include <ctype.h>
#include <crtdll/ctype.h>
char _SetCurrentDirectory(char *dir);
int _GetCurrentDirectory(int count,char *buffer);

View file

@ -1,6 +1,6 @@
#include <direct.h>
#include <stdlib.h>
#include <ctype.h>
#include <crtdll/direct.h>
#include <crtdll/stdlib.h>
#include <crtdll/ctype.h>
#include <windows.h>
int cur_drive = 0;

View file

@ -1,6 +1,6 @@
#include <windows.h>
#include <direct.h>
#include <stdlib.h>
#include <crtdll/direct.h>
#include <crtdll/stdlib.h>

View file

@ -1,6 +1,6 @@
#include <direct.h>
#include <crtdll/direct.h>
#include <windows.h>
#include <ctype.h>
#include <crtdll/ctype.h>
unsigned int _getdiskfree(unsigned int _drive, struct _diskfree_t *_diskspace)

View file

@ -1,5 +1,5 @@
#include <direct.h>
#include <ctype.h>
#include <crtdll/direct.h>
#include <crtdll/ctype.h>
#include <windows.h>
extern int cur_drive;

View file

@ -1,4 +1,4 @@
#include <direct.h>
#include <crtdll/direct.h>
#include <windows.h>
#undef mkdir

View file

@ -1,4 +1,4 @@
#include <direct.h>
#include <crtdll/direct.h>
#include <windows.h>
#undef rmdir

View file

@ -9,21 +9,21 @@
* Significantly revised and rewinddir, seekdir and telldir added by Colin
* Peters <colin@fu.is.saga-u.ac.jp>
*
* $Revision: 1.1 $
* $Author: rex $
* $Date: 1999/01/16 02:11:43 $
* $Revision: 1.2 $
* $Author: ariadne $
* $Date: 1999/04/02 21:43:47 $
*
*/
#include <stdlib.h>
/* #include <ctype.h> */
#include <errno.h>
#include <string.h>
#include <dir.h>
#include <direct.h>
#include <sys/stat.h>
#include <crtdll/stdlib.h>
/* #include <crtdll/ctype.h> */
#include <crtdll/errno.h>
#include <crtdll/string.h>
#include <crtdll/dir.h>
#include <crtdll/direct.h>
#include <crtdll/sys/stat.h>
#include <dirent.h>
#include <crtdll/dirent.h>
#define SUFFIX "*"
#define SLASH "\\"

View file

@ -0,0 +1,6 @@
#include <windows.h>
int _abnormal_termination(void)
{
return AbnormalTermination();
}

View file

@ -0,0 +1,8 @@
#include <crtdll/float.h>
//Obvious fixme
double _chgsign( double x )
{
return -1.0*x;
}

View file

@ -1,4 +1,4 @@
#include <float.h>
#include <crtdll/float.h>
unsigned int _clearfp (void)
{

View file

@ -1,6 +1,6 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <float.h>
#include <crtdll/float.h>
unsigned int _controlfp (unsigned int unNew, unsigned int unMask)
{

View file

@ -1,7 +1,7 @@
#include <float.h>
#include <crtdll/float.h>
void _fpreset (void)
{
__asm__ __volatile__("fninit\n\t");
return;
}
}

View file

@ -0,0 +1,12 @@
#include <crtdll/math.h>
#include <crtdll/float.h>
int isnan(double x)
{
if ( x>= 0.0 && x < HUGE_VAL )
return FALSE;
else if ( x <= 0.0 && x > HUGE_VAL )
return FALSE;
return TRUE;
}

View file

@ -1,4 +1,4 @@
#include <float.h>
#include <crtdll/float.h>
unsigned int _statusfp (void)
{
@ -11,4 +11,4 @@ __asm__ __volatile__ (
:"=a" (__res)
);
return __res;
}
}

View file

@ -1,4 +1,4 @@
#include <io.h>
#include <crtdll/io.h>
#include <windows.h>
#ifndef F_OK
@ -24,7 +24,7 @@ int _access( const char *_path, int _amode )
if ( Attributes == -1 )
return -1;
if ( _amode & W_OK == W_OK ) {
if ( (_amode & W_OK) == W_OK ) {
if ( (Attributes & FILE_ATTRIBUTE_READONLY) == FILE_ATTRIBUTE_READONLY )
return -1;
}

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <io.h>
#include <crtdll/io.h>
int
_chmod(const char *filename, int func)

View file

@ -1,5 +1,5 @@
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
#include <io.h>
#include <crtdll/io.h>
int
chsize(int _fd, long size)

View file

@ -1,6 +1,6 @@
#include <io.h>
#include <crtdll/io.h>
#include <windows.h>
#include <libc/file.h>
#include <crtdll/internal/file.h>
int _close(int _fd)

View file

@ -1,7 +1,9 @@
#include <windows.h>
#include <io.h>
#include <errno.h>
#include <libc/file.h>
#include <crtdll/io.h>
#include <crtdll/errno.h>
#include <crtdll/internal/file.h>
int _commode_dll = _IOCOMMIT;
int _commit(int _fd)
{

View file

@ -1,5 +1,5 @@
#include <io.h>
#include <fcntl.h>
#include <crtdll/io.h>
#include <crtdll/fcntl.h>
#undef creat
int creat(const char *filename, int mode)

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <io.h>
#include <crtdll/io.h>
int _dup( int handle )

View file

@ -1,12 +1,6 @@
#include <windows.h>
#include <io.h>
#undef dup2
int dup2( int handle1, int handle2 )
{
return _dup2(handle1,handle2);
}
#include <crtdll/io.h>
#include <crtdll/internal/file.h>
int _dup2( int handle1, int handle2 )
{

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <io.h>
#include <crtdll/io.h>
int _eof( int _fd )
{

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <io.h>
#include <crtdll/io.h>
long
_filelength(int _fd)

View file

@ -1,24 +1,11 @@
#include <windows.h>
#include <io.h>
#include <string.h>
#if 0
//UnixTimeToFileTime
//FileTimeToUnixTime
/*
* DOS file system functions
*
* Copyright 1993 Erik Bos
* Copyright 1996 Alexandre Julliard
*/
#include <crtdll/io.h>
#include <crtdll/string.h>
#include <crtdll/internal/file.h>
void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder );
time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder );
long _findfirst(char *_name, struct _finddata_t *result)
int _findfirst(const char *_name, struct _finddata_t *result)
{
WIN32_FIND_DATA FindFileData;
char dir[MAX_PATH];
@ -32,7 +19,7 @@ long _findfirst(char *_name, struct _finddata_t *result)
}
else
strcpy(dir,_name);
hFindFile = FindFirstFile( dir, &FindFileData );
hFindFile = (long)FindFirstFileA( dir, &FindFileData );
result->attrib = FindFileData.dwFileAttributes;
@ -40,17 +27,17 @@ long _findfirst(char *_name, struct _finddata_t *result)
result->time_access = FileTimeToUnixTime( &FindFileData.ftLastAccessTime,NULL);
result->time_write = FileTimeToUnixTime( &FindFileData.ftLastWriteTime,NULL);
result->size = FindFileData.nFileSizeLow;
strncpy(result->name,&FindFileData.cFileName,260);
strncpy(result->name,FindFileData.cFileName,260);
return hFindFile;
}
int _findnext(long handle, struct _finddata_t *result)
int _findnext(int handle, struct _finddata_t *result)
{
WIN32_FIND_DATA FindFileData;
if (handle == -1 )
return -1;
if ( !FindNextFile(handle, &FindFileData ) )
if ( !FindNextFile((void *)handle, &FindFileData ) )
return -1;
result->attrib = FindFileData.dwFileAttributes;
@ -58,198 +45,12 @@ int _findnext(long handle, struct _finddata_t *result)
result->time_access = FileTimeToUnixTime( &FindFileData.ftLastAccessTime,NULL);
result->time_write = FileTimeToUnixTime( &FindFileData.ftLastWriteTime,NULL);
result->size = FindFileData.nFileSizeLow;
strncpy(result->name,&FindFileData.cFileName,260);
strncpy(result->name,FindFileData.cFileName,260);
return 0;
}
int _findclose(long handle)
int _findclose(int handle)
{
return FindClose(handle);
return FindClose((void *)handle);
}
/***********************************************************************
* DOSFS_UnixTimeToFileTime
*
* Convert a Unix time to FILETIME format.
* The FILETIME structure is a 64-bit value representing the number of
* 100-nanosecond intervals since January 1, 1601, 0:00.
* 'remainder' is the nonnegative number of 100-ns intervals
* corresponding to the time fraction smaller than 1 second that
* couldn't be stored in the time_t value.
*/
void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime,
DWORD remainder )
{
/* NOTES:
CONSTANTS:
The time difference between 1 January 1601, 00:00:00 and
1 January 1970, 00:00:00 is 369 years, plus the leap years
from 1604 to 1968, excluding 1700, 1800, 1900.
This makes (1968 - 1600) / 4 - 3 = 89 leap days, and a total
of 134774 days.
Any day in that period had 24 * 60 * 60 = 86400 seconds.
The time difference is 134774 * 86400 * 10000000, which can be written
116444736000000000
27111902 * 2^32 + 3577643008
413 * 2^48 + 45534 * 2^32 + 54590 * 2^16 + 32768
If you find that these constants are buggy, please change them in all
instances in both conversion functions.
VERSIONS:
There are two versions, one of them uses long long variables and
is presumably faster but not ISO C. The other one uses standard C
data types and operations but relies on the assumption that negative
numbers are stored as 2's complement (-1 is 0xffff....). If this
assumption is violated, dates before 1970 will not convert correctly.
This should however work on any reasonable architecture where WINE
will run.
DETAILS:
Take care not to remove the casts. I have tested these functions
(in both versions) for a lot of numbers. I would be interested in
results on other compilers than GCC.
The operations have been designed to account for the possibility
of 64-bit time_t in future UNICES. Even the versions without
internal long long numbers will work if time_t only is 64 bit.
A 32-bit shift, which was necessary for that operation, turned out
not to work correctly in GCC, besides giving the warning. So I
used a double 16-bit shift instead. Numbers are in the ISO version
represented by three limbs, the most significant with 32 bit, the
other two with 16 bit each.
As the modulo-operator % is not well-defined for negative numbers,
negative divisors have been avoided in DOSFS_FileTimeToUnixTime.
There might be quicker ways to do this in C. Certainly so in
assembler.
Claus Fischer, fischer@iue.tuwien.ac.at
*/
unsigned long a0; /* 16 bit, low bits */
unsigned long a1; /* 16 bit, medium bits */
unsigned long a2; /* 32 bit, high bits */
/* Copy the unix time to a2/a1/a0 */
a0 = unix_time & 0xffff;
a1 = (unix_time >> 16) & 0xffff;
/* This is obsolete if unix_time is only 32 bits, but it does not hurt.
Do not replace this by >> 32, it gives a compiler warning and it does
not work. */
a2 = (unix_time >= 0 ? (unix_time >> 16) >> 16 :
~((~unix_time >> 16) >> 16));
/* Multiply a by 10000000 (a = a2/a1/a0)
Split the factor into 10000 * 1000 which are both less than 0xffff. */
a0 *= 10000;
a1 = a1 * 10000 + (a0 >> 16);
a2 = a2 * 10000 + (a1 >> 16);
a0 &= 0xffff;
a1 &= 0xffff;
a0 *= 1000;
a1 = a1 * 1000 + (a0 >> 16);
a2 = a2 * 1000 + (a1 >> 16);
a0 &= 0xffff;
a1 &= 0xffff;
/* Add the time difference and the remainder */
a0 += 32768 + (remainder & 0xffff);
a1 += 54590 + (remainder >> 16 ) + (a0 >> 16);
a2 += 27111902 + (a1 >> 16);
a0 &= 0xffff;
a1 &= 0xffff;
/* Set filetime */
filetime->dwLowDateTime = (a1 << 16) + a0;
filetime->dwHighDateTime = a2;
}
/***********************************************************************
* DOSFS_FileTimeToUnixTime
*
* Convert a FILETIME format to Unix time.
* If not NULL, 'remainder' contains the fractional part of the filetime,
* in the range of [0..9999999] (even if time_t is negative).
*/
time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder )
{
/* Read the comment in the function DOSFS_UnixTimeToFileTime. */
unsigned long a0; /* 16 bit, low bits */
unsigned long a1; /* 16 bit, medium bits */
unsigned long a2; /* 32 bit, high bits */
unsigned long r; /* remainder of division */
unsigned int carry; /* carry bit for subtraction */
int negative; /* whether a represents a negative value */
/* Copy the time values to a2/a1/a0 */
a2 = (unsigned long)filetime->dwHighDateTime;
a1 = ((unsigned long)filetime->dwLowDateTime ) >> 16;
a0 = ((unsigned long)filetime->dwLowDateTime ) & 0xffff;
/* Subtract the time difference */
if (a0 >= 32768 ) a0 -= 32768 , carry = 0;
else a0 += (1 << 16) - 32768 , carry = 1;
if (a1 >= 54590 + carry) a1 -= 54590 + carry, carry = 0;
else a1 += (1 << 16) - 54590 - carry, carry = 1;
a2 -= 27111902 + carry;
/* If a is negative, replace a by (-1-a) */
negative = (a2 >= ((unsigned long)1) << 31);
if (negative)
{
/* Set a to -a - 1 (a is a2/a1/a0) */
a0 = 0xffff - a0;
a1 = 0xffff - a1;
a2 = ~a2;
}
/* Divide a by 10000000 (a = a2/a1/a0), put the rest into r.
Split the divisor into 10000 * 1000 which are both less than 0xffff. */
a1 += (a2 % 10000) << 16;
a2 /= 10000;
a0 += (a1 % 10000) << 16;
a1 /= 10000;
r = a0 % 10000;
a0 /= 10000;
a1 += (a2 % 1000) << 16;
a2 /= 1000;
a0 += (a1 % 1000) << 16;
a1 /= 1000;
r += (a0 % 1000) * 10000;
a0 /= 1000;
/* If a was negative, replace a by (-1-a) and r by (9999999 - r) */
if (negative)
{
/* Set a to -a - 1 (a is a2/a1/a0) */
a0 = 0xffff - a0;
a1 = 0xffff - a1;
a2 = ~a2;
r = 9999999 - r;
}
if (remainder) *remainder = r;
/* Do not replace this by << 32, it gives a compiler warning and it does
not work. */
return ((((time_t)a2) << 16) << 16) + (a1 << 16) + a0;
}
#endif

View file

@ -1,6 +1,6 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <fcntl.h>
#include <io.h>
#include <crtdll/fcntl.h>
#include <crtdll/io.h>
#undef _fmode
unsigned int _fmode = O_TEXT;

View file

@ -1,8 +1,14 @@
#include <io.h>
#include <crtdll/io.h>
#include <crtdll/sys/stat.h>
#undef isatty
int isatty( int handle )
int _isatty( int fd )
{
return (handle & 3);
struct stat buf;
if (fstat (fd, &buf) < 0)
return 0;
if (S_ISCHR (buf.st_mode))
return 1;
return 0;
}

View file

@ -1,5 +1,5 @@
#include <windows.h>
#include <io.h>
#include <crtdll/io.h>
int _locking( int _fd, int mode, long nbytes )
{
@ -8,4 +8,4 @@ int _locking( int _fd, int mode, long nbytes )
return -1;
return 0;
}
}

View file

@ -1,16 +1,10 @@
#include <windows.h>
#include <io.h>
//#include <libc/file.h>
#undef lseek
long lseek(int _fildes, long _offset, int _whence)
{
return _lseek(_fildes,_offset,_whence);
}
#include <crtdll/io.h>
#include <crtdll/internal/file.h>
long _lseek(int _fildes, long _offset, int _whence)
{
//return _llseek(filehnd(_fildes),_offset,_whence);
return _llseek((HFILE)filehnd(_fildes),_offset,_whence);
}

View file

@ -13,9 +13,9 @@
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <stdio.h>
#include <string.h>
#include <io.h>
#include <crtdll/stdio.h>
#include <crtdll/string.h>
#include <crtdll/io.h>
char *

View file

@ -7,14 +7,14 @@
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <io.h>
#include <crtdll/io.h>
#include <windows.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <stdlib.h>
#include <libc/file.h>
#include <string.h>
#include <share.h>
#include <crtdll/fcntl.h>
#include <crtdll/sys/stat.h>
#include <crtdll/stdlib.h>
#include <crtdll/internal/file.h>
#include <crtdll/string.h>
#include <crtdll/share.h>
typedef struct _fileno_modes_type
{
@ -39,12 +39,6 @@ char __is_text_file(FILE *p) {
int __fileno_alloc(HANDLE hFile, int mode);
// fixme
#undef open
int open(const char *_path, int _oflag,...)
{
return _open(_path,_oflag);
}
int _open(const char *_path, int _oflag,...)
{
@ -55,9 +49,9 @@ int _open(const char *_path, int _oflag,...)
DWORD dwCreationDistribution = 0;
DWORD dwFlagsAndAttributes = 0;
if (( _oflag & _S_IREAD ) == _S_IREAD)
if (( _oflag & S_IREAD ) == S_IREAD)
dwShareMode = FILE_SHARE_READ;
else if ( ( _oflag & _S_IWRITE) == _S_IWRITE ) {
else if ( ( _oflag & S_IWRITE) == S_IWRITE ) {
dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
}
@ -74,18 +68,21 @@ _O_TEXT Opens file in text (translated) mode. (For more information, see Text
else if (( _oflag & _O_WRONLY ) == _O_WRONLY )
dwDesiredAccess |= GENERIC_WRITE;
if (( _oflag & _S_IREAD ) == _S_IREAD )
if (( _oflag & S_IREAD ) == S_IREAD )
dwShareMode |= FILE_SHARE_READ;
if (( _oflag & _S_IWRITE ) == _S_IWRITE )
if (( _oflag & S_IWRITE ) == S_IWRITE )
dwShareMode |= FILE_SHARE_WRITE;
if (( _oflag & (_O_CREAT | _O_EXCL ) ) == (_O_CREAT | _O_EXCL) )
dwCreationDistribution |= CREATE_NEW;
else if (( _oflag & (O_TRUNC | O_CREAT ) ) == (O_TRUNC | O_CREAT) )
dwCreationDistribution |= CREATE_ALWAYS;
else if (( _oflag & O_TRUNC ) == O_TRUNC ) {
if (( _oflag & O_CREAT ) == O_CREAT )
dwCreationDistribution |= CREATE_ALWAYS;
else if (( _oflag & O_RDONLY ) != O_RDONLY )
dwCreationDistribution |= TRUNCATE_EXISTING;
}
else if (( _oflag & _O_APPEND ) == _O_APPEND )
dwCreationDistribution |= OPEN_EXISTING;
else if (( _oflag & _O_CREAT ) == _O_CREAT )
@ -93,8 +90,7 @@ _O_TEXT Opens file in text (translated) mode. (For more information, see Text
else
dwCreationDistribution |= OPEN_EXISTING;
// if (( _oflag & _O_TRUNC ) == _O_TRUNC )
// dwCreationDistribution |= TRUNCATE_EXISTING;
if (( _oflag & _O_RANDOM ) == _O_RANDOM )
dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
@ -224,7 +220,7 @@ int __fileno_dup2( int handle1, int handle2 )
int __fileno_setmode(int _fd, int _newmode)
{
int m;
if ( _fd < 0 )
if ( _fd < minfno )
return -1;
if ( _fd >= maxfno )
@ -245,10 +241,15 @@ int __fileno_close(int _fd)
fileno_modes[_fd].fd = -1;
fileno_modes[_fd].hFile = (HANDLE)-1;
return 0;
}
int _open_osfhandle (void *osfhandle, int flags )
{
return __fileno_alloc((HANDLE)osfhandle, flags);
}
void *_get_osfhandle( int fileno )
{
return filehnd(fileno);
}

View file

@ -8,8 +8,8 @@
* 28/12/98: Appropriated for Reactos
*/
#include <windows.h>
#include <io.h>
#include <libc/file.h>
#include <crtdll/io.h>
#include <crtdll/internal/file.h>
int _pipe(int _fildes[2], unsigned int size, int mode )

View file

@ -7,7 +7,7 @@
* UPDATE HISTORY:
* 28/12/98: Created
*/
#include <io.h>
#include <crtdll/io.h>
#include <windows.h>
size_t _read(int _fd, void *_buf, size_t _nbyte)

View file

@ -8,9 +8,9 @@
* 28/12/98: Created
*/
#include <io.h>
#include <stdio.h>
#include <libc/file.h>
#include <crtdll/io.h>
#include <crtdll/stdio.h>
#include <crtdll/internal/file.h>
#undef setmode
int setmode(int _fd, int _newmode)

View file

@ -1,4 +1,4 @@
#include <io.h>
#include <crtdll/io.h>
int _sopen(char *path,int access,int shflag,int mode)

View file

@ -1,6 +1,6 @@
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
#include <errno.h>
#include <io.h>
#include <crtdll/errno.h>
#include <crtdll/io.h>
off_t

View file

@ -1,11 +1,11 @@
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <sys/stat.h>
#include <crtdll/sys/stat.h>
mode_t
_umask(mode_t newmask)
unsigned _unMode_dll = 022;
unsigned _umask (unsigned unMode)
{
static mode_t the_mask = 022;
mode_t old_mask = the_mask;
the_mask = newmask;
unsigned old_mask = _unMode_dll;
_unMode_dll = unMode;
return old_mask;
}

Some files were not shown because too many files have changed in this diff Show more