2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
11 #pragma pack(push,_CRT_PACKING)
18 #define _NFILE _NSTREAM_
20 #define _IOB_ENTRIES 20
34 typedef struct _iobuf
FILE;
40 #define _wP_tmpdir L"/"
42 #define _P_tmpdir "\\"
43 #define _wP_tmpdir L"\\"
46 #define L_tmpnam (sizeof(_P_tmpdir) + 12)
57 #define STDIN_FILENO 0
58 #define STDOUT_FILENO 1
59 #define STDERR_FILENO 2
61 #define FILENAME_MAX 260
70 #define NULL ((void *)0)
74 #ifndef _OFF_T_DEFINED
75 #define _OFF_T_DEFINED
79 #if !defined(NO_OLDNAMES) || defined(_POSIX)
85 #ifndef _OFF64_T_DEFINED
86 #define _OFF64_T_DEFINED
87 typedef long long _off64_t
;
88 #if !defined(NO_OLDNAMES) || defined(_POSIX)
89 typedef long long off64_t
;
93 #ifndef _STDIO_DEFINED
94 _CRTIMP
FILE *__cdecl
__iob_func(void);
95 _CRTIMP
extern FILE _iob
[];
98 #ifndef _FPOS_T_DEFINED
99 #define _FPOS_T_DEFINED
102 #if (!defined(NO_OLDNAMES) || defined(__GNUC__)) && _INTEGRAL_MAX_BITS >= 64
103 typedef __int64
fpos_t;
104 #define _FPOSOFF(fp) ((long)(fp))
106 typedef long long fpos_t;
107 #define _FPOSOFF(fp) ((long)(fp))
112 #ifndef _STDSTREAM_DEFINED
113 #define _STDSTREAM_DEFINED
115 #define stdin (&__iob_func()[0])
116 #define stdout (&__iob_func()[1])
117 #define stderr (&__iob_func()[2])
118 #else // !_M_CEE_PURE
119 #define stdin (&_iob[0])
120 #define stdout (&_iob[1])
121 #define stderr (&_iob[2])
125 #define _IOREAD 0x0001
126 #define _IOWRT 0x0002
128 #define _IOFBF 0x0000
129 #define _IOLBF 0x0040
130 #define _IONBF 0x0004
132 #define _IOMYBUF 0x0008
133 #define _IOEOF 0x0010
134 #define _IOERR 0x0020
135 #define _IOSTRG 0x0040
138 #define _IOAPPEND 0x0200
141 #define _TWO_DIGIT_EXPONENT 0x1
143 #ifndef _STDIO_DEFINED
145 _CRTIMP
int __cdecl
_filbuf(FILE *_File
);
146 _CRTIMP
int __cdecl
_flsbuf(int _Ch
,FILE *_File
);
148 _CRTIMP
FILE *__cdecl
_fsopen(const char *_Filename
,const char *_Mode
);
150 _CRTIMP
FILE *__cdecl
_fsopen(const char *_Filename
,const char *_Mode
,int _ShFlag
);
152 void __cdecl
clearerr(FILE *_File
);
153 int __cdecl
fclose(FILE *_File
);
154 _CRTIMP
int __cdecl
_fcloseall(void);
156 FILE *__cdecl
fdopen(int _FileHandle
,const char *_Mode
);
158 _CRTIMP
FILE *__cdecl
_fdopen(int _FileHandle
,const char *_Mode
);
160 int __cdecl
feof(FILE *_File
);
161 int __cdecl
ferror(FILE *_File
);
162 int __cdecl
fflush(FILE *_File
);
163 int __cdecl
fgetc(FILE *_File
);
164 _CRTIMP
int __cdecl
_fgetchar(void);
165 int __cdecl
fgetpos(FILE *_File
,fpos_t *_Pos
);
166 char *__cdecl
fgets(char *_Buf
,int _MaxCount
,FILE *_File
);
168 int __cdecl
fileno(FILE *_File
);
170 _CRTIMP
int __cdecl
_fileno(FILE *_File
);
172 _CRTIMP
char *__cdecl
_tempnam(const char *_DirName
,const char *_FilePrefix
);
173 _CRTIMP
int __cdecl
_flushall(void);
174 FILE *__cdecl
fopen(const char *_Filename
,const char *_Mode
);
175 FILE *fopen64(const char *filename
,const char *mode
);
176 int __cdecl
fprintf(FILE *_File
,const char *_Format
,...);
177 int __cdecl
fputc(int _Ch
,FILE *_File
);
178 _CRTIMP
int __cdecl
_fputchar(int _Ch
);
179 int __cdecl
fputs(const char *_Str
,FILE *_File
);
180 size_t __cdecl
fread(void *_DstBuf
,size_t _ElementSize
,size_t _Count
,FILE *_File
);
181 FILE *__cdecl
freopen(const char *_Filename
,const char *_Mode
,FILE *_File
);
182 int __cdecl
fscanf(FILE *_File
,const char *_Format
,...);
183 int __cdecl
fsetpos(FILE *_File
,const fpos_t *_Pos
);
184 int __cdecl
fseek(FILE *_File
,long _Offset
,int _Origin
);
185 int fseeko64(FILE* stream
, _off64_t offset
, int whence
);
186 long __cdecl
ftell(FILE *_File
);
187 _off64_t
ftello64(FILE * stream
);
188 int __cdecl
_fseeki64(FILE *_File
,__int64 _Offset
,int _Origin
);
189 __int64 __cdecl
_ftelli64(FILE *_File
);
190 size_t __cdecl
fwrite(const void *_Str
,size_t _Size
,size_t _Count
,FILE *_File
);
191 int __cdecl
getc(FILE *_File
);
192 int __cdecl
getchar(void);
193 _CRTIMP
int __cdecl
_getmaxstdio(void);
194 char *__cdecl
gets(char *_Buffer
);
195 int __cdecl
_getw(FILE *_File
);
196 #ifndef _CRT_PERROR_DEFINED
197 #define _CRT_PERROR_DEFINED
198 void __cdecl
perror(const char *_ErrMsg
);
200 _CRTIMP
int __cdecl
_pclose(FILE *_File
);
201 _CRTIMP
FILE *__cdecl
_popen(const char *_Command
,const char *_Mode
);
202 #if !defined(NO_OLDNAMES) && !defined(popen)
204 #define pclose _pclose
206 int __cdecl
printf(const char *_Format
,...);
207 int __cdecl
putc(int _Ch
,FILE *_File
);
208 int __cdecl
putchar(int _Ch
);
209 int __cdecl
puts(const char *_Str
);
210 _CRTIMP
int __cdecl
_putw(int _Word
,FILE *_File
);
211 #ifndef _CRT_DIRECTORY_DEFINED
212 #define _CRT_DIRECTORY_DEFINED
213 int __cdecl
remove(const char *_Filename
);
214 int __cdecl
rename(const char *_OldFilename
,const char *_NewFilename
);
215 _CRTIMP
int __cdecl
_unlink(const char *_Filename
);
217 int __cdecl
unlink(const char *_Filename
);
220 void __cdecl
rewind(FILE *_File
);
221 _CRTIMP
int __cdecl
_rmtmp(void);
222 int __cdecl
scanf(const char *_Format
,...);
223 void __cdecl
setbuf(FILE *_File
,char *_Buffer
);
224 _CRTIMP
int __cdecl
_setmaxstdio(int _Max
);
225 _CRTIMP
unsigned int __cdecl
_set_output_format(unsigned int _Format
);
226 _CRTIMP
unsigned int __cdecl
_get_output_format(void);
227 int __cdecl
setvbuf(FILE *_File
,char *_Buf
,int _Mode
,size_t _Size
);
228 _CRTIMP
int __cdecl
_scprintf(const char *_Format
,...);
229 int __cdecl
sscanf(const char *_Src
,const char *_Format
,...);
230 _CRTIMP
int __cdecl
_snscanf(const char *_Src
,size_t _MaxCount
,const char *_Format
,...);
231 FILE *__cdecl
tmpfile(void);
232 char *__cdecl
tmpnam(char *_Buffer
);
233 int __cdecl
ungetc(int _Ch
,FILE *_File
);
234 int __cdecl
vfprintf(FILE *_File
,const char *_Format
,va_list _ArgList
);
235 int __cdecl
vprintf(const char *_Format
,va_list _ArgList
);
236 /* Make sure macros are not defined. */
237 #if __MINGW_GNUC_PREREQ(4,4)
238 #pragma push_macro("vsnprintf")
239 #pragma push_macro("snprintf")
246 __attribute__((format(gnu_printf
, 3, 0))) __attribute__((nonnull (3)))
248 int __mingw_vsnprintf(char *_DstBuf
,size_t _MaxCount
,const char *_Format
,va_list _ArgList
);
251 __attribute__((format(gnu_printf
, 3, 4))) __attribute__((nonnull (3)))
253 int __mingw_snprintf(char* s
, size_t n
, const char* format
, ...);
254 int __cdecl
vsnprintf(char *_DstBuf
,size_t _MaxCount
,const char *_Format
,va_list _ArgList
);
255 _CRTIMP
int __cdecl
_snprintf(char *_Dest
,size_t _Count
,const char *_Format
,...);
256 _CRTIMP
int __cdecl
_vsnprintf(char *_Dest
,size_t _Count
,const char *_Format
,va_list _Args
);
257 int __cdecl
sprintf(char *_Dest
,const char *_Format
,...);
258 int __cdecl
vsprintf(char *_Dest
,const char *_Format
,va_list _Args
);
259 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
260 int __cdecl
snprintf(char* s
, size_t n
, const char* format
, ...);
261 __CRT_INLINE
int __cdecl
vsnprintf (char* s
, size_t n
, const char* format
,va_list arg
) {
262 return _vsnprintf ( s
, n
, format
, arg
);
264 int __cdecl
vscanf(const char * __restrict__ Format
, va_list argp
);
265 int __cdecl
vfscanf (FILE * __restrict__ fp
, const char * Format
,va_list argp
);
266 int __cdecl
vsscanf (const char * __restrict__ _Str
,const char * __restrict__ Format
,va_list argp
);
268 /* Restore may prior defined macros snprintf/vsnprintf. */
269 #if __MINGW_GNUC_PREREQ(4,4)
270 #pragma pop_macro("snprintf")
271 #pragma pop_macro("vsnprintf")
273 /* Check if vsnprintf and snprintf are defaulting to gnu-style. */
274 #if defined(USE_MINGW_GNU_SNPRINTF) && USE_MINGW_GNU_SNPRINTF
276 #define vsnprintf __mingw_vsnprintf
279 #define snprintf __mingw_snprintf
283 #define vsnprintf _vsnprintf
286 #define snprintf _snprintf
290 _CRTIMP
int __cdecl
_vscprintf(const char *_Format
,va_list _ArgList
);
291 _CRTIMP
int __cdecl
_set_printf_count_output(int _Value
);
292 _CRTIMP
int __cdecl
_get_printf_count_output();
294 #ifndef _WSTDIO_DEFINED
297 #define WEOF (wint_t)(0xFFFF)
301 _CRTIMP
FILE *__cdecl
_wfsopen(const wchar_t *_Filename
,const wchar_t *_Mode
);
303 _CRTIMP
FILE *__cdecl
_wfsopen(const wchar_t *_Filename
,const wchar_t *_Mode
,int _ShFlag
);
305 wint_t __cdecl
fgetwc(FILE *_File
);
306 _CRTIMP
wint_t __cdecl
_fgetwchar(void);
307 wint_t __cdecl
fputwc(wchar_t _Ch
,FILE *_File
);
308 _CRTIMP
wint_t __cdecl
_fputwchar(wchar_t _Ch
);
309 wint_t __cdecl
getwc(FILE *_File
);
310 wint_t __cdecl
getwchar(void);
311 wint_t __cdecl
putwc(wchar_t _Ch
,FILE *_File
);
312 wint_t __cdecl
putwchar(wchar_t _Ch
);
313 wint_t __cdecl
ungetwc(wint_t _Ch
,FILE *_File
);
314 wchar_t *__cdecl
fgetws(wchar_t *_Dst
,int _SizeInWords
,FILE *_File
);
315 int __cdecl
fputws(const wchar_t *_Str
,FILE *_File
);
316 _CRTIMP
wchar_t *__cdecl
_getws(wchar_t *_String
);
317 _CRTIMP
int __cdecl
_putws(const wchar_t *_Str
);
318 int __cdecl
fwprintf(FILE *_File
,const wchar_t *_Format
,...);
319 int __cdecl
wprintf(const wchar_t *_Format
,...);
320 _CRTIMP
int __cdecl
_scwprintf(const wchar_t *_Format
,...);
321 int __cdecl
vfwprintf(FILE *_File
,const wchar_t *_Format
,va_list _ArgList
);
322 int __cdecl
vwprintf(const wchar_t *_Format
,va_list _ArgList
);
323 _CRTIMP
int __cdecl
swprintf(wchar_t*, const wchar_t*, ...);
324 _CRTIMP
int __cdecl
vswprintf(wchar_t*, const wchar_t*,va_list);
325 _CRTIMP
int __cdecl
_swprintf_c(wchar_t *_DstBuf
,size_t _SizeInWords
,const wchar_t *_Format
,...);
326 _CRTIMP
int __cdecl
_vswprintf_c(wchar_t *_DstBuf
,size_t _SizeInWords
,const wchar_t *_Format
,va_list _ArgList
);
327 _CRTIMP
int __cdecl
_snwprintf(wchar_t *_Dest
,size_t _Count
,const wchar_t *_Format
,...);
328 _CRTIMP
int __cdecl
_vsnwprintf(wchar_t *_Dest
,size_t _Count
,const wchar_t *_Format
,va_list _Args
);
329 #ifndef __NO_ISOCEXT /* externs in libmingwex.a */
330 __CRT_INLINE
int __cdecl
snwprintf (wchar_t* s
, size_t n
, const wchar_t* format
, ...) {
333 __mingw_va_start(a
, format
);
334 r
= _vsnwprintf (s
, n
, format
, a
);
338 __CRT_INLINE
int __cdecl
vsnwprintf (wchar_t* s
, size_t n
, const wchar_t* format
, va_list arg
) { return _vsnwprintf(s
,n
,format
,arg
); }
339 int __cdecl
vwscanf (const wchar_t *, va_list);
340 int __cdecl
vfwscanf (FILE *,const wchar_t *,va_list);
341 int __cdecl
vswscanf (const wchar_t *,const wchar_t *,va_list);
343 _CRTIMP
int __cdecl
_swprintf(wchar_t *_Dest
,const wchar_t *_Format
,...);
344 _CRTIMP
int __cdecl
_vswprintf(wchar_t *_Dest
,const wchar_t *_Format
,va_list _Args
);
350 //#ifdef _CRT_NON_CONFORMING_SWPRINTFS
351 //#ifndef __cplusplus
352 //#define swprintf _swprintf
353 //#define vswprintf _vswprintf
354 //#define _swprintf_l __swprintf_l
355 //#define _vswprintf_l __vswprintf_l
359 _CRTIMP
wchar_t *__cdecl
_wtempnam(const wchar_t *_Directory
,const wchar_t *_FilePrefix
);
360 _CRTIMP
int __cdecl
_vscwprintf(const wchar_t *_Format
,va_list _ArgList
);
361 int __cdecl
fwscanf(FILE *_File
,const wchar_t *_Format
,...);
362 int __cdecl
swscanf(const wchar_t *_Src
,const wchar_t *_Format
,...);
363 _CRTIMP
int __cdecl
_snwscanf(const wchar_t *_Src
,size_t _MaxCount
,const wchar_t *_Format
,...);
364 int __cdecl
wscanf(const wchar_t *_Format
,...);
365 _CRTIMP
FILE *__cdecl
_wfdopen(int _FileHandle
,const wchar_t *_Mode
);
366 _CRTIMP
FILE *__cdecl
_wfopen(const wchar_t *_Filename
,const wchar_t *_Mode
);
367 _CRTIMP
FILE *__cdecl
_wfreopen(const wchar_t *_Filename
,const wchar_t *_Mode
,FILE *_OldFile
);
368 #ifndef _CRT_WPERROR_DEFINED
369 #define _CRT_WPERROR_DEFINED
370 _CRTIMP
void __cdecl
_wperror(const wchar_t *_ErrMsg
);
372 _CRTIMP
FILE *__cdecl
_wpopen(const wchar_t *_Command
,const wchar_t *_Mode
);
373 #if !defined(NO_OLDNAMES) && !defined(wpopen)
374 #define wpopen _wpopen
376 _CRTIMP
int __cdecl
_wremove(const wchar_t *_Filename
);
377 _CRTIMP
wchar_t *__cdecl
_wtmpnam(wchar_t *_Buffer
);
378 _CRTIMP
wint_t __cdecl
_fgetwc_nolock(FILE *_File
);
379 _CRTIMP
wint_t __cdecl
_fputwc_nolock(wchar_t _Ch
,FILE *_File
);
380 _CRTIMP
wint_t __cdecl
_ungetwc_nolock(wint_t _Ch
,FILE *_File
);
382 #undef _CRT_GETPUTWCHAR_NOINLINE
384 #if !defined(__cplusplus) || defined(_CRT_GETPUTWCHAR_NOINLINE)
385 #define getwchar() fgetwc(stdin)
386 #define putwchar(_c) fputwc((_c),stdout)
388 __CRT_INLINE
wint_t __cdecl
getwchar() { return (fgetwc(stdin
)); }
389 __CRT_INLINE
wint_t __cdecl
putwchar(wchar_t _C
) { return (fputwc(_C
,stdout
)); }
392 #define getwc(_stm) fgetwc(_stm)
393 #define putwc(_c,_stm) fputwc(_c,_stm)
394 #define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm)
395 #define _getwc_nolock(_stm) _fgetwc_nolock(_stm)
397 #define _WSTDIO_DEFINED
400 #define _STDIO_DEFINED
401 #endif // !_STDIO_DEFINED
403 #define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
404 #define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
405 #define _getc_nolock(_stream) _fgetc_nolock(_stream)
406 #define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream)
407 #define _getchar_nolock() _getc_nolock(stdin)
408 #define _putchar_nolock(_c) _putc_nolock((_c),stdout)
409 #define _getwchar_nolock() _getwc_nolock(stdin)
410 #define _putwchar_nolock(_c) _putwc_nolock((_c),stdout)
412 _CRTIMP
void __cdecl
_lock_file(FILE *_File
);
413 _CRTIMP
void __cdecl
_unlock_file(FILE *_File
);
414 _CRTIMP
int __cdecl
_fclose_nolock(FILE *_File
);
415 _CRTIMP
int __cdecl
_fflush_nolock(FILE *_File
);
416 _CRTIMP
size_t __cdecl
_fread_nolock(void *_DstBuf
,size_t _ElementSize
,size_t _Count
,FILE *_File
);
417 _CRTIMP
int __cdecl
_fseek_nolock(FILE *_File
,long _Offset
,int _Origin
);
418 _CRTIMP
long __cdecl
_ftell_nolock(FILE *_File
);
419 _CRTIMP
int __cdecl
_fseeki64_nolock(FILE *_File
,__int64 _Offset
,int _Origin
);
420 _CRTIMP __int64 __cdecl
_ftelli64_nolock(FILE *_File
);
421 _CRTIMP
size_t __cdecl
_fwrite_nolock(const void *_DstBuf
,size_t _Size
,size_t _Count
,FILE *_File
);
422 _CRTIMP
int __cdecl
_ungetc_nolock(int _Ch
,FILE *_File
);
424 #if !defined(NO_OLDNAMES) || !defined(_POSIX)
425 #define P_tmpdir _P_tmpdir
426 #define SYS_OPEN _SYS_OPEN
428 char *__cdecl
tempnam(const char *_Directory
,const char *_FilePrefix
);
429 int __cdecl
fcloseall(void);
430 FILE *__cdecl
fdopen(int _FileHandle
,const char *_Format
);
431 int __cdecl
fgetchar(void);
432 int __cdecl
fileno(FILE *_File
);
433 int __cdecl
flushall(void);
434 int __cdecl
fputchar(int _Ch
);
435 int __cdecl
getw(FILE *_File
);
436 int __cdecl
putw(int _Ch
,FILE *_File
);
437 int __cdecl
rmtmp(void);
446 #include <sec_api/stdio_s.h>