cstdio 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. // -*- C++ -*- forwarding header.
  2. // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
  3. // 2006, 2007, 2008, 2009
  4. // Free Software Foundation, Inc.
  5. //
  6. // This file is part of the GNU ISO C++ Library. This library is free
  7. // software; you can redistribute it and/or modify it under the
  8. // terms of the GNU General Public License as published by the
  9. // Free Software Foundation; either version 3, or (at your option)
  10. // any later version.
  11. // This library is distributed in the hope that it will be useful,
  12. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. // GNU General Public License for more details.
  15. // Under Section 7 of GPL version 3, you are granted additional
  16. // permissions described in the GCC Runtime Library Exception, version
  17. // 3.1, as published by the Free Software Foundation.
  18. // You should have received a copy of the GNU General Public License and
  19. // a copy of the GCC Runtime Library Exception along with this program;
  20. // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
  21. // <http://www.gnu.org/licenses/>.
  22. /** @file include/cstdio
  23. * This is a Standard C++ Library file. You should @c #include this file
  24. * in your programs, rather than any of the "*.h" implementation files.
  25. *
  26. * This is the C++ version of the Standard C Library header @c stdio.h,
  27. * and its contents are (mostly) the same as that header, but are all
  28. * contained in the namespace @c std (except for names which are defined
  29. * as macros in C).
  30. */
  31. //
  32. // ISO C++ 14882: 27.8.2 C Library files
  33. //
  34. #pragma GCC system_header
  35. #include <bits/c++config.h>
  36. #include <cstddef>
  37. #include <stdio.h>
  38. #ifndef _GLIBCXX_CSTDIO
  39. #define _GLIBCXX_CSTDIO 1
  40. // Get rid of those macros defined in <stdio.h> in lieu of real functions.
  41. #undef clearerr
  42. #undef fclose
  43. #undef feof
  44. #undef ferror
  45. #undef fflush
  46. #undef fgetc
  47. #undef fgetpos
  48. #undef fgets
  49. #undef fopen
  50. #undef fprintf
  51. #undef fputc
  52. #undef fputs
  53. #undef fread
  54. #undef freopen
  55. #undef fscanf
  56. #undef fseek
  57. #undef fsetpos
  58. #undef ftell
  59. #undef fwrite
  60. #undef getc
  61. #undef getchar
  62. #undef gets
  63. #undef perror
  64. #undef printf
  65. #undef putc
  66. #undef putchar
  67. #undef puts
  68. #undef remove
  69. #undef rename
  70. #undef rewind
  71. #undef scanf
  72. #undef setbuf
  73. #undef setvbuf
  74. #undef sprintf
  75. #undef sscanf
  76. #undef tmpfile
  77. #undef tmpnam
  78. #undef ungetc
  79. #undef vfprintf
  80. #undef vprintf
  81. #undef vsprintf
  82. _GLIBCXX_BEGIN_NAMESPACE(std)
  83. using ::FILE;
  84. using ::fpos_t;
  85. using ::clearerr;
  86. using ::fclose;
  87. using ::feof;
  88. using ::ferror;
  89. using ::fflush;
  90. using ::fgetc;
  91. using ::fgetpos;
  92. using ::fgets;
  93. using ::fopen;
  94. using ::fprintf;
  95. using ::fputc;
  96. using ::fputs;
  97. using ::fread;
  98. using ::freopen;
  99. using ::fscanf;
  100. using ::fseek;
  101. using ::fsetpos;
  102. using ::ftell;
  103. using ::fwrite;
  104. using ::getc;
  105. using ::getchar;
  106. using ::gets;
  107. using ::perror;
  108. using ::printf;
  109. using ::putc;
  110. using ::putchar;
  111. using ::puts;
  112. using ::remove;
  113. using ::rename;
  114. using ::rewind;
  115. using ::scanf;
  116. using ::setbuf;
  117. using ::setvbuf;
  118. using ::sprintf;
  119. using ::sscanf;
  120. using ::tmpfile;
  121. using ::tmpnam;
  122. using ::ungetc;
  123. using ::vfprintf;
  124. using ::vprintf;
  125. using ::vsprintf;
  126. _GLIBCXX_END_NAMESPACE
  127. #if _GLIBCXX_USE_C99
  128. #undef snprintf
  129. #undef vfscanf
  130. #undef vscanf
  131. #undef vsnprintf
  132. #undef vsscanf
  133. _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
  134. #if _GLIBCXX_USE_C99_CHECK || _GLIBCXX_USE_C99_DYNAMIC
  135. extern "C" int
  136. (snprintf)(char * restrict, size_t, const char * restrict, ...);
  137. extern "C" int
  138. (vfscanf)(FILE * restrict, const char * restrict, __gnuc_va_list);
  139. extern "C" int (vscanf)(const char * restrict, __gnuc_va_list);
  140. extern "C" int
  141. (vsnprintf)(char * restrict, size_t, const char * restrict, __gnuc_va_list);
  142. extern "C" int
  143. (vsscanf)(const char * restrict, const char * restrict, __gnuc_va_list);
  144. #endif
  145. #if !_GLIBCXX_USE_C99_DYNAMIC
  146. using ::snprintf;
  147. using ::vfscanf;
  148. using ::vscanf;
  149. using ::vsnprintf;
  150. using ::vsscanf;
  151. #endif
  152. _GLIBCXX_END_NAMESPACE
  153. _GLIBCXX_BEGIN_NAMESPACE(std)
  154. using ::__gnu_cxx::snprintf;
  155. using ::__gnu_cxx::vfscanf;
  156. using ::__gnu_cxx::vscanf;
  157. using ::__gnu_cxx::vsnprintf;
  158. using ::__gnu_cxx::vsscanf;
  159. _GLIBCXX_END_NAMESPACE
  160. #endif // _GLIBCXX_USE_C99
  161. #ifdef __GXX_EXPERIMENTAL_CXX0X__
  162. # if defined(_GLIBCXX_INCLUDE_AS_TR1)
  163. # error C++0x header cannot be included from TR1 header
  164. # endif
  165. # if defined(_GLIBCXX_INCLUDE_AS_CXX0X)
  166. # include <tr1_impl/cstdio>
  167. # else
  168. # define _GLIBCXX_INCLUDE_AS_CXX0X
  169. # define _GLIBCXX_BEGIN_NAMESPACE_TR1
  170. # define _GLIBCXX_END_NAMESPACE_TR1
  171. # define _GLIBCXX_TR1
  172. # include <tr1_impl/cstdio>
  173. # undef _GLIBCXX_TR1
  174. # undef _GLIBCXX_END_NAMESPACE_TR1
  175. # undef _GLIBCXX_BEGIN_NAMESPACE_TR1
  176. # undef _GLIBCXX_INCLUDE_AS_CXX0X
  177. # endif
  178. #endif
  179. #endif