📄 _stdio_file.h
字号:
// Decrements the current read/write position by 1, returning the
// character at the NEW position.
inline char& _FILE_I_predecr(FILE *__f) { ++__f->_cnt; return *(--__f->_ptr); }
// Decrements the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_postdecr(FILE *__f) { ++__f->_cnt; return *(__f->_ptr--); }
// Increments the current read/write position by __n.
inline void _FILE_I_bump(FILE *__f, int __n) { __f->_cnt -= __n; __f->_ptr += __n; }
// Sets the beginning of the bufer to __begin, the current read/write
// position to __next, and the buffer's past-the-end pointer to __end.
// If any of those pointers is null, then all of them must be null.
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end)
{
__f->_base = __begin;
__f->_ptr = __next;
__f->_cnt = __end - __next;
__f->_bufsiz = __end - __begin;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined(__MRC__) || defined(__SC__) //*TY 02/24/2000 - added support for MPW
inline int _FILE_fd(const FILE *__f) { return __f->_file; }
// Returns a pointer to the beginning of the buffer.
inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->_base; }
// Returns the current read/write position within the buffer.
inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->_ptr; }
// Returns a pointer immediately past the end of the buffer.
inline char* _FILE_I_end(const FILE *__f) { return (char*)__f->_end; }
// Returns the number of characters remaining in the buffer, i.e.
// _FILE_[IO]_end(__f) - _FILE_[IO]_next(__f).
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->_cnt; }
// Increments the current read/write position by 1, returning the
// character at the NEW position.
inline char& _FILE_I_preincr(FILE *__f) { --__f->_cnt; return*(char*) (++__f->_ptr); }
// Increments the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_postincr(FILE *__f) { --__f->_cnt; return*(char*) (__f->_ptr++); }
// Decrements the current read/write position by 1, returning the
// character at the NEW position.
inline char& _FILE_I_predecr(FILE *__f) { ++__f->_cnt; return*(char*) (--__f->_ptr); }
// Decrements the current read/write position by 1, returning the
// character at the old position.
inline char& _FILE_I_postdecr(FILE *__f) { ++__f->_cnt; return*(char*) (__f->_ptr--); }
// Increments the current read/write position by __n.
inline void _FILE_I_bump(FILE *__f, int __n) { __f->_cnt -= __n; __f->_ptr += __n; }
// Sets the beginning of the bufer to __begin, the current read/write
// position to __next, and the buffer's past-the-end pointer to __end.
// If any of those pointers is null, then all of them must be null.
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end)
{
__f->_base = (unsigned char*)__begin;
__f->_ptr = (unsigned char*)__next;
__f->_end = (unsigned char*)__end;
__f->_cnt = __end - __next;
__f->_size = __end - __begin;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined (__MVS__)
typedef unsigned char* _File_ptr_type;
inline int _FILE_fd(const FILE *__f) { return fileno(__CONST_CAST(FILE
*,__f)); }
inline char* _FILE_I_begin(const FILE *__f) { return (char*)
__f->__fp->__bufPtr; }
inline char* _FILE_I_next(const FILE *__f) { return (char*)
__f->__fp->__bufPtr; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->__fp->__bufPtr + __f->__fp->__countIn; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return
__f->__fp->__countIn; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->__fp->__countIn; return *(char*) (++__f->__fp->__bufPtr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->__fp->__countIn; return *(char*) (__f->__fp->__bufPtr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->__fp->__countIn; return *(char*) (--__f->__fp->__bufPtr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->__fp->__countIn; return *(char*) (__f->__fp->__bufPtr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->__fp->__bufPtr += __n; __f->__fp->__countIn -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char*
__end) {
// __f->_base = (_File_ptr_type) __begin;
if(__f->__fp) {
__f->__fp->__bufPtr = (_File_ptr_type) __next;
__f->__fp->__countIn = __end - __next;
}
}
inline char* _FILE_O_begin(const FILE *__f) { return (char*)__f->__fp->__bufPtr;}
inline char* _FILE_O_next(const FILE *__f) { return (char*) __f->__fp->__bufPtr;}
inline char* _FILE_O_end(const FILE *__f) { return (char*) __f->__fp->__bufPtr + __f->__fp->__countOut; }
inline ptrdiff_t _FILE_O_avail(const FILE *__f) { return __f->__fp->__countOut; }
inline char& _FILE_O_preincr(FILE *__f)
{ --__f->__fp->__countOut; return *(char*) (++__f->__fp->__bufPtr); }
inline char& _FILE_O_postincr(FILE *__f)
{ --__f->__fp->__countOut; return *(char*) (__f->__fp->__bufPtr++); }
inline char& _FILE_O_predecr(FILE *__f)
{ ++__f->__fp->__countOut; return *(char*) (--__f->__fp->__bufPtr); }
inline char& _FILE_O_postdecr(FILE *__f)
{ ++__f->__fp->__countOut; return *(char*) (__f->__fp->__bufPtr--); }
inline void _FILE_O_bump(FILE *__f, int __n)
{ __f->__fp->__bufPtr += __n; __f->__fp->__countOut -= __n; }
inline void _FILE_O_set(FILE *__f, char* __begin, char* __next, char*
__end) {
// __f->_base = (_File_ptr_type) __begin;
if(__f->__fp) {
__f->__fp->__bufPtr = (_File_ptr_type) __next;
__f->__fp->__countOut = __end - __next;
}
}
#elif defined(__QNXNTO__)
inline int _FILE_fd(const FILE *__f) { return __f->_handle;
}
inline char* _FILE_I_begin(const FILE *__f) { return
(char*) __f->_base; }
inline char* _FILE_I_next(const FILE *__f) { return
(char*) __f->_ptr; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->_ptr + __f->_cnt; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return
__f->_cnt; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->_cnt; return *(char*) (++__f->_ptr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->_cnt; return *(char*) (__f->_ptr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (--__f->_ptr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (__f->_ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->_ptr += __n; __f->_cnt -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char*
__next, char*
__end) {
__f->_base = (unsigned char*) __begin;
__f->_ptr = (unsigned char*) __next;
__f->_cnt = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined(__WATCOMC__) // Nikolaev
inline int _FILE_fd (const FILE *__f) { return __f->_handle;}
inline char* _FILE_I_begin (const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_link); }
inline char* _FILE_I_next (const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_ptr); }
inline char* _FILE_I_end (const FILE *__f) { return __REINTERPRET_CAST(char*, __f->_ptr + __f->_cnt); }
inline ptrdiff_t _FILE_I_avail (const FILE *__f) { return __f->_cnt; }
inline char& _FILE_I_preincr(FILE *__f)
{
--__f->_cnt;
return *__REINTERPRET_CAST(char*, ++__f->_ptr);
}
inline char& _FILE_I_postincr(FILE *__f)
{
--__f->_cnt;
return *__REINTERPRET_CAST(char*, __f->_ptr++);
}
inline char& _FILE_I_predecr(FILE *__f)
{
++__f->_cnt;
return *__REINTERPRET_CAST(char*, --__f->_ptr);
}
inline char& _FILE_I_postdecr(FILE *__f)
{
++__f->_cnt;
return *__REINTERPRET_CAST(char*, __f->_ptr--);
}
inline void _FILE_I_bump(FILE *__f, int __n)
{
__f->_ptr += __n;
__f->_cnt -= __n;
}
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end)
{
__f->_link = __REINTERPRET_CAST(__stream_link*, __begin);
__f->_ptr = __REINTERPRET_CAST(unsigned char*, __next);
__f->_cnt = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL
#elif defined (__Lynx__)
// the prototypes are taken from LynxOS patch for STLport 4.0
inline int _FILE_fd(const FILE *__f) { return __f->_fd; }
inline char* _FILE_I_begin(const FILE *__f) { return (char*) __f->_base; }
inline char* _FILE_I_next(const FILE *__f) { return (char*) __f->_ptr; }
inline char* _FILE_I_end(const FILE *__f)
{ return (char*) __f->_ptr + __f->_cnt; }
inline ptrdiff_t _FILE_I_avail(const FILE *__f) { return __f->_cnt; }
inline char& _FILE_I_preincr(FILE *__f)
{ --__f->_cnt; return *(char*) (++__f->_ptr); }
inline char& _FILE_I_postincr(FILE *__f)
{ --__f->_cnt; return *(char*) (__f->_ptr++); }
inline char& _FILE_I_predecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (--__f->_ptr); }
inline char& _FILE_I_postdecr(FILE *__f)
{ ++__f->_cnt; return *(char*) (__f->_ptr--); }
inline void _FILE_I_bump(FILE *__f, int __n)
{ __f->_ptr += __n; __f->_cnt -= __n; }
inline void _FILE_I_set(FILE *__f, char* __begin, char* __next, char* __end) {
__f->_base = __begin;
__f->_ptr = __next;
__f->_cnt = __end - __next;
}
# define _STLP_FILE_I_O_IDENTICAL
#else /* A C library that we don't have an implementation for. */
# error The C++ I/O library is not configured for this compiler
#endif
// For most stdio's , input and output FILE manipulation is identical.
# ifdef _STLP_FILE_I_O_IDENTICAL
inline char* _FILE_O_begin(const FILE *__f) { return _FILE_I_begin(__f); }
inline char* _FILE_O_next(const FILE *__f) { return _FILE_I_next(__f); }
inline char* _FILE_O_end(const FILE *__f) { return _FILE_I_end(__f); }
inline ptrdiff_t _FILE_O_avail(const FILE *__f) { return _FILE_I_avail(__f); }
inline char& _FILE_O_preincr(FILE *__f) { return _FILE_I_preincr(__f); }
inline char& _FILE_O_postincr(FILE *__f) { return _FILE_I_postincr(__f); }
inline char& _FILE_O_predecr(FILE *__f) { return _FILE_I_predecr(__f); }
inline char& _FILE_O_postdecr(FILE *__f) { return _FILE_I_postdecr(__f); }
inline void _FILE_O_bump(FILE *__f, int __n) { _FILE_I_bump(__f, __n); }
inline void _FILE_O_set(FILE *__f, char* __begin, char* __next, char* __end)
{ _FILE_I_set(__f, __begin, __next, __end); }
# endif
_STLP_END_NAMESPACE
#endif /* _STLP_STDIO_FILE_H */
// Local Variables:
// mode:C++
// End:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -