GCC with patches for OS216
Revision | bd7c273f3e456919f43b9389ee559f48a7c61315 (tree) |
---|---|
Zeit | 2000-12-07 14:57:29 |
Autor | Jeffrey A Law <law@cygn...> |
Commiter | Jeff Law |
[multiple changes]
From-SVN: r38096
@@ -1,3 +1,31 @@ | ||
1 | +Wed Dec 6 22:52:34 2000 Jeffrey A Law (law@cygnus.com) | |
2 | + | |
3 | + 2000-10-11 Jakub Jelinek <jakub@redhat.com> | |
4 | + * iostream.cc (ostream::operator<<(double n)) [__GLIBC_MINOR__ >= 2]: | |
5 | + Initialize new fields wide and i18n of struct printf_info. | |
6 | + (ostream::operator<<(long double n)) [__GLIBC_MINOR__ >= 2]: | |
7 | + Likewise. | |
8 | + | |
9 | + 2000-09-23 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> | |
10 | + * stdstreams.cc: Include <libio.h>, not "libio.h". | |
11 | + * iolibio.h: Likewise. | |
12 | + (_IO_pos_BAD): Use _IO_off_t instead of _IO_fpos_t. | |
13 | + * libio.h (_IO_USER_LOCK): Define. | |
14 | + | |
15 | + 1999-12-13 Jakub Jelinek <jakub@redhat.com> | |
16 | + * libio.h (_IO_cookie_io_functions_t): Use _IO_off_t instead of | |
17 | + _IO_fpos_t. | |
18 | + (_IO_seekoff, _IO_seekpos): Likewise. Use _IO_off64_t instead of | |
19 | + _IO_fpos64_t. | |
20 | + * libioP.h (_IO_seekoff_t, _IO_seekpos_t, _IO_seek_t): Likewise. | |
21 | + (_IO_seekoff, _IO_seekpos): Likewise. | |
22 | + (_IO_default_seekoff, _IO_default_seekpos): Likewise. | |
23 | + (_IO_default_seek): Likewise. | |
24 | + (_IO_file_seekoff, _IO_file_seek, _IO_str_seekoff): Likewise. | |
25 | + * streambuf.h (streampos): Typedef to _IO_off_t resp. _IO_off64_t. | |
26 | + * parsestream.h (class parsebuf::pos_at_line_start): Change type | |
27 | + to _IO_off_t. | |
28 | + | |
1 | 29 | Sun Oct 24 23:54:10 PDT 1999 Jeff Law (law@cygnus.com) |
2 | 30 | |
3 | 31 | * gcc-2.95.2 Released. |
@@ -1,4 +1,4 @@ | ||
1 | -#include "libio.h" | |
1 | +#include <libio.h> | |
2 | 2 | |
3 | 3 | /* These emulate stdio functionality, but with a different name |
4 | 4 | (_IO_ungetc instead of ungetc), and using _IO_FILE instead of FILE. */ |
@@ -38,7 +38,11 @@ extern int _IO_obstack_vprintf __P ((struct obstack *, const char *, | ||
38 | 38 | _IO_va_list)); |
39 | 39 | extern int _IO_obstack_printf __P ((struct obstack *, const char *, ...)); |
40 | 40 | #ifndef _IO_pos_BAD |
41 | -#define _IO_pos_BAD ((_IO_fpos_t)(-1)) | |
41 | +# if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 | |
42 | +# define _IO_pos_BAD ((_IO_off64_t) -1) | |
43 | +# else | |
44 | +# define _IO_pos_BAD ((_IO_off_t) -1) | |
45 | +# endif | |
42 | 46 | #endif |
43 | 47 | #define _IO_clearerr(FP) ((FP)->_flags &= ~(_IO_ERR_SEEN|_IO_EOF_SEEN)) |
44 | 48 | #define _IO_fseek(__fp, __offset, __whence) \ |
@@ -1,5 +1,5 @@ | ||
1 | 1 | /* This is part of libio/iostream, providing -*- C++ -*- input/output. |
2 | - Copyright (C) 1993, 1997 Free Software Foundation, Inc. | |
2 | + Copyright (C) 1993, 1997, 2000 Free Software Foundation, Inc. | |
3 | 3 | |
4 | 4 | This file is part of the GNU IO Library. This library is free |
5 | 5 | software; you can redistribute it and/or modify it under the |
@@ -687,6 +687,10 @@ ostream& ostream::operator<<(double n) | ||
687 | 687 | /* extra: */ 0, |
688 | 688 | #if __GLIBC_MINOR__ >= 1 |
689 | 689 | /* is_char: */ 0, |
690 | +#if __GLIBC_MINOR__ >= 2 | |
691 | + /* wide: */ 0, | |
692 | + /* i18n: */ 0, | |
693 | +#endif | |
690 | 694 | #endif |
691 | 695 | #endif |
692 | 696 | /* pad: */ fill() |
@@ -793,6 +797,10 @@ ostream& ostream::operator<<(long double n) | ||
793 | 797 | /* extra: */ 0, |
794 | 798 | #if __GLIBC_MINOR__ >= 1 |
795 | 799 | /* is_char: */ 0, |
800 | +#if __GLIBC_MINOR__ >= 2 | |
801 | + /* wide: */ 0, | |
802 | + /* i18n: */ 0, | |
803 | +#endif | |
796 | 804 | #endif |
797 | 805 | #endif |
798 | 806 | /* pad: */ fill() |
@@ -136,6 +136,7 @@ | ||
136 | 136 | #define _IO_IS_APPENDING 0x1000 |
137 | 137 | #define _IO_IS_FILEBUF 0x2000 |
138 | 138 | #define _IO_BAD_SEEN 0x4000 |
139 | +#define _IO_USER_LOCK 0x8000 | |
139 | 140 | |
140 | 141 | /* These are "formatting flags" matching the iostream fmtflags enum values. */ |
141 | 142 | #define _IO_SKIPWS 01 |
@@ -277,7 +278,7 @@ typedef struct | ||
277 | 278 | { |
278 | 279 | _IO_ssize_t (*read) __PMT ((struct _IO_FILE *, void *, _IO_ssize_t)); |
279 | 280 | _IO_ssize_t (*write) __PMT ((struct _IO_FILE *, const void *, _IO_ssize_t)); |
280 | - _IO_fpos_t (*seek) __PMT ((struct _IO_FILE *, _IO_off_t, int)); | |
281 | + _IO_off_t (*seek) __PMT ((struct _IO_FILE *, _IO_off_t, int)); | |
281 | 282 | int (*close) __PMT ((struct _IO_FILE *)); |
282 | 283 | } _IO_cookie_io_functions_t; |
283 | 284 |
@@ -348,11 +349,11 @@ extern _IO_ssize_t _IO_padn __P ((_IO_FILE *, int, _IO_ssize_t)); | ||
348 | 349 | extern _IO_size_t _IO_sgetn __P ((_IO_FILE *, void *, _IO_size_t)); |
349 | 350 | |
350 | 351 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
351 | -extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int)); | |
352 | -extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int)); | |
352 | +extern _IO_off64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int)); | |
353 | +extern _IO_off64_t _IO_seekpos __P ((_IO_FILE *, _IO_off64_t, int)); | |
353 | 354 | #else |
354 | -extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
355 | -extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int)); | |
355 | +extern _IO_off_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
356 | +extern _IO_off_t _IO_seekpos __P ((_IO_FILE *, _IO_off_t, int)); | |
356 | 357 | #endif |
357 | 358 | |
358 | 359 | extern void _IO_free_backup_area __P ((_IO_FILE *)); |
@@ -146,10 +146,10 @@ typedef _IO_size_t (*_IO_xsgetn_t) __PMT ((_IO_FILE *FP, void *DATA, | ||
146 | 146 | It matches the streambuf::seekoff virtual function. |
147 | 147 | It is also used for the ANSI fseek function. */ |
148 | 148 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
149 | -typedef _IO_fpos64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF, | |
149 | +typedef _IO_off64_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off64_t OFF, | |
150 | 150 | int DIR, int MODE)); |
151 | 151 | #else |
152 | -typedef _IO_fpos_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off_t OFF, | |
152 | +typedef _IO_off_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off_t OFF, | |
153 | 153 | int DIR, int MODE)); |
154 | 154 | #endif |
155 | 155 | #define _IO_SEEKOFF(FP, OFF, DIR, MODE) JUMP3 (__seekoff, FP, OFF, DIR, MODE) |
@@ -160,9 +160,9 @@ typedef _IO_fpos_t (*_IO_seekoff_t) __PMT ((_IO_FILE *FP, _IO_off_t OFF, | ||
160 | 160 | It is also used for the ANSI fgetpos and fsetpos functions. */ |
161 | 161 | /* The _IO_seek_cur and _IO_seek_end options are not allowed. */ |
162 | 162 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
163 | -typedef _IO_fpos64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_fpos64_t, int)); | |
163 | +typedef _IO_off64_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off64_t, int)); | |
164 | 164 | #else |
165 | -typedef _IO_fpos_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_fpos_t, int)); | |
165 | +typedef _IO_off_t (*_IO_seekpos_t) __PMT ((_IO_FILE *, _IO_off_t, int)); | |
166 | 166 | #endif |
167 | 167 | #define _IO_SEEKPOS(FP, POS, FLAGS) JUMP2 (__seekpos, FP, POS, FLAGS) |
168 | 168 |
@@ -213,9 +213,9 @@ typedef _IO_ssize_t (*_IO_write_t) __PMT ((_IO_FILE *,const void *,_IO_ssize_t)) | ||
213 | 213 | It matches the streambuf::sys_seek virtual function, which is |
214 | 214 | specific to this implementation. */ |
215 | 215 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
216 | -typedef _IO_fpos64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int)); | |
216 | +typedef _IO_off64_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off64_t, int)); | |
217 | 217 | #else |
218 | -typedef _IO_fpos_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off_t, int)); | |
218 | +typedef _IO_off_t (*_IO_seek_t) __PMT ((_IO_FILE *, _IO_off_t, int)); | |
219 | 219 | #endif |
220 | 220 | #define _IO_SYSSEEK(FP, OFFSET, MODE) JUMP2 (__seek, FP, OFFSET, MODE) |
221 | 221 |
@@ -298,11 +298,11 @@ struct _IO_FILE_plus | ||
298 | 298 | /* Generic functions */ |
299 | 299 | |
300 | 300 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
301 | -extern _IO_fpos64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int)); | |
302 | -extern _IO_fpos64_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos64_t, int)); | |
301 | +extern _IO_off64_t _IO_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int)); | |
302 | +extern _IO_off64_t _IO_seekpos __P ((_IO_FILE *, _IO_off64_t, int)); | |
303 | 303 | #else |
304 | -extern _IO_fpos_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
305 | -extern _IO_fpos_t _IO_seekpos __P ((_IO_FILE *, _IO_fpos_t, int)); | |
304 | +extern _IO_off_t _IO_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
305 | +extern _IO_off_t _IO_seekpos __P ((_IO_FILE *, _IO_off_t, int)); | |
306 | 306 | #endif |
307 | 307 | |
308 | 308 | extern void _IO_switch_to_main_get_area __P ((_IO_FILE *)); |
@@ -340,22 +340,22 @@ extern _IO_size_t _IO_default_xsputn __P ((_IO_FILE *, const void *, | ||
340 | 340 | _IO_size_t)); |
341 | 341 | extern _IO_size_t _IO_default_xsgetn __P ((_IO_FILE *, void *, _IO_size_t)); |
342 | 342 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
343 | -extern _IO_fpos64_t _IO_default_seekoff __P ((_IO_FILE *, | |
343 | +extern _IO_off64_t _IO_default_seekoff __P ((_IO_FILE *, | |
344 | 344 | _IO_off64_t, int, int)); |
345 | -extern _IO_fpos64_t _IO_default_seekpos __P ((_IO_FILE *, | |
346 | - _IO_fpos64_t, int)); | |
345 | +extern _IO_off64_t _IO_default_seekpos __P ((_IO_FILE *, | |
346 | + _IO_off64_t, int)); | |
347 | 347 | #else |
348 | -extern _IO_fpos_t _IO_default_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
349 | -extern _IO_fpos_t _IO_default_seekpos __P ((_IO_FILE *, _IO_fpos_t, int)); | |
348 | +extern _IO_off_t _IO_default_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
349 | +extern _IO_off_t _IO_default_seekpos __P ((_IO_FILE *, _IO_off_t, int)); | |
350 | 350 | #endif |
351 | 351 | extern _IO_ssize_t _IO_default_write __P ((_IO_FILE *, const void *, |
352 | 352 | _IO_ssize_t)); |
353 | 353 | extern _IO_ssize_t _IO_default_read __P ((_IO_FILE *, void *, _IO_ssize_t)); |
354 | 354 | extern int _IO_default_stat __P ((_IO_FILE *, void *)); |
355 | 355 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
356 | -extern _IO_fpos64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int)); | |
356 | +extern _IO_off64_t _IO_default_seek __P ((_IO_FILE *, _IO_off64_t, int)); | |
357 | 357 | #else |
358 | -extern _IO_fpos_t _IO_default_seek __P ((_IO_FILE *, _IO_off_t, int)); | |
358 | +extern _IO_off_t _IO_default_seek __P ((_IO_FILE *, _IO_off_t, int)); | |
359 | 359 | #endif |
360 | 360 | extern int _IO_default_sync __P ((_IO_FILE *)); |
361 | 361 | #define _IO_default_close ((_IO_close_t) _IO_default_sync) |
@@ -389,11 +389,11 @@ extern void _IO_flush_all_linebuffered __P ((void)); | ||
389 | 389 | extern int _IO_file_doallocate __P ((_IO_FILE *)); |
390 | 390 | extern _IO_FILE* _IO_file_setbuf __P ((_IO_FILE *, char *, _IO_ssize_t)); |
391 | 391 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
392 | -extern _IO_fpos64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int)); | |
393 | -extern _IO_fpos64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int)); | |
392 | +extern _IO_off64_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int)); | |
393 | +extern _IO_off64_t _IO_file_seek __P ((_IO_FILE *, _IO_off64_t, int)); | |
394 | 394 | #else |
395 | -extern _IO_fpos_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
396 | -extern _IO_fpos_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int)); | |
395 | +extern _IO_off_t _IO_file_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
396 | +extern _IO_off_t _IO_file_seek __P ((_IO_FILE *, _IO_off_t, int)); | |
397 | 397 | #endif |
398 | 398 | extern _IO_size_t _IO_file_xsputn __P ((_IO_FILE *, const void *, _IO_size_t)); |
399 | 399 | extern int _IO_file_stat __P ((_IO_FILE *, void *)); |
@@ -427,9 +427,9 @@ extern int _IO_str_underflow __P ((_IO_FILE *)); | ||
427 | 427 | extern int _IO_str_overflow __P ((_IO_FILE *, int)); |
428 | 428 | extern int _IO_str_pbackfail __P ((_IO_FILE *, int)); |
429 | 429 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
430 | -extern _IO_fpos64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int)); | |
430 | +extern _IO_off64_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off64_t, int, int)); | |
431 | 431 | #else |
432 | -extern _IO_fpos_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
432 | +extern _IO_off_t _IO_str_seekoff __P ((_IO_FILE *, _IO_off_t, int, int)); | |
433 | 433 | #endif |
434 | 434 | extern void _IO_str_finish __P ((_IO_FILE *, int)); |
435 | 435 |
@@ -544,12 +544,12 @@ extern int _IO_vscanf __P ((const char *, _IO_va_list)); | ||
544 | 544 | where an _IO_fpos_t is a struct. |
545 | 545 | Note that _IO_off_t must be an integral type. */ |
546 | 546 | |
547 | -/* _IO_pos_BAD is an _IO_fpos_t value indicating error, unknown, or EOF. */ | |
547 | +/* _IO_pos_BAD is an _IO_off_t value indicating error, unknown, or EOF. */ | |
548 | 548 | #ifndef _IO_pos_BAD |
549 | 549 | # if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
550 | -# define _IO_pos_BAD ((_IO_fpos64_t) -1) | |
550 | +# define _IO_pos_BAD ((_IO_off64_t) -1) | |
551 | 551 | # else |
552 | -# define _IO_pos_BAD ((_IO_fpos_t) -1) | |
552 | +# define _IO_pos_BAD ((_IO_off_t) -1) | |
553 | 553 | # endif |
554 | 554 | #endif |
555 | 555 | /* _IO_pos_as_off converts an _IO_fpos_t value to an _IO_off_t value. */ |
@@ -1,156 +1 @@ | ||
1 | -/* This is part of libio/iostream, providing -*- C++ -*- input/output. | |
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 this library; see the file COPYING. If not, write to the Free | |
17 | -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 | -Written by Per Bothner (bothner@cygnus.com). */ | |
26 | - | |
27 | -#ifndef PARSESTREAM_H | |
28 | -#define PARSESTREAM_H | |
29 | -#ifdef __GNUG__ | |
30 | -#pragma interface | |
31 | -#endif | |
32 | -#include "streambuf.h" | |
33 | - | |
34 | -extern "C++" { | |
35 | -// A parsebuf is a streambuf optimized for scanning text files. | |
36 | -// It keeps track of line and column numbers. | |
37 | -// It is guaranteed to remember the entire current line, | |
38 | -// as well the '\n'-s on either side of it (if they exist). | |
39 | -// You can arbitrarily seek (or unget) within this extended line. | |
40 | -// Other backward seeks are not supported. | |
41 | -// Normal read semantics are supported (and hence istream operators like >>). | |
42 | - | |
43 | -class parsebuf : public streambuf { | |
44 | - protected: | |
45 | - _IO_fpos_t pos_at_line_start; | |
46 | - long _line_length; | |
47 | - unsigned long __line_number; | |
48 | - char *buf_start; | |
49 | - char *buf_end; | |
50 | - | |
51 | - public: | |
52 | - parsebuf *chain; | |
53 | - | |
54 | - // Return column number (raw - don't handle tabs etc). | |
55 | - // Retult can be -1, meaning: at '\n' before current line. | |
56 | - virtual int tell_in_line(); | |
57 | - | |
58 | - // seek to (raw) column I in current line. | |
59 | - // Result is new (raw) column position - differs from I if unable to seek. | |
60 | - // Seek to -1 tries to seek to before previous LF. | |
61 | - virtual int seek_in_line(int i); | |
62 | - | |
63 | - // Note: there is no "current line" initially, until something is read. | |
64 | - | |
65 | - // Current line number, starting with 0. | |
66 | - // If tell_in_line()==-1, then line number of next line. | |
67 | - int line_number() { return __line_number; } | |
68 | - | |
69 | - // Length of current line, not counting either '\n'. | |
70 | - int line_length() { return _line_length; } | |
71 | - // Current line - not a copy, so file ops may trash it. | |
72 | - virtual char* current_line(); | |
73 | - virtual streampos seekoff(streamoff, _seek_dir, int mode=ios::in|ios::out); | |
74 | - virtual streambuf* setbuf(char* p, int len); | |
75 | - protected: | |
76 | - parsebuf() { chain= NULL; | |
77 | - __line_number = 0; pos_at_line_start = 0; _line_length = -1; } | |
78 | - virtual int pbackfail(int c); | |
79 | -}; | |
80 | - | |
81 | -// A string_parsebuf is a parsebuf whose source is a fixed string. | |
82 | - | |
83 | -class string_parsebuf : public parsebuf { | |
84 | - public: | |
85 | - int do_delete; | |
86 | - string_parsebuf(char *str, int len, int delete_at_close=0); | |
87 | - virtual int underflow(); | |
88 | - virtual char* current_line(); | |
89 | - virtual int seek_in_line(int i); | |
90 | - virtual int tell_in_line(); | |
91 | - char *left() const { return base(); } | |
92 | - char *right() const { return ebuf(); } | |
93 | -// streampos seekoff(streamoff, _seek_dir, int); | |
94 | -}; | |
95 | - | |
96 | -// A func_parsebuf calls a given function to get new input. | |
97 | -// Each call returns an entire NUL-terminated line (without the '\n'). | |
98 | -// That line has been allocated with malloc(), not new. | |
99 | -// The interface is tailored to the GNU readline library. | |
100 | -// Example: | |
101 | -// char* DoReadLine(void* arg) | |
102 | -// { | |
103 | -// char *line = readline((char*)arg); /* 'arg' is used as prompt. */ | |
104 | -// if line == NULL) { putc('\n', stderr); return NULL; } | |
105 | -// if (line[0] != '\0') add_history(line); | |
106 | -// return line; | |
107 | -// } | |
108 | -// char PromptBuffer[100] = "> "; | |
109 | -// func_parsebuf my_stream(DoReadLine, PromptBuffer); | |
110 | - | |
111 | -typedef char *(*CharReader)(void *arg); | |
112 | -class istream; | |
113 | - | |
114 | -class func_parsebuf : public parsebuf { | |
115 | - public: | |
116 | - void *arg; | |
117 | - CharReader read_func; | |
118 | - int backed_up_to_newline; | |
119 | - func_parsebuf(CharReader func, void *argm = NULL); | |
120 | - int underflow(); | |
121 | - virtual int tell_in_line(); | |
122 | - virtual int seek_in_line(int i); | |
123 | - virtual char* current_line(); | |
124 | -}; | |
125 | - | |
126 | -// A general_parsebuf is a parsebuf which gets its input from some | |
127 | -// other streambuf. It explicitly buffers up an entire line. | |
128 | - | |
129 | -class general_parsebuf : public parsebuf { | |
130 | - public: | |
131 | - streambuf *sbuf; | |
132 | - int delete_buf; // Delete sbuf when destroying this. | |
133 | - general_parsebuf(streambuf *buf, int delete_arg_buf = 0); | |
134 | - int underflow(); | |
135 | - virtual int tell_in_line(); | |
136 | - virtual int seek_in_line(int i); | |
137 | - ~general_parsebuf(); | |
138 | - virtual char* current_line(); | |
139 | -}; | |
140 | - | |
141 | -#if 0 | |
142 | -class parsestream : public istream { | |
143 | - streammarker marks[2]; | |
144 | - short _first; // of the two marks; either 0 or 1 | |
145 | - int _lineno; | |
146 | - int first() { return _first; } | |
147 | - int second() { return 1-_first; } | |
148 | - int line_length() { marks[second].delta(marks[first]); } | |
149 | - int line_length() { marks[second].delta(marks[first]); } | |
150 | - int seek_in_line(int i); | |
151 | - int tell_in_line(); | |
152 | - int line_number(); | |
153 | -}; | |
154 | -#endif | |
155 | -} // extern "C++" | |
156 | -#endif /*!defined(PARSESTREAM_H)*/ | |
1 | + _IO_off_t pos_at_line_start; |
@@ -1,153 +1 @@ | ||
1 | -/* This is part of libio/iostream, providing -*- C++ -*- input/output. | |
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 this library; see the file COPYING. If not, write to the Free | |
17 | -Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 | -/* Written by Per Bothner (bothner@cygnus.com). */ | |
26 | - | |
27 | -#include "libioP.h" | |
28 | -#include "streambuf.h" | |
29 | -#include <stdio.h> | |
30 | - | |
31 | -// The ANSI draft requires that operations on cin/cout/cerr can be | |
32 | -// mixed with operations on stdin/stdout/stderr on a character by | |
33 | -// character basis. This normally requires that the streambuf's | |
34 | -// used by cin/cout/cerr be stdiostreams. However, if the stdio | |
35 | -// implementation is the one that is built using this library, | |
36 | -// then we don't need to, since in that case stdin/stdout/stderr | |
37 | -// are identical to _IO_stdin/_IO_stdout/_IO_stderr. | |
38 | - | |
39 | -#include "libio.h" | |
40 | - | |
41 | -#ifdef _STDIO_USES_IOSTREAM | |
42 | -#define CIN_SBUF _IO_stdin_ | |
43 | -#define COUT_SBUF _IO_stdout_ | |
44 | -#define CERR_SBUF _IO_stderr_ | |
45 | -static int use_stdiobuf = 0; | |
46 | -#else | |
47 | -#define CIN_SBUF _IO_stdin_buf | |
48 | -#define COUT_SBUF _IO_stdout_buf | |
49 | -#define CERR_SBUF _IO_stderr_buf | |
50 | -static int use_stdiobuf = 1; | |
51 | -#endif | |
52 | - | |
53 | -#define cin CIN | |
54 | -#define cout COUT | |
55 | -#define cerr CERR | |
56 | -#define clog CLOG | |
57 | -#include "iostream.h" | |
58 | -#undef cin | |
59 | -#undef cout | |
60 | -#undef cerr | |
61 | -#undef clog | |
62 | - | |
63 | -#ifdef __GNUG__ | |
64 | -#define PAD 0 /* g++ allows 0-length arrays. */ | |
65 | -#else | |
66 | -#define PAD 1 | |
67 | -#endif | |
68 | -struct _fake_istream { | |
69 | - struct myfields { | |
70 | -#ifdef __GNUC__ | |
71 | - _ios_fields *vb; /* pointer to virtual base class ios */ | |
72 | - _IO_ssize_t _gcount; | |
73 | -#else | |
74 | - /* This is supposedly correct for cfront. */ | |
75 | - _IO_ssize_t _gcount; | |
76 | - void *vptr; | |
77 | - _ios_fields *vb; /* pointer to virtual base class ios */ | |
78 | -#endif | |
79 | - } mine; | |
80 | - _ios_fields base; | |
81 | - char filler[sizeof(struct istream)-sizeof(struct _ios_fields)+PAD]; | |
82 | -}; | |
83 | -struct _fake_ostream { | |
84 | - struct myfields { | |
85 | -#ifndef __GNUC__ | |
86 | - void *vptr; | |
87 | -#endif | |
88 | - _ios_fields *vb; /* pointer to virtual base class ios */ | |
89 | - } mine; | |
90 | - _ios_fields base; | |
91 | - char filler[sizeof(struct ostream)-sizeof(struct _ios_fields)+PAD]; | |
92 | -}; | |
93 | - | |
94 | - | |
95 | -#ifdef _IO_NEW_STREAMS | |
96 | -#define STD_STR(SBUF, TIE, EXTRA_FLAGS) \ | |
97 | - (streambuf*)&SBUF, TIE, 0, ios::skipws|ios::dec|EXTRA_FLAGS, ' ',0,0,6 | |
98 | -#else | |
99 | -#define STD_STR(SBUF, TIE, EXTRA_FLAGS) \ | |
100 | - (streambuf*)&SBUF, TIE, 0, ios::dont_close|ios::dec|ios::skipws|EXTRA_FLAGS, ' ',0,0,6 | |
101 | -#endif | |
102 | - | |
103 | -#ifdef __GNUC__ | |
104 | -#define OSTREAM_DEF(NAME, SBUF, TIE, EXTRA_FLAGS, ASM) \ | |
105 | - _fake_ostream NAME ASM = { {&NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }}; | |
106 | -#define ISTREAM_DEF(NAME, SBUF, TIE, EXTRA_FLAGS) \ | |
107 | - _fake_istream NAME = { {&NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }}; | |
108 | -#else | |
109 | -#define OSTREAM_DEF(NAME, SBUF, TIE, EXTRA_FLAGS) \ | |
110 | - _fake_ostream NAME = { {0, &NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS) }}; | |
111 | -#define ISTREAM_DEF(NAME, SBUF, TIE, EXTRA_FLAGS) \ | |
112 | - _fake_istream NAME = {{0, 0, &NAME.base}, {STD_STR(SBUF, TIE, EXTRA_FLAGS)}}; | |
113 | -#endif | |
114 | - | |
115 | -OSTREAM_DEF(cout, COUT_SBUF, NULL, 0, ) | |
116 | -OSTREAM_DEF(cerr, CERR_SBUF,(ostream*)&cout, ios::unitbuf, ) | |
117 | -ISTREAM_DEF(cin, CIN_SBUF, (ostream*)&cout, 0) | |
118 | - | |
119 | -/* Only for (partial) compatibility with AT&T's library. */ | |
120 | -#if _G_CLOG_CONFLICT | |
121 | -OSTREAM_DEF(clog, CERR_SBUF, (ostream*)&cout, 0, __asm__ ("__IO_clog")) | |
122 | -#else | |
123 | -OSTREAM_DEF(clog, CERR_SBUF, (ostream*)&cout, 0, ) | |
124 | -#endif | |
125 | - | |
126 | -// Switches between using _IO_std{in,out,err} and __std{in,out,err}_buf | |
127 | -// for standard streams. This does not normally need to be called | |
128 | -// explicitly, but is provided for AT&T compatibility. | |
129 | - | |
130 | -int ios::sync_with_stdio(int new_state) | |
131 | -{ | |
132 | -#ifdef _STDIO_USES_IOSTREAM | |
133 | - // It is always synced. | |
134 | - return 0; | |
135 | -#else | |
136 | - if (new_state == use_stdiobuf) // The usual case now. | |
137 | - return use_stdiobuf; | |
138 | - if (new_state) { | |
139 | - cin.base._strbuf = (streambuf*)&_IO_stdin_buf; | |
140 | - cout.base._strbuf = (streambuf*)&_IO_stdout_buf; | |
141 | - cerr.base._strbuf = (streambuf*)&_IO_stderr_buf; | |
142 | - clog.base._strbuf = (streambuf*)&_IO_stderr_buf; | |
143 | - } else { | |
144 | - cin.base._strbuf = (streambuf*)_IO_stdin; | |
145 | - cout.base._strbuf = (streambuf*)_IO_stdout; | |
146 | - cerr.base._strbuf = (streambuf*)_IO_stderr; | |
147 | - clog.base._strbuf = (streambuf*)_IO_stderr; | |
148 | - } | |
149 | - int old_state = use_stdiobuf; | |
150 | - use_stdiobuf = new_state; | |
151 | - return old_state; | |
152 | -#endif | |
153 | -} | |
1 | +#include <libio.h> |
@@ -72,10 +72,10 @@ class ostream; class streambuf; | ||
72 | 72 | |
73 | 73 | #if defined(_G_IO_IO_FILE_VERSION) && _G_IO_IO_FILE_VERSION == 0x20001 |
74 | 74 | typedef _IO_off64_t streamoff; |
75 | -typedef _IO_fpos64_t streampos; | |
75 | +typedef _IO_off64_t streampos; | |
76 | 76 | #else |
77 | 77 | typedef _IO_off_t streamoff; |
78 | -typedef _IO_fpos_t streampos; | |
78 | +typedef _IO_off_t streampos; | |
79 | 79 | #endif |
80 | 80 | typedef _IO_ssize_t streamsize; |
81 | 81 |