Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===---------------------------- cstdio ----------------------------------===// |
| 3 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
Howard Hinnant | b64f8b0 | 2010-11-16 22:09:02 +0000 | [diff] [blame] | 6 | // This file is dual licensed under the MIT and the University of Illinois Open |
| 7 | // Source Licenses. See LICENSE.TXT for details. |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_CSTDIO |
| 12 | #define _LIBCPP_CSTDIO |
| 13 | |
| 14 | /* |
| 15 | cstdio synopsis |
| 16 | |
| 17 | Macros: |
| 18 | |
| 19 | BUFSIZ |
| 20 | EOF |
| 21 | FILENAME_MAX |
| 22 | FOPEN_MAX |
| 23 | L_tmpnam |
| 24 | NULL |
| 25 | SEEK_CUR |
| 26 | SEEK_END |
| 27 | SEEK_SET |
| 28 | TMP_MAX |
| 29 | _IOFBF |
| 30 | _IOLBF |
| 31 | _IONBF |
| 32 | stderr |
| 33 | stdin |
| 34 | stdout |
| 35 | |
| 36 | namespace std |
| 37 | { |
| 38 | |
| 39 | Types: |
| 40 | |
| 41 | FILE |
| 42 | fpos_t |
| 43 | size_t |
| 44 | |
| 45 | int remove(const char* filename); |
| 46 | int rename(const char* old, const char* new); |
| 47 | FILE* tmpfile(void); |
| 48 | char* tmpnam(char* s); |
| 49 | int fclose(FILE* stream); |
| 50 | int fflush(FILE* stream); |
| 51 | FILE* fopen(const char* restrict filename, const char* restrict mode); |
| 52 | FILE* freopen(const char* restrict filename, const char * restrict mode, |
| 53 | FILE * restrict stream); |
| 54 | void setbuf(FILE* restrict stream, char* restrict buf); |
| 55 | int setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size); |
| 56 | int fprintf(FILE* restrict stream, const char* restrict format, ...); |
| 57 | int fscanf(FILE* restrict stream, const char * restrict format, ...); |
| 58 | int printf(const char* restrict format, ...); |
| 59 | int scanf(const char* restrict format, ...); |
| 60 | int snprintf(char* restrict s, size_t n, const char* restrict format, ...); // C99 |
| 61 | int sprintf(char* restrict s, const char* restrict format, ...); |
| 62 | int sscanf(const char* restrict s, const char* restrict format, ...); |
| 63 | int vfprintf(FILE* restrict stream, const char* restrict format, va_list arg); |
| 64 | int vfscanf(FILE* restrict stream, const char* restrict format, va_list arg); // C99 |
| 65 | int vprintf(const char* restrict format, va_list arg); |
| 66 | int vscanf(const char* restrict format, va_list arg); // C99 |
| 67 | int vsnprintf(char* restrict s, size_t n, const char* restrict format, // C99 |
| 68 | va_list arg); |
| 69 | int vsprintf(char* restrict s, const char* restrict format, va_list arg); |
| 70 | int vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99 |
| 71 | int fgetc(FILE* stream); |
| 72 | char* fgets(char* restrict s, int n, FILE* restrict stream); |
| 73 | int fputc(int c, FILE* stream); |
| 74 | int fputs(const char* restrict s, FILE* restrict stream); |
| 75 | int getc(FILE* stream); |
| 76 | int getchar(void); |
Marshall Clow | 1206720 | 2013-10-12 19:09:47 +0000 | [diff] [blame] | 77 | char* gets(char* s); // removed in C++14 |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 78 | int putc(int c, FILE* stream); |
| 79 | int putchar(int c); |
| 80 | int puts(const char* s); |
| 81 | int ungetc(int c, FILE* stream); |
| 82 | size_t fread(void* restrict ptr, size_t size, size_t nmemb, |
| 83 | FILE* restrict stream); |
| 84 | size_t fwrite(const void* restrict ptr, size_t size, size_t nmemb, |
| 85 | FILE* restrict stream); |
| 86 | int fgetpos(FILE* restrict stream, fpos_t* restrict pos); |
| 87 | int fseek(FILE* stream, long offset, int whence); |
| 88 | int fsetpos(FILE*stream, const fpos_t* pos); |
| 89 | long ftell(FILE* stream); |
| 90 | void rewind(FILE* stream); |
| 91 | void clearerr(FILE* stream); |
| 92 | int feof(FILE* stream); |
| 93 | int ferror(FILE* stream); |
| 94 | void perror(const char* s); |
| 95 | |
| 96 | } // std |
| 97 | */ |
| 98 | |
| 99 | #include <__config> |
| 100 | #include <stdio.h> |
Saleem Abdulrasool | ebeef1b | 2016-09-01 21:09:19 +0000 | [diff] [blame] | 101 | #if defined(_LIBCPP_MSVCRT) |
| 102 | #include <crtversion.h> |
| 103 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 104 | |
Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 105 | #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 106 | #pragma GCC system_header |
Howard Hinnant | 08e1747 | 2011-10-17 20:05:10 +0000 | [diff] [blame] | 107 | #endif |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 108 | |
| 109 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 110 | |
| 111 | using ::FILE; |
| 112 | using ::fpos_t; |
| 113 | using ::size_t; |
| 114 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 115 | using ::fclose; |
| 116 | using ::fflush; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 117 | using ::setbuf; |
| 118 | using ::setvbuf; |
| 119 | using ::fprintf; |
| 120 | using ::fscanf; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 121 | using ::snprintf; |
| 122 | using ::sprintf; |
| 123 | using ::sscanf; |
| 124 | using ::vfprintf; |
| 125 | using ::vfscanf; |
Howard Hinnant | 78b6828 | 2011-10-22 20:59:45 +0000 | [diff] [blame] | 126 | using ::vsscanf; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 127 | using ::vsnprintf; |
| 128 | using ::vsprintf; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 129 | using ::fgetc; |
| 130 | using ::fgets; |
| 131 | using ::fputc; |
| 132 | using ::fputs; |
| 133 | using ::getc; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 134 | using ::putc; |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 135 | using ::ungetc; |
| 136 | using ::fread; |
| 137 | using ::fwrite; |
| 138 | using ::fgetpos; |
| 139 | using ::fseek; |
| 140 | using ::fsetpos; |
| 141 | using ::ftell; |
| 142 | using ::rewind; |
| 143 | using ::clearerr; |
| 144 | using ::feof; |
| 145 | using ::ferror; |
| 146 | using ::perror; |
| 147 | |
Ed Schouten | abd06b4 | 2015-03-26 14:35:46 +0000 | [diff] [blame] | 148 | #ifndef _LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE |
| 149 | using ::fopen; |
| 150 | using ::freopen; |
| 151 | using ::remove; |
| 152 | using ::rename; |
| 153 | using ::tmpfile; |
| 154 | using ::tmpnam; |
| 155 | #endif |
| 156 | |
| 157 | #ifndef _LIBCPP_HAS_NO_STDIN |
| 158 | using ::getchar; |
Saleem Abdulrasool | ebeef1b | 2016-09-01 21:09:19 +0000 | [diff] [blame] | 159 | #if _LIBCPP_STD_VER <= 11 && \ |
| 160 | (!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14) |
Ed Schouten | abd06b4 | 2015-03-26 14:35:46 +0000 | [diff] [blame] | 161 | using ::gets; |
| 162 | #endif |
| 163 | using ::scanf; |
| 164 | using ::vscanf; |
| 165 | #endif |
| 166 | |
| 167 | #ifndef _LIBCPP_HAS_NO_STDOUT |
| 168 | using ::printf; |
| 169 | using ::putchar; |
| 170 | using ::puts; |
| 171 | using ::vprintf; |
| 172 | #endif |
| 173 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 174 | _LIBCPP_END_NAMESPACE_STD |
| 175 | |
| 176 | #endif // _LIBCPP_CSTDIO |