📄 uclibc_stdio.h
字号:
#endif /* __STDIO_GETC_MACRO */#ifdef __STDIO_PUTC_MACRO unsigned char *__bufputc_u; /* 1 past last writeable by putc_unlocked */#endif /* __STDIO_PUTC_MACRO */#endif /* __STDIO_BUFFERS */#ifdef __STDIO_HAS_OPENLIST struct __STDIO_FILE_STRUCT *__nextopen;#endif#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ void *__cookie; _IO_cookie_io_functions_t __gcs;#endif#ifdef __UCLIBC_HAS_WCHAR__ wchar_t __ungot[2];#endif#ifdef __STDIO_MBSTATE __mbstate_t __state;#endif#ifdef __UCLIBC_HAS_XLOCALE__ void *__unused; /* Placeholder for codeset binding. */#endif#ifdef __UCLIBC_HAS_THREADS__ int __user_locking; pthread_mutex_t __lock;#endif/* Everything after this is unimplemented... and may be trashed. */#if __STDIO_BUILTIN_BUF_SIZE > 0 unsigned char __builtinbuf[__STDIO_BUILTIN_BUF_SIZE];#endif /* __STDIO_BUILTIN_BUF_SIZE > 0 */};/***********************************************************************//* Having ungotten characters implies the stream is reading. * The scheme used here treats the least significant 2 bits of * the stream's modeflags member as follows: * 0 0 Not currently reading. * 0 1 Reading, but no ungetc() or scanf() push back chars. * 1 0 Reading with one ungetc() char (ungot[1] is 1) * or one scanf() pushed back char (ungot[1] is 0). * 1 1 Reading with both an ungetc() char and a scanf() * pushed back char. Note that this must be the result * of a scanf() push back (in ungot[0]) _followed_ by * an ungetc() call (in ungot[1]). * * Notes: * scanf() can NOT use ungetc() to push back characters. * (See section 7.19.6.2 of the C9X rationale -- WG14/N897.) */#define __MASK_READING 0x0003U /* (0x0001 | 0x0002) */#define __FLAG_READING 0x0001U#define __FLAG_UNGOT 0x0002U#define __FLAG_EOF 0x0004U#define __FLAG_ERROR 0x0008U#define __FLAG_WRITEONLY 0x0010U#define __FLAG_READONLY 0x0020U /* (__FLAG_WRITEONLY << 1) */#define __FLAG_WRITING 0x0040U#define __FLAG_NARROW 0x0080U#define __FLAG_FBF 0x0000U /* must be 0 */#define __FLAG_LBF 0x0100U#define __FLAG_NBF 0x0200U /* (__FLAG_LBF << 1) */#define __MASK_BUFMODE 0x0300U /* (__FLAG_LBF|__FLAG_NBF) */#define __FLAG_APPEND 0x0400U /* fixed! == O_APPEND for linux */#define __FLAG_WIDE 0x0800U/* available slot 0x1000U */#define __FLAG_FREEFILE 0x2000U#define __FLAG_FREEBUF 0x4000U#define __FLAG_LARGEFILE 0x8000U /* fixed! == 0_LARGEFILE for linux *//* Note: In no-buffer mode, it would be possible to pack the necessary * flags into one byte. Since we wouldn't be buffering and there would * be no support for wchar, the only flags we would need would be: * 2 bits : ungot count * 2 bits : eof + error * 2 bits : readonly + writeonly * 1 bit : freefile * 1 bit : appending * So, for a very small system (< 128 files) we might have a * 4-byte FILE struct of: * unsigned char flags; * signed char filedes; * unsigned char ungot[2]; *//********************************************************************** * PROTOTYPES OF INTERNAL FUNCTIONS **********************************************************************/#ifdef _LIBCextern void _stdio_init(void);extern void _stdio_term(void);#ifdef __STDIO_HAS_OPENLISTextern struct __STDIO_FILE_STRUCT *_stdio_openlist;#ifdef __UCLIBC_HAS_THREADS__extern pthread_mutex_t _stdio_openlist_lock;extern int _stdio_openlist_delflag;extern int _stdio_user_locking;extern void __stdio_init_mutex(pthread_mutex_t *m);#endif#endif#endif/**********************************************************************/#define __CLEARERR_UNLOCKED(__stream) \ ((void)((__stream)->__modeflags &= ~(__FLAG_EOF|__FLAG_ERROR)))#define __FEOF_UNLOCKED(__stream) ((__stream)->__modeflags & __FLAG_EOF)#define __FERROR_UNLOCKED(__stream) ((__stream)->__modeflags & __FLAG_ERROR)#ifdef __UCLIBC_HAS_THREADS__# define __CLEARERR(__stream) (clearerr)(__stream)# define __FERROR(__stream) (ferror)(__stream)# define __FEOF(__stream) (feof)(__stream)#else# define __CLEARERR(__stream) __CLEARERR_UNLOCKED(__stream)# define __FERROR(__stream) __FERROR_UNLOCKED(__stream)# define __FEOF(__stream) __FEOF_UNLOCKED(__stream)#endifextern int __fgetc_unlocked(FILE *__stream);extern int __fputc_unlocked(int __c, FILE *__stream);/* First define the default definitions. They overriden below as necessary. */#define __FGETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream))#define __FGETC(__stream) (fgetc)((__stream))#define __GETC_UNLOCKED_MACRO(__stream) (__fgetc_unlocked)((__stream))#define __GETC_UNLOCKED(__stream) (__fgetc_unlocked)((__stream))#define __GETC(__stream) (fgetc)((__stream))#define __FPUTC_UNLOCKED(__c, __stream) (__fputc_unlocked)((__c),(__stream))#define __FPUTC(__c, __stream) (fputc)((__c),(__stream))#define __PUTC_UNLOCKED_MACRO(__c, __stream) (__fputc_unlocked)((__c),(__stream))#define __PUTC_UNLOCKED(__c, __stream) (__fputc_unlocked)((__c),(__stream))#define __PUTC(__c, __stream) (fputc)((__c),(__stream))#ifdef __STDIO_GETC_MACROextern FILE *__stdin; /* For getchar() macro. */# undef __GETC_UNLOCKED_MACRO# define __GETC_UNLOCKED_MACRO(__stream) \ ( ((__stream)->__bufpos < (__stream)->__bufgetc_u) \ ? (*(__stream)->__bufpos++) \ : __fgetc_unlocked(__stream) )# if 0 /* Classic macro approach. getc{_unlocked} can have side effects. */# undef __GETC_UNLOCKED# define __GETC_UNLOCKED(__stream) __GETC_UNLOCKED_MACRO((__stream))# ifndef __UCLIBC_HAS_THREADS__# undef __GETC# define __GETC(__stream) __GETC_UNLOCKED_MACRO((__stream))# endif# else /* Using gcc extension for safety and additional inlining. */# undef __FGETC_UNLOCKED# define __FGETC_UNLOCKED(__stream) \ (__extension__ ({ \ FILE *__S = (__stream); \ __GETC_UNLOCKED_MACRO(__S); \ }) )# undef __GETC_UNLOCKED# define __GETC_UNLOCKED(__stream) __FGETC_UNLOCKED((__stream))# ifdef __UCLIBC_HAS_THREADS__# undef __FGETC# define __FGETC(__stream) \ (__extension__ ({ \ FILE *__S = (__stream); \ ((__S->__user_locking ) \ ? __GETC_UNLOCKED_MACRO(__S) \ : (fgetc)(__S)); \ }) )# undef __GETC# define __GETC(__stream) __FGETC((__stream))# else # undef __FGETC# define __FGETC(__stream) __FGETC_UNLOCKED((__stream))# undef __GETC# define __GETC(__stream) __FGETC_UNLOCKED((__stream))# endif# endif#else#endif /* __STDIO_GETC_MACRO */#ifdef __STDIO_PUTC_MACROextern FILE *__stdout; /* For putchar() macro. */# undef __PUTC_UNLOCKED_MACRO# define __PUTC_UNLOCKED_MACRO(__c, __stream) \ ( ((__stream)->__bufpos < (__stream)->__bufputc_u) \ ? (*(__stream)->__bufpos++) = (__c) \ : __fputc_unlocked((__c),(__stream)) )# if 0 /* Classic macro approach. putc{_unlocked} can have side effects.*/# undef __PUTC_UNLOCKED# define __PUTC_UNLOCKED(__c, __stream) \ __PUTC_UNLOCKED_MACRO((__c), (__stream))# ifndef __UCLIBC_HAS_THREADS__# undef __PUTC# define __PUTC(__c, __stream) __PUTC_UNLOCKED_MACRO((__c), (__stream))# endif# else /* Using gcc extension for safety and additional inlining. */# undef __FPUTC_UNLOCKED# define __FPUTC_UNLOCKED(__c, __stream) \ (__extension__ ({ \ FILE *__S = (__stream); \ __PUTC_UNLOCKED_MACRO((__c),__S); \ }) )# undef __PUTC_UNLOCKED# define __PUTC_UNLOCKED(__c, __stream) __FPUTC_UNLOCKED((__c), (__stream))# ifdef __UCLIBC_HAS_THREADS__# undef __FPUTC# define __FPUTC(__c, __stream) \ (__extension__ ({ \ FILE *__S = (__stream); \ ((__S->__user_locking) \ ? __PUTC_UNLOCKED_MACRO((__c),__S) \ : (fputc)((__c),__S)); \ }) )# undef __PUTC# define __PUTC(__c, __stream) __FPUTC((__c), (__stream))# else# undef __FPUTC# define __FPUTC(__c, __stream) __FPUTC_UNLOCKED((__c),(__stream))# undef __PUTC# define __PUTC(__c, __stream) __FPUTC_UNLOCKED((__c),(__stream))# endif# endif#endif /* __STDIO_PUTC_MACRO */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -