0001:   /* Copyright (C) 1991-2014 Free Software Foundation, Inc.
0002:      This file is part of the GNU C Library.
0003:      Written by Per Bothner <bothner@cygnus.com>.
0004:   
0005:      The GNU C Library is free software; you can redistribute it and/or
0006:      modify it under the terms of the GNU Lesser General Public
0007:      License as published by the Free Software Foundation; either
0008:      version 2.1 of the License, or (at your option) any later version.
0009:   
0010:      The GNU C Library is distributed in the hope that it will be useful,
0011:      but WITHOUT ANY WARRANTY; without even the implied warranty of
0012:      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0013:      Lesser General Public License for more details.
0014:   
0015:      You should have received a copy of the GNU Lesser General Public
0016:      License along with the GNU C Library; if not, see
0017:      <http://www.gnu.org/licenses/>.
0018:   
0019:      As a special exception, if you link the code in this file with
0020:      files compiled with a GNU compiler to produce an executable,
0021:      that does not cause the resulting executable to be covered by
0022:      the GNU Lesser General Public License.  This exception does not
0023:      however invalidate any other reasons why the executable file
0024:      might be covered by the GNU Lesser General Public License.
0025:      This exception applies to code released by its copyright holders
0026:      in files containing the exception.  */
0027:   
0028:   #ifndef _IO_STDIO_H
0029:   #define _IO_STDIO_H
0030:   
0031:   #include <_G_config.h>
0032:   /* ALL of these should be defined in _G_config.h */
0033:   #define _IO_fpos_t _G_fpos_t
0034:   #define _IO_fpos64_t _G_fpos64_t
0035:   #define _IO_size_t size_t
0036:   #define _IO_ssize_t __ssize_t
0037:   #define _IO_off_t __off_t
0038:   #define _IO_off64_t __off64_t
0039:   #define _IO_pid_t __pid_t
0040:   #define _IO_uid_t __uid_t
0041:   #define _IO_iconv_t _G_iconv_t
0042:   #define _IO_HAVE_ST_BLKSIZE _G_HAVE_ST_BLKSIZE
0043:   #define _IO_BUFSIZ _G_BUFSIZ
0044:   #define _IO_va_list _G_va_list
0045:   #define _IO_wint_t wint_t
0046:   
0047:   /* This define avoids name pollution if we're using GNU stdarg.h */
0048:   #define __need___va_list
0049:   #include <stdarg.h>
0050:   #ifdef __GNUC_VA_LIST
0051:   # undef _IO_va_list
0052:   # define _IO_va_list __gnuc_va_list
0053:   #endif /* __GNUC_VA_LIST */
0054:   
0055:   #ifndef __P
0056:   # include <sys/cdefs.h>
0057:   #endif /*!__P*/
0058:   
0059:   #define _IO_UNIFIED_JUMPTABLES 1
0060:   
0061:   #ifndef EOF
0062:   # define EOF (-1)
0063:   #endif
0064:   #ifndef NULL
0065:   # if defined __GNUG__ && \
0066:       (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 8))
0067:   #  define NULL (__null)
0068:   # else
0069:   #  if !defined(__cplusplus)
0070:   #   define NULL ((void*)0)
0071:   #  else
0072:   #   define NULL (0)
0073:   #  endif
0074:   # endif
0075:   #endif
0076:   
0077:   #define _IOS_INPUT      1
0078:   #define _IOS_OUTPUT     2
0079:   #define _IOS_ATEND      4
0080:   #define _IOS_APPEND     8
0081:   #define _IOS_TRUNC      16
0082:   #define _IOS_NOCREATE   32
0083:   #define _IOS_NOREPLACE  64
0084:   #define _IOS_BIN        128
0085:   
0086:   /* Magic numbers and bits for the _flags field.
0087:      The magic numbers use the high-order bits of _flags;
0088:      the remaining bits are available for variable flags.
0089:      Note: The magic numbers must all be negative if stdio
0090:      emulation is desired. */
0091:   
0092:   #define _IO_MAGIC 0xFBAD0000 /* Magic number */
0093:   #define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */
0094:   #define _IO_MAGIC_MASK 0xFFFF0000
0095:   #define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */
0096:   #define _IO_UNBUFFERED 2
0097:   #define _IO_NO_READS 4 /* Reading not allowed */
0098:   #define _IO_NO_WRITES 8 /* Writing not allowd */
0099:   #define _IO_EOF_SEEN 0x10
0100:   #define _IO_ERR_SEEN 0x20
0101:   #define _IO_DELETE_DONT_CLOSE 0x40 /* Don't call close(_fileno) on cleanup. */
0102:   #define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/
0103:   #define _IO_IN_BACKUP 0x100
0104:   #define _IO_LINE_BUF 0x200
0105:   #define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */
0106:   #define _IO_CURRENTLY_PUTTING 0x800
0107:   #define _IO_IS_APPENDING 0x1000
0108:   #define _IO_IS_FILEBUF 0x2000
0109:   #define _IO_BAD_SEEN 0x4000
0110:   #define _IO_USER_LOCK 0x8000
0111:   
0112:   #define _IO_FLAGS2_MMAP 1
0113:   #define _IO_FLAGS2_NOTCANCEL 2
0114:   #ifdef _LIBC
0115:   # define _IO_FLAGS2_FORTIFY 4
0116:   #endif
0117:   #define _IO_FLAGS2_USER_WBUF 8
0118:   #ifdef _LIBC
0119:   # define _IO_FLAGS2_SCANF_STD 16
0120:   # define _IO_FLAGS2_NOCLOSE 32
0121:   # define _IO_FLAGS2_CLOEXEC 64
0122:   #endif
0123:   
0124:   /* These are "formatting flags" matching the iostream fmtflags enum values. */
0125:   #define _IO_SKIPWS 01
0126:   #define _IO_LEFT 02
0127:   #define _IO_RIGHT 04
0128:   #define _IO_INTERNAL 010
0129:   #define _IO_DEC 020
0130:   #define _IO_OCT 040
0131:   #define _IO_HEX 0100
0132:   #define _IO_SHOWBASE 0200
0133:   #define _IO_SHOWPOINT 0400
0134:   #define _IO_UPPERCASE 01000
0135:   #define _IO_SHOWPOS 02000
0136:   #define _IO_SCIENTIFIC 04000
0137:   #define _IO_FIXED 010000
0138:   #define _IO_UNITBUF 020000
0139:   #define _IO_STDIO 040000
0140:   #define _IO_DONT_CLOSE 0100000
0141:   #define _IO_BOOLALPHA 0200000
0142:   
0143:   
0144:   struct _IO_jump_t;  struct _IO_FILE;
0145:   
0146:   /* Handle lock.  */
0147:   #ifdef _IO_MTSAFE_IO
0148:   # if defined __GLIBC__ && __GLIBC__ >= 2
0149:   #  include <bits/stdio-lock.h>
0150:   # else
0151:   /*# include <comthread.h>*/
0152:   # endif
0153:   #else
0154:   typedef void _IO_lock_t;
0155:   #endif
0156:   
0157:   
0158:   /* A streammarker remembers a position in a buffer. */
0159:   
0160:   struct _IO_marker {
0161:     struct _IO_marker *_next;
0162:     struct _IO_FILE *_sbuf;
0163:     /* If _pos >= 0
0164:    it points to _buf->Gbase()+_pos. FIXME comment */
0165:     /* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */
0166:     int _pos;
0167:   #if 0
0168:       void set_streampos(streampos sp) { _spos = sp; }
0169:       void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); }
0170:     public:
0171:       streammarker(streambuf *sb);
0172:       ~streammarker();
0173:       int saving() { return  _spos == -2; }
0174:       int delta(streammarker&);
0175:       int delta();
0176:   #endif
0177:   };
0178:   
0179:   /* This is the structure from the libstdc++ codecvt class.  */
0180:   enum __codecvt_result
0181:   {
0182:     __codecvt_ok,
0183:     __codecvt_partial,
0184:     __codecvt_error,
0185:     __codecvt_noconv
0186:   };
0187:   
0188:   #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
0189:   /* The order of the elements in the following struct must match the order
0190:      of the virtual functions in the libstdc++ codecvt class.  */
0191:   struct _IO_codecvt
0192:   {
0193:     void (*__codecvt_destr) (struct _IO_codecvt *);
0194:     enum __codecvt_result (*__codecvt_do_out) (struct _IO_codecvt *,
0195:                                                __mbstate_t *,
0196:                                                const wchar_t *,
0197:                                                const wchar_t *,
0198:                                                const wchar_t **, char *,
0199:                                                char *, char **);
0200:     enum __codecvt_result (*__codecvt_do_unshift) (struct _IO_codecvt *,
0201:                                                    __mbstate_t *, char *,
0202:                                                    char *, char **);
0203:     enum __codecvt_result (*__codecvt_do_in) (struct _IO_codecvt *,
0204:                                               __mbstate_t *,
0205:                                               const char *, const char *,
0206:                                               const char **, wchar_t *,
0207:                                               wchar_t *, wchar_t **);
0208:     int (*__codecvt_do_encoding) (struct _IO_codecvt *);
0209:     int (*__codecvt_do_always_noconv) (struct _IO_codecvt *);
0210:     int (*__codecvt_do_length) (struct _IO_codecvt *, __mbstate_t *,
0211:                                 const char *, const char *, _IO_size_t);
0212:     int (*__codecvt_do_max_length) (struct _IO_codecvt *);
0213:   
0214:     _IO_iconv_t __cd_in;
0215:     _IO_iconv_t __cd_out;
0216:   };
0217:   
0218:   /* Extra data for wide character streams.  */
0219:   struct _IO_wide_data
0220:   {
0221:     wchar_t *_IO_read_ptr;        /* Current read pointer */
0222:     wchar_t *_IO_read_end;        /* End of get area. */
0223:     wchar_t *_IO_read_base;       /* Start of putback+get area. */
0224:     wchar_t *_IO_write_base;      /* Start of put area. */
0225:     wchar_t *_IO_write_ptr;       /* Current put pointer. */
0226:     wchar_t *_IO_write_end;       /* End of put area. */
0227:     wchar_t *_IO_buf_base;        /* Start of reserve area. */
0228:     wchar_t *_IO_buf_end;         /* End of reserve area. */
0229:     /* The following fields are used to support backing up and undo. */
0230:     wchar_t *_IO_save_base;       /* Pointer to start of non-current get area. */
0231:     wchar_t *_IO_backup_base;     /* Pointer to first valid character of
0232:                                      backup area */
0233:     wchar_t *_IO_save_end;        /* Pointer to end of non-current get area. */
0234:   
0235:     __mbstate_t _IO_state;
0236:     __mbstate_t _IO_last_state;
0237:     struct _IO_codecvt _codecvt;
0238:   
0239:     wchar_t _shortbuf[1];
0240:   
0241:     const struct _IO_jump_t *_wide_vtable;
0242:   };
0243:   #endif
0244:   
0245:   struct _IO_FILE {
0246:     int _flags;           /* High-order word is _IO_MAGIC; rest is flags. */
0247:   #define _IO_file_flags _flags
0248:   
0249:     /* The following pointers correspond to the C++ streambuf protocol. */
0250:     /* Note:  Tk uses the _IO_read_ptr and _IO_read_end fields directly. */
0251:     char* _IO_read_ptr;   /* Current read pointer */
0252:     char* _IO_read_end;   /* End of get area. */
0253:     char* _IO_read_base;  /* Start of putback+get area. */
0254:     char* _IO_write_base; /* Start of put area. */
0255:     char* _IO_write_ptr;  /* Current put pointer. */
0256:     char* _IO_write_end;  /* End of put area. */
0257:     char* _IO_buf_base;   /* Start of reserve area. */
0258:     char* _IO_buf_end;    /* End of reserve area. */
0259:     /* The following fields are used to support backing up and undo. */
0260:     char *_IO_save_base; /* Pointer to start of non-current get area. */
0261:     char *_IO_backup_base;  /* Pointer to first valid character of backup area */
0262:     char *_IO_save_end; /* Pointer to end of non-current get area. */
0263:   
0264:     struct _IO_marker *_markers;
0265:   
0266:     struct _IO_FILE *_chain;
0267:   
0268:     int _fileno;
0269:   #if 0
0270:     int _blksize;
0271:   #else
0272:     int _flags2;
0273:   #endif
0274:     _IO_off_t _old_offset; /* This used to be _offset but it's too small.  */
0275:   
0276:   #define __HAVE_COLUMN /* temporary */
0277:     /* 1+column number of pbase(); 0 is unknown. */
0278:     unsigned short _cur_column;
0279:     signed char _vtable_offset;
0280:     char _shortbuf[1];
0281:   
0282:     /*  char* _save_gptr;  char* _save_egptr; */
0283:   
0284:     _IO_lock_t *_lock;
0285:   #ifdef _IO_USE_OLD_IO_FILE
0286:   };
0287:   
0288:   struct _IO_FILE_complete
0289:   {
0290:     struct _IO_FILE _file;
0291:   #endif
0292:   #if defined _G_IO_IO_FILE_VERSION && _G_IO_IO_FILE_VERSION == 0x20001
0293:     _IO_off64_t _offset;
0294:   # if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
0295:     /* Wide character stream stuff.  */
0296:     struct _IO_codecvt *_codecvt;
0297:     struct _IO_wide_data *_wide_data;
0298:     struct _IO_FILE *_freeres_list;
0299:     void *_freeres_buf;
0300:     size_t _freeres_size;
0301:   # else
0302:     void *__pad1;
0303:     void *__pad2;
0304:     void *__pad3;
0305:     void *__pad4;
0306:     size_t __pad5;
0307:   # endif
0308:     int _mode;
0309:     /* Make sure we don't get into trouble again.  */
0310:     char _unused2[15 * sizeof (int) - 4 * sizeof (void *) - sizeof (size_t)];
0311:   #endif
0312:   };
0313:   
0314:   #ifndef __cplusplus
0315:   typedef struct _IO_FILE _IO_FILE;
0316:   #endif
0317:   
0318:   struct _IO_FILE_plus;
0319:   
0320:   extern struct _IO_FILE_plus _IO_2_1_stdin_;
0321:   extern struct _IO_FILE_plus _IO_2_1_stdout_;
0322:   extern struct _IO_FILE_plus _IO_2_1_stderr_;
0323:   #ifndef _LIBC
0324:   #define _IO_stdin ((_IO_FILE*)(&_IO_2_1_stdin_))
0325:   #define _IO_stdout ((_IO_FILE*)(&_IO_2_1_stdout_))
0326:   #define _IO_stderr ((_IO_FILE*)(&_IO_2_1_stderr_))
0327:   #else
0328:   extern _IO_FILE *_IO_stdin attribute_hidden;
0329:   extern _IO_FILE *_IO_stdout attribute_hidden;
0330:   extern _IO_FILE *_IO_stderr attribute_hidden;
0331:   #endif
0332:   
0333:   
0334:   /* Functions to do I/O and file management for a stream.  */
0335:   
0336:   /* Read NBYTES bytes from COOKIE into a buffer pointed to by BUF.
0337:      Return number of bytes read.  */
0338:   typedef __ssize_t __io_read_fn (void *__cookie, char *__buf, size_t __nbytes);
0339:   
0340:   /* Write N bytes pointed to by BUF to COOKIE.  Write all N bytes
0341:      unless there is an error.  Return number of bytes written.  If
0342:      there is an error, return 0 and do not write anything.  If the file
0343:      has been opened for append (__mode.__append set), then set the file
0344:      pointer to the end of the file and then do the write; if not, just
0345:      write at the current file pointer.  */
0346:   typedef __ssize_t __io_write_fn (void *__cookie, const char *__buf,
0347:                                    size_t __n);
0348:   
0349:   /* Move COOKIE's file position to *POS bytes from the
0350:      beginning of the file (if W is SEEK_SET),
0351:      the current position (if W is SEEK_CUR),
0352:      or the end of the file (if W is SEEK_END).
0353:      Set *POS to the new file position.
0354:      Returns zero if successful, nonzero if not.  */
0355:   typedef int __io_seek_fn (void *__cookie, _IO_off64_t *__pos, int __w);
0356:   
0357:   /* Close COOKIE.  */
0358:   typedef int __io_close_fn (void *__cookie);
0359:   
0360:   
0361:   #ifdef _GNU_SOURCE
0362:   /* User-visible names for the above.  */
0363:   typedef __io_read_fn cookie_read_function_t;
0364:   typedef __io_write_fn cookie_write_function_t;
0365:   typedef __io_seek_fn cookie_seek_function_t;
0366:   typedef __io_close_fn cookie_close_function_t;
0367:   
0368:   /* The structure with the cookie function pointers.  */
0369:   typedef struct
0370:   {
0371:     __io_read_fn *read;           /* Read bytes.  */
0372:     __io_write_fn *write;         /* Write bytes.  */
0373:     __io_seek_fn *seek;           /* Seek/tell file position.  */
0374:     __io_close_fn *close;         /* Close file.  */
0375:   } _IO_cookie_io_functions_t;
0376:   typedef _IO_cookie_io_functions_t cookie_io_functions_t;
0377:   
0378:   struct _IO_cookie_file;
0379:   
0380:   /* Initialize one of those.  */
0381:   extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write,
0382:                                void *__cookie, _IO_cookie_io_functions_t __fns);
0383:   #endif
0384:   
0385:   
0386:   #ifdef __cplusplus
0387:   extern "C" {
0388:   #endif
0389:   
0390:   extern int __underflow (_IO_FILE *);
0391:   extern int __uflow (_IO_FILE *);
0392:   extern int __overflow (_IO_FILE *, int);
0393:   #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
0394:   extern _IO_wint_t __wunderflow (_IO_FILE *);
0395:   extern _IO_wint_t __wuflow (_IO_FILE *);
0396:   extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t);
0397:   #endif
0398:   
0399:   #if  __GNUC__ >= 3
0400:   # define _IO_BE(expr, res) __builtin_expect ((expr), res)
0401:   #else
0402:   # define _IO_BE(expr, res) (expr)
0403:   #endif
0404:   
0405:   #define _IO_getc_unlocked(_fp) \
0406:          (_IO_BE ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end, 0) \
0407:           ? __uflow (_fp) : *(unsigned char *) (_fp)->_IO_read_ptr++)
0408:   #define _IO_peekc_unlocked(_fp) \
0409:          (_IO_BE ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end, 0) \
0410:             && __underflow (_fp) == EOF ? EOF \
0411:           : *(unsigned char *) (_fp)->_IO_read_ptr)
0412:   #define _IO_putc_unlocked(_ch, _fp) \
0413:      (_IO_BE ((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end, 0) \
0414:       ? __overflow (_fp, (unsigned char) (_ch)) \
0415:       : (unsigned char) (*(_fp)->_IO_write_ptr++ = (_ch)))
0416:   
0417:   #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
0418:   # define _IO_getwc_unlocked(_fp) \
0419:     (_IO_BE ((_fp)->_wide_data == NULL                                    \
0420:              || ((_fp)->_wide_data->_IO_read_ptr                          \
0421:                  >= (_fp)->_wide_data->_IO_read_end), 0)                  \
0422:      ? __wuflow (_fp) : (_IO_wint_t) *(_fp)->_wide_data->_IO_read_ptr++)
0423:   # define _IO_putwc_unlocked(_wch, _fp) \
0424:     (_IO_BE ((_fp)->_wide_data == NULL                                    \
0425:              || ((_fp)->_wide_data->_IO_write_ptr                         \
0426:                  >= (_fp)->_wide_data->_IO_write_end), 0)                 \
0427:      ? __woverflow (_fp, _wch)                                            \
0428:      : (_IO_wint_t) (*(_fp)->_wide_data->_IO_write_ptr++ = (_wch)))
0429:   #endif
0430:   
0431:   #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0)
0432:   #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0)
0433:   
0434:   extern int _IO_getc (_IO_FILE *__fp);
0435:   extern int _IO_putc (int __c, _IO_FILE *__fp);
0436:   extern int _IO_feof (_IO_FILE *__fp) __THROW;
0437:   extern int _IO_ferror (_IO_FILE *__fp) __THROW;
0438:   
0439:   extern int _IO_peekc_locked (_IO_FILE *__fp);
0440:   
0441:   /* This one is for Emacs. */
0442:   #define _IO_PENDING_OUTPUT_COUNT(_fp)   \
0443:           ((_fp)->_IO_write_ptr - (_fp)->_IO_write_base)
0444:   
0445:   extern void _IO_flockfile (_IO_FILE *) __THROW;
0446:   extern void _IO_funlockfile (_IO_FILE *) __THROW;
0447:   extern int _IO_ftrylockfile (_IO_FILE *) __THROW;
0448:   
0449:   #ifdef _IO_MTSAFE_IO
0450:   # define _IO_peekc(_fp) _IO_peekc_locked (_fp)
0451:   # define _IO_flockfile(_fp) \
0452:     if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_flockfile (_fp)
0453:   # define _IO_funlockfile(_fp) \
0454:     if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_funlockfile (_fp)
0455:   #else
0456:   # define _IO_peekc(_fp) _IO_peekc_unlocked (_fp)
0457:   # define _IO_flockfile(_fp) /**/
0458:   # define _IO_funlockfile(_fp) /**/
0459:   # define _IO_ftrylockfile(_fp) /**/
0460:   # define _IO_cleanup_region_start(_fct, _fp) /**/
0461:   # define _IO_cleanup_region_end(_Doit) /**/
0462:   #endif /* !_IO_MTSAFE_IO */
0463:   
0464:   extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict,
0465:                           _IO_va_list, int *__restrict);
0466:   extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict,
0467:                            _IO_va_list);
0468:   extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t);
0469:   extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t);
0470:   
0471:   extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int);
0472:   extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int);
0473:   
0474:   extern void _IO_free_backup_area (_IO_FILE *) __THROW;
0475:   
0476:   #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
0477:   extern _IO_wint_t _IO_getwc (_IO_FILE *__fp);
0478:   extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp);
0479:   extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW;
0480:   # if __GNUC__ >= 2
0481:   /* While compiling glibc we have to handle compatibility with very old
0482:      versions.  */
0483:   #  if defined _LIBC && defined SHARED
0484:   #   include <shlib-compat.h>
0485:   #   if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
0486:   #    define _IO_fwide_maybe_incompatible \
0487:     (__builtin_expect (&_IO_stdin_used == NULL, 0))
0488:   extern const int _IO_stdin_used;
0489:   weak_extern (_IO_stdin_used);
0490:   #   endif
0491:   #  endif
0492:   #  ifndef _IO_fwide_maybe_incompatible
0493:   #   define _IO_fwide_maybe_incompatible (0)
0494:   #  endif
0495:   /* A special optimized version of the function above.  It optimizes the
0496:      case of initializing an unoriented byte stream.  */
0497:   #  define _IO_fwide(__fp, __mode) \
0498:     ({ int __result = (__mode);                                                 \
0499:        if (__result < 0 && ! _IO_fwide_maybe_incompatible)                      \
0500:          {                                                                      \
0501:            if ((__fp)->_mode == 0)                                              \
0502:              /* We know that all we have to do is to set the flag.  */          \
0503:              (__fp)->_mode = -1;                                                \
0504:            __result = (__fp)->_mode;                                            \
0505:          }                                                                      \
0506:        else if (__builtin_constant_p (__mode) && (__mode) == 0)                 \
0507:          __result = _IO_fwide_maybe_incompatible ? -1 : (__fp)->_mode;          \
0508:        else                                                                     \
0509:          __result = _IO_fwide (__fp, __result);                                 \
0510:        __result; })
0511:   # endif
0512:   
0513:   extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict,
0514:                            _IO_va_list, int *__restrict);
0515:   extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict,
0516:                             _IO_va_list);
0517:   extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t);
0518:   extern void _IO_free_wbackup_area (_IO_FILE *) __THROW;
0519:   #endif
0520:   
0521:   #ifdef __LDBL_COMPAT
0522:   # include <bits/libio-ldbl.h>
0523:   #endif
0524:   
0525:   #ifdef __cplusplus
0526:   }
0527:   #endif
0528:   
0529:   #endif /* _IO_STDIO_H */