Added separate libio header (since some C++ headers are needing it) - still messy.

Cleaned up stdio_{pre|post}.h headers.


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@7363 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2004-05-03 09:29:27 +00:00
parent 0d7f2390a4
commit 1062a34eae
3 changed files with 284 additions and 150 deletions
+22 -45
View File
@@ -1,9 +1,8 @@
#ifndef _STDIO_POST_H_
#define _STDIO_POST_H_
/*
** Distributed under the terms of the OpenBeOS License.
*/
#ifndef _STDIO_POST_H_
#define _STDIO_POST_H_
// "Private"/inline functions of our BeOS compatible stdio implementation
@@ -16,6 +15,11 @@
# error "This file must be included from stdio.h!"
#endif
extern char _single_threaded;
// this boolean value is true (1) if there is only the main thread
// running - as soon as you spawn the first thread, it's set to
// false (0)
#ifdef __cplusplus
# define __INLINE inline
#else
@@ -23,25 +27,13 @@
#endif
extern int _IO_feof_unlocked(FILE *stream);
extern int _IO_ferror_unlocked(FILE *stream);
extern int _IO_putc(int c, FILE *stream);
extern int _IO_putc_unlocked(int c, FILE *stream);
extern int _IO_getc(FILE *stream);
extern int _IO_getc_unlocked(FILE *stream);
extern int _IO_peekc_unlocked(FILE *stream);
extern int __underflow(FILE *stream);
extern int __uflow(FILE *stream);
extern int __overflow(FILE *stream, int c);
__INLINE int
feof_unlocked(FILE *stream)
{
return _IO_feof_unlocked(stream);
}
__INLINE int
ferror_unlocked(FILE *stream)
{
@@ -54,35 +46,6 @@ ferror_unlocked(FILE *stream)
#define putc(c, stream) \
(_single_threaded ? _IO_putc_unlocked(c, stream) : _IO_putc(c, stream))
__INLINE int
_IO_getc_unlocked(FILE *stream)
{
if (stream->_IO_read_ptr >= stream->_IO_read_end)
return __uflow(stream);
return *(unsigned char *)stream->_IO_read_ptr++;
}
__INLINE int
_IO_peekc_unlocked(FILE *stream)
{
if (stream->_IO_read_ptr >= stream->_IO_read_end && __underflow(stream) == EOF)
return EOF;
return *(unsigned char *)stream->_IO_read_ptr;
}
__INLINE int
_IO_putc_unlocked(int c, FILE *stream)
{
if (stream->_IO_write_ptr >= stream->_IO_write_end)
return __overflow(stream, (unsigned char)c);
return (unsigned char)(*stream->_IO_write_ptr++ = c);
}
__INLINE int
putc_unlocked(int c, FILE *stream)
@@ -97,6 +60,20 @@ putchar_unlocked(int c)
return _IO_putc_unlocked(c, stdout);
}
__INLINE int
getc_unlocked(FILE *stream)
{
return _IO_getc_unlocked(stream);
}
__INLINE int
getchar_unlocked(void)
{
return _IO_getc_unlocked(stdin);
}
#undef __INLINE
#endif /* _STDIO_POST_H_ */