--- /dev/null
+/*
+ * 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__ */
+
* 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 $
*
*/
* 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.
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#ifndef __dj_include_conio_h_
-#define __dj_include_conio_h_
-
-#ifdef __cplusplus
+/*
+ * 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 $
+ *
+ */
+
+#ifndef __STRICT_ANSI__
+
+#ifndef _CONIO_H_
+#define _CONIO_H_
+
+#ifdef __cplusplus
extern "C" {
#endif
-#ifndef __dj_ENFORCE_ANSI_FREESTANDING
-
-#ifndef __STRICT_ANSI__
-
-#ifndef _POSIX_SOURCE
-
-extern int directvideo; /* ignored by gppconio */
-extern int _wscroll;
+char* _cgets (char* szBuffer);
+int _cprintf (const char* szFormat, ...);
+int _cputs (const char* szString);
+int _cscanf (char* szFormat, ...);
-#define _NOCURSOR 0
-#define _SOLIDCURSOR 1
-#define _NORMALCURSOR 2
+int _getch (void);
+int _getche (void);
+int _kbhit (void);
+int _putch (int cPut);
+int _ungetch (int 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;
-};
-enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
+#ifndef _NO_OLDNAMES
-enum COLORS {
- /* dark colors */
- BLACK,
- BLUE,
- GREEN,
- CYAN,
- RED,
- MAGENTA,
- BROWN,
- LIGHTGRAY,
- /* light colors */
- DARKGRAY,
- LIGHTBLUE,
- LIGHTGREEN,
- LIGHTCYAN,
- LIGHTRED,
- LIGHTMAGENTA,
- YELLOW,
- WHITE
-};
+#define getch _getch
+#define getche _getche
+#define kbhit _kbhit
+#define putch (cPut) _putch(cPut)
+#define ungetch (cUnget) _ungetch(cUnget)
-#define BLINK 0x80 /* blink bit */
+#endif /* Not _NO_OLDNAMES */
-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__ */
* 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
#define __need_wchar_t
#define __need_wint_t
-#include <stddef.h>
+#include <crtdll/stddef.h>
/*
#define _CONTROL 0x0020
#define _BLANK 0x0040
#define _HEX 0x0080
-#define _LEADBYTE 0x8000
-
#define _ALPHA 0x0103
+#define _GRAPH 0x0200 // added
+#define _PRINT 0x0400 // added
+#define _LEADBYTE 0x8000
-/* 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" {
* 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 _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" {
* 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 $
*
*/
#ifndef _DIRENT_H_
#define _DIRENT_H_
-#include <dir.h>
+#include <crtdll/dir.h>
#ifdef __cplusplus
extern "C" {
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)
* 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 $
*
*/
#if __MSVCRT__
/* One of the MSVCRTxx libraries */
+
extern int* __imp__sys_nerr;
#define sys_nerr (*__imp__sys_nerr)
+
+extern char** __imp__sys_errlist;
+#define sys_errlist (__imp__sys_errlist)
+
#else
/* CRTDLL run time library */
-extern int* __imp__sys_nerr_dll;
-#define sys_nerr (*__imp__sys_nerr_dll)
+
+
+#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
-extern char** __imp__sys_errlist;
-#define sys_errlist (__imp__sys_errlist)
+
#ifdef __cplusplus
}
--- /dev/null
+/*
+ * 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 */
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#ifndef __dj_include_fcntl_h_
-#define __dj_include_fcntl_h_
-
-#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 */
-
-
-#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
-
+/*
+ * 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 */
-#define S_IREAD S_IRUSR
-#define S_IWRITE S_IWUSR
-#define S_IEXEC S_IXUSR
+#ifndef _FCNTL_H_
+#define _FCNTL_H_
/*
- * For compatibility with other DOS C compilers.
+ * It appears that fcntl.h should include io.h for compatibility...
*/
-
-#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
+#include <crtdll/io.h>
/*
- * Support for advanced filesystems (Windows 9x VFAT, NTFS, LFN etc.)
+ * 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
-#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
+/* Mask for access mode bits in the _open flags. */
+#define _O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)
-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 _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. */
-#define _LFN_CTIME 1
-#define _LFN_ATIME 2
+/* 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
-unsigned _lfn_get_ftime (int _handle, int _which);
+#define _O_TEMPORARY 0x0040 /* Make the file dissappear after closing.
+ * WARNING: Even if not created by _open! */
-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 */
+#define _O_RANDOM 0x0010
+#define _O_SEQUENTIAL _O_RANDOM
+#define _O_SHORT_LIVED 0x1000
+
+#ifndef __STRICT_ANSI__
+#ifndef _NO_OLDNAMES
+
+/* POSIX/Non-ANSI names for increased portability */
+#define O_RDONLY _O_RDONLY
+#define O_WRONLY _O_WRONLY
+#define O_RDWR _O_RDWR
+#define O_ACCMODE _O_ACCMODE
+#define O_APPEND _O_APPEND
+#define O_CREAT _O_CREAT
+#define O_TRUNC _O_TRUNC
+#define O_EXCL _O_EXCL
+#define O_TEXT _O_TEXT
+#define O_BINARY _O_BINARY
+#define O_TEMPORARY _O_TEMPORARY
+
+#define O_RANDOM _O_RANDOM
+#define O_SEQUENTIAL _O_RANDOM
+#define O_SHORT_LIVED _O_SHORT_LIVED
+
+#endif /* Not _NO_OLDNAMES */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int _setmode (int nHandle, int nAccessMode);
-#ifndef __dj_ENFORCE_FUNCTION_CALLS
-#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
+#ifndef _NO_OLDNAMES
+int setmode (int nHandle, int nAccessMode);
+#endif /* Not _NO_OLDNAMES */
-#ifdef __cplusplus
+#ifdef __cplusplus
}
#endif
-#endif /* !__dj_include_fcntl_h_ */
+#endif /* Not __STRICT_ANSI__ */
+#endif /* Not _FCNTL_H_ */
* 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 $
*
*/
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()))
/*
--- /dev/null
+/* 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__ */
--- /dev/null
+/* 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__ */
* 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 */
#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. */
--- /dev/null
+/*
+ * 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__ */
* 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 $
*
*/
#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
* 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_
#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);
/*
#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.
void *_loaddll (char *name);
int _unloaddll(void *handle);
+unsigned long __threadid(void);
+#define _threadid __threadid()
+void * __threadhandle(void);
+
+
#ifndef _NO_OLDNAMES
#define cwait _cwait
--- /dev/null
+
+#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
\ No newline at end of file
* 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 $
*
*/
#define offsetof(TYPE, MEMBER) ((size_t) &( ((TYPE *) 0)->MEMBER ))
#endif /* _STDDEF_H_ */
+
#endif /* not _STDDEF_H_ */
-/* 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
#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;
#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);
+
+#ifndef _NO_OLDNAMES
+#define fgetchar _fgetchar
+#define fputchar _fputchar
+#define fdopen _fdopen
+#endif /* Not _NO_OLDNAMES */
-#define L_ctermid
-#define L_cusrid
-/* #define STREAM_MAX 20 - DOS can change this */
-
-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_ */
* 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_
* 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);
#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));
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
#define ecvt _ecvt
#define fcvt _fcvt
#define gcvt _gcvt
+
+#define swab _swab
#endif /* Not _NO_OLDNAMES */
#endif /* Not __STRICT_ANSI__ */
--- /dev/null
+/*
+ * 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
+++ /dev/null
-/* 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
--- /dev/null
+/*
+ * This file is part of the Mingw32 package.
+ *
+ * This fcntl.h maps to the root fcntl.h
+ */
+#ifndef __STRICT_ANSI__
+#include <fcntl.h>
+#endif
--- /dev/null
+/*
+ * 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
--- /dev/null
+/*
+ * 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__ */
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#ifndef __dj_include_sys_stat_h_
-#define __dj_include_sys_stat_h_
+/*
+ * 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 $
+ *
+ */
-#ifdef __cplusplus
+#ifndef __STRICT_ANSI__
+
+#ifndef _STAT_H_
+#define _STAT_H_
+
+#include <crtdll/sys/types.h>
+
+#ifdef __cplusplus
extern "C" {
#endif
-#ifndef __dj_ENFORCE_ANSI_FREESTANDING
+/*
+ * 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 */
+
+#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 */
+};
-#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)
-
-#define S_ISUID 0x80000000
-#define S_ISGID 0x40000000
-
-#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
-
-#include <sys/types.h>
-#include <internal/types.h>
-//#include <sys/djtypes.h>
-__DJ_time_t
-#undef __DJ_time_t
-#define __DJ_time_t
-
-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 */
-};
+int _fstat (int nHandle, struct stat* pstat);
+int _chmod (const char* szPath, int nMode);
+int _stat (const char* szPath, struct stat* pstat);
-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
-
-/* POSIX.1 doesn't mention these at all */
-
-#define S_IFMT 0xf000
-
-#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
-
-#define S_IFLABEL 0x5000
-#define S_ISLABEL(m) (((m) & 0xf000) == 0x5000)
-
-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
+
+#ifndef _NO_OLDNAMES
+
+/* 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);
+
+#endif /* Not _NO_OLDNAMES */
+
+
+#ifdef __cplusplus
}
#endif
-#endif /* !__dj_include_sys_stat_h_ */
+#endif /* Not _STAT_H_ */
+
+#endif /* Not __STRICT_ANSI__ */
--- /dev/null
+
+#include <time.h>
+
--- /dev/null
+/*
+ * 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__ */
-/* 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__
-
-#include <sys/djtypes.h>
-
-typedef int dev_t;
-typedef int ino_t;
-typedef int mode_t;
-typedef int nlink_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 __STRICT_ANSI__
+
+#ifndef _OFF_T_DEFINED
+typedef long _off_t;
+
+#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_ */
--- /dev/null
+/*
+ * This file is part of the Mingw32 package.
+ *
+ * unistd.h maps (roughly) to io.h
+ */
+#ifndef __STRICT_ANSI__
+#include <io.h>
+#endif
+
--- /dev/null
+/*
+ * 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__ */
--- /dev/null
+/*
+ * 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_ */
+
* 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 */
#define __need_wchar_t
#define __need_size_t
-#include <stddef.h>
+#include <crtdll/stddef.h>
#ifdef __cplusplus
extern "C" {
/*
* 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
--- /dev/null
+/*
+ * 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>
+
/* 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(;;);
}
-#include <conio.h>
+#include <crtdll/conio.h>
char *
-#include <stdio.h>
-#include <conio.h>
+#include <crtdll/stdio.h>
+#include <crtdll/conio.h>
int
cprintf(const char *fmt, ...)
* 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;
-#include <conio.h>
+#include <crtdll/conio.h>
/*
* 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;
* 28/12/98: Created
*/
-#include <process.h>
-#include <conio.h>
+#include <crtdll/process.h>
+#include <crtdll/conio.h>
extern int char_avail;
* UPDATE HISTORY:
* 28/12/98: Created
*/
-#include <conio.h>
+#include <crtdll/conio.h>
#include <windows.h>
int _putch( int c )
* 28/12/98: Created
*/
-#include <process.h>
+#include <crtdll/process.h>
#define EOF -1
int char_avail = 0;
; 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.
; ??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).
; _wtol
;
EXPORTS
+__builtin_new
+__builtin_delete
+_set_new_handler__FPFUi_i
_CIacos
_CIasin
_CIatan
* UPDATE HISTORY:
* 28/12/98: Created
*/
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef isalnum
}
#undef iswalnum
-int iswalnum(int c)
+int iswalnum(wint_t c)
{
return iswctype(c,_ALPHA | _DIGIT);
}
* 28/12/98: Created
*/
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef isalpha
int isalpha(int c)
}
#undef iswalpha
-int iswalpha(int c)
+int iswalpha(wint_t c)
{
return iswctype(c,_ALPHA);
}
* 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);
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef iscntrl
int iscntrl(int c)
}
#undef iswcntrl
-int iswcntrl(int c)
+int iswcntrl(wint_t c)
{
return iswctype(c,_CONTROL);
}
* 28/12/98: Created
*/
-#include <ctype.h>
+#include <crtdll/ctype.h>
int __iscsymf(int c)
{
int __iscsym(int c)
{
return (isalnum(c) || ( c == '_' )) ;
-}
\ No newline at end of file
+}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
#define __dj_ISUPPER _UPPER
#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[] = {
__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 */
__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 */
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 );
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef isdigit
int isdigit(int c)
}
#undef iswdigit
-int iswdigit(int c)
+int iswdigit(wint_t c)
{
return iswctype(c,_DIGIT);
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef isgraph
int isgraph(int c)
}
#undef iswgraph
-int iswgraph(int c)
+int iswgraph(wint_t c)
{
return iswctype(c,_GRAPH);
}
/* 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);
-}
\ No newline at end of file
+ return iswctype(c,_LOWER);
+}
/* 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);
-}
\ No newline at end of file
+}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef ispunct
int ispunct(int c)
}
#undef iswpunct
-int iswpunct(int c)
+int iswpunct(wint_t c)
{
return iswctype(c,_PUNCT);
}
* 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);
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef isupper
int isupper(int c)
return _isctype(c,_UPPER);
}
-int iswupper(int c)
+int iswupper(wint_t c)
{
return iswctype(c,_UPPER);
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef isxdigit
int isxdigit(int c)
}
#undef iswxdigit
-int iswxdigit(int c)
+int iswxdigit(wint_t c)
{
return iswctype(c,_HEX);
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
int __toascii(int c)
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <ctype.h>
+#include <crtdll/ctype.h>
#undef tolower
int tolower(int c)
{
/* 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)
-#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);
-#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;
#include <windows.h>
-#include <direct.h>
-#include <stdlib.h>
+#include <crtdll/direct.h>
+#include <crtdll/stdlib.h>
-#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)
-#include <direct.h>
-#include <ctype.h>
+#include <crtdll/direct.h>
+#include <crtdll/ctype.h>
#include <windows.h>
extern int cur_drive;
-#include <direct.h>
+#include <crtdll/direct.h>
#include <windows.h>
#undef mkdir
-#include <direct.h>
+#include <crtdll/direct.h>
#include <windows.h>
#undef rmdir
* 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 "\\"
--- /dev/null
+#include <windows.h>
+
+int _abnormal_termination(void)
+{
+ return AbnormalTermination();
+}
\ No newline at end of file
--- /dev/null
+#include <crtdll/float.h>
+
+//Obvious fixme
+
+double _chgsign( double x )
+{
+ return -1.0*x;
+}
-#include <float.h>
+#include <crtdll/float.h>
unsigned int _clearfp (void)
{
/* 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)
{
-#include <float.h>
+#include <crtdll/float.h>
void _fpreset (void)
{
__asm__ __volatile__("fninit\n\t");
return;
-}
\ No newline at end of file
+}
--- /dev/null
+#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;
+}
\ No newline at end of file
-#include <float.h>
+#include <crtdll/float.h>
unsigned int _statusfp (void)
{
:"=a" (__res)
);
return __res;
-}
\ No newline at end of file
+}
-#include <io.h>
+#include <crtdll/io.h>
#include <windows.h>
#ifndef F_OK
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;
}
#include <windows.h>
-#include <io.h>
+#include <crtdll/io.h>
int
_chmod(const char *filename, int func)
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
-#include <io.h>
+#include <crtdll/io.h>
int
chsize(int _fd, long size)
-#include <io.h>
+#include <crtdll/io.h>
#include <windows.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int _close(int _fd)
#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)
{
-#include <io.h>
-#include <fcntl.h>
+#include <crtdll/io.h>
+#include <crtdll/fcntl.h>
#undef creat
int creat(const char *filename, int mode)
#include <windows.h>
-#include <io.h>
+#include <crtdll/io.h>
int _dup( int handle )
#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 )
{
#include <windows.h>
-#include <io.h>
+#include <crtdll/io.h>
int _eof( int _fd )
{
#include <windows.h>
-#include <io.h>
+#include <crtdll/io.h>
long
_filelength(int _fd)
#include <windows.h>
-#include <io.h>
-#include <string.h>
+#include <crtdll/io.h>
+#include <crtdll/string.h>
+#include <crtdll/internal/file.h>
-#if 0
-//UnixTimeToFileTime
-//FileTimeToUnixTime
-/*
- * DOS file system functions
- *
- * Copyright 1993 Erik Bos
- * Copyright 1996 Alexandre Julliard
- */
-
-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];
}
else
strcpy(dir,_name);
- hFindFile = FindFirstFile( dir, &FindFileData );
+ hFindFile = (long)FindFirstFileA( dir, &FindFileData );
result->attrib = FindFileData.dwFileAttributes;
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;
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
/* 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;
-#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;
}
#include <windows.h>
-#include <io.h>
+#include <crtdll/io.h>
int _locking( int _fd, int mode, long nbytes )
{
return -1;
return 0;
-}
\ No newline at end of file
+}
#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);
}
/* 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 *
* 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
{
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,...)
{
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;
}
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 )
else
dwCreationDistribution |= OPEN_EXISTING;
-// if (( _oflag & _O_TRUNC ) == _O_TRUNC )
-// dwCreationDistribution |= TRUNCATE_EXISTING;
+
if (( _oflag & _O_RANDOM ) == _O_RANDOM )
dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS;
int __fileno_setmode(int _fd, int _newmode)
{
int m;
- if ( _fd < 0 )
+ if ( _fd < minfno )
return -1;
if ( _fd >= maxfno )
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);
+}
\ No newline at end of file
* 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 )
* 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)
* 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)
-#include <io.h>
+#include <crtdll/io.h>
int _sopen(char *path,int access,int shflag,int mode)
/* 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
/* 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;
}
* 28/12/98: Created
*/
#include <windows.h>
-#include <io.h>
+#include <crtdll/io.h>
* UPDATE HISTORY:
* 28/12/98: Created
*/
-#include <io.h>
+#include <crtdll/io.h>
#include <windows.h>
--- /dev/null
+/*
+FUNCTION
+<<setlocale>>, <<localeconv>>---select or query locale
+
+INDEX
+ setlocale
+INDEX
+ localeconv
+INDEX
+ _setlocale_r
+INDEX
+ _localeconv_r
+
+ANSI_SYNOPSIS
+ #include <crtdll/locale.h>
+ char *setlocale(int <[category]>, const char *<[locale]>);
+ lconv *localeconv(void);
+
+ char *_setlocale_r(void *<[reent]>,
+ int <[category]>, const char *<[locale]>);
+ lconv *_localeconv_r(void *<[reent]>);
+
+TRAD_SYNOPSIS
+ #include <crtdll/locale.h>
+ char *setlocale(<[category]>, <[locale]>)
+ int <[category]>;
+ char *<[locale]>;
+
+ lconv *localeconv();
+
+ char *_setlocale_r(<[reent]>, <[category]>, <[locale]>)
+ char *<[reent]>;
+ int <[category]>;
+ char *<[locale]>;
+
+ lconv *_localeconv_r(<[reent]>);
+ char *<[reent]>;
+
+DESCRIPTION
+<<setlocale>> is the facility defined by ANSI C to condition the
+execution environment for international collating and formatting
+information; <<localeconv>> reports on the settings of the current
+locale.
+
+This is a minimal implementation, supporting only the required <<``C''>>
+value for <[locale]>; strings representing other locales are not
+honored unless MB_CAPABLE is defined in which case three new
+extensions are allowed for LC_CTYPE only: <<''C-JIS''>>, <<''C-EUCJP''>>,
+and <<''C-SJIS''>>. (<<``''>> is also accepted; it represents the default locale
+for an implementation, here equivalent to <<``C''>>.)
+
+If you use <<NULL>> as the <[locale]> argument, <<setlocale>> returns
+a pointer to the string representing the current locale (always
+<<``C''>> in this implementation). The acceptable values for
+<[category]> are defined in `<<locale.h>>' as macros beginning with
+<<"LC_">>, but this implementation does not check the values you pass
+in the <[category]> argument.
+
+<<localeconv>> returns a pointer to a structure (also defined in
+`<<locale.h>>') describing the locale-specific conventions currently
+in effect.
+
+<<_localeconv_r>> and <<_setlocale_r>> are reentrant versions of
+<<localeconv>> and <<setlocale>> respectively. The extra argument
+<[reent]> is a pointer to a reentrancy structure.
+
+RETURNS
+<<setlocale>> returns either a pointer to a string naming the locale
+currently in effect (always <<``C''>> for this implementation, or, if
+the locale request cannot be honored, <<NULL>>.
+
+<<localeconv>> returns a pointer to a structure of type <<lconv>>,
+which describes the formatting and collating conventions in effect (in
+this implementation, always those of the C locale).
+
+PORTABILITY
+ANSI C requires <<setlocale>>, but the only locale required across all
+implementations is the C locale.
+
+No supporting OS subroutines are required.
+*/
+
+/*
+ * setlocale, localeconv : internationalize your locale.
+ * (Only "C" or null supported).
+ */
+
+#include <crtdll/locale.h>
+#include <crtdll/string.h>
+#include <limits.h>
+
+
+int _current_category; /* used by setlocale */
+const char *_current_locale;
+int __mb_cur_max_dll = 1;
+
+static const struct lconv lconv =
+{
+ ".", "", "", "", "", "", "", "", "", "",
+ CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,
+ CHAR_MAX, CHAR_MAX, CHAR_MAX, CHAR_MAX,
+};
+
+
+char * setlocale(int category ,const char *locale)
+{
+ static char lc_ctype[8] = "C";
+ static char last_lc_ctype[8] = "C";
+
+#ifndef MB_CAPABLE
+ if (locale)
+ {
+ if (strcmp (locale, "C") && strcmp (locale, ""))
+ return 0;
+ _current_category = category;
+ _current_locale = locale;
+ }
+ return "C";
+#else
+ if (locale)
+ {
+ if (category != LC_CTYPE)
+ {
+ if (strcmp (locale, "C") && strcmp (locale, ""))
+ return 0;
+ if (category == LC_ALL)
+ {
+ strcpy (last_lc_ctype, lc_ctype);
+ strcpy (lc_ctype, locale);
+ __mb_cur_max_dll = 1;
+ }
+ }
+ else
+ {
+ if (strcmp (locale, "C") && strcmp (locale, "") &&
+ strcmp (locale, "C") && strcmp (locale, "C-JIS") &&
+ strcmp (locale, "C-EUCJP") && strcmp (locale, "C-SJIS"))
+ return 0;
+
+ strcpy (last_lc_ctype, lc_ctype);
+ strcpy (lc_ctype, locale);
+
+ if (!strcmp (locale, "C-JIS"))
+ __mb_cur_max_dll = 8;
+ else if (strlen (locale) > 1)
+ __mb_cur_max_dll = 2;
+ else
+ __mb_cur_max_dll = 1;
+ }
+ _current_category = category;
+ _current_locale = locale;
+
+ if (category == LC_CTYPE)
+ return last_lc_ctype;
+ }
+ else
+ {
+ if (category == LC_CTYPE)
+ return lc_ctype;
+ }
+
+ return "C";
+#endif
+
+}
+
+
+struct lconv *localeconv(void)
+{
+ return (struct lconv *) &lconv;
+}
+
DIRECT_OBJECTS = direct/chdir.o direct/chdrive.o direct/getcwd.o direct/getdrive.o \
direct/rmdir.o direct/mkdir.o direct/getdfree.o
+MALLOC_OBJECTS = malloc/expand.o malloc/heap.o
-MISC_OBJECTS = misc/sleep.o misc/GetArgs.o misc/CRTfmode.o misc/CRTglob.o
+MISC_OBJECTS = misc/GetArgs.o misc/setnew.o misc/purecall.o
STRING_OBJECTS = string/memchr.o string/memcmp.o string/strcat.o \
string/strchr.o string/strcmp.o string/strcoll.o \
string/strspn.o string/strstr.o string/strtok.o \
string/strxfrm.o string/memmove.o string/memset.o \
string/strdup.o string/strlwr.o string/strupr.o \
- string/str_old.o string/strerror.o
+ string/str_old.o string/strerror.o string/stricmp.o\
+ string/strnlen.o
WCHAR_OBJECTS = wchar/wcscat.o wchar/wcschr.o wchar/wcscmp.o \
wchar/wcscoll.o wchar/wcscpy.o wchar/wcscspn.o \
wchar/wcsdup.o wchar/wcsicmp.o wchar/wcslen.o \
wchar/wcslwr.o wchar/wcsncat.o wchar/wcsncmp.o \
- wchar/wcsncpy.o
+ wchar/wcsncpy.o
STDIO_OBJECTS = stdio/getenv.o stdio/doprnt.o stdio/doscan.o stdio/filbuf.o \
stdio/fclose.o stdio/feof.o stdio/ferror.o stdio/fileno.o\
stdio/getchar.o stdio/gets.o stdio/getw.o stdio/perror.o stdio/printf.o \
stdio/putc.o stdio/putchar.o stdio/puts.o stdio/putw.o \
stdio/remove.o stdio/rename.o stdio/rewind.o stdio/allocfil.o\
- stdio/scanf.o stdio/setbuf.o stdio/setbuffe.o \
+ stdio/scanf.o stdio/setbuf.o stdio/setbuffe.o stdlib/obsol.o\
stdio/setlineb.o stdio/setvbuf.o stdio/sprintf.o stdio/sscanf.o \
stdio/stdiohk.o stdio/stdhnd.o stdio/tempnam.o stdio/tmpfile.o stdio/tmpnam.o \
stdio/ungetc.o stdio/vfprintf.o stdio/vprintf.o stdio/vsprintf.o
io/chmod.o io/chsize.o io/commit.o io/locking.o io/pipe.o io/sopen.o io/filelen.o\
io/umask.o io/tell.o io/eof.o
+SEARCH_OBJECTS = search/lsearch.o search/lfind.o
+
STDLIB_OBJECTS = stdlib/abort.o stdlib/abs.o stdlib/atexit.o stdlib/atof.o stdlib/atoi.o \
- stdlib/bsearch.o stdlib/div.o stdlib/errno.o stdlib/Exit.o \
- stdlib/fullpath.o stdlib/labs.o stdlib/ldiv.o stdlib/llabs.o stdlib/lldiv.o \
+ stdlib/bsearch.o stdlib/div.o stdlib/errno.o stdlib/_exit.o \
+ stdlib/fullpath.o stdlib/labs.o stdlib/ldiv.o \
stdlib/makepath.o stdlib/malloc.o stdlib/putenv.o stdlib/qsort.o \
stdlib/rand.o stdlib/senv.o stdlib/splitp.o stdlib/strtod.o stdlib/strtol.o \
- stdlib/strtoul.o
+ stdlib/strtoul.o stdlib/swab.o stdlib/atol.o
SIGNAL_OBJECTS = signal/signal.o
PROCESS_OBJECTS = process/_cwait.o process/dll.o process/spawnl.o process/spawnlp.o process/spawnlpe.o process/spawnvpe.o process/spawnvp.o \
process/spawnv.o process/spawnve.o process/spawnle.o process/execl.o process/execlp.o process/execlpe.o \
- process/execvpe.o process/execvp.o process/execv.o process/execle.o process/_system.o
+ process/execvpe.o process/execvp.o process/execv.o process/execle.o process/_system.o\
+ process/threadid.o process/thread.o
+
+TCHAR_OBJECTS = tchar/strdec.o tchar/strinc.o tchar/strninc.o tchar/strncnt.o tchar/strnextc.o tchar/strspnp.o
TIME_OBJECTS = time/ctime.o time/difftime.o time/strftime.o time/time.o time/clock.o
-FLOAT_OBJECTS = float/fpreset.o float/clearfp.o float/cntrlfp.o float/statfp.o float/logb.o
+FLOAT_OBJECTS = float/fpreset.o float/clearfp.o float/cntrlfp.o float/statfp.o float/logb.o\
+ float/chgsign.o
-SYS_STAT_OBJECTS = sys_stat/fstat.o sys_stat/stat.o
+SYS_STAT_OBJECTS = sys_stat/fstat.o sys_stat/stat.o sys_stat/futime.o
MATH_OBJECTS = math/acos.o math/acosh.o math/asin.o math/asinh.o math/atan.o math/atan2.o\
math/floor.o math/fmod.o math/frexp.o math/huge_val.o math/hypot.o\
math/ldexp.o math/log.o math/log10.o math/modf.o math/pow.o\
math/sin.o math/sinh.o math/sqrt.o math/tan.o\
- math/tanh.o
+ math/tanh.o math/stubs.o math/j0_y0.o math/j1_y1.o math/jn_yn.o
OBJECTS = $(ASSERT_OBJECTS) $(CTYPE_OBJECTS) $(CONIO_OBJECTS) $(DIRECT_OBJECTS)\
$(MISC_OBJECTS) $(STRING_OBJECTS) $(STDIO_OBJECTS) $(STDLIB_OBJECTS) \
- $(IO_OBJECTS) $(PROCESS_OBJECTS) $(TIME_OBJECTS) \
- $(SYS_STAT_OBJECTS) $(SIGNAL_OBJECTS) $(MATH_OBJECTS) $(FLOAT_OBJECTS)
+ $(IO_OBJECTS) $(PROCESS_OBJECTS) $(TIME_OBJECTS) $(MALLOC_OBJECTS)\
+ $(SYS_STAT_OBJECTS) $(SIGNAL_OBJECTS) $(MATH_OBJECTS) $(FLOAT_OBJECTS)\
+ $(SEARCH_OBJECTS)
crtdll.a: $(OBJECTS)
- $(LD) -r $(OBJECTS) -o crtdll.a
+ $(LD) -r $(OBJECTS) -o crtdll.a
crtdll.dll: $(DLLMAIN) $(OBJECTS) crtdll.def
$(LD) -r $(OBJECTS) -o crtdll.o
--- /dev/null
+#include <windows.h>
+#include <kernel32/heap.h>
+#include <crtdll/malloc.h>
+#include <crtdll/stdlib.h>
+
+void *_expand( void *pold, size_t size )
+{
+ PHEAP_BUCKET pbucket;
+ PHEAP_SUBALLOC psub;
+ PHEAP_FRAGMENT pfrag=(PHEAP_FRAGMENT)((LPVOID)pold-HEAP_FRAG_ADMIN_SIZE);
+
+ /* sanity checks */
+ if(pfrag->Magic!=HEAP_FRAG_MAGIC)
+ return NULL;
+
+ /* get bucket size */
+ psub=pfrag->Sub;
+ pbucket=psub->Bucket;
+ if(size<=pbucket->Size)
+ {
+ pfrag->Size=size;
+ return pold;
+ }
+ else
+ return NULL;
+
+ return NULL;
+}
--- /dev/null
+
+#include <windows.h>
+#include <kernel32/proc.h>
+#include <kernel32/heap.h>
+#include <crtdll/malloc.h>
+
+int _heapchk (void)
+{
+ if (!HeapValidate(GetProcessHeap(), 0, NULL))
+ return -1;
+ return 0;
+}
+int _heapmin (void)
+{
+ if ( !HeapCompact( GetProcessHeap(), 0 ))
+ return -1;
+ return 0;
+}
+int _heapset (unsigned int unFill)
+{
+ if ( _heapchk() == -1 )
+ return -1;
+ return 0;
+
+}
+
+
+int _heapwalk ( struct _heapinfo *entry)
+{
+ return 0;
+}
\ No newline at end of file
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <math.h>
+#include <crtdll/math.h>
double acos (double __x)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <math.h>
+#include <crtdll/math.h>
double
acosh(double x)
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <math.h>
+#include <crtdll/math.h>
double asin (double __x)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <math.h>
+#include <crtdll/math.h>
double
asinh(double x)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <math.h>
+#include <crtdll/math.h>
double
atanh(double x)
-#include <math.h>
+#include <crtdll/math.h>
double _cabs( struct _complex z )
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <math.h>
+#include <crtdll/math.h>
double cosh(double x)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <math.h>
+#include <crtdll/math.h>
double
frexp(double x, int *exptr)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <libc/ieee.h>
-double_t _HUGE_dll = { 0x00000, 0x00000, 0x7ff, 0x0 };
+typedef struct {
+ unsigned mantissal:32;
+ unsigned mantissah:20;
+ unsigned exponent:11;
+ unsigned sign:1;
+} double_t;
+
+
+#undef _HUGE
+double_t _HUGE = { 0x00000, 0x00000, 0x7ff, 0x0 };
+double *_HUGE_dll = (double *)&_HUGE;
*
*/
-#include <float.h>
-#include <math.h>
-#include <errno.h>
+#include <crtdll/float.h>
+#include <crtdll/math.h>
+#include <crtdll/errno.h>
/* Approximate square roots of DBL_MAX and DBL_MIN. Numbers
between these two shouldn't neither overflow nor underflow
#define __SQRT_DBL_MIN 2.3e-162
double
-hypot(double x, double y)
+_hypot(double x, double y)
{
double abig = fabs(x), asmall = fabs(y);
double ratio;
#ifdef TEST
-#include <stdio.h>
+#include <crtdll/stdio.h>
int
main(void)
{
- printf("hypot(3, 4) =\t\t\t %25.17e\n", hypot(3., 4.));
- printf("hypot(3*10^150, 4*10^150) =\t %25.17g\n", hypot(3.e+150, 4.e+150));
- printf("hypot(3*10^306, 4*10^306) =\t %25.17g\n", hypot(3.e+306, 4.e+306));
- printf("hypot(3*10^-320, 4*10^-320) =\t %25.17g\n",
- hypot(3.e-320, 4.e-320));
- printf("hypot(0.7*DBL_MAX, 0.7*DBL_MAX) =%25.17g\n",
- hypot(0.7*DBL_MAX, 0.7*DBL_MAX));
- printf("hypot(DBL_MAX, 1.0) =\t\t %25.17g\n", hypot(DBL_MAX, 1.0));
- printf("hypot(1.0, DBL_MAX) =\t\t %25.17g\n", hypot(1.0, DBL_MAX));
- printf("hypot(0.0, DBL_MAX) =\t\t %25.17g\n", hypot(0.0, DBL_MAX));
+ printf("hypot(3, 4) =\t\t\t %25.17e\n", _hypot(3., 4.));
+ printf("hypot(3*10^150, 4*10^150) =\t %25.17g\n", _hypot(3.e+150, 4.e+150));
+ printf("hypot(3*10^306, 4*10^306) =\t %25.17g\n", _hypot(3.e+306, 4.e+306));
+ printf("hypot(3*10^-320, 4*10^-320) =\t %25.17g\n",_hypot(3.e-320, 4.e-320));
+ printf("hypot(0.7*DBL_MAX, 0.7*DBL_MAX) =%25.17g\n",_hypot(0.7*DBL_MAX, 0.7*DBL_MAX));
+ printf("hypot(DBL_MAX, 1.0) =\t\t %25.17g\n", _hypot(DBL_MAX, 1.0));
+ printf("hypot(1.0, DBL_MAX) =\t\t %25.17g\n", _hypot(1.0, DBL_MAX));
+ printf("hypot(0.0, DBL_MAX) =\t\t %25.17g\n", _hypot(0.0, DBL_MAX));
return 0;
}
--- /dev/null
+#include <crtdll/math.h>
+
+double _j0(double x)
+{
+ return x;
+}
+
+double _y0(double x)
+{
+ return x;
+}
\ No newline at end of file
--- /dev/null
+#include <crtdll/math.h>
+
+double _j1(double x)
+{
+ return x;
+}
+
+double _y1(double x)
+{
+ return x;
+}
\ No newline at end of file
--- /dev/null
+#include <crtdll/math.h>
+
+double _jn(int n, double x)
+{
+ return x;
+}
+
+double _yn(int n, double x)
+{
+ return x;
+}
\ No newline at end of file
// from linux libc
-#include <math.h>
+#include <crtdll/math.h>
/* Slooow version. */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <math.h>
+#include <crtdll/math.h>
double sinh(double x)
{
--- /dev/null
+#include <crtdll/math.h>
+
+double _CIsin (double x);
+double _CIcos (double x);
+double _CItan (double x);
+double _CIsinh (double x);
+double _CIcosh (double x);
+double _CItanh (double x);
+double _CIasin (double x);
+double _CIacos (double x);
+double _CIatan (double x);
+double _CIatan2 (double y, double x);
+double _CIexp (double x);
+double _CIlog (double x);
+double _CIlog10 (double x);
+double _CIpow (double x, double y);
+double _CIsqrt (double x);
+double _CIfmod (double x, double y);
+
+
+double _CIsin (double x)
+{
+ return sin(x);
+}
+double _CIcos (double x)
+{
+ return cos(x);
+}
+double _CItan (double x)
+{
+ return tan(x);
+}
+double _CIsinh (double x)
+{
+ return sinh(x);
+}
+double _CIcosh (double x)
+{
+ return cosh(x);
+}
+double _CItanh (double x)
+{
+ return tanh(x);
+}
+double _CIasin (double x)
+{
+ return asin(x);
+}
+double _CIacos (double x)
+{
+ return acos(x);
+}
+double _CIatan (double x)
+{
+ return atan(x);
+}
+double _CIatan2 (double y, double x)
+{
+ return atan2(y,x);
+}
+double _CIexp (double x)
+{
+ return exp(x);
+}
+double _CIlog (double x)
+{
+ return log(x);
+}
+double _CIlog10 (double x)
+{
+ return log10(x);
+}
+double _CIpow (double x, double y)
+{
+ return pow(x,y);
+}
+double _CIsqrt (double x)
+{
+ return sqrt(x);
+}
+double _CIfmod (double x, double y)
+{
+ return fmod(x,y);
+}
\ No newline at end of file
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <math.h>
+#include <crtdll/math.h>
double tanh(double x)
{
#include <windows.h>
-#include <stdlib.h>
-#include <string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
-#undef _acmdln_dll
+
+char *_pgmptr_dll;
char *_acmdln_dll;
-#undef _commode_dll
unsigned int _commode_dll;
-
-#undef _winmajor_dll
unsigned int _winmajor_dll;
-#undef _winminor_dll
unsigned int _winminor_dll;
-#undef _winver_dll
unsigned int _winver_dll;
-#undef _osver_dll
-unsigned int _osver_dll;
+
+
+unsigned int _osmajor_dll;
+unsigned int _osminor_dll;
+unsigned int _osmode_dll;
+unsigned int _osver_dll;
+unsigned int _osversion_dll;
#undef __argv
#undef __argc
char *** _environ_dll = &_environ;
-
-int __GetMainArgs(int *argc,char ***argv,char **env,int flag)
+int __GetMainArgs(int *argc,char ***argv,char ***env,int flag)
{
int i,afterlastspace;
DWORD version;
_environ = (char **)GetEnvironmentStringsA();;
_environ_dll = &_environ;
- argc = __argc_dll;
- argv = __argv_dll;
- env = _environ_dll;
+ *argc = __argc;
+ *argv = __argv;
+ *env = _environ;
+ _pgmptr_dll = strdup((char *)argv[0]);
+
return 0;
}
* DISCLAMED. This includes but is not limited to warrenties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Revision: 1.1 $
- * $Author: rex $
- * $Date: 1999/01/16 02:11:43 $
+ * $Revision: 1.2 $
+ * $Author: ariadne $
+ * $Date: 1999/04/02 21:43:55 $
*
*/
-#include <stdlib.h>
-#include <stdio.h>
-#include <io.h>
-#include <fcntl.h>
-#include <process.h>
-#include <float.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/stdio.h>
+#include <crtdll/io.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/process.h>
+#include <crtdll/float.h>
#include <windows.h>
/* NOTE: The code for initializing the _argv, _argc, and environ variables
* UnhandledExceptionFilter, which is prototyped just above
* (see Functions.h).
*/
- SetUnhandledExceptionFilter (NULL);
- /*
- * Initialize errno.
- */
- errno = 0;
+ //SetUnhandledExceptionFilter (NULL);
/*
* Initialize floating point unit.
*/
_mingw32_init_mainargs();
-
/*
* Sets the default file mode for stdin, stdout and stderr, as well
* as files later opened by the user, to _CRT_fmode.
* that one calls WinMain. See main.c in the 'lib' dir
* for more details.
*/
-
- nRet = cmdmain(_argc, _argv, environ);
+ nRet = main(_argc, _argv, _environ);
/*
* Perform exit processing for the C library. This means
#endif
#endif
-
* DISCLAMED. This includes but is not limited to warrenties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Revision: 1.1 $
- * $Author: rex $
- * $Date: 1999/01/16 02:11:43 $
+ * $Revision: 1.2 $
+ * $Author: ariadne $
+ * $Date: 1999/04/02 21:43:56 $
*
*/
-#include <stdio.h>
-#include <io.h>
-#include <process.h>
+#include <crtdll/stdio.h>
+#include <crtdll/io.h>
+#include <crtdll/process.h>
#include <windows.h>
/* See note in crt0.c */
* Contributors:
* Code supplied by Stan Cox <scox@cygnus.com>
*
- * $Revision: 1.1 $
- * $Author: rex $
- * $Date: 1999/01/16 02:11:43 $
+ * $Revision: 1.2 $
+ * $Author: ariadne $
+ * $Date: 1999/04/02 21:43:56 $
*
*/
/* Needed for the atexit prototype. */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
typedef void (*func_ptr) (void);
extern func_ptr __CTOR_LIST__[];
* DISCLAMED. This includes but is not limited to warrenties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Revision: 1.1 $
- * $Author: rex $
- * $Date: 1999/01/16 02:11:43 $
+ * $Revision: 1.2 $
+ * $Author: ariadne $
+ * $Date: 1999/04/02 21:43:56 $
*
*/
* DISCLAMED. This includes but is not limited to warrenties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Revision: 1.1 $
- * $Author: rex $
- * $Date: 1999/01/16 02:11:43 $
+ * $Revision: 1.2 $
+ * $Author: ariadne $
+ * $Date: 1999/04/02 21:43:56 $
*
*/
-#include <stdlib.h>
-#include <process.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/process.h>
#include <windows.h>
#define ISSPACE(a) (a == ' ' || a == '\t')
--- /dev/null
+
+int _purecall(void)
+{
+ return 0;
+}
\ No newline at end of file
--- /dev/null
+#include <crtdll/stdlib.h>
+
+
+typedef int (* new_handler_t)( size_t );
+
+new_handler_t new_handler;
+
+new_handler_t _set_new_handler(new_handler_t hnd)
+{
+ new_handler_t old = new_handler;
+
+ new_handler = hnd;
+
+ return old;
+}
+
+void operator delete(void* m)
+{
+ if ( m != NULL )
+ free( m );
+}
+
+void * operator new( unsigned int s )
+{
+ if ( s == 0 )
+ s = 1;
+ return malloc( s );
+}
-#include <process.h>
#include <windows.h>
+#include <crtdll/process.h>
+#include <crtdll/errno.h>
+#include <crtdll/internal/file.h>
-int _cwait( int *termstat, int procHandle, int action )
+int _cwait (int* pnStatus, int hProc, int nAction)
{
- DWORD RetVal;
- RetVal = WaitForSingleObject((HANDLE)procHandle, INFINITE);
- if (RetVal == WAIT_FAILED || RetVal == WAIT_ABANDONED) {
- //errno = ECHILD;
+ nAction = 0;
+ if ( WaitForSingleObject((void *)hProc,INFINITE) != WAIT_OBJECT_0 ) {
+ __set_errno(ECHILD);
return -1;
}
- if ( RetVal == WAIT_OBJECT_0 ) {
- GetExitCodeProcess((HANDLE)procHandle, termstat);
- return procHandle;
- }
-
- return -1;
- // WAIT_TIMEOUT
-}
+ if ( !GetExitCodeProcess((void *)hProc,pnStatus) )
+ return -1;
+ return *pnStatus;
+}
\ No newline at end of file
-#include <process.h>
+#include <crtdll/process.h>
#include <windows.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
int system(const char *command)
{
#include <windows.h>
-#include <process.h>
+#include <crtdll/process.h>
void *_loaddll (char *name)
{
int _unloaddll(void *handle)
{
return FreeLibrary(handle);
-}
\ No newline at end of file
+}
+
+FARPROC _getdllprocaddr(void *hModule,char * lpProcName, int iOrdinal)
+{
+
+
+ if ( lpProcName != NULL )
+ return GetProcAddress(hModule, lpProcName);
+ else
+ return GetProcAddress(hModule, (LPSTR)iOrdinal);
+ return (NULL);
+}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
-#include <stdlib.h>
+#include <crtdll/process.h>
+#include <crtdll/stdlib.h>
+#include <stdarg.h>
-int _execl(const char *path, const char *argv0, ...)
+int _execl(const char* szPath, const char* szArgv0, ...)
{
- return _spawnve(P_OVERLAY, path, (char *const*)&argv0, _environ);
+ va_list a = 0;
+ va_start(a,szArgv0);
+ return _spawnve(P_OVERLAY, szPath, (char *const*)a, _environ);
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
+#include <crtdll/process.h>
#define scan_ptr() \
const char **ptr; \
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
-#include <stdlib.h>
+#include <crtdll/process.h>
+#include <crtdll/stdlib.h>
int _execlp(const char *path, const char *argv0, ...)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
+#include <crtdll/process.h>
#define scan_ptr() \
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
-#include <stdlib.h>
+#include <crtdll/process.h>
+#include <crtdll/stdlib.h>
-int _execv(const char *path, const char * const *argv)
+int _execv(const char* szPath, char* const* szaArgv)
{
- return _spawnve(P_OVERLAY, path, argv, _environ);
+ return _spawnve(P_OVERLAY, szPath, szaArgv, _environ);
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-//#include <libc/stubs.h>
-//#include <unistd.h>
-#include <process.h>
+//#include <crtdll/stubs.h>
+//#include <crtdll/unistd.h>
+#include <crtdll/process.h>
int execve(const char *path,const char * const argv[], char * const envp[])
{
-/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details *///#include <libc/stubs.h>
-//#include <unistd.h>
-#include <process.h>
-#include <stdlib.h>
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details *///#include <crtdll/stubs.h>
+//#include <crtdll/unistd.h>
+#include <crtdll/process.h>
+#include <crtdll/stdlib.h>
-int _execvp(const char *path,const char * const argv[])
+int _execvp(const char* szPath, char* const* szaArgv)
{
- return _spawnvpe(P_OVERLAY, path, argv, _environ);
+ return _spawnvpe(P_OVERLAY, szPath, szaArgv, _environ);
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
+#include <crtdll/process.h>
-int _execvpe(const char *path,const char * const argv[],const char * const envp[])
+int _execvpe(const char* szPath, char* const* szaArgv, char* const* szaEnv)
{
- return _spawnvpe(P_OVERLAY, path, argv, envp);
+ return _spawnvpe(P_OVERLAY, szPath, szaArgv, szaEnv);
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
+#include <crtdll/process.h>
+#include <crtdll/stdlib.h>
+#include <stdarg.h>
-extern char **_environ;
-
-int _spawnl(int mode, const char *path, const char *argv0, ...)
+int _spawnl(int nMode, const char* szPath, const char* szArgv0,...)
{
- return spawnve(mode, path, (char * const *)&argv0, _environ);
+ va_list a = 0;
+ va_start(a,szArgv0);
+ return _spawnve(nMode, szPath, (char * const *)a, _environ);
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
+#include <crtdll/process.h>
#define scan_ptr() \
const char **ptr; \
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
-#include <stdlib.h>
+#include <crtdll/process.h>
+#include <crtdll/stdlib.h>
+#include <stdarg.h>
-int _spawnlp(int mode, const char *path, const char *argv0, ...)
+int _spawnlp(int nMode, const char* szPath, const char* szArgv0, ...)
{
- return _spawnvpe(mode, path, (char * const *)&argv0, (char * const *)_environ);
+ va_list a = 0;
+ va_start(a,szArgv0);
+ return _spawnvpe(nMode, szPath, (char * const *)a, _environ);
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
+#include <crtdll/process.h>
#define scan_ptr() \
const char **ptr; \
union { const char **ccpp; const char *ccp; } u; \
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
-#include <stdlib.h>
+#include <crtdll/process.h>
+#include <crtdll/stdlib.h>
-
-int _spawnv(int mode, const char *path,const char *const argv[])
+int _spawnv (int nMode, const char* szPath, char* const* szaArgv)
{
- return _spawnve(mode, path, (char * const *)argv, _environ);
+ return _spawnve(nMode, szPath, (char * const *)szaArgv, _environ);
}
-#include <process.h>
-#include <string.h>
+#include <crtdll/process.h>
+#include <crtdll/string.h>
#include <windows.h>
-#include <stdio.h>
+#include <crtdll/stdio.h>
int _p_overlay = 2;
-int _spawnve(int mode, const char *path,const char *const argv[],const char *const envp[])
+int _spawnve(int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv)
{
char ApplicationName[MAX_PATH];
int i = 0;
CommandLine[0] = 0;
- while(argv[i] != NULL ) {
- strcat(CommandLine,argv[i]);
+ while(szaArgv[i] != NULL ) {
+ strcat(CommandLine,szaArgv[i]);
strcat(CommandLine," ");
i++;
}
- strcpy(ApplicationName,argv[0]);
+ strcpy(ApplicationName,szaArgv[0]);
fflush(stdout); /* just in case */
StartupInfo.cb = sizeof(STARTUPINFO);
StartupInfo.dwFlags = 0;
-// if ( CreateProcessA(ApplicationName,CommandLine,NULL,NULL,TRUE,CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS,NULL,*envp,&StartupInfo,&ProcessInformation) ) {
-// errno = GetLastError();
-// return -1;
-// }
+ if ( CreateProcessA(ApplicationName,CommandLine,NULL,NULL,TRUE,CREATE_NEW_CONSOLE|NORMAL_PRIORITY_CLASS,NULL,*szaEnv,&StartupInfo,&ProcessInformation) ) {
+ return -1;
+ }
- if (mode == P_OVERLAY)
- _exit(i);
+ // if (nMode == P_OVERLAY)
+ // _exit(i);
// _P_NOWAIT or _P_NOWAITO
- return ProcessInformation.hProcess;
+ return (int )ProcessInformation.hProcess;
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
-#include <stdlib.h>
+#include <crtdll/process.h>
+#include <crtdll/stdlib.h>
-int spawnvp(int mode, const char *path,const char *const argv[])
+int _spawnvp(int nMode, const char* szPath, char* const* szaArgv)
{
- return spawnvpe(mode, path, (char * const *)argv, _environ);
+ return spawnvpe(nMode, szPath, (char * const *)szaArgv, _environ);
}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <process.h>
-#include <errno.h>
+#include <crtdll/process.h>
+#include <crtdll/errno.h>
-int _spawnvpe(int mode, const char *path,const char *const argv[],const char *const envp[])
+int _spawnvpe(int nMode, const char* szPath, char* const* szaArgv, char* const* szaEnv)
{
- char rpath[300];
- return spawnve(mode, rpath, argv, envp);
+ return spawnve(nMode, szPath, szaArgv, szaEnv);
}
--- /dev/null
+#include <windows.h>
+#include <crtdll/process.h>
+
+unsigned long __threadid (void)
+{
+ return GetCurrentThreadId();
+}
+
+void *__threadhandle(void)
+{
+ return GetCurrentThread();
+}
\ No newline at end of file
--- /dev/null
+#include <crtdll/search.h>
+#include <crtdll/stdlib.h>
+
+
+void *_lfind(const void *key, const void *base, size_t *nelp,
+ size_t width, int (*compar)(const void *, const void *))
+{
+ char *char_base = (char *)base;
+ int i;
+ for(i=0;i<*nelp;i++) {
+ if ( compar(key,char_base) == 0)
+ return char_base;
+ char_base += width;
+ }
+ return NULL;
+}
+
\ No newline at end of file
--- /dev/null
+#include <crtdll/search.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
+
+void *_lsearch(const void *key, void *base, size_t *nelp, size_t width,
+ int (*compar)(const void *, const void *))
+{
+ void *ret_find = _lfind(key,base,nelp,width,compar);
+ if ( ret_find != NULL )
+ return ret_find;
+
+ memcpy( base + (*nelp*width), key, width );
+ (*nelp)++;
+ return base ;
+}
\ No newline at end of file
Exception handling and basis for signal support for DJGPP V2.0
This software may be freely distributed, no warranty. */
-#include <signal.h>
-#include <stdlib.h>
+#include <crtdll/signal.h>
+#include <crtdll/stdlib.h>
extern unsigned end __asm__ ("end");
void __djgpp_traceback_exit(int sig)
{
_exit(3);
-}
\ No newline at end of file
+}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <libc/file.h>
-//#include <libc/local.h>
-//#include <libc/stdiohk.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/internal/file.h>
+
FILE * __alloc_file(void);
__file_rec *fr = __file_rec_list;
__file_rec **last_fr = &__file_rec_list;
- int total_closed;
+ int total_closed = 0;
int i = 0;
/* Try to find an empty slot */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
#ifdef clearerr
#undef clearerr
#include <stdarg.h>
-//#include <internal/debug.h>
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-#include <string.h>
-
-//#undef isdigit
-
-size_t strnlen( const char *string, size_t count );
-
+//#include <crtdll/internal/debug.h>
+#include <crtdll/ctype.h>
+#include <crtdll/string.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
static int skip_atoi(const char **s)
{
if (num == 0)
tmp[i++]='0';
else while (num != 0)
- tmp[i++] = digits[do_div(&num,base)];
+ tmp[i++] = digits[do_div((int *)&num,base)];
if (i > precision)
precision = i;
size -= precision;
putc( ' ',f);
if (sign)
putc( sign,f);
- if (type & SPECIAL)
- if (base==8)
+ if (type & SPECIAL) {
+ if (base==8) {
putc( '0',f);
+ }
else if (base==16) {
putc( '0', f);
putc( digits[33],f);
}
- if (!(type & LEFT))
+ }
+ if (!(type & LEFT)) {
while (size-- > 0)
putc( c,f);
+ }
while (i < precision--)
putc( '0', f);
while (i-- > 0)
case 'n':
if (qualifier == 'l') {
- long * ip = va_arg(args, long *);
+ long * ip;
+ ip = va_arg(args, long *);
//*ip = (str - buf);
} else {
- int * ip = va_arg(args, int *);
+ int * ip;
+ ip = va_arg(args, int *);
//*ip = (str - buf);
}
continue;
}
if (qualifier == 'l')
num = va_arg(args, unsigned long);
- else if (qualifier == 'h')
+ else if (qualifier == 'h') {
if (flags & SIGN)
num = va_arg(args, short);
else
num = va_arg(args, unsigned short);
+ }
else if (flags & SIGN)
num = va_arg(args, int);
else
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/ctype.h>
+#include <crtdll/internal/file.h>
+
-//long double
-//atold(const char *ascii);
#define atold atof
// dubious variable
int
_doscan_low(FILE *iop, int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *),
- const char *fmt, void **argp);
+ const char *fmt, va_list argp);
-//#include <libc/local.h>
+//#include <crtdll/local.h>
#define SPC 01
#define STP 02
static int nchars = 0;
int
-_doscan(FILE *iop, const char *fmt, void **argp)
+_doscan(FILE *iop, const char *fmt, va_list argp)
{
return(_doscan_low(iop, fgetc, ungetc, fmt, argp));
}
int
-_dowscan(FILE *iop, const wchar_t *fmt, void **argp)
+_dowscan(FILE *iop, const wchar_t *fmt, va_list argp)
{
- return(_doscan_low(iop, fgetwc, ungetwc, fmt, argp));
+ return(_doscan_low(iop, fgetwc, ((void *)ungetwc), ((void *)fmt), argp));
}
int
_doscan_low(FILE *iop, int (*scan_getc)(FILE *), int (*scan_ungetc)(int, FILE *),
- const char *fmt, void **argp)
+ const char *fmt, va_list argp)
{
register int ch;
int nmatch, len, ch1;
goto def;
ptr = 0;
if (ch != '*')
- ptr = (int **)argp++;
+ ptr = va_arg(argp, int **);
else
ch = *fmt++;
len = 0;
np = numbuf;
expseen = 0;
negflg = 0;
- while (((nchars++, c = scan_getc(iop)) != EOF) && (_sctab[c] & SPC))
+ while (((nchars++, c = scan_getc(iop)) != EOF) && (_sctab[c] & SPC) )
;
if (c == EOF) nchars--;
if (c=='-') {
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-//#include <libc/stubs.h>
-#include <stdio.h>
-#include <io.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-//#include <unistd.h>
-#include <libc/file.h>
+//#include <crtdll/stubs.h>
+#include <crtdll/stdio.h>
+#include <crtdll/io.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/sys/stat.h>
+#include <crtdll/stdlib.h>
+//#include <crtdll/unistd.h>
+#include <crtdll/internal/file.h>
#if 0
#ifndef __dj_include_stdio_h_
-#include <stdio.h>
+#include <crtdll/stdio.h>
FILE *_fdopen(int handle, char *mode)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
#ifdef feof
#undef feof
-feof(FILE *stream);
+int feof(FILE *stream);
#endif
-feof(FILE *stream)
+int feof(FILE *stream)
{
return stream->_flag & _IOEOF;
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
#ifdef ferror
#undef ferror
-ferror(FILE *stream);
+int ferror(FILE *stream);
#endif
-int
-ferror(FILE *stream)
+int ferror(FILE *stream)
{
return stream->_flag & _IOERR;
}
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-//#include <libc/stubs.h>
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <libc/file.h>
-#include <io.h>
+
+#include <crtdll/stdio.h>
+#include <crtdll/errno.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/sys/stat.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/io.h>
+
int
fflush(FILE *f)
if (f == NULL)
{
-// int e = errno;
+ int e = errno;
-// errno = 0;
+ __set_errno(0);
_fwalk((void (*)(FILE *))fflush);
-// if (errno)
-// return EOF;
-// errno = e;
+ if (_errno)
+ return EOF;
+ __set_errno(e);
return 0;
}
25/02/99: Added fgetwc
*/
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
int
fgetc(FILE *f)
-#include <stdio.h>
-#include <conio.h>
+#include <crtdll/stdio.h>
+#include <crtdll/conio.h>
int _fgetchar (void)
{
return _getch();
-}
\ No newline at end of file
+}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <errno.h>
+#include <crtdll/stdio.h>
+#include <crtdll/errno.h>
int
fgetpos(FILE *stream, fpos_t *pos)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
char *
fgets(char *s, int n, FILE *f)
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-//#include <libc/stubs.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <stdlib.h>
-//#include <unistd.h>
-#include <string.h>
-//#include <go32.h>
-#include <libc/file.h>
-//#include <libc/stdiohk.h>
-#include <io.h>
+
+#include <crtdll/stdio.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/io.h>
/* Note: We set _fillsize to 512, and use that for reading instead of
_bufsize, for performance reasons. We double _fillsize each time
-#include <stdio.h>
+#include <crtdll/stdio.h>
#undef fileno
int fileno(FILE *f)
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-//#include <libc/stubs.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <stdlib.h>
-//#include <unistd.h>
-//#include <go32.h>
-#include <libc/file.h>
-#include <io.h>
+//#include <crtdll/stubs.h>
+#include <crtdll/stdio.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/stdlib.h>
+//#include <crtdll/unistd.h>
+//#include <crtdll/go32.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/io.h>
int
_flsbuf(int c, FILE *f)
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <sys/types.h>
-#include <stdio.h>
-#include <io.h>
-#include <fcntl.h>
-#include <libc/file.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/stdio.h>
+#include <crtdll/io.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/internal/file.h>
FILE * __alloc_file(void);
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
int
fprintf(register FILE *iop, const char *fmt, ...)
{
int len;
char localbuf[BUFSIZ];
+ va_list a=0;
+
+ va_start( a, fmt );
if (iop->_flag & _IONBF)
{
iop->_flag &= ~_IONBF;
iop->_ptr = iop->_base = localbuf;
iop->_bufsiz = BUFSIZ;
- len = _doprnt(fmt, (&fmt)+1, iop);
+ len = _doprnt(fmt,a, iop);
fflush(iop);
iop->_flag |= _IONBF;
iop->_base = NULL;
iop->_cnt = 0;
}
else
- len = _doprnt(fmt, (&fmt)+1, iop);
+ len = _doprnt(fmt, a, iop);
return ferror(iop) ? EOF : len;
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <wchar.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/wchar.h>
+#include <crtdll/internal/file.h>
int
fputc(int c, FILE *fp)
-#include <stdio.h>
-#include <conio.h>
+#include <crtdll/stdio.h>
+#include <crtdll/conio.h>
int _fputchar (int c)
{
return _putch(c);
-}
\ No newline at end of file
+}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
-#include <string.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/string.h>
#include <windows.h>
int
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
+#include <crtdll/internal/file.h>
#define _fillsize _bufsiz
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <sys/types.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <libc/file.h>
-#include <io.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/stdio.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/io.h>
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-//#include <libc/local.h>
+#include <crtdll/stdio.h>
+//#include <crtdll/local.h>
static __file_rec __initial_file_rec = {
0,
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <stdarg.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int
fscanf(FILE *f, const char *fmt, ...)
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
-#include <fcntl.h>
-#include <io.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/io.h>
#define _fillsize _bufsiz
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <errno.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/errno.h>
+#include <crtdll/internal/file.h>
int
-fsetpos(FILE *stream, fpos_t *pos)
+fsetpos(FILE *stream,const fpos_t *pos)
{
if (stream && pos)
{
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-//#include <libc/stubs.h>
-#include <stdio.h>
-//#include <unistd.h>
-#include <libc/file.h>
-#include <fcntl.h>
-#include <io.h>
+//#include <crtdll/stubs.h>
+#include <crtdll/stdio.h>
+//#include <crtdll/unistd.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/io.h>
long
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
-//#include <libc/local.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
+
+// not exported by crtdll
#define __FILE_REC_MAX 20
typedef struct __file_rec {
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
+#include <crtdll/internal/file.h>
size_t
fwrite(const void *vptr, size_t size, size_t count, FILE *f)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <windows.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int getc(FILE *f)
{
int c;
- DWORD NumberOfBytesRead;
+ DWORD NumberOfBytesRead =0;
+ if (f->_cnt > 0) {
+ f->_cnt--;
+ f->_flag &= ~_IOUNGETC;
+ return *f->_ptr;
+ }
+
+
if ( !ReadFile(_get_osfhandle(f->_file),&c, 1, &NumberOfBytesRead, NULL) )
return -1;
if ( NumberOfBytesRead == 0 )
return -1;
- return c;
+ putchar(c&0xFF);
+ return c&0xFF;
+
+
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
#undef getchar
int
#include <windows.h>
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
void *malloc(size_t size);
* 28/12/98: Appropriated for Reactos
*/
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
char *
gets(char *s)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
int
getw(FILE *f)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
+#include <crtdll/errno.h>
#ifdef perror
-#include <io.h>
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libc/file.h>
+#include <crtdll/io.h>
+#include <crtdll/errno.h>
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
+#include <crtdll/internal/file.h>
FILE *
_popen (const char *cm, const char *md) /* program name, pipe mode */
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
-#include <internal/debug.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
+
+
int
printf(const char *fmt, ...)
{
int len;
-
- len = _doprnt(fmt, (&fmt)+1, stdout);
+ va_list a = 0;
+ va_start( a, fmt );
+ len = _doprnt(fmt, a, stdout);
/* People were confused when printf() didn't flush stdout,
so we'll do it to reduce confusion */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <windows.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int putc(int c, FILE *fp)
{
* UPDATE HISTORY:
* 28/12/98: Created
*/
-#include <stdio.h>
+#include <crtdll/stdio.h>
#undef putc
#undef putchar
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <io.h>
+#include <crtdll/stdio.h>
+#include <crtdll/io.h>
#include <windows.h>
-#include <string.h>
+#include <crtdll/string.h>
#undef putchar
int
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
int
putw(int w, FILE *f)
#include <windows.h>
-#include <stdio.h>
-#include <io.h>
+#include <crtdll/stdio.h>
+#include <crtdll/io.h>
-int rename(const char *old, const char *new)
-{
- return _rename(old,new);
-}
-int _rename(const char *old, const char *new)
+int rename(const char *old_, const char *new_)
{
- if ( !MoveFile(old,new) )
+ if ( !MoveFile(old_,new_) )
return -1;
return 0;
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <io.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/io.h>
+#include <crtdll/internal/file.h>
void rewind(FILE *f)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <stdarg.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int
scanf(const char *fmt, ...)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <stdlib.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/internal/file.h>
void
setbuf(FILE *f, char *buf)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-//#include <libc/stubs.h>
-#include <stdio.h>
-#include <stdlib.h>
+//#include <crtdll/stubs.h>
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
void setbuffer(FILE *f, void *buf, int size)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
void setlinebuf(FILE *f)
{
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <stdlib.h>
-#include <io.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/io.h>
+#include <crtdll/internal/file.h>
#define _fillsize _bufsiz
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <limits.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int
{
FILE _strbuf;
int len;
+ va_list a = 0;
+ va_start( a, fmt );
_strbuf._flag = _IOWRT|_IOSTRG;
_strbuf._ptr = str;
_strbuf._cnt = INT_MAX;
- len = _doprnt(fmt, &(fmt)+1, &_strbuf);
+ len = _doprnt(fmt, a, &_strbuf);
*_strbuf._ptr = 0;
return len;
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <stdarg.h>
-#include <libc/file.h>
-//#include <libc/unconst.h>
+#include <crtdll/internal/file.h>
+//#include <crtdll/unconst.h>
int
sscanf(const char *str, const char *fmt, ...)
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
-//#include <libc/stdiohk.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
+//#include <crtdll/stdiohk.h>
// stdout
{
NULL, 0, NULL,
- _IOWRT | _IOFBF |_IOSTRG,
+ _IOWRT | _IOLBF |_IOSTRG,
1,0,0, NULL
},
// stderr
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
static void fcloseall_helper(FILE *f)
-#include <stdio.h>
#include <windows.h>
-
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
char *_tempnam(const char *dir,const char *prefix )
/* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-//#include <libc/stubs.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-//#include <unistd.h>
-#include <io.h>
-#include <libc/file.h>
-#include <share.h>
+//#include <crtdll/stubs.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/errno.h>
+#include <crtdll/fcntl.h>
+//#include <crtdll/unistd.h>
+#include <crtdll/io.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/share.h>
#if 0
#ifndef __dj_include_stdio_h_
#include <windows.h>
-#include <stdio.h>
-#include <string.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
-char *
-_tmpnam(char *s);
-
-char *
-tmpnam(char *s)
-{
- return _tmpnam(s);
-}
-char *
-_tmpnam(char *s)
+char * tmpnam(char *s)
{
char PathName[MAX_PATH];
static char static_buf[MAX_PATH];
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <libc/file.h>
+#include <crtdll/stdio.h>
+#include <crtdll/internal/file.h>
+#include <crtdll/wchar.h>
int
ungetc(int c, FILE *f)
return c;
}
+
+
+int
+ungetwc(wchar_t c, FILE *f)
+{
+ return ungetc(c,f);
+}
\ No newline at end of file
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <stdarg.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int
vfprintf(FILE *f, const char *fmt, va_list ap)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <stdarg.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int
vprintf(const char *fmt, va_list ap)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
+#include <crtdll/stdio.h>
#include <stdarg.h>
#include <limits.h>
-#include <libc/file.h>
+#include <crtdll/internal/file.h>
int
vsprintf(char *str, const char *fmt, va_list ap)
#include <windows.h>
-#include <stdlib.h>
-#include <io.h>
-#include <fcntl.h>
-#include <libc/atexit.h>
-
-void _exit(int _status);
+#include <crtdll/stdlib.h>
+#include <crtdll/io.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/internal/atexit.h>
struct __atexit *__atexit_ptr = 0;
-void
-exit(int status)
+void exit(int status)
{
//int i;
struct __atexit *a = __atexit_ptr;
/* in case the program set it this way */
setmode(0, O_TEXT);
_exit(status);
+ for(;;);
}
void _exit(int _status)
{
- //ExitProcess(_status);
+ ExitProcess(_status);
+ for(;;);
}
void _cexit( void )
-#include <stdlib.h>
-#include <stdio.h>
-#include <io.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/stdio.h>
+#include <crtdll/io.h>
static char msg[] = "Abort!\r\n";
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
int
abs(int j)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
-#include <libc/atexit.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/internal/atexit.h>
int
atexit(void (*a)(void))
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
double
atof(const char *ascii)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
int
atoi(const char *str)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
long
atol(const char *str)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
long double
_atold(const char *ascii)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
void *
bsearch(const void *key, const void *base0, size_t nelem,
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
-#include <string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
void *
calloc(size_t size, size_t nelem)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
div_t
div(int num, int denom)
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
-#include <float.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/float.h>
char *
_ecvt (double value, int ndigits, int *decpt, int *sign)
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <float.h>
-#include <locale.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
+#include <crtdll/float.h>
+#include <crtdll/locale.h>
void __ecvround (char *, char *, const char *, int *);
#include <windows.h>
-#include <errno.h>
+#include <crtdll/errno.h>
#undef errno
int errno;
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
-#include <float.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/float.h>
char *
_fcvt (double value, int ndigits, int *decpt, int *sign)
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <float.h>
-#include <locale.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
+#include <crtdll/float.h>
+#include <crtdll/locale.h>
void __ecvround (char *, char *, const char *, int *);
* UPDATE HISTORY:
* 28/12/98: Created
*/
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
#include <windows.h>
#undef fullpath
/* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
char *
_gcvt (double value, int ndigits, char *buf)
* 1998: Added ltoa Boudewijn Dekker
*/
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <errno.h>
-#include <stdlib.h>
+#include <crtdll/errno.h>
+#include <crtdll/stdlib.h>
char *
itoa(int value, char *string, int radix)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
long
labs(long j)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
ldiv_t
ldiv(long num, long denom)
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
long long
llabs(long long j)
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
lldiv_t
lldiv(long long num, long long denom)
-#include <stdlib.h>
-#include <string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
void _makepath( char *path, const char *drive, const char *dir, const char *fname, const char *ext )
{
#include <windows.h>
-#include <stdlib.h>
-//#include <types.h>
+#include <crtdll/stdlib.h>
+//#include <crtdll/types.h>
#include <ddk/ntddk.h>
void* malloc(size_t _size)
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
int mblen (const char* mbs, size_t sizeString)
#include <windows.h>
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
+
+#undef _cpumode
+unsigned char _cpumode = 0;
+unsigned char *_cpumode_dll = &_cpumode;
void _seterrormode(int nMode)
{
return;
}
-void _beep(unsigned nFreq, unsigned dur)
+void _beep(unsigned nFreq, unsigned nDur)
{
Beep(nFreq,nDur);
return;
{
Sleep(ulTime);
return;
-}
\ No newline at end of file
+}
#include <windows.h>
-#include <stdlib.h>
-#include <string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
/*-
* Copyright (c) 1980, 1983 The Regents of the University of California.
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
static unsigned long long next = 0;
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
#include <windows.h>
-#include <string.h>
+#include <crtdll/string.h>
void _searchenv(const char *file,const char *var,char *path )
{
-#include <stdlib.h>
-#include <string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/string.h>
void _splitpath( const char *path, char *drive, char *dir, char *fname, char *ext )
{
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <math.h>
-#include <stdlib.h>
+#include <crtdll/math.h>
+#include <crtdll/stdlib.h>
double
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <libc/file.h>
+#include <crtdll/ctype.h>
+#include <crtdll/errno.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/internal/file.h>
long
strtol(const char *nptr, char **endptr, int base)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <stdlib.h>
-#include <ctype.h>
-//#include <libc/unconst.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/ctype.h>
+//#include <crtdll/unconst.h>
static double powten[] =
{
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-//#include <libc/unconst.h>
+#include <crtdll/ctype.h>
+#include <crtdll/errno.h>
+#include <crtdll/stdlib.h>
+//#include <crtdll/unconst.h>
/* constants used in Solaris */
#define LLONG_MIN -9223372036854775807L-1L
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <libc/file.h>
+#include <crtdll/ctype.h>
+#include <crtdll/errno.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/internal/file.h>
/*
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#include <limits.h>
-#include <ctype.h>
-#include <errno.h>
-#include <stdlib.h>
-//#include <libc/unconst.h>
+#include <crtdll/ctype.h>
+#include <crtdll/errno.h>
+#include <crtdll/stdlib.h>
+//#include <crtdll/unconst.h>
/*
* Convert a string to an unsigned long integer.
--- /dev/null
+/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
+#include <crtdll/stdlib.h>
+
+void _swab (const char* caFrom, char* caTo, size_t sizeToCopy)
+{
+ unsigned long temp;
+
+ sizeToCopy >>= 1; sizeToCopy++;
+#define STEP temp = *((const char *)caFrom)++,*((char *)caTo)++ = *((const char *)caFrom)++,*((char *)caTo)++ = temp
+ /* round to multiple of 8 */
+ while ((--sizeToCopy) & 07)
+ STEP;
+ sizeToCopy >>= 3;
+ while (--sizeToCopy >= 0) {
+ STEP; STEP; STEP; STEP;
+ STEP; STEP; STEP; STEP;
+ }
+}
-#include <stdlib.h>
+#include <crtdll/stdlib.h>
size_t wcstombs (char* mbsDest, const wchar_t* wsConvert, size_t size)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
void *
memchr(const void *s, int c, size_t n)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
int
memcmp(const void *s1, const void *s2, size_t n)
return to;
}
+
+void *__constant_memcpy(char *to, char *from, size_t count)
+{
+ return memcpy(to,from,count);
+}
+
+void *__memcpy(char *to, char *from, size_t count)
+{
+ return memcpy(to,from,count);
+}
+
+
-#include <string.h>
+#include <crtdll/string.h>
void * memmove(void *dest,const void *src,size_t count)
{
- char *char_dest = dest;
- char *char_src = src;
+ char *char_dest = (char *)dest;
+ char *char_src = (char *)src;
while(count > 0 )
{
}
return src;
}
+
+void *__memset_generic(void *src,int val,size_t count)
+{
+ return memset(src,val,count);
+}
+
+void * __constant_c_and_count_memset(void * s, unsigned long pattern, size_t count)
+{
+ return memset(s,pattern,count);
+}
+
+
+void * __constant_c_memset(void *src,int val,size_t count)
+{
+ return memset(src,val,count);
+}
* DISCLAMED. This includes but is not limited to warrenties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Revision: 1.1 $
- * $Author: rex $
- * $Date: 1999/01/16 02:11:44 $
+ * $Revision: 1.2 $
+ * $Author: ariadne $
+ * $Date: 1999/04/02 21:44:05 $
*
*/
-#include <string.h>
-#include <wchar.h>
+#include <crtdll/string.h>
+#include <crtdll/wchar.h>
int
strcasecmp (const char* sz1, const char* sz2)
{
- return stricmp (sz1, sz2);
+ return _stricmp (sz1, sz2);
}
int
int
wcscmpi (const wchar_t* ws1, const wchar_t* ws2)
{
- return wcsicmp (ws1, ws2);
+ //return wcsicmp (ws1, ws2);
+ return 0;
}
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
char *
strcat(char *s, const char *append)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
int
strcmp(const char *s1, const char *s2)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
int
strcoll(const char *s1, const char *s2)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
size_t
strcspn(const char *s1, const char *s2)
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
-#include <stdlib.h>
+#include <crtdll/string.h>
+#include <crtdll/stdlib.h>
-char *
-strdup(const char *_s)
+char *_strdup(const char *_s)
{
char *rv;
if (_s == 0)
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-//#include <libc/unconst.h>
+#include <crtdll/stdio.h>
+#include <crtdll/string.h>
+#include <crtdll/stdlib.h>
+#include <crtdll/errno.h>
char __syserr00[] = "No Error";
int __sys_nerr = sizeof(__sys_errlist) / sizeof(__sys_errlist[0]);
-char *
-strerror(int errnum)
+int* _sys_nerr_dll = &__sys_nerr;
+
+char *strerror(int errnum)
{
static char ebuf[40]; /* 64-bit number + slop */
char *cp;
return ebuf;
}
-#undef errno
-extern int errno;
+
char *_strerror(const char *s)
{
if ( s == NULL )
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
-#include <ctype.h>
+#include <crtdll/string.h>
+#include <crtdll/ctype.h>
int
-stricmp(const char *s1, const char *s2)
+_stricmp(const char *s1, const char *s2)
{
while (toupper(*s1) == toupper(*s2))
{
}
return toupper(*(unsigned const char *)s1) - toupper(*(unsigned const char *)(s2));
}
+
+int
+_strcmpi(const char *s1, const char *s2)
+{
+ return stricmp(s1,s2);
+}
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
size_t
strlen(const char *str)
* Copyright 1997 Uwe Bonnes
*/
-#include <string.h>
-#include <ctype.h>
+#include <crtdll/string.h>
+#include <crtdll/ctype.h>
-char * strlwr(char *x)
+char * _strlwr(char *x)
{
char *y=x;
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
char *
strncat(char *dst, const char *src, size_t n)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
int
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
char *
strncpy(char *dst, const char *src, size_t n)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
-#include <ctype.h>
+#include <crtdll/string.h>
+#include <crtdll/ctype.h>
-int
-strnicmp(const char *s1, const char *s2, size_t n)
+int _strnicmp(const char *s1, const char *s2, size_t n)
{
if (n == 0)
/* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
size_t
-strnlen(const char *str, int count)
+strnlen(const char *str, size_t count)
{
const char *s;
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
char *
/* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
-//#include <libc/unconst.h>
+#include <crtdll/string.h>
+//#include <crtdll/unconst.h>
char *
strrchr(const char *s, int c)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
size_t
strspn(const char *s1, const char *s2)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
-//#include <libc/unconst.h>
+#include <crtdll/string.h>
+//#include <crtdll/unconst.h>
char *
strstr(const char *s, const char *find)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
char *
strtok(char *s, const char *delim)
-#include <string.h>
-#include <ctype.h>
+#include <crtdll/string.h>
+#include <crtdll/ctype.h>
unsigned long strtoul(const char *cp,char **endp,unsigned int base)
{
*/
-#include <string.h>
-#include <ctype.h>
+#include <crtdll/string.h>
+#include <crtdll/ctype.h>
char *strupr(char *x)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
size_t
strxfrm(char *dst,const char *src, size_t n)
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/sys/stat.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/string.h>
#include <windows.h>
-//#include <libc/file.h>
+#include <crtdll/internal/file.h>
-void UnixTimeToFileTime( time_t unix_time, FILETIME *filetime, DWORD remainder );
-time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder );
int
-fstat(int handle, struct stat *statbuf)
+_fstat(int handle, struct stat *statbuf)
{
BY_HANDLE_FILE_INFORMATION FileInformation;
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <io.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/sys/stat.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/io.h>
-#undef stat
-int stat( const char *path, struct stat *buffer )
-{
- return _stat(path,buffer);
-}
int _stat( const char *path, struct stat *buffer )
{
--- /dev/null
+#include <crtdll/tchar.h>
+
+char * _strdec(const char *str1, const char *str2)
+{
+ return (char *) (( str1 >= str2 ) ? ( str1 ) : --str2);
+}
+
--- /dev/null
+#include <crtdll/tchar.h>
+
+char * _strinc(const char *str)
+{
+ return (char *)(++str);
+}
--- /dev/null
+#include <crtdll/tchar.h>
+#include <crtdll/sys/types.h>
+#include <crtdll/string.h>
+
+size_t _strncnt( const char *str, size_t max)
+{
+ return strnlen(str,max);
+}
--- /dev/null
+#include <crtdll/tchar.h>
+
+int _strnextc(const char *str)
+{
+ return *(++str);
+}
--- /dev/null
+#include <crtdll/tchar.h>
+
+char * _strninc(const char *str, size_t inc)
+{
+ return (char *)(str + inc);
+}
--- /dev/null
+#include <crtdll/tchar.h>
+
+
+char * _strspnp( const char * str1, const char * str2)
+{
+ return NULL;
+}
\ No newline at end of file
*/
#include <windows.h>
-#include <time.h>
+#include <crtdll/time.h>
+#include <crtdll/internal/file.h>
-// should be replace by a call to RtltimeToSecondsSince70
-time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder );
+VOID STDCALL GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime );
clock_t clock ( void )
{
FILETIME SystemTime;
DWORD Remainder;
- if ( !GetProcessTimes(-1,&CreationTime,&ExitTime,&KernelTime,&UserTime ) )
+ if ( !GetProcessTimes(GetCurrentProcess(),&CreationTime,&ExitTime,&KernelTime,&UserTime ) )
return -1;
- if ( !GetSystemTimeAsFileTime(&SystemTime) )
- return -1;
+ GetSystemTimeAsFileTime(&SystemTime);
+
return FileTimeToUnixTime( &SystemTime,&Remainder ) - FileTimeToUnixTime( &CreationTime,&Remainder );
}
\ No newline at end of file
-#include <fcntl.h>
-#include <time.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
+#include <crtdll/fcntl.h>
+#include <crtdll/time.h>
+#include <crtdll/string.h>
+#include <crtdll/ctype.h>
+#include <crtdll/stdio.h>
+#include <crtdll/stdlib.h>
#include <windows.h>
#include "tzfile.h"
-#include <io.h>
+#include <crtdll/io.h>
#include "posixrul.h"
** manual page of what this "time zone abbreviation" means (doing this so
** that tzname[0] has the "normal" length of three characters).
*/
+int _daylight_dll;
+
static char WILDABBR[] = " ";
#ifndef TRUE
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <time.h>
+#include <crtdll/time.h>
double
difftime(time_t time1, time_t time0)
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <string.h>
+#include <crtdll/string.h>
-#include <time.h>
+#include <crtdll/time.h>
#define TM_YEAR_BASE 1900
* 28/12/98: Created
*/
-#include <windows.h>
-#include <time.h>
+/*
+ * DOS file system functions
+ *
+ * Copyright 1993 Erik Bos
+ * Copyright 1996 Alexandre Julliard
+ */
-// should be replace by a call to RtltimeToSecondsSince70
-// and moved to a header
+#include <windows.h>
+#include <crtdll/time.h>
+#include <crtdll/internal/file.h>
-time_t FileTimeToUnixTime( const FILETIME *filetime, DWORD *remainder );
+VOID STDCALL GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime );
time_t
time(time_t *t)
return FileTimeToUnixTime( &SystemTime,&Remainder );
}
+/***********************************************************************
+ * 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;
+
+}
+
+
+
-#include <wstring.h>
+#include <crtdll/wchar.h>
wchar_t * wcscat(wchar_t * dest,const wchar_t * src)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <wstring.h>
+#include <crtdll/wchar.h>
wchar_t* wcschr(const wchar_t* str, wchar_t ch)
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <wstring.h>
+#include <crtdll/wchar.h>
int wcscmp(const wchar_t* cs,const wchar_t * ct)
{
* Copyright 1997 Uwe Bonnes
*/
-#include <wstring.h>
+#include <crtdll/wchar.h>
-size_t wcscoll(wchar_t *a1,wchar_t *a2)
+int wcscoll(const wchar_t *a1,const wchar_t *a2)
{
/* FIXME: handle collates */
return wcscmp(a1,a2);
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <wstring.h>
+#include <crtdll/wchar.h>
wchar_t * wcscpy(wchar_t * str1,const wchar_t * str2)
{
-#include <wstring.h>
+#include <crtdll/wchar.h>
size_t wcscspn(const wchar_t *str,const wchar_t *reject)
{
-#include <wstring.h>
+#include <crtdll/wchar.h>
-wchar_t *wcsdup(const wchar_t *ptr)
+wchar_t *_wcsdup(const wchar_t *ptr)
{
wchar_t *dup;
dup = malloc((wcslen(ptr) + 1)*sizeof(wchar_t));
--- /dev/null
+#include <crtdll/wchar.h>
+
+size_t wcsftime(wchar_t *str, size_t len, const wchar_t *fmt, const struct tm *tp )
+{
+ return 0;
+}
\ No newline at end of file
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <wstring.h>
+#include <crtdll/wchar.h>
-int wcsicmp(const wchar_t* cs,const wchar_t * ct)
+int _wcsicmp(const wchar_t* cs,const wchar_t * ct)
{
while (towlower(*cs) == towlower(*ct))
{
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
-#include <wstring.h>
-
-size_t wstrlen(const wchar_t *s)
-{
- return wcslen(s);
-}
+#include <crtdll/wchar.h>
size_t wcslen(const wchar_t * s)
for (save = s; *save; ++save);
return save-s;
}
+
+size_t wstrlen(const wchar_t *s)
+{
+ return wcslen(s);
+}
+
+
* Copyright 1997 Uwe Bonnes
*/
-#include <wstring.h>
+#include <crtdll/wchar.h>
-wchar_t * wcslwr(wchar_t *x)
+wchar_t * _wcslwr(wchar_t *x)
{
wchar_t *y=x;
-#include <wstring.h>
+#include <crtdll/wchar.h>
wchar_t * wcsncat(wchar_t * dest,const wchar_t * src,size_t count)
{
-#include <wstring.h>
+#include <crtdll/wchar.h>
int wcsncmp(const wchar_t * cs,const wchar_t * ct,size_t count)
{
-#include <wstring.h>
+#include <crtdll/wchar.h>
-wchar_t * wcsncpy(wchar_t * dest,const wchar_t *src,size_t count)
+wchar_t * _wcsncpy(wchar_t * dest,const wchar_t *src,size_t count)
{
int i;
-#include <wstring.h>
+#include <crtdll/wchar.h>
-int wcsnicmp(const wchar_t * cs,const wchar_t * ct,size_t count)
+int _wcsnicmp(const wchar_t * cs,const wchar_t * ct,size_t count)
{
wchar_t *save = cs;
while (towlower(*cs) == towlower(*ct) && (int)(cs - save) < count)
-size_t wcsnlen(const wchar_t * s, size_t count)
+#include <crtdll/wchar.h>
+
+size_t _wcsnlen(const wchar_t * s, size_t count)
{
unsigned int len=0;
+#include <crtdll/wchar.h>
+
wchar_t* wcsrchr(const wchar_t* str, wchar_t ch)
{
-wchar_t * wcsrev(wchar_t *s)
+#include <crtdll/wchar.h>
+
+wchar_t * _wcsrev(wchar_t *s)
{
wchar_t *e;
wchar_t a;
-size_t wcsspn(const wchar_t *str,const wchar_t *accept)
+#include <crtdll/wchar.h>
+
+size_t _wcsspn(const wchar_t *str,const wchar_t *accept)
{
wchar_t *s;
wchar_t *t;
+#include <crtdll/wchar.h>
+
wchar_t *wcsstr(const wchar_t *s,const wchar_t *b)
{
wchar_t *x;
+#include <crtdll/wchar.h>
+
wchar_t *wcstok(wchar_t *s, const wchar_t *ct)
{
const wchar_t *spanp;
+#include <crtdll/wchar.h>
+
+
+long wcstol(const wchar_t *cp,wchar_t **endp,unsigned int base)
+{
+ long result = 0,value;
+ int sign = 1;
+
+ if ( *cp == L'-' ) {
+ sign = -1;
+ *cp++;
+ }
+
+ if (!base) {
+ base = 10;
+ if (*cp == L'0') {
+ base = 8;
+ cp++;
+ if ((*cp == L'x') && iswxdigit(cp[1])) {
+ cp++;
+ base = 16;
+ }
+ }
+ }
+ while (iswxdigit(*cp) && (value = iswdigit(*cp) ? *cp-L'0' : (iswlower(*cp)
+ ? towupper(*cp) : *cp)-L'A'+10) < base) {
+ result = result*base + value;
+ cp++;
+ }
+ if (endp)
+ *endp = (wchar_t *)cp;
+ return result * sign;
+}
+
+
unsigned long wcstoul(const wchar_t *cp,wchar_t **endp,unsigned int base)
{
unsigned long result = 0,value;
-wchar_t *wcsupr(wchar_t *x)
+#include <crtdll/wchar.h>
+
+wchar_t *_wcsupr(wchar_t *x)
{
wchar_t *y=x;
--- /dev/null
+#include <crtdll/string.h>
+
+size_t wcsxfrm( wchar_t *str1, const wchar_t *str2, size_t len )
+{
+ return 0;
+}
\ No newline at end of file