cstdio revision 261272
1227825Stheraven// -*- C++ -*-
2227825Stheraven//===---------------------------- cstdio ----------------------------------===//
3227825Stheraven//
4227825Stheraven//                     The LLVM Compiler Infrastructure
5227825Stheraven//
6227825Stheraven// This file is dual licensed under the MIT and the University of Illinois Open
7227825Stheraven// Source Licenses. See LICENSE.TXT for details.
8227825Stheraven//
9227825Stheraven//===----------------------------------------------------------------------===//
10227825Stheraven
11227825Stheraven#ifndef _LIBCPP_CSTDIO
12227825Stheraven#define _LIBCPP_CSTDIO
13227825Stheraven
14227825Stheraven/*
15227825Stheraven    cstdio synopsis
16227825Stheraven
17227825StheravenMacros:
18227825Stheraven
19227825Stheraven    BUFSIZ
20227825Stheraven    EOF
21227825Stheraven    FILENAME_MAX
22227825Stheraven    FOPEN_MAX
23227825Stheraven    L_tmpnam
24227825Stheraven    NULL
25227825Stheraven    SEEK_CUR
26227825Stheraven    SEEK_END
27227825Stheraven    SEEK_SET
28227825Stheraven    TMP_MAX
29227825Stheraven    _IOFBF
30227825Stheraven    _IOLBF
31227825Stheraven    _IONBF
32227825Stheraven    stderr
33227825Stheraven    stdin
34227825Stheraven    stdout
35227825Stheraven
36227825Stheravennamespace std
37227825Stheraven{
38227825Stheraven
39227825StheravenTypes:
40227825Stheraven
41227825StheravenFILE
42227825Stheravenfpos_t
43227825Stheravensize_t
44227825Stheraven
45227825Stheravenint remove(const char* filename);
46227825Stheravenint rename(const char* old, const char* new);
47227825StheravenFILE* tmpfile(void);
48227825Stheravenchar* tmpnam(char* s);
49227825Stheravenint fclose(FILE* stream);
50227825Stheravenint fflush(FILE* stream);
51227825StheravenFILE* fopen(const char* restrict filename, const char* restrict mode);
52227825StheravenFILE* freopen(const char* restrict filename, const char * restrict mode,
53227825Stheraven              FILE * restrict stream);
54227825Stheravenvoid setbuf(FILE* restrict stream, char* restrict buf);
55227825Stheravenint setvbuf(FILE* restrict stream, char* restrict buf, int mode, size_t size);
56227825Stheravenint fprintf(FILE* restrict stream, const char* restrict format, ...);
57227825Stheravenint fscanf(FILE* restrict stream, const char * restrict format, ...);
58227825Stheravenint printf(const char* restrict format, ...);
59227825Stheravenint scanf(const char* restrict format, ...);
60227825Stheravenint snprintf(char* restrict s, size_t n, const char* restrict format, ...);    // C99
61227825Stheravenint sprintf(char* restrict s, const char* restrict format, ...);
62227825Stheravenint sscanf(const char* restrict s, const char* restrict format, ...);
63227825Stheravenint vfprintf(FILE* restrict stream, const char* restrict format, va_list arg);
64227825Stheravenint vfscanf(FILE* restrict stream, const char* restrict format, va_list arg);  // C99
65227825Stheravenint vprintf(const char* restrict format, va_list arg);
66227825Stheravenint vscanf(const char* restrict format, va_list arg);                          // C99
67227825Stheravenint vsnprintf(char* restrict s, size_t n, const char* restrict format,         // C99
68227825Stheraven              va_list arg);
69227825Stheravenint vsprintf(char* restrict s, const char* restrict format, va_list arg);
70227825Stheravenint vsscanf(const char* restrict s, const char* restrict format, va_list arg); // C99
71227825Stheravenint fgetc(FILE* stream);
72227825Stheravenchar* fgets(char* restrict s, int n, FILE* restrict stream);
73227825Stheravenint fputc(int c, FILE* stream);
74227825Stheravenint fputs(const char* restrict s, FILE* restrict stream);
75227825Stheravenint getc(FILE* stream);
76227825Stheravenint getchar(void);
77261272Sdimchar* gets(char* s);  // removed in C++14
78227825Stheravenint putc(int c, FILE* stream);
79227825Stheravenint putchar(int c);
80227825Stheravenint puts(const char* s);
81227825Stheravenint ungetc(int c, FILE* stream);
82227825Stheravensize_t fread(void* restrict ptr, size_t size, size_t nmemb,
83227825Stheraven             FILE* restrict stream);
84227825Stheravensize_t fwrite(const void* restrict ptr, size_t size, size_t nmemb,
85227825Stheraven              FILE* restrict stream);
86227825Stheravenint fgetpos(FILE* restrict stream, fpos_t* restrict pos);
87227825Stheravenint fseek(FILE* stream, long offset, int whence);
88227825Stheravenint fsetpos(FILE*stream, const fpos_t* pos);
89227825Stheravenlong ftell(FILE* stream);
90227825Stheravenvoid rewind(FILE* stream);
91227825Stheravenvoid clearerr(FILE* stream);
92227825Stheravenint feof(FILE* stream);
93227825Stheravenint ferror(FILE* stream);
94227825Stheravenvoid perror(const char* s);
95227825Stheraven
96227825Stheraven}  // std
97227825Stheraven*/
98227825Stheraven
99227825Stheraven#include <__config>
100227825Stheraven#include <stdio.h>
101227825Stheraven
102227825Stheraven#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
103227825Stheraven#pragma GCC system_header
104227825Stheraven#endif
105227825Stheraven
106261272Sdim// snprintf
107261272Sdim#if defined(_LIBCPP_MSVCRT)
108261272Sdim#include "support/win32/support.h"
109261272Sdim#endif
110261272Sdim
111241900Sdim#ifdef getc
112241900Sdiminline _LIBCPP_INLINE_VISIBILITY int __libcpp_getc(FILE* __stream) {return getc(__stream);}
113241900Sdim#undef getc
114241900Sdiminline _LIBCPP_INLINE_VISIBILITY int getc(FILE* __stream) {return __libcpp_getc(__stream);}
115241900Sdim#endif  // getc
116241900Sdim
117241900Sdim#ifdef putc
118241900Sdiminline _LIBCPP_INLINE_VISIBILITY int __libcpp_putc(int __c, FILE* __stream) {return putc(__c, __stream);}
119241900Sdim#undef putc
120241900Sdiminline _LIBCPP_INLINE_VISIBILITY int putc(int __c, FILE* __stream) {return __libcpp_putc(__c, __stream);}
121241900Sdim#endif  // putc
122241900Sdim
123227825Stheraven_LIBCPP_BEGIN_NAMESPACE_STD
124227825Stheraven
125227825Stheravenusing ::FILE;
126227825Stheravenusing ::fpos_t;
127227825Stheravenusing ::size_t;
128227825Stheraven
129227825Stheravenusing ::remove;
130227825Stheravenusing ::rename;
131227825Stheravenusing ::tmpfile;
132227825Stheravenusing ::tmpnam;
133227825Stheravenusing ::fclose;
134227825Stheravenusing ::fflush;
135227825Stheravenusing ::fopen;
136227825Stheravenusing ::freopen;
137227825Stheravenusing ::setbuf;
138227825Stheravenusing ::setvbuf;
139227825Stheravenusing ::fprintf;
140227825Stheravenusing ::fscanf;
141227825Stheravenusing ::printf;
142227825Stheravenusing ::scanf;
143227825Stheravenusing ::snprintf;
144227825Stheravenusing ::sprintf;
145227825Stheravenusing ::sscanf;
146261272Sdim#ifndef _LIBCPP_MSVCRT
147227825Stheravenusing ::vfprintf;
148227825Stheravenusing ::vfscanf;
149227825Stheravenusing ::vscanf;
150227825Stheravenusing ::vsscanf;
151261272Sdim#endif // _LIBCPP_MSVCRT
152227825Stheravenusing ::vprintf;
153227825Stheravenusing ::vsnprintf;
154227825Stheravenusing ::vsprintf;
155227825Stheravenusing ::fgetc;
156227825Stheravenusing ::fgets;
157227825Stheravenusing ::fputc;
158227825Stheravenusing ::fputs;
159227825Stheravenusing ::getc;
160227825Stheravenusing ::getchar;
161261272Sdim#if _LIBCPP_STD_VER <= 11
162227825Stheravenusing ::gets;
163261272Sdim#endif
164227825Stheravenusing ::putc;
165227825Stheravenusing ::putchar;
166227825Stheravenusing ::puts;
167227825Stheravenusing ::ungetc;
168227825Stheravenusing ::fread;
169227825Stheravenusing ::fwrite;
170227825Stheravenusing ::fgetpos;
171227825Stheravenusing ::fseek;
172227825Stheravenusing ::fsetpos;
173227825Stheravenusing ::ftell;
174227825Stheravenusing ::rewind;
175227825Stheravenusing ::clearerr;
176227825Stheravenusing ::feof;
177227825Stheravenusing ::ferror;
178227825Stheravenusing ::perror;
179227825Stheraven
180227825Stheraven_LIBCPP_END_NAMESPACE_STD
181227825Stheraven
182227825Stheraven#endif  // _LIBCPP_CSTDIO
183