|
|
1.1 ! root 1: /* ! 2: Copyright (C) 1993 Free Software Foundation ! 3: ! 4: This file is part of the GNU IO Library. This library is free ! 5: software; you can redistribute it and/or modify it under the ! 6: terms of the GNU General Public License as published by the ! 7: Free Software Foundation; either version 2, or (at your option) ! 8: any later version. ! 9: ! 10: This library is distributed in the hope that it will be useful, ! 11: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 12: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! 13: GNU General Public License for more details. ! 14: ! 15: You should have received a copy of the GNU General Public License ! 16: along with GNU CC; see the file COPYING. If not, write to ! 17: the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. ! 18: ! 19: As a special exception, if you link this library with files ! 20: compiled with a GNU compiler to produce an executable, this does not cause ! 21: the resulting executable to be covered by the GNU General Public License. ! 22: This exception does not however invalidate any other reasons why ! 23: the executable file might be covered by the GNU General Public License. */ ! 24: ! 25: /* This is part of the iostream library. ! 26: Copyright (C) 1991, 1992 Per Bothner. */ ! 27: ! 28: #ifndef _IO_STDIO_H ! 29: #define _IO_STDIO_H ! 30: #ifdef __GNUG__ ! 31: #pragma interface ! 32: #pragma cplusplus ! 33: #endif ! 34: ! 35: #if 1 ! 36: #include <_G_config.h> ! 37: #define _IO_pos_t _G_fpos_t /* obsolete */ ! 38: #define _IO_fpos_t _G_fpos_t ! 39: #define _IO_size_t _G_size_t ! 40: #define _IO_ssize_t _G_ssize_t ! 41: #define _IO_off_t _G_off_t ! 42: #define _IO_pid_t _G_pid_t ! 43: #define _IO_HAVE_SYS_WAIT _G_HAVE_SYS_WAIT ! 44: #define _IO_BUFSIZ _G_BUFSIZ ! 45: #define _IO_va_list _G_va_list ! 46: ! 47: #ifdef _G_NEED_STDARG_H ! 48: /* This define avoids name pollution if we're using GNU stdarg.h */ ! 49: #define __need___va_list ! 50: extern "C" { ! 51: #include <stdarg.h> ! 52: } ! 53: #ifdef __GNUC_VA_LIST ! 54: #undef _IO_va_list ! 55: #define _IO_va_list __gnuc_va_list ! 56: #endif /* __GNUC_VA_LIST */ ! 57: #endif ! 58: ! 59: #else ! 60: #include <_IO_config.h> ! 61: typedef _IO_fpos_t _IO_pos_t; ! 62: #endif ! 63: ! 64: #ifndef _PARAMS ! 65: #ifdef __STDC__ ! 66: #define _PARAMS(paramlist) paramlist ! 67: #else ! 68: #define _PARAMS(paramlist) () ! 69: #endif ! 70: #endif /*!_PARAMS*/ ! 71: #ifndef __STDC__ ! 72: #define const ! 73: #endif ! 74: #define USE_DTOA ! 75: ! 76: #if 0 ! 77: #ifdef _IO_NEED_STDARG_H ! 78: extern "C" { ! 79: #include <stdarg.h> ! 80: } ! 81: #endif ! 82: #endif ! 83: ! 84: #ifndef EOF ! 85: #define EOF (-1) ! 86: #endif ! 87: #ifndef NULL ! 88: #if !defined(__cplusplus) || defined(__GNUC__) ! 89: #define NULL ((void*)0) ! 90: #else ! 91: #define NULL (0) ! 92: #endif ! 93: #endif ! 94: ! 95: #define _IOS_INPUT 1 ! 96: #define _IOS_OUTPUT 2 ! 97: #define _IOS_ATEND 4 ! 98: #define _IOS_APPEND 8 ! 99: #define _IOS_TRUNC 16 ! 100: #define _IOS_NOCREATE 32 ! 101: #define _IOS_NOREPLACE 64 ! 102: #define _IOS_BIN 128 ! 103: ! 104: /* Magic numbers and bits for the _flags field. ! 105: The magic numbers use the high-order bits of _flags; ! 106: the remaining bits are abailable for variable flags. ! 107: Note: The magic numbers must all be negative if stdio ! 108: emulation is desired. */ ! 109: ! 110: #define _IO_MAGIC 0xFBAD0000 /* Magic number */ ! 111: #define _OLD_STDIO_MAGIC 0xFABC0000 /* Emulate old stdio. */ ! 112: #define _IO_MAGIC_MASK 0xFFFF0000 ! 113: #define _IO_USER_BUF 1 /* User owns buffer; don't delete it on close. */ ! 114: #define _IO_UNBUFFERED 2 ! 115: #define _IO_NO_READS 4 /* Reading not allowed */ ! 116: #define _IO_NO_WRITES 8 /* Writing not allowd */ ! 117: #define _IO_EOF_SEEN 0x10 ! 118: #define _IO_ERR_SEEN 0x20 ! 119: #define _IO_DELETE_DONT_CLOSE 0x40 ! 120: #define _IO_LINKED 0x80 /* Set if linked (using _chain) to streambuf::_list_all.*/ ! 121: #define _IO_IN_BACKUP 0x100 ! 122: #define _IO_LINE_BUF 0x200 ! 123: #define _IO_TIED_PUT_GET 0x400 /* Set if put and get pointer logicly tied. */ ! 124: #define _IO_CURRENTLY_PUTTING 0x800 ! 125: #define _IO_IS_APPENDING 0x1000 ! 126: #define _IO_IS_FILEBUF 0x2000 ! 127: ! 128: /* These are "formatting flags" matching the iostream fmtflags enum values. */ ! 129: #define _IO_SKIPWS 01 ! 130: #define _IO_LEFT 02 ! 131: #define _IO_RIGHT 04 ! 132: #define _IO_INTERNAL 010 ! 133: #define _IO_DEC 020 ! 134: #define _IO_OCT 040 ! 135: #define _IO_HEX 0100 ! 136: #define _IO_SHOWBASE 0200 ! 137: #define _IO_SHOWPOINT 0400 ! 138: #define _IO_UPPERCASE 01000 ! 139: #define _IO_SHOWPOS 02000 ! 140: #define _IO_SCIENTIFIC 04000 ! 141: #define _IO_FIXED 010000 ! 142: #define _IO_UNITBUF 020000 ! 143: #define _IO_STDIO 040000 ! 144: #define _IO_DONT_CLOSE 0100000 ! 145: ! 146: /* A streammarker remembers a position in a buffer. */ ! 147: ! 148: struct _IO_jump_t; struct _IO_FILE; ! 149: ! 150: struct _IO_marker { ! 151: struct _IO_marker *_next; ! 152: struct _IO_FILE *_sbuf; ! 153: /* If _pos >= 0 ! 154: it points to _buf->Gbase()+_pos. FIXME comment */ ! 155: /* if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment */ ! 156: int _pos; ! 157: #if 0 ! 158: void set_streampos(streampos sp) { _spos = sp; } ! 159: void set_offset(int offset) { _pos = offset; _spos = (streampos)(-2); } ! 160: public: ! 161: streammarker(streambuf *sb); ! 162: ~streammarker(); ! 163: int saving() { return _spos == -2; } ! 164: int delta(streammarker&); ! 165: int delta(); ! 166: #endif ! 167: }; ! 168: ! 169: struct _IO_FILE { ! 170: int _flags; /* High-order word is _IO_MAGIC; rest is flags. */ ! 171: #define _IO_file_flags _flags ! 172: ! 173: /* The following pointers correspond to the C++ streambuf protocol. */ ! 174: char* _IO_read_ptr; /* Current read pointer */ ! 175: char* _IO_read_end; /* End of get area. */ ! 176: char* _IO_read_base; /* Start of putback+get area. */ ! 177: char* _IO_write_base; /* Start of put area. */ ! 178: char* _IO_write_ptr; /* Current put pointer. */ ! 179: char* _IO_write_end; /* End of put area. */ ! 180: char* _IO_buf_base; /* Start of reserve area. */ ! 181: char* _IO_buf_end; /* End of reserve area. */ ! 182: /* The following fields are used to support backing up and undo. */ ! 183: char *_IO_save_base; /* Pointer to start of non-current get area. */ ! 184: char *_IO_backup_base; /* Pointer to first valid character of backup area */ ! 185: char *_IO_save_end; /* Pointer to end of non-current get area. */ ! 186: ! 187: /* These names are temporary aliases. TODO */ ! 188: #define _other_gbase _IO_save_base ! 189: #define _aux_limit _IO_backup_base ! 190: #define _other_egptr _IO_save_end ! 191: ! 192: struct _IO_marker *_markers; ! 193: ! 194: struct _IO_FILE *_chain; ! 195: ! 196: struct _IO_jump_t *_jumps; /* Jump table */ ! 197: ! 198: int _fileno; ! 199: int _blksize; ! 200: _IO_off_t _offset; ! 201: ! 202: #define __HAVE_COLUMN /* temporary */ ! 203: /* 1+column number of pbase(); 0 is unknown. */ ! 204: unsigned short _cur_column; ! 205: char _unused; ! 206: char _shortbuf[1]; ! 207: ! 208: /* char* _save_gptr; char* _save_egptr; */ ! 209: }; ! 210: ! 211: #ifndef __cplusplus ! 212: typedef struct _IO_FILE _IO_FILE; ! 213: #endif ! 214: ! 215: /* We always allocate an extra word following an _IO_FILE. ! 216: This is for compatibility with C++ streambuf; the word can ! 217: be used to smash to a pointer to a virtual function table. */ ! 218: ! 219: struct _IO_FILE_plus { ! 220: _IO_FILE _file; ! 221: const void *_vtable; ! 222: }; ! 223: ! 224: extern struct _IO_FILE_plus _IO_stdin_, _IO_stdout_, _IO_stderr_; ! 225: #define _IO_stdin (&_IO_stdin_._file) ! 226: #define _IO_stdout (&_IO_stdout_._file) ! 227: #define _IO_stderr (&_IO_stderr_._file) ! 228: ! 229: #ifdef __cplusplus ! 230: extern "C" { ! 231: #endif ! 232: ! 233: extern int __underflow _PARAMS((_IO_FILE*)); ! 234: extern int __overflow _PARAMS((_IO_FILE*, int)); ! 235: ! 236: extern unsigned __adjust_column _PARAMS((unsigned start, const char *line, int count)); ! 237: ! 238: #define _IO_getc(_fp) \ ! 239: ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end \ ! 240: && __underflow(_fp) == EOF ? EOF \ ! 241: : *(unsigned char*)(_fp)->_IO_read_ptr++) ! 242: #define _IO_peekc(_fp) \ ! 243: ((_fp)->_IO_read_ptr >= (_fp)->_IO_read_end \ ! 244: && __underflow(_fp) == EOF ? EOF \ ! 245: : *(unsigned char*)(_fp)->_IO_read_ptr) ! 246: ! 247: #define _IO_putc(_ch, _fp) \ ! 248: (((_fp)->_IO_write_ptr >= (_fp)->_IO_write_end) \ ! 249: ? __overflow(_fp, (unsigned char)_ch) \ ! 250: : (unsigned char)(*(_fp)->_IO_write_ptr++ = _ch)) ! 251: ! 252: extern int _IO_vfscanf _PARAMS((_IO_FILE*, const char*, _IO_va_list, int*)); ! 253: extern int _IO_vfprintf _PARAMS((_IO_FILE*, const char*, _IO_va_list)); ! 254: extern _IO_ssize_t _IO_padn _PARAMS((_IO_FILE *, int, _IO_ssize_t)); ! 255: extern _IO_size_t _IO_sgetn _PARAMS((_IO_FILE *, void*, _IO_size_t)); ! 256: ! 257: extern void _IO_free_backup_area _PARAMS((_IO_FILE*)); ! 258: ! 259: #ifdef __cplusplus ! 260: } ! 261: #endif ! 262: ! 263: #endif /* _IO_STDIO_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.