1 2008-07-21 Guenter Ebermann <guenter.ebermann@gmx.at>
3 * src/common/fclose.cxx (fclose): Replace config-dependent use of
4 delete with free(), as the memory had been allocated with malloc.
6 2007-07-02 Gary Thomas <gary@mlbassoc.com>
8 * src/output/vfnprintf.cxx: Add (char *) casts to make GCC/4.2.x happy.
10 2007-02-05 Sergei Organov <osv@javad.com>
12 * src/output/vfnprintf.cxx (vfnprintf): while formatting integers
13 in decimal, convert the value to unsigned long from unsigned long
14 long before processing, unless we actually print long long
15 argument. This tremendously speeds-up the formatting.
17 2007-01-16 Sergei Organov <osv@javad.com>
19 Speed-up [v]s[n]printf() functions by a factor of about 2+. In
20 particular, sprintf(s, "%s", "") becomes faster 2.8 times,
21 printing of every character -- 1.7 times, and, as a result, e.g.,
22 printing of a string of length 50 -- 2.2 times.
24 * include/stream.hxx (class Cyg_OutputStream): New ABC.
25 (class Cyg_StdioStream): inherit from Cyg_OutputStream; make
26 the destructor, write(), and get_error() virtual.
28 * src/output/vfnprintf.cxx (vfnprintf): Use ABC Cyg_OutputStream
29 instead of Cyg_StdioStream.
31 * src/common/vsnprintf.cxx (class Cyg_VsnprintfStream): New class
32 that specializes Cyg_OutputStream for output to a string.
33 (vsnprintf): Use Cyg_VsnprintfStream for printing to a string.
35 2006-12-22 Sergei Organov <osv@javad.com>
37 * src/output/vfnprintf.cxx (vfnprintf): Speed-up formatting of
38 decimal integers by replacing modulo operation with multiply and
41 2006-09-27 Jonathan Larmour <jifl@eCosCentric.com>
43 * include/stdio.h: Make fpos_t be signed to allow negative
44 SEEK_CUR offsets to fseek().
45 * include/stream.inl (set_position): If SEEK_CUR, then if
46 having to reconcile difference between position and underlying
47 file position, then requested seek position needs adjusting
49 Both above reported and analysed by Ivan Djelic.
51 2006-09-26 Jonathan Larmour <jifl@eCosCentric.com>
53 * src/common/stream.cxx (read): Only update position after direct
54 reads from I/O system so it's updated by the correct number of
56 (write): Reset underlying file position if there had been
57 stuff read from the file left in the buffer so the file positions
60 2005-07-22 Andrew Lunn <andrew.lunn@ascom.ch>
62 * src/common/fopen.cxx (fopen): Default the open mode to Read
63 until we have process the flags. Initialize the dev handle. These
64 keep the compiler happy.
66 2005-04-11 Jonathan Larmour <jifl@eCosCentric.com>
68 * src/common/stream.cxx (read): don't reference flags.buffering
69 when configured by CDL to be unbuffered.
71 2005-03-27 Andrew Lunn <andrew.lunn@ascom.ch>
73 * include/stdio.h: Added CYGBLD_ATTRIB_{PRINTF|SCANF}_FORMAT where
74 appropriate so the compiler does more checking.
76 2004-12-08 Daniel Neri <daniel.neri@sigicom.se>
78 * cdl/stdio.cdl (CYGPKG_LIBC_STDIO_FILEIO): The FILEIO variant of
79 vsnprintf breaks if CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF is disabled.
81 2004-09-27 Jonathan Larmour <jifl@eCosCentric.com>
83 * cdl/stdio.cdl (CYGFUN_LIBC_STDIO_OPEN_POSIX_FDFUNCS): New option,
84 to control whether or not fdopen()/fileno() are implemented.
85 Only build fopen/fclose if CYGPKG_LIBC_STDIO_OPEN.
87 * src/common/fclose.cxx: Can remove ifdef CYGPKG_LIBC_STDIO_OPEN since
88 file now isn't even built if not.
89 * src/common/fopen.cxx: Ditto. Also condition on
90 CYGFUN_LIBC_STDIO_OPEN_POSIX_FDFUNCS so decision is centralised in CDL.
92 2004-08-18 Jonathan Larmour <jifl@eCosCentric.com>
94 * cdl/stdio.cdl (CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE): Only use
95 CYGDAT_IO_SERIAL_TTY_CONSOLE if set.
97 2004-08-18 Fredrik Hederstierna <fredrik@wespot.com>
98 2004-08-18 Jonathan Larmour <jifl@eCosCentric.com>
100 * src/input/vfscanf.cxx (vfscanf): Add long long and long double
102 * cdl/stdio.cdl (CYGFUN_LIBC_STDIO_LONGLONG): Make it a new option.
104 2004-08-16 Oyvind Harboe <oyvind.harboe@zylin.com>
106 * src/common/stream.cxx (read): fixed performance problem with
107 unbuffered reads. Long unbuffered i/o read requests would cause
108 one roundtrip to the underlying file system for each byte, instead
109 of a single trip as intended.
111 2004-03-29 Kelvin Lawson <klawson@ad-holdings.co.uk>
113 * src/common/fopen.cxx:
114 * src/common/stream.cxx:
116 * include/stream.hxx:
117 Split CYGSTREAM_READWRITE into CYGSTREAM_READWRITE_CREATE and
118 CYGSTREAM_READWRITE_NOCREATE. This fixes fopen() with mode 'w+'
119 which previously did not allow file creation.
121 2004-03-27 Andrew Lunn <andrew.lunn@ascom.ch>
123 * include/stream.inl (set_position): Flush the output buffer
124 before seeking the underlying file otherwise the writes ends up in
125 the wrong location in the file.
127 2004-03-15 Jonathan Larmour <jifl@eCosCentric.com>
129 * src/common/fileops.cxx (tmpnam): Only close if open() succeded.
131 2004-03-12 Jonathan Larmour <jifl@eCosCentric.com>
133 * src/input/vfscanf.cxx (vfscanf): Silence warning.
136 Add file operation functions which weren't here before!
137 While I'm here, add __THROW everywhere and use __externC not externC.
139 * cdl/stdio.cdl: We implement stdio fileops in isoinfra now.
140 Also set header for that.
142 L_tmpnam must be at least 4.
143 TMP_MAX must be at least 1, and ISO C says it should be >=25.
144 Add description for CYGPKG_LIBC_STDIO_FILEIO and move up from
145 bottom so it goes with others.
147 * src/common/fileops.cxx: New file. Implements rename(), remove(),
148 tmpnam() and tmpfile().
150 * src/common/fclose.cxx: Add throw specifiers to match stdio.h.
151 * src/common/feof.cxx: Ditto.
152 * src/common/fflush.cxx: Ditto.
153 * src/common/fopen.cxx: Ditto.
154 * src/common/freopen.cxx: Ditto.
155 * src/common/fseek.cxx: Ditto.
156 * src/common/setvbuf.cxx: Ditto.
157 * src/common/snprintf.cxx: Ditto.
158 * src/common/sprintf.cxx: Ditto.
159 * src/common/sscanf.cxx: Ditto.
160 * src/common/stdioinlines.cxx: Ditto.
161 * src/common/ungetc.cxx: Ditto.
162 * src/common/vsnprintf.cxx: Ditto.
163 * src/common/vsscanf.cxx: Ditto.
164 * src/input/fgetc.cxx: Ditto.
165 * src/input/fgets.cxx: Ditto.
166 * src/input/fread.cxx: Ditto.
167 * src/input/fscanf.cxx: Ditto.
168 * src/input/gets.cxx: Ditto.
169 * src/input/scanf.cxx: Ditto.
170 * src/input/vfscanf.cxx: Ditto.
171 * src/output/fnprintf.cxx: Ditto.
172 * src/output/fprintf.cxx: Ditto.
173 * src/output/fputc.cxx: Ditto.
174 * src/output/fputs.cxx: Ditto.
175 * src/output/fwrite.cxx: Ditto.
176 * src/output/printf.cxx: Ditto.
177 * src/output/vfnprintf.cxx: Ditto.
179 2004-02-17 Jonathan Larmour <jifl@eCosCentric.com>
181 * cdl/stdio.cdl (CYGSEM_LIBC_STDIO_THREAD_SAFE_STREAMS): Can
182 be inactive when no kernel.
183 * cdl/stdio.cdl: Implements file positioning functions in isoinfra.
185 2003-09-03 Thomas Koeller <thomas.koeller@baslerweb.com>
187 * cdl/stdio.cdl: only require "/dev/haldiag" if actually using it.
189 2003-08-12 Scott Wilkinson <scott@alliantnetworks.com>
191 * src/common/fclose.cxx (fclose): fclose would seg-fault if passed
192 NULL FILE pointer. Now returns error. Also cleaned up some exit
193 paths to call Cyg_libc_stdio_files::unlock()
195 * src/common/fopen.cxx (fopen): Cleaned up some exit paths to call
196 Cyg_libc_stdio_files::unlock()
198 2003-06-10 Andrew Lunn <andrew.lunn@ascom.ch>
199 Knud Wöhler <woehler@ossi.fho-emden.de>
201 * src/output/vfnprintf.cxx (SARG): Cast size_t to long. This seems
202 to stop gcc from producing wrong code for the plain int clause. The
203 wrong code causes negative numbers to be printed as positive because
204 the sign extend from 32 bits to 64 bits is wrong.
206 2003-03-06 Gary Thomas <gary@mlbassoc.com>
208 * src/input/fread.cxx (fread): Simple EOF should not set error.
210 * tests/fileio.c: New file.
211 * cdl/stdio.cdl: Add new file I/O tests.
213 2003-02-24 Jonathan Larmour <jifl@eCosCentric.com>
215 * cdl/stdio.cdl: Fix doc link.
217 2003-02-15 Fabrice Gautier <Fabrice_Gautier@sdesigns.com>
219 * include/stdio.inl (setbuf): Don't supply size with _IONBF.
220 * src/common/stdioinlines.cxx (setbuf): Ditto.
222 2003-01-29 Jonathan Larmour <jifl@eCosCentric.com>
224 * src/output/vfnprintf.cxx: Add support for C99 'z' flag (size_t).
226 2002-09-02 Andrew Lunn <andrew.lunn@ascom.ch>
228 * include/stream.inl (set_position): Fixed typo in none buffered
229 case. Seek pos bytes, not whence bytes.
231 2002-05-17 Martin Buck <martin.buck@ascom.ch>
233 * include/stdio.h (fnprintf): Added printf-format-checking using
234 CYGBLD_ATTRIB_PRINTF_FORMAT, since gcc does it automatically only for
238 2002-04-24 Yoshinori Sato <qzb04471@nifty.ne.jp>
240 * include/streambuf.inl (Cyg_StdioStreamBuffer constructor):
241 Don't set default args in func definition.
244 2002-04-05 Jonathan Larmour <jlarmour@redhat.com>
246 * src/input/fgetc.cxx (fgetc): Silence conversion warning.
248 2002-04-04 Jonathan Larmour <jlarmour@redhat.com>
250 * src/common/fopen.cxx (fopen_inner): Allocate memory using malloc and
251 placement new, not default new.
253 * src/input/fgetc.cxx (fgetc): Don't set error on true EOF.
255 2002-04-04 Jurica Baricevic <jura@INTESIS.hr>
257 * src/common/fclose.cxx (fclose): Use delete if we can.
259 2002-02-06 Jonathan Larmour <jlarmour@redhat.com>
261 * src/input/fread.cxx (fread): when looping read into ptrc, not ptr!
263 2002-01-25 Jonathan Larmour <jlarmour@redhat.com>
265 * include/stream.inl (set_position): Fix the seek backwards case again.
268 2002-01-24 Jonathan Larmour <jlarmour@redhat.com>
270 * include/stream.inl (set_position): Fix the posdiff == 0 case.
272 2002-01-24 Jesper Skov <jskov@redhat.com>
274 * include/stream.inl (set_position): Check that posdiff is >0
275 before taking the code path that assumes so.
277 2002-01-17 Jonathan Larmour <jlarmour@redhat.com>
279 * include/stream.inl (set_position): Use an off_t for bytesavail to
282 2001-12-05 Jonathan Larmour <jlarmour@redhat.com>
284 * src/common/fflush.cxx (cyg_libc_stdio_flush_all_but): Fix starvation
285 problem when waiting for threads to unlock of lower priority.
288 2001-11-23 Jonathan Larmour <jlarmour@redhat.com>
290 * cdl/stdio.cdl: Add dependency on stdlib string conversion functions
293 2001-08-10 Robin Farine <robin.farine@terminus.org>
295 * src/output/vfnprintf.cxx (cvt): Handles the cases of finite,
296 NaN and infinite numbers separately.
298 * src/common/stream.cxx (read): Read correct number of bytes when
299 a character has been "ungot".
301 2001-08-03 Jonathan Larmour <jlarmour@redhat.com>
303 * include/streambuf.inl (~Cyg_StdioStreamBuffer): use correct configury
304 to decide when to call free.
306 2001-07-27 Jesper Skov <jskov@redhat.com>
308 * src/common/fflush.cxx (cyg_libc_stdio_flush_all_but): The check
309 for last operation being a read is only valid in buffered IO mode.
311 2001-07-20 Jonathan Larmour <jlarmour@redhat.com>
313 * include/stream.inl (set_position): Take read buffer into account
314 when seeking. Thanks to jjtsai <jjtsai@itri.org.tw> for the
317 2001-07-12 Jonathan Larmour <jlarmour@redhat.com>
319 * src/common/fflush.cxx (cyg_libc_stdio_flush_all_but): Don't
320 flush a stream that was last used for reading - it doesn't need it.
321 * include/stream.hxx: cyg_libc_stdio_flush_all_but needs to be a
322 friend of class Cyg_StdioStream to do the above.
324 2001-06-18 Jonathan Larmour <jlarmour@redhat.com>
326 * src/input/fread.cxx (fread): Fix compilation problem with below
329 2001-06-15 Rob Jansen <rwjansen@planet.nl>
331 * src/input/fread.cxx (fread): Changed to read the requested amount
332 of data items instead of stopping on CYG_LIBC_STDIO_BUFSIZE boundaries.
334 2001-06-08 Jeff Johnston <jjohnstn@redhat.com>
336 * src/input/vfscanf.cxx (vfscanf)[CYGINT_LIBC_I18N_MB_REQUIRED]: Added
337 call to mbtowc_fn for current locale to process format string.
338 Also added variable definitions needed in this circumstance.
339 * src/output/vfnprintf.cxx (vfnprintf)[CYGINT_LIBC_I18N_MB_REQUIRED]: Ditto.
340 (vfnprintf): Changed non-multibyte path to simply use the current
341 character rather than call the C mbtowc function since only
342 single byte characters would be possible.
344 2001-03-19 Jonathan Larmour <jlarmour@redhat.com>
346 * src/common/stream.cxx (refill_read_buffer): Flush all streams here...
347 (read): ...rather than here, or...
348 (read_byte): ...here.
349 This means less flushing, which improves performance.
351 * src/input/fgets.cxx: Add a reminder comment to improve this later.
352 * src/input/gets.cxx: Ditto.
355 2001-03-16 Jonathan Larmour <jlarmour@redhat.com>
357 * include/stream.hxx (class Cyg_StdioStream): Improve member visibility.
359 * src/common/stream.cxx (refill_read_buffer): Ensure eof is set.
360 * src/common/feof.cxx: New file. Implements the long lost
361 feof(), ferror() and clearerr() functions which were MIA for
363 * cdl/stdio.cdl: Build it.
365 2001-03-15 Jonathan Larmour <jlarmour@redhat.com>
367 * cdl/stdio.cdl (CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE): Default to
370 * src/input/fgets.cxx (fgets): Reimplement to work with EOF properly.
372 * src/input/gets.cxx (gets): Ditto.
374 * include/io.hxx, include/io.inl, include/stream.hxx,
375 include/stream.inl, include/streambuf.hxx, include/streambuf.inl:
376 Silence warnings from recent compilers.
378 2001-02-01 Jonathan Larmour <jlarmour@redhat.com>
380 * cdl/stdio.cdl (CYGPKG_LIBC_STDIO_OPEN): Implements
381 CYGINT_ISO_STDIO_POSIX_FDFUNCS ( fileno() and fdopen() ).
383 2000-11-01 Jonathan Larmour <jlarmour@redhat.com>
385 * include/stdio.h: Make FILE array type larger to be more resistant
386 against small data sections.
387 Lose the cyg_libc_stdio_stdin/out/err definitions with macros for
388 stdin/stdout/err since it can cause problems with libgcc exception
389 code. Instead just make these extern FILE *s.
390 * src/common/stderr.cxx:
391 * src/common/stdin.cxx:
392 * src/common/stdout.cxx:
393 Define objects with init priority corresponding to order the fd's
394 should be allocated where applicable.
395 Define actual stdin, stdout, stderr externally visible constants to
396 point to the streams.
398 * cdl/stdio.cdl: Support CYGINT_ISO_STDIO_STREAMS interface
400 * src/common/fopen.cxx (fdopen): return f as intended
402 2000-10-23 Jesper Skov <jskov@redhat.com>
404 * include/streambuf.inl: Adjust assertions to cope with buffers
405 generated by sprintf and similar non-bound-buffer calls.
407 2000-08-09 Jonathan Larmour <jlarmour@redhat.co.uk>
409 * include/io.inl: No need to include string.h
411 * cdl/stdio.cdl: Add some more requires statements
413 2000-08-07 Jonathan Larmour <jlarmour@redhat.co.uk>
415 * src/common/stream.cxx (Cyg_StdioStream::Cyg_StdioStream):
416 Only call io_buf members conditionally.
418 2000-08-03 Jonathan Larmour <jlarmour@redhat.co.uk>
420 * src/common/fseek.cxx: Include assertion and tracing support since
423 2000-07-20 Nick Garnett <nickg@cygnus.co.uk>
425 * include/stream.hxx (class Cyg_StdioStream): Added get_dev()
426 accessor member function to return underlying device handle.
428 * src/common/fopen.cxx: Added fdopen() and fileno(). Reorganized
429 fopen() so that code common with fdopen() is now in a separate
432 * src/common/stdiosupp.cxx (Cyg_libc_stdio_find_filename): Removed
435 2000-07-13 Nick Garnett <nickg@cygnus.co.uk>
437 * cdl/stdio.cdl: Added common/fseek.cxx to compile list.
438 Reorganized options for stream buffering:
439 CYGSEM_LIBC_STDIO_DYNAMIC_SETVBUF now controls whether the user
440 can attach their own buffer to the stream.
441 CYGSEM_LIBC_STDIO_SETVBUF_MALLOC controls whether buffers can be
442 malloced or only statically defined.
443 Added CYGPKG_LIBC_STDIO_FILEIO option to control whether the STDIO
444 package uses the FILEIO package for all IO, or goes directly to
445 the device drivers as before.
447 * include/stdio.h: Added file positioning calls defined in section
448 7.9.9 of the standard.
452 Added these files to define an abstraction layer for access to the
453 real device underlying an IO stream. Depending on
454 CYGPKG_LIBC_STDIO_FILEIO this either goes to the FILEIO package or
455 directly to the device drivers.
457 * include/stream.hxx:
458 Modifications to use io.hxx abstractions.
459 Added second constructor for creating a buffer-only stream.
460 Added initialize() function which contains most of the common
461 stream initialization code.
462 Added a close() member function.
464 * include/stream.inl:
465 Modifications to use io.hxx abstractions.
466 Moved most of the work of the destructor into close() member.
467 Added FILEIO version of set_position() member function.
469 * include/streambuf.hxx:
470 * include/streambuf.inl:
471 * src/common/streambuf.cxx:
472 Rearranged to match new buffering configuration options.
474 * src/common/stream.cxx:
475 Modifications to use io.hxx abstractions.
476 Added second constructor, and moved common initialization code to
477 initialize() member function.
478 Added code to make position member correctly track current file
481 * src/common/fopen.cxx:
482 Fixed handling of write/append in process_mode().
483 Moved call of process_mode() to before call to cyg_stdio_open() so
484 that stream modes may be passed in.
485 Added code to detect an interactive stream and choose non-buffered
486 mode - fully buffered is now the default.
487 Added calls to cyg_stdio_close() where appropriate.
489 * src/output/vfnprintf.cxx: Removed FLUSH() macro and its
490 uses. Deciding to flush should be in the hands of the buffer code,
491 or the user calling fflush().
493 * src/common/vsscanf.cxx:
494 Added FILEIO variant of vsscanf(). This uses a precharged stream
495 object to emulate input.
497 * src/common/vsnprintf.cxx:
498 Added FILEIO variant of vsnprintf(). This uses the standard stream
499 object to print into the supplied buffer.
501 * src/common/fseek.cxx:
502 Added this file to implement file positioning functions.
504 * src/common/fclose.cxx (fclose):
505 Added call to Cyg_StdioStream::close().
507 * include/stdiosupp.hxx:
508 * src/common/stdiosupp.cxx:
509 Modified Cyg_libc_stdio_find_filename() to take mode, binary and
512 * src/common/stdin.cxx:
513 * src/common/stdout.cxx:
514 * src/common/stderr.cxx:
515 Modified calls to Cyg_libc_stdio_find_filename() to pass
516 appropriate values for mode, binary and append arguments.
518 2000-06-18 Jonathan Larmour <jlarmour@redhat.co.uk>
520 * src/common/vsscanf.cxx: Add NULL select entry to DEVIO_TABLE
521 * src/common/vsnprintf.cxx: Likewise
523 2000-05-25 Hugo Tyson <hmt@cygnus.co.uk>
525 * include/stream.inl (set_error): If the error is EEOF, set
526 the EOF flag (flags.at_eof) so that clients know.
528 * src/input/fgetc.cxx (__fgetc):
529 * src/input/fgets.cxx (_fgets):
530 * src/input/fread.cxx (_fread): Correctly handle an error,
531 or EOF indication, from real_stream->refill_read_buffer().
533 2000-05-02 Jonathan Larmour <jlarmour@redhat.co.uk>
536 Separated original libc out into separate packages on functional
538 Header files are now managed by isoinfra package
539 Plenty of cleanups done, but no major functionality changes
541 //===========================================================================
542 //####ECOSGPLCOPYRIGHTBEGIN####
543 // -------------------------------------------
544 // This file is part of eCos, the Embedded Configurable Operating System.
545 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
546 // Copyright (C) 2004, 2006 eCosCentric Limited
548 // eCos is free software; you can redistribute it and/or modify it under
549 // the terms of the GNU General Public License as published by the Free
550 // Software Foundation; either version 2 or (at your option) any later version.
552 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
553 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
554 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
557 // You should have received a copy of the GNU General Public License along
558 // with eCos; if not, write to the Free Software Foundation, Inc.,
559 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
561 // As a special exception, if other files instantiate templates or use macros
562 // or inline functions from this file, or you compile this file and link it
563 // with other works to produce a work based on this file, this file does not
564 // by itself cause the resulting work to be covered by the GNU General Public
565 // License. However the source code for this file must still be made available
566 // in accordance with section (3) of the GNU General Public License.
568 // This exception does not invalidate any other reasons why a work based on
569 // this file might be covered by the GNU General Public License.
570 // -------------------------------------------
571 //####ECOSGPLCOPYRIGHTEND####
572 //===========================================================================