xref: /minix3/external/bsd/libc++/dist/libcxx/include/cstdio (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
14684ddb6SLionel Sambuc// -*- C++ -*-
24684ddb6SLionel Sambuc//===---------------------------- cstdio ----------------------------------===//
34684ddb6SLionel Sambuc//
44684ddb6SLionel Sambuc//                     The LLVM Compiler Infrastructure
54684ddb6SLionel Sambuc//
64684ddb6SLionel Sambuc// This file is dual licensed under the MIT and the University of Illinois Open
74684ddb6SLionel Sambuc// Source Licenses. See LICENSE.TXT for details.
84684ddb6SLionel Sambuc//
94684ddb6SLionel Sambuc//===----------------------------------------------------------------------===//
104684ddb6SLionel Sambuc
114684ddb6SLionel Sambuc#ifndef _LIBCPP_CSTDIO
124684ddb6SLionel Sambuc#define _LIBCPP_CSTDIO
134684ddb6SLionel Sambuc
144684ddb6SLionel Sambuc/*
154684ddb6SLionel Sambuc    cstdio synopsis
164684ddb6SLionel Sambuc
174684ddb6SLionel SambucMacros:
184684ddb6SLionel Sambuc
194684ddb6SLionel Sambuc    BUFSIZ
204684ddb6SLionel Sambuc    EOF
214684ddb6SLionel Sambuc    FILENAME_MAX
224684ddb6SLionel Sambuc    FOPEN_MAX
234684ddb6SLionel Sambuc    L_tmpnam
244684ddb6SLionel Sambuc    NULL
254684ddb6SLionel Sambuc    SEEK_CUR
264684ddb6SLionel Sambuc    SEEK_END
274684ddb6SLionel Sambuc    SEEK_SET
284684ddb6SLionel Sambuc    TMP_MAX
294684ddb6SLionel Sambuc    _IOFBF
304684ddb6SLionel Sambuc    _IOLBF
314684ddb6SLionel Sambuc    _IONBF
324684ddb6SLionel Sambuc    stderr
334684ddb6SLionel Sambuc    stdin
344684ddb6SLionel Sambuc    stdout
354684ddb6SLionel Sambuc
364684ddb6SLionel Sambucnamespace std
374684ddb6SLionel Sambuc{
384684ddb6SLionel Sambuc
394684ddb6SLionel SambucTypes:
404684ddb6SLionel Sambuc
414684ddb6SLionel SambucFILE
424684ddb6SLionel Sambucfpos_t
434684ddb6SLionel Sambucsize_t
444684ddb6SLionel Sambuc
454684ddb6SLionel Sambucint remove(const char* filename);
464684ddb6SLionel Sambucint rename(const char* old, const char* new);
474684ddb6SLionel SambucFILE* tmpfile(void);
484684ddb6SLionel Sambucchar* tmpnam(char* s);
494684ddb6SLionel Sambucint fclose(FILE* stream);
504684ddb6SLionel Sambucint fflush(FILE* stream);
514684ddb6SLionel SambucFILE* fopen(const char* restrict filename, const char* restrict mode);
524684ddb6SLionel SambucFILE* freopen(const char* restrict filename, const char * restrict mode,
534684ddb6SLionel Sambuc              FILE * restrict stream);
544684ddb6SLionel Sambucvoid setbuf(FILE* restrict stream, char* restrict buf);
554684ddb6SLionel Sambucint setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
564684ddb6SLionel Sambucint fprintf(FILE* restrict stream, const char* restrict format, ...);
574684ddb6SLionel Sambucint fscanf(FILE* restrict stream, const char * restrict format, ...);
584684ddb6SLionel Sambucint printf(const char* restrict format, ...);
594684ddb6SLionel Sambucint scanf(const char* restrict format, ...);
604684ddb6SLionel Sambucint snprintf(char* restrict s, size_t n, const char* restrict format, ...);    // C99
614684ddb6SLionel Sambucint sprintf(char* restrict s, const char* restrict format, ...);
624684ddb6SLionel Sambucint sscanf(const char* restrict s, const char* restrict format, ...);
634684ddb6SLionel Sambucint vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
644684ddb6SLionel Sambucint vfscanf(FILE* restrict stream, const char* restrict format, va_list arg);  // C99
654684ddb6SLionel Sambucint vprintf(const char* restrict format, va_list arg);
664684ddb6SLionel Sambucint vscanf(const char* restrict format, va_list arg);                          // C99
674684ddb6SLionel Sambucint vsnprintf(char* restrict s, size_t n, const char* restrict format,         // C99
684684ddb6SLionel Sambuc              va_list arg);
694684ddb6SLionel Sambucint vsprintf(char* restrict s, const char* restrict format, va_list arg);
704684ddb6SLionel Sambucint vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
714684ddb6SLionel Sambucint fgetc(FILE* stream);
724684ddb6SLionel Sambucchar* fgets(char* restrict s, int n, FILE* restrict stream);
734684ddb6SLionel Sambucint fputc(int c, FILE* stream);
744684ddb6SLionel Sambucint fputs(const char* restrict s, FILE* restrict stream);
754684ddb6SLionel Sambucint getc(FILE* stream);
764684ddb6SLionel Sambucint getchar(void);
774684ddb6SLionel Sambucchar* gets(char* s);  // removed in C++14
784684ddb6SLionel Sambucint putc(int c, FILE* stream);
794684ddb6SLionel Sambucint putchar(int c);
804684ddb6SLionel Sambucint puts(const char* s);
814684ddb6SLionel Sambucint ungetc(int c, FILE* stream);
824684ddb6SLionel Sambucsize_t fread(void* restrict ptr, size_t size, size_t nmemb,
834684ddb6SLionel Sambuc             FILE* restrict stream);
844684ddb6SLionel Sambucsize_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
854684ddb6SLionel Sambuc              FILE* restrict stream);
864684ddb6SLionel Sambucint fgetpos(FILE* restrict stream, fpos_t* restrict pos);
874684ddb6SLionel Sambucint fseek(FILE* stream, long offset, int whence);
884684ddb6SLionel Sambucint fsetpos(FILE*stream, const fpos_t* pos);
894684ddb6SLionel Sambuclong ftell(FILE* stream);
904684ddb6SLionel Sambucvoid rewind(FILE* stream);
914684ddb6SLionel Sambucvoid clearerr(FILE* stream);
924684ddb6SLionel Sambucint feof(FILE* stream);
934684ddb6SLionel Sambucint ferror(FILE* stream);
944684ddb6SLionel Sambucvoid perror(const char* s);
954684ddb6SLionel Sambuc
964684ddb6SLionel Sambuc}  // std
974684ddb6SLionel Sambuc*/
984684ddb6SLionel Sambuc
994684ddb6SLionel Sambuc#include <__config>
1004684ddb6SLionel Sambuc#include <stdio.h>
1014684ddb6SLionel Sambuc
1024684ddb6SLionel Sambuc#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
1034684ddb6SLionel Sambuc#pragma GCC system_header
1044684ddb6SLionel Sambuc#endif
1054684ddb6SLionel Sambuc
1064684ddb6SLionel Sambuc// snprintf
1074684ddb6SLionel Sambuc#if defined(_LIBCPP_MSVCRT)
1084684ddb6SLionel Sambuc#include "support/win32/support.h"
1094684ddb6SLionel Sambuc#endif
1104684ddb6SLionel Sambuc
1114684ddb6SLionel Sambuc#ifdef getc
1124684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
1134684ddb6SLionel Sambuc#undef getc
1144684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
1154684ddb6SLionel Sambuc#endif  // getc
1164684ddb6SLionel Sambuc
1174684ddb6SLionel Sambuc#ifdef putc
1184684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
1194684ddb6SLionel Sambuc#undef putc
1204684ddb6SLionel Sambucinline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
1214684ddb6SLionel Sambuc#endif  // putc
1224684ddb6SLionel Sambuc
123*0a6a1f1dSLionel Sambuc#ifdef clearerr
124*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY void __libcpp_clearerr(FILE* __stream) { return clearerr(__stream); }
125*0a6a1f1dSLionel Sambuc#undef clearerr
126*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY void clearerr(FILE* __stream) { return __libcpp_clearerr(__stream); }
127*0a6a1f1dSLionel Sambuc#endif  // clearerr
128*0a6a1f1dSLionel Sambuc
129*0a6a1f1dSLionel Sambuc#ifdef feof
130*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY int __libcpp_feof(FILE* __stream) { return feof(__stream); }
131*0a6a1f1dSLionel Sambuc#undef feof
132*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY int feof(FILE* __stream) { return __libcpp_feof(__stream); }
133*0a6a1f1dSLionel Sambuc#endif  // feof
134*0a6a1f1dSLionel Sambuc
135*0a6a1f1dSLionel Sambuc#ifdef ferror
136*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY int __libcpp_ferror(FILE* __stream) { return ferror(__stream); }
137*0a6a1f1dSLionel Sambuc#undef ferror
138*0a6a1f1dSLionel Sambucinline _LIBCPP_INLINE_VISIBILITY int ferror(FILE* __stream) { return __libcpp_ferror(__stream); }
139*0a6a1f1dSLionel Sambuc#endif  // ferror
140*0a6a1f1dSLionel Sambuc
1414684ddb6SLionel Sambuc_LIBCPP_BEGIN_NAMESPACE_STD
1424684ddb6SLionel Sambuc
1434684ddb6SLionel Sambucusing ::FILE;
1444684ddb6SLionel Sambucusing ::fpos_t;
1454684ddb6SLionel Sambucusing ::size_t;
1464684ddb6SLionel Sambuc
1474684ddb6SLionel Sambucusing ::fclose;
1484684ddb6SLionel Sambucusing ::fflush;
1494684ddb6SLionel Sambucusing ::setbuf;
1504684ddb6SLionel Sambucusing ::setvbuf;
1514684ddb6SLionel Sambucusing ::fprintf;
1524684ddb6SLionel Sambucusing ::fscanf;
1534684ddb6SLionel Sambucusing ::snprintf;
1544684ddb6SLionel Sambucusing ::sprintf;
1554684ddb6SLionel Sambucusing ::sscanf;
1564684ddb6SLionel Sambuc#ifndef _LIBCPP_MSVCRT
1574684ddb6SLionel Sambucusing ::vfprintf;
1584684ddb6SLionel Sambucusing ::vfscanf;
1594684ddb6SLionel Sambucusing ::vsscanf;
1604684ddb6SLionel Sambuc#endif // _LIBCPP_MSVCRT
1614684ddb6SLionel Sambucusing ::vsnprintf;
1624684ddb6SLionel Sambucusing ::vsprintf;
1634684ddb6SLionel Sambucusing ::fgetc;
1644684ddb6SLionel Sambucusing ::fgets;
1654684ddb6SLionel Sambucusing ::fputc;
1664684ddb6SLionel Sambucusing ::fputs;
1674684ddb6SLionel Sambucusing ::getc;
1684684ddb6SLionel Sambucusing ::putc;
1694684ddb6SLionel Sambucusing ::ungetc;
1704684ddb6SLionel Sambucusing ::fread;
1714684ddb6SLionel Sambucusing ::fwrite;
1724684ddb6SLionel Sambucusing ::fgetpos;
1734684ddb6SLionel Sambucusing ::fseek;
1744684ddb6SLionel Sambucusing ::fsetpos;
1754684ddb6SLionel Sambucusing ::ftell;
1764684ddb6SLionel Sambucusing ::rewind;
1774684ddb6SLionel Sambucusing ::clearerr;
1784684ddb6SLionel Sambucusing ::feof;
1794684ddb6SLionel Sambucusing ::ferror;
1804684ddb6SLionel Sambucusing ::perror;
1814684ddb6SLionel Sambuc
182*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE
183*0a6a1f1dSLionel Sambucusing ::fopen;
184*0a6a1f1dSLionel Sambucusing ::freopen;
185*0a6a1f1dSLionel Sambucusing ::remove;
186*0a6a1f1dSLionel Sambucusing ::rename;
187*0a6a1f1dSLionel Sambucusing ::tmpfile;
188*0a6a1f1dSLionel Sambucusing ::tmpnam;
189*0a6a1f1dSLionel Sambuc#endif
190*0a6a1f1dSLionel Sambuc
191*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP_HAS_NO_STDIN
192*0a6a1f1dSLionel Sambucusing ::getchar;
193*0a6a1f1dSLionel Sambuc#if _LIBCPP_STD_VER <= 11
194*0a6a1f1dSLionel Sambucusing ::gets;
195*0a6a1f1dSLionel Sambuc#endif
196*0a6a1f1dSLionel Sambucusing ::scanf;
197*0a6a1f1dSLionel Sambucusing ::vscanf;
198*0a6a1f1dSLionel Sambuc#endif
199*0a6a1f1dSLionel Sambuc
200*0a6a1f1dSLionel Sambuc#ifndef _LIBCPP_HAS_NO_STDOUT
201*0a6a1f1dSLionel Sambucusing ::printf;
202*0a6a1f1dSLionel Sambucusing ::putchar;
203*0a6a1f1dSLionel Sambucusing ::puts;
204*0a6a1f1dSLionel Sambucusing ::vprintf;
205*0a6a1f1dSLionel Sambuc#endif
206*0a6a1f1dSLionel Sambuc
2074684ddb6SLionel Sambuc_LIBCPP_END_NAMESPACE_STD
2084684ddb6SLionel Sambuc
2094684ddb6SLionel Sambuc#endif  // _LIBCPP_CSTDIO
210