Back to index

glibc  2.9
libio.h
Go to the documentation of this file.
00001 /* Copyright (C) 1991-1995,1997-2006,2007 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003    Written by Per Bothner <bothner@cygnus.com>.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.
00019 
00020    As a special exception, if you link the code in this file with
00021    files compiled with a GNU compiler to produce an executable,
00022    that does not cause the resulting executable to be covered by
00023    the GNU Lesser General Public License.  This exception does not
00024    however invalidate any other reasons why the executable file
00025    might be covered by the GNU Lesser General Public License.
00026    This exception applies to code released by its copyright holders
00027    in files containing the exception.  */
00028 
00029 #ifndef _IO_STDIO_H
00030 #define _IO_STDIO_H
00031 
00032 #include <_G_config.h>
00033 /* ALL of these should be defined in _G_config.h */
00034 #define _IO_pos_t _G_fpos_t /* obsolete */
00035 #define _IO_fpos_t _G_fpos_t
00036 #define _IO_fpos64_t _G_fpos64_t
00037 #define _IO_size_t _G_size_t
00038 #define _IO_ssize_t _G_ssize_t
00039 #define _IO_off_t _G_off_t
00040 #define _IO_off64_t _G_off64_t
00041 #define _IO_pid_t _G_pid_t
00042 #define _IO_uid_t _G_uid_t
00043 #define _IO_iconv_t _G_iconv_t
00044 #define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT
00045 #define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
00046 #define _IO_BUFSIZ _G_BUFSIZ
00047 #define _IO_va_list _G_va_list
00048 #define _IO_wint_t _G_wint_t
00049 
00050 #ifdef _G_NEED_STDARG_H
00051 /* This define avoids name pollution if we're using GNU stdarg.h */
00052 # define __need___va_list
00053 # include <stdarg.h>
00054 # ifdef __GNUC_VA_LIST
00055 #  undef _IO_va_list
00056 #  define _IO_va_list __gnuc_va_list
00057 # endif /* __GNUC_VA_LIST */
00058 #endif
00059 
00060 #ifndef __P
00061 # if _G_HAVE_SYS_CDEFS
00062 #  include <sys/cdefs.h>
00063 # else
00064 #  ifdef __STDC__
00065 #   define __P(p) p
00066 #   define __PMT(p) p
00067 #  else
00068 #   define __P(p) ()
00069 #   define __PMT(p) ()
00070 #  endif
00071 # endif
00072 #endif 
00074 /* For backward compatibility */
00075 #ifndef _PARAMS
00076 # define _PARAMS(protos) __P(protos)
00077 #endif 
00079 #ifndef __STDC__
00080 # ifndef const
00081 #  define const
00082 # endif
00083 #endif
00084 #define _IO_UNIFIED_JUMPTABLES 1
00085 #ifndef _G_HAVE_PRINTF_FP
00086 # define _IO_USE_DTOA 1
00087 #endif
00088 
00089 #ifndef EOF
00090 # define EOF (-1)
00091 #endif
00092 #ifndef NULL
00093 # if defined __GNUG__ && \
00094     (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
00095 #  define NULL (__null)
00096 # else
00097 #  if !defined(__cplusplus)
00098 #   define NULL ((void*)0)
00099 #  else
00100 #   define NULL (0)
00101 #  endif
00102 # endif
00103 #endif
00104 
00105 #define _IOS_INPUT   1
00106 #define _IOS_OUTPUT  2
00107 #define _IOS_ATEND   4
00108 #define _IOS_APPEND  8
00109 #define _IOS_TRUNC   16
00110 #define _IOS_NOCREATE       32
00111 #define _IOS_NOREPLACE      64
00112 #define _IOS_BIN     128
00113 
00114 /* Magic numbers and bits for the _flags field.
00115    The magic numbers use the high-order bits of _flags;
00116    the remaining bits are available for variable flags.
00117    Note: The magic numbers must all be negative if stdio
00118    emulation is desired. */
00119 
00120 #define _IO_MAGIC 0xFBAD0000 /* Magic number */
00121 #define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */
00122 #define _IO_MAGIC_MASK 0xFFFF0000
00123 #define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */
00124 #define _IO_UNBUFFERED 2
00125 #define _IO_NO_READS 4 /* Reading not allowed */
00126 #define _IO_NO_WRITES 8 /* Writing not allowd */
00127 #define _IO_EOF_SEEN 0x10
00128 #define _IO_ERR_SEEN 0x20
00129 #define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */
00130 #define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/
00131 #define _IO_IN_BACKUP 0x100
00132 #define _IO_LINE_BUF 0x200
00133 #define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */
00134 #define _IO_CURRENTLY_PUTTING 0x800
00135 #define _IO_IS_APPENDING 0x1000
00136 #define _IO_IS_FILEBUF 0x2000
00137 #define _IO_BAD_SEEN 0x4000
00138 #define _IO_USER_LOCK 0x8000
00139 
00140 #define _IO_FLAGS2_MMAP 1
00141 #define _IO_FLAGS2_NOTCANCEL 2
00142 #ifdef _LIBC
00143 # define _IO_FLAGS2_FORTIFY 4
00144 #endif
00145 #define _IO_FLAGS2_USER_WBUF 8
00146 #ifdef _LIBC
00147 # define _IO_FLAGS2_SCANF_STD 16
00148 #endif
00149 
00150 /* These are "formatting flags" matching the iostream fmtflags enum values. */
00151 #define _IO_SKIPWS 01
00152 #define _IO_LEFT 02
00153 #define _IO_RIGHT 04
00154 #define _IO_INTERNAL 010
00155 #define _IO_DEC 020
00156 #define _IO_OCT 040
00157 #define _IO_HEX 0100
00158 #define _IO_SHOWBASE 0200
00159 #define _IO_SHOWPOINT 0400
00160 #define _IO_UPPERCASE 01000
00161 #define _IO_SHOWPOS 02000
00162 #define _IO_SCIENTIFIC 04000
00163 #define _IO_FIXED 010000
00164 #define _IO_UNITBUF 020000
00165 #define _IO_STDIO 040000
00166 #define _IO_DONT_CLOSE 0100000
00167 #define _IO_BOOLALPHA 0200000
00168 
00169 
00170 struct _IO_jump_t;  struct _IO_FILE;
00171 
00172 /* Handle lock.  */
00173 #ifdef _IO_MTSAFE_IO
00174 # if defined __GLIBC__ && __GLIBC__ >= 2
00175 #  include <bits/stdio-lock.h>
00176 # else
00177 /*# include <comthread.h>*/
00178 # endif
00179 #else
00180 typedef void _IO_lock_t;
00181 #endif
00182 
00183 
00184 /* A streammarker remembers a position in a buffer. */
00185 
00186 struct _IO_marker {
00187   struct _IO_marker *_next;
00188   struct _IO_FILE *_sbuf;
00189   /* If _pos >= 0
00190  it points to _buf->Gbase()+_pos. FIXME comment */
00191   /* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */
00192   int _pos;
00193 #if 0
00194     void set_streampos(streampos sp) { _spos = sp; }
00195     void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
00196   public:
00197     streammarker(streambuf *sb);
00198     ~streammarker();
00199     int saving() { return  _spos == -2; }
00200     int delta(streammarker&);
00201     int delta();
00202 #endif
00203 };
00204 
00205 /* This is the structure from the libstdc++ codecvt class.  */
00206 enum __codecvt_result
00207 {
00208   __codecvt_ok,
00209   __codecvt_partial,
00210   __codecvt_error,
00211   __codecvt_noconv
00212 };
00213 
00214 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
00215 /* The order of the elements in the following struct must match the order
00216    of the virtual functions in the libstdc++ codecvt class.  */
00217 struct _IO_codecvt
00218 {
00219   void (*__codecvt_destr) (struct _IO_codecvt *);
00220   enum __codecvt_result (*__codecvt_do_out) (struct _IO_codecvt *,
00221                                         __mbstate_t *,
00222                                         const wchar_t *,
00223                                         const wchar_t *,
00224                                         const wchar_t **, char *,
00225                                         char *, char **);
00226   enum __codecvt_result (*__codecvt_do_unshift) (struct _IO_codecvt *,
00227                                            __mbstate_t *, char *,
00228                                            char *, char **);
00229   enum __codecvt_result (*__codecvt_do_in) (struct _IO_codecvt *,
00230                                        __mbstate_t *,
00231                                        const char *, const char *,
00232                                        const char **, wchar_t *,
00233                                        wchar_t *, wchar_t **);
00234   int (*__codecvt_do_encoding) (struct _IO_codecvt *);
00235   int (*__codecvt_do_always_noconv) (struct _IO_codecvt *);
00236   int (*__codecvt_do_length) (struct _IO_codecvt *, __mbstate_t *,
00237                            const char *, const char *, _IO_size_t);
00238   int (*__codecvt_do_max_length) (struct _IO_codecvt *);
00239 
00240   _IO_iconv_t __cd_in;
00241   _IO_iconv_t __cd_out;
00242 };
00243 
00244 /* Extra data for wide character streams.  */
00245 struct _IO_wide_data
00246 {
00247   wchar_t *_IO_read_ptr;    /* Current read pointer */
00248   wchar_t *_IO_read_end;    /* End of get area. */
00249   wchar_t *_IO_read_base;   /* Start of putback+get area. */
00250   wchar_t *_IO_write_base;  /* Start of put area. */
00251   wchar_t *_IO_write_ptr;   /* Current put pointer. */
00252   wchar_t *_IO_write_end;   /* End of put area. */
00253   wchar_t *_IO_buf_base;    /* Start of reserve area. */
00254   wchar_t *_IO_buf_end;            /* End of reserve area. */
00255   /* The following fields are used to support backing up and undo. */
00256   wchar_t *_IO_save_base;   /* Pointer to start of non-current get area. */
00257   wchar_t *_IO_backup_base; /* Pointer to first valid character of
00258                                backup area */
00259   wchar_t *_IO_save_end;    /* Pointer to end of non-current get area. */
00260 
00261   __mbstate_t _IO_state;
00262   __mbstate_t _IO_last_state;
00263   struct _IO_codecvt _codecvt;
00264 
00265   wchar_t _shortbuf[1];
00266 
00267   const struct _IO_jump_t *_wide_vtable;
00268 };
00269 #endif
00270 
00271 struct _IO_FILE {
00272   int _flags;        /* High-order word is _IO_MAGIC; rest is flags. */
00273 #define _IO_file_flags _flags
00274 
00275   /* The following pointers correspond to the C++ streambuf protocol. */
00276   /* Note:  Tk uses the _IO_read_ptr and _IO_read_end fields directly. */
00277   char* _IO_read_ptr;       /* Current read pointer */
00278   char* _IO_read_end;       /* End of get area. */
00279   char* _IO_read_base;      /* Start of putback+get area. */
00280   char* _IO_write_base;     /* Start of put area. */
00281   char* _IO_write_ptr;      /* Current put pointer. */
00282   char* _IO_write_end;      /* End of put area. */
00283   char* _IO_buf_base;       /* Start of reserve area. */
00284   char* _IO_buf_end; /* End of reserve area. */
00285   /* The following fields are used to support backing up and undo. */
00286   char *_IO_save_base; /* Pointer to start of non-current get area. */
00287   char *_IO_backup_base;  /* Pointer to first valid character of backup area */
00288   char *_IO_save_end; /* Pointer to end of non-current get area. */
00289 
00290   struct _IO_marker *_markers;
00291 
00292   struct _IO_FILE *_chain;
00293 
00294   int _fileno;
00295 #if 0
00296   int _blksize;
00297 #else
00298   int _flags2;
00299 #endif
00300   _IO_off_t _old_offset; /* This used to be _offset but it's too small.  */
00301 
00302 #define __HAVE_COLUMN /* temporary */
00303   /* 1+column number of pbase(); 0 is unknown. */
00304   unsigned short _cur_column;
00305   signed char _vtable_offset;
00306   char _shortbuf[1];
00307 
00308   /*  char* _save_gptr;  char* _save_egptr; */
00309 
00310   _IO_lock_t *_lock;
00311 #ifdef _IO_USE_OLD_IO_FILE
00312 };
00313 
00314 struct _IO_FILE_complete
00315 {
00316   struct _IO_FILE _file;
00317 #endif
00318 #if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
00319   _IO_off64_t _offset;
00320 # if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
00321   /* Wide character stream stuff.  */
00322   struct _IO_codecvt *_codecvt;
00323   struct _IO_wide_data *_wide_data;
00324   struct _IO_FILE *_freeres_list;
00325   void *_freeres_buf;
00326   size_t _freeres_size;
00327 # else
00328   void *__pad1;
00329   void *__pad2;
00330   void *__pad3;
00331   void *__pad4;
00332   size_t __pad5;
00333 # endif
00334   int _mode;
00335   /* Make sure we don't get into trouble again.  */
00336   char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
00337 #endif
00338 };
00339 
00340 #ifndef __cplusplus
00341 typedef struct _IO_FILE _IO_FILE;
00342 #endif
00343 
00344 struct _IO_FILE_plus;
00345 
00346 extern struct _IO_FILE_plus _IO_2_1_stdin_;
00347 extern struct _IO_FILE_plus _IO_2_1_stdout_;
00348 extern struct _IO_FILE_plus _IO_2_1_stderr_;
00349 #ifndef _LIBC
00350 #define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
00351 #define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
00352 #define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
00353 #else
00354 extern _IO_FILE *_IO_stdin attribute_hidden;
00355 extern _IO_FILE *_IO_stdout attribute_hidden;
00356 extern _IO_FILE *_IO_stderr attribute_hidden;
00357 #endif
00358 
00359 
00360 /* Functions to do I/O and file management for a stream.  */
00361 
00362 /* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF.
00363    Return number of bytes read.  */
00364 typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
00365 
00366 /* Write N bytes pointed to by BUF to COOKIE.  Write all N bytes
00367    unless there is an error.  Return number of bytes written, or -1 if
00368    there is an error without writing anything.  If the file has been
00369    opened for append (__mode.__append set), then set the file pointer
00370    to the end of the file and then do the write; if not, just write at
00371    the current file pointer.  */
00372 typedef __ssize_t __io_write_fn (void *__cookie, __const char *__buf,
00373                              size_t __n);
00374 
00375 /* Move COOKIE's file position to *POS bytes from the
00376    beginning of the file (if W is SEEK_SET),
00377    the current position (if W is SEEK_CUR),
00378    or the end of the file (if W is SEEK_END).
00379    Set *POS to the new file position.
00380    Returns zero if successful, nonzero if not.  */
00381 typedef int __io_seek_fn (void *__cookie, _IO_off64_t *__pos, int __w);
00382 
00383 /* Close COOKIE.  */
00384 typedef int __io_close_fn (void *__cookie);
00385 
00386 
00387 #ifdef _GNU_SOURCE
00388 /* User-visible names for the above.  */
00389 typedef __io_read_fn cookie_read_function_t;
00390 typedef __io_write_fn cookie_write_function_t;
00391 typedef __io_seek_fn cookie_seek_function_t;
00392 typedef __io_close_fn cookie_close_function_t;
00393 
00394 /* The structure with the cookie function pointers.  */
00395 typedef struct
00396 {
00397   __io_read_fn *read;              /* Read bytes.  */
00398   __io_write_fn *write;            /* Write bytes.  */
00399   __io_seek_fn *seek;              /* Seek/tell file position.  */
00400   __io_close_fn *close;            /* Close file.  */
00401 } _IO_cookie_io_functions_t;
00402 typedef _IO_cookie_io_functions_t cookie_io_functions_t;
00403 
00404 struct _IO_cookie_file;
00405 
00406 /* Initialize one of those.  */
00407 extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
00408                           void *__cookie, _IO_cookie_io_functions_t __fns);
00409 #endif
00410 
00411 
00412 #ifdef __cplusplus
00413 extern "C" {
00414 #endif
00415 
00416 extern int __underflow (_IO_FILE *);
00417 extern int __uflow (_IO_FILE *);
00418 extern int __overflow (_IO_FILE *, int);
00419 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
00420 extern _IO_wint_t __wunderflow (_IO_FILE *);
00421 extern _IO_wint_t __wuflow (_IO_FILE *);
00422 extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t);
00423 #endif
00424 
00425 #if  __GNUC__ >= 3
00426 # define _IO_BE(expr, res) __builtin_expect ((expr), res)
00427 #else
00428 # define _IO_BE(expr, res) (expr)
00429 #endif
00430 
00431 #define _IO_getc_unlocked(_fp) \
00432        (_IO_BE ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end, 0) \
00433        ? __uflow (_fp) : *(unsigned char *) (_fp)->_IO_read_ptr++)
00434 #define _IO_peekc_unlocked(_fp) \
00435        (_IO_BE ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end, 0) \
00436          && __underflow (_fp) == EOF ? EOF \
00437        : *(unsigned char *) (_fp)->_IO_read_ptr)
00438 #define _IO_putc_unlocked(_ch, _fp) \
00439    (_IO_BE ((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end, 0) \
00440     ? __overflow (_fp, (unsigned char) (_ch)) \
00441     : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
00442 
00443 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
00444 # define _IO_getwc_unlocked(_fp) \
00445   (_IO_BE ((_fp)->_wide_data->_IO_read_ptr >= (_fp)->_wide_data->_IO_read_end,\
00446           0) \
00447    ? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
00448 # define _IO_putwc_unlocked(_wch, _fp) \
00449   (_IO_BE ((_fp)->_wide_data->_IO_write_ptr \
00450           >= (_fp)->_wide_data->_IO_write_end, 0) \
00451    ? __woverflow (_fp, _wch) \
00452    : (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
00453 #endif
00454 
00455 #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
00456 #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
00457 
00458 extern int _IO_getc (_IO_FILE *__fp);
00459 extern int _IO_putc (int __c, _IO_FILE *__fp);
00460 extern int _IO_feof (_IO_FILE *__fp) __THROW;
00461 extern int _IO_ferror (_IO_FILE *__fp) __THROW;
00462 
00463 extern int _IO_peekc_locked (_IO_FILE *__fp);
00464 
00465 /* This one is for Emacs. */
00466 #define _IO_PENDING_OUTPUT_COUNT(_fp)     \
00467        ((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
00468 
00469 extern void _IO_flockfile (_IO_FILE *) __THROW;
00470 extern void _IO_funlockfile (_IO_FILE *) __THROW;
00471 extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
00472 
00473 #ifdef _IO_MTSAFE_IO
00474 # define _IO_peekc(_fp) _IO_peekc_locked (_fp)
00475 # define _IO_flockfile(_fp) \
00476   if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp)
00477 # define _IO_funlockfile(_fp) \
00478   if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (_fp)
00479 #else
00480 # define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
00481 # define _IO_flockfile(_fp) 
00482 # define _IO_funlockfile(_fp) 
00483 # define _IO_ftrylockfile(_fp) 
00484 # define _IO_cleanup_region_start(_fct, _fp) 
00485 # define _IO_cleanup_region_end(_Doit) 
00486 #endif /* !_IO_MTSAFE_IO */
00487 
00488 extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
00489                      _IO_va_list, int *__restrict);
00490 extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
00491                       _IO_va_list);
00492 extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t);
00493 extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t);
00494 
00495 extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int);
00496 extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int);
00497 
00498 extern void _IO_free_backup_area (_IO_FILE *) __THROW;
00499 
00500 #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
00501 extern _IO_wint_t _IO_getwc (_IO_FILE *__fp);
00502 extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp);
00503 extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
00504 # if __GNUC__ >= 2
00505 /* While compiling glibc we have to handle compatibility with very old
00506    versions.  */
00507 #  if defined _LIBC && defined SHARED
00508 #   include <shlib-compat.h>
00509 #   if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
00510 #    define _IO_fwide_maybe_incompatible \
00511   (__builtin_expect (&_IO_stdin_used == NULL, 0))
00512 extern const int _IO_stdin_used;
00513 weak_extern (_IO_stdin_used);
00514 #   endif
00515 #  endif
00516 #  ifndef _IO_fwide_maybe_incompatible
00517 #   define _IO_fwide_maybe_incompatible (0)
00518 #  endif
00519 /* A special optimized version of the function above.  It optimizes the
00520    case of initializing an unoriented byte stream.  */
00521 #  define _IO_fwide(__fp, __mode) \
00522   ({ int __result = (__mode);                                               \
00523      if (__result < 0 && ! _IO_fwide_maybe_incompatible)                    \
00524        {                                                             \
00525         if ((__fp)->_mode == 0)                                      \
00526           /* We know that all we have to do is to set the flag.  */         \
00527           (__fp)->_mode = -1;                                               \
00528         __result = (__fp)->_mode;                                    \
00529        }                                                             \
00530      else if (__builtin_constant_p (__mode) && (__mode) == 0)               \
00531        __result = _IO_fwide_maybe_incompatible ? -1 : (__fp)->_mode;        \
00532      else                                                            \
00533        __result = _IO_fwide (__fp, __result);                               \
00534      __result; })
00535 # endif
00536 
00537 extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict,
00538                       _IO_va_list, int *__restrict);
00539 extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict,
00540                        _IO_va_list);
00541 extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t);
00542 extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
00543 #endif
00544 
00545 #ifdef __LDBL_COMPAT
00546 # include <bits/libio-ldbl.h>
00547 #endif
00548 
00549 #ifdef __cplusplus
00550 }
00551 #endif
00552 
00553 #endif /* _IO_STDIO_H */