2001-04-10 23:21:43 +00:00
|
|
|
/*
|
|
|
|
* Standard I/O definitions.
|
|
|
|
*
|
|
|
|
* Derived from the mingw header written by Colin Peters.
|
|
|
|
* Modified for Wine use by Jon Griffiths and Francois Gouget.
|
|
|
|
* This file is in the public domain.
|
|
|
|
*/
|
|
|
|
#ifndef __WINE_STDIO_H
|
|
|
|
#define __WINE_STDIO_H
|
2003-07-18 22:57:15 +00:00
|
|
|
#ifndef __WINE_USE_MSVCRT
|
2001-10-22 18:59:23 +00:00
|
|
|
#define __WINE_USE_MSVCRT
|
2003-07-18 22:57:15 +00:00
|
|
|
#endif
|
2001-04-10 23:21:43 +00:00
|
|
|
|
2001-05-07 18:18:33 +00:00
|
|
|
#ifndef RC_INVOKED
|
2001-04-10 23:21:43 +00:00
|
|
|
#include <stdarg.h>
|
2001-05-07 18:18:33 +00:00
|
|
|
#endif
|
2001-04-10 23:21:43 +00:00
|
|
|
|
2006-07-10 10:28:25 +00:00
|
|
|
#if !defined(_MSC_VER) && !defined(__int64)
|
|
|
|
#define __int64 long long
|
|
|
|
#endif
|
|
|
|
|
2001-04-10 23:21:43 +00:00
|
|
|
/* file._flag flags */
|
2001-10-15 17:50:55 +00:00
|
|
|
#define _IOREAD 0x0001
|
|
|
|
#define _IOWRT 0x0002
|
|
|
|
#define _IOMYBUF 0x0008
|
|
|
|
#define _IOEOF 0x0010
|
|
|
|
#define _IOERR 0x0020
|
|
|
|
#define _IOSTRG 0x0040
|
|
|
|
#define _IORW 0x0080
|
2001-04-10 23:21:43 +00:00
|
|
|
|
2002-12-18 20:17:20 +00:00
|
|
|
#ifndef NULL
|
|
|
|
#ifdef __cplusplus
|
|
|
|
#define NULL 0
|
|
|
|
#else
|
|
|
|
#define NULL ((void *)0)
|
|
|
|
#endif
|
|
|
|
#endif
|
2001-04-10 23:21:43 +00:00
|
|
|
|
|
|
|
#define STDIN_FILENO 0
|
|
|
|
#define STDOUT_FILENO 1
|
|
|
|
#define STDERR_FILENO 2
|
|
|
|
|
|
|
|
/* more file._flag flags, but these conflict with Unix */
|
|
|
|
#define _IOFBF 0x0000
|
|
|
|
#define _IONBF 0x0004
|
|
|
|
#define _IOLBF 0x0040
|
|
|
|
|
|
|
|
#define EOF (-1)
|
|
|
|
#define FILENAME_MAX 260
|
2003-10-24 00:23:51 +00:00
|
|
|
#define TMP_MAX 0x7fff
|
2001-04-10 23:21:43 +00:00
|
|
|
#define FOPEN_MAX 20
|
|
|
|
#define L_tmpnam 260
|
|
|
|
|
|
|
|
#define BUFSIZ 512
|
|
|
|
|
|
|
|
#ifndef SEEK_SET
|
|
|
|
#define SEEK_SET 0
|
|
|
|
#define SEEK_CUR 1
|
|
|
|
#define SEEK_END 2
|
|
|
|
#endif
|
|
|
|
|
2004-06-25 01:19:15 +00:00
|
|
|
#ifndef _FILE_DEFINED
|
|
|
|
#define _FILE_DEFINED
|
|
|
|
typedef struct _iobuf
|
2001-04-10 23:21:43 +00:00
|
|
|
{
|
|
|
|
char* _ptr;
|
|
|
|
int _cnt;
|
|
|
|
char* _base;
|
|
|
|
int _flag;
|
|
|
|
int _file;
|
|
|
|
int _charbuf;
|
|
|
|
int _bufsiz;
|
|
|
|
char* _tmpfname;
|
2004-06-25 01:19:15 +00:00
|
|
|
} FILE;
|
|
|
|
#endif /* _FILE_DEFINED */
|
2001-04-10 23:21:43 +00:00
|
|
|
|
2004-06-25 01:19:15 +00:00
|
|
|
#ifndef _FPOS_T_DEFINED
|
2005-01-04 20:38:14 +00:00
|
|
|
typedef __int64 fpos_t;
|
2004-06-25 01:19:15 +00:00
|
|
|
#define _FPOS_T_DEFINED
|
2002-12-18 20:17:20 +00:00
|
|
|
#endif
|
2001-04-10 23:21:43 +00:00
|
|
|
|
2004-06-25 01:19:15 +00:00
|
|
|
#ifndef _SIZE_T_DEFINED
|
2006-07-10 10:28:25 +00:00
|
|
|
#ifdef _WIN64
|
|
|
|
typedef unsigned __int64 size_t;
|
|
|
|
#else
|
2004-06-25 01:19:15 +00:00
|
|
|
typedef unsigned int size_t;
|
2006-07-10 10:28:25 +00:00
|
|
|
#endif
|
2004-06-25 01:19:15 +00:00
|
|
|
#define _SIZE_T_DEFINED
|
2001-04-10 23:21:43 +00:00
|
|
|
#endif
|
|
|
|
|
2004-06-25 01:19:15 +00:00
|
|
|
#ifndef _WCHAR_T_DEFINED
|
|
|
|
#define _WCHAR_T_DEFINED
|
2002-12-18 20:17:20 +00:00
|
|
|
#ifndef __cplusplus
|
2004-06-25 01:19:15 +00:00
|
|
|
typedef unsigned short wchar_t;
|
2002-12-18 20:17:20 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2004-04-26 23:31:39 +00:00
|
|
|
#ifndef _WCTYPE_T_DEFINED
|
2004-06-25 01:19:15 +00:00
|
|
|
typedef unsigned short wint_t;
|
|
|
|
typedef unsigned short wctype_t;
|
2004-04-26 23:31:39 +00:00
|
|
|
#define _WCTYPE_T_DEFINED
|
2002-12-18 20:17:20 +00:00
|
|
|
#endif
|
2001-04-10 23:21:43 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2004-06-25 01:19:15 +00:00
|
|
|
#ifndef _STDIO_DEFINED
|
|
|
|
FILE* __p__iob(void);
|
2001-04-10 23:21:43 +00:00
|
|
|
#define _iob (__p__iob())
|
2004-06-25 01:19:15 +00:00
|
|
|
#endif /* _STDIO_DEFINED */
|
2002-12-18 20:17:20 +00:00
|
|
|
|
2001-04-10 23:21:43 +00:00
|
|
|
#define stdin (_iob+STDIN_FILENO)
|
|
|
|
#define stdout (_iob+STDOUT_FILENO)
|
|
|
|
#define stderr (_iob+STDERR_FILENO)
|
|
|
|
|
2004-06-25 01:19:15 +00:00
|
|
|
#ifndef _STDIO_DEFINED
|
|
|
|
#define _STDIO_DEFINED
|
|
|
|
int _fcloseall(void);
|
|
|
|
FILE* _fdopen(int,const char*);
|
2001-04-10 23:21:43 +00:00
|
|
|
int _fgetchar(void);
|
2004-06-25 01:19:15 +00:00
|
|
|
int _filbuf(FILE*);
|
|
|
|
int _fileno(FILE*);
|
|
|
|
int _flsbuf(int,FILE*);
|
2001-04-10 23:21:43 +00:00
|
|
|
int _flushall(void);
|
|
|
|
int _fputchar(int);
|
2004-06-25 01:19:15 +00:00
|
|
|
FILE* _fsopen(const char*,const char*,int);
|
2001-04-10 23:21:43 +00:00
|
|
|
int _getmaxstdio(void);
|
2004-06-25 01:19:15 +00:00
|
|
|
int _getw(FILE*);
|
|
|
|
int _pclose(FILE*);
|
|
|
|
FILE* _popen(const char*,const char*);
|
|
|
|
int _putw(int,FILE*);
|
2001-04-10 23:21:43 +00:00
|
|
|
int _rmtmp(void);
|
|
|
|
int _setmaxstdio(int);
|
2004-06-25 01:19:15 +00:00
|
|
|
int _snprintf(char*,size_t,const char*,...);
|
2001-04-10 23:21:43 +00:00
|
|
|
char* _tempnam(const char*,const char*);
|
|
|
|
int _unlink(const char*);
|
2004-06-25 01:19:15 +00:00
|
|
|
int _vsnprintf(char*,size_t,const char*,va_list);
|
|
|
|
|
|
|
|
void clearerr(FILE*);
|
|
|
|
int fclose(FILE*);
|
|
|
|
int feof(FILE*);
|
|
|
|
int ferror(FILE*);
|
|
|
|
int fflush(FILE*);
|
|
|
|
int fgetc(FILE*);
|
|
|
|
int fgetpos(FILE*,fpos_t*);
|
|
|
|
char* fgets(char*,int,FILE*);
|
|
|
|
FILE* fopen(const char*,const char*);
|
|
|
|
int fprintf(FILE*,const char*,...);
|
|
|
|
int fputc(int,FILE*);
|
|
|
|
int fputs(const char*,FILE*);
|
|
|
|
size_t fread(void*,size_t,size_t,FILE*);
|
|
|
|
FILE* freopen(const char*,const char*,FILE*);
|
|
|
|
int fscanf(FILE*,const char*,...);
|
|
|
|
int fseek(FILE*,long,int);
|
|
|
|
int fsetpos(FILE*,fpos_t*);
|
|
|
|
long ftell(FILE*);
|
|
|
|
size_t fwrite(const void*,size_t,size_t,FILE*);
|
|
|
|
int getc(FILE*);
|
|
|
|
int getchar(void);
|
|
|
|
char* gets(char*);
|
|
|
|
void perror(const char*);
|
|
|
|
int printf(const char*,...);
|
|
|
|
int putc(int,FILE*);
|
|
|
|
int putchar(int);
|
|
|
|
int puts(const char*);
|
|
|
|
int remove(const char*);
|
|
|
|
int rename(const char*,const char*);
|
|
|
|
void rewind(FILE*);
|
|
|
|
int scanf(const char*,...);
|
|
|
|
void setbuf(FILE*,char*);
|
|
|
|
int setvbuf(FILE*,char*,int,size_t);
|
|
|
|
int sprintf(char*,const char*,...);
|
|
|
|
int sscanf(const char*,const char*,...);
|
|
|
|
FILE* tmpfile(void);
|
|
|
|
char* tmpnam(char*);
|
|
|
|
int ungetc(int,FILE*);
|
|
|
|
int vfprintf(FILE*,const char*,va_list);
|
|
|
|
int vprintf(const char*,va_list);
|
|
|
|
int vsprintf(char*,const char*,va_list);
|
|
|
|
|
|
|
|
#ifndef _WSTDIO_DEFINED
|
|
|
|
#define _WSTDIO_DEFINED
|
|
|
|
wint_t _fgetwchar(void);
|
|
|
|
wint_t _fputwchar(wint_t);
|
|
|
|
wchar_t*_getws(wchar_t*);
|
|
|
|
int _putws(const wchar_t*);
|
|
|
|
int _snwprintf(wchar_t*,size_t,const wchar_t*,...);
|
|
|
|
int _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list);
|
|
|
|
FILE* _wfdopen(int,const wchar_t*);
|
|
|
|
FILE* _wfopen(const wchar_t*,const wchar_t*);
|
|
|
|
FILE* _wfreopen(const wchar_t*,const wchar_t*,FILE*);
|
|
|
|
FILE* _wfsopen(const wchar_t*,const wchar_t*,int);
|
|
|
|
void _wperror(const wchar_t*);
|
|
|
|
FILE* _wpopen(const wchar_t*,const wchar_t*);
|
|
|
|
int _wremove(const wchar_t*);
|
|
|
|
wchar_t*_wtempnam(const wchar_t*,const wchar_t*);
|
|
|
|
wchar_t*_wtmpnam(wchar_t*);
|
|
|
|
|
|
|
|
wint_t fgetwc(FILE*);
|
|
|
|
wchar_t*fgetws(wchar_t*,int,FILE*);
|
|
|
|
wint_t fputwc(wint_t,FILE*);
|
|
|
|
int fputws(const wchar_t*,FILE*);
|
|
|
|
int fwprintf(FILE*,const wchar_t*,...);
|
|
|
|
int fputws(const wchar_t*,FILE*);
|
|
|
|
int fwscanf(FILE*,const wchar_t*,...);
|
|
|
|
wint_t getwc(FILE*);
|
|
|
|
wint_t getwchar(void);
|
|
|
|
wchar_t*getws(wchar_t*);
|
|
|
|
wint_t putwc(wint_t,FILE*);
|
|
|
|
wint_t putwchar(wint_t);
|
|
|
|
int putws(const wchar_t*);
|
|
|
|
int swprintf(wchar_t*,const wchar_t*,...);
|
|
|
|
int swscanf(const wchar_t*,const wchar_t*,...);
|
|
|
|
wint_t ungetwc(wint_t,FILE*);
|
|
|
|
int vfwprintf(FILE*,const wchar_t*,va_list);
|
|
|
|
int vswprintf(wchar_t*,const wchar_t*,va_list);
|
|
|
|
int vwprintf(const wchar_t*,va_list);
|
|
|
|
int wprintf(const wchar_t*,...);
|
|
|
|
int wscanf(const wchar_t*,...);
|
|
|
|
#endif /* _WSTDIO_DEFINED */
|
|
|
|
|
|
|
|
#endif /* _STDIO_DEFINED */
|
2001-04-10 23:21:43 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2004-06-25 01:19:15 +00:00
|
|
|
static inline FILE* fdopen(int fd, const char *mode) { return _fdopen(fd, mode); }
|
2003-03-22 21:15:41 +00:00
|
|
|
static inline int fgetchar(void) { return _fgetchar(); }
|
2004-06-25 01:19:15 +00:00
|
|
|
static inline int fileno(FILE* file) { return _fileno(file); }
|
2003-03-22 21:15:41 +00:00
|
|
|
static inline int fputchar(int c) { return _fputchar(c); }
|
2004-06-25 01:19:15 +00:00
|
|
|
static inline int pclose(FILE* file) { return _pclose(file); }
|
|
|
|
static inline FILE* popen(const char* command, const char* mode) { return _popen(command, mode); }
|
2003-03-22 21:15:41 +00:00
|
|
|
static inline char* tempnam(const char *dir, const char *prefix) { return _tempnam(dir, prefix); }
|
2004-06-25 01:19:15 +00:00
|
|
|
#ifndef _UNLINK_DEFINED
|
2003-01-11 22:49:54 +00:00
|
|
|
static inline int unlink(const char* path) { return _unlink(path); }
|
2004-06-25 01:19:15 +00:00
|
|
|
#define _UNLINK_DEFINED
|
2003-01-11 22:49:54 +00:00
|
|
|
#endif
|
2003-08-13 22:01:12 +00:00
|
|
|
static inline int vsnprintf(char *buffer, size_t size, const char *format, va_list args) { return _vsnprintf(buffer,size,format,args); }
|
2001-04-10 23:21:43 +00:00
|
|
|
|
2004-06-25 01:19:15 +00:00
|
|
|
static inline wint_t fgetwchar(void) { return _fgetwchar(); }
|
|
|
|
static inline wint_t fputwchar(wint_t wc) { return _fputwchar(wc); }
|
|
|
|
static inline int getw(FILE* file) { return _getw(file); }
|
|
|
|
static inline int putw(int val, FILE* file) { return _putw(val, file); }
|
|
|
|
static inline FILE* wpopen(const wchar_t* command,const wchar_t* mode) { return _wpopen(command, mode); }
|
2001-04-10 23:21:43 +00:00
|
|
|
|
|
|
|
#endif /* __WINE_STDIO_H */
|