📄 stdstrbufs.cpp
字号:
/* This has been copied from the gnu source tree *//* Make all changes there, not here! */#ifdef __cplusplusextern "C" {#endif#ifndef _N_char __stdstrbufs_o = 0;#elsechar _N_ = 0;#endif#ifdef __cplusplus}#endif#include "vxWorks.h"/*Copyright (C) 1994 Free Software FoundationThis file is part of the GNU IO Library. This library is freesoftware; you can redistribute it and/or modify it under theterms of the GNU General Public License as published by theFree Software Foundation; either version 2, or (at your option)any later version.This library is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this library; see the file COPYING. If not, write to the FreeSoftware Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.As a special exception, if you link this library with filescompiled with a GNU compiler to produce an executable, this does not causethe resulting executable to be covered by the GNU General Public License.This exception does not however invalidate any other reasons whythe executable file might be covered by the GNU General Public License. *//* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr for C++ code. Compare stdfiles.c. (The difference is that here the vtable field is set to point to builtinbuf's vtable, so the objects are effectively of class builtinbuf.) */#include "libioP.h"#include <stdio.h>#if !defined(filebuf_vtable) && defined(__cplusplus)#ifdef __GNUC__extern char filebuf_vtable[] asm (_G_VTABLE_LABEL_PREFIX#if _G_VTABLE_LABEL_HAS_LENGTH "7"#endif "filebuf");#else /* !__GNUC__ */#if _G_VTABLE_LABEL_HAS_LENGTH#define filebuf_vtable _G_VTABLE_LABEL_PREFIX_ID##7filebuf#else#define filebuf_vtable _G_VTABLE_LABEL_PREFIX_ID##filebuf#endifextern char filebuf_vtable[];#endif /* !__GNUC__ */#endif /* !defined(filebuf_vtable) && defined(__cplusplus) */#ifndef STD_VTABLE#define STD_VTABLE (const struct _IO_jump_t *)filebuf_vtable#endif#ifdef _IO_MTSAFE_IO#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \ static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \ struct _IO_FILE_plus NAME \ = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), STD_VTABLE}#else#define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \ struct _IO_FILE_plus NAME = {FILEBUF_LITERAL(CHAIN, FLAGS, FD), STD_VTABLE}#endifDEF_STDFILE(_IO_stdin_, 0, 0, _IO_NO_WRITES);DEF_STDFILE(_IO_stdout_, 1, &_IO_stdin_.file, _IO_NO_READS);DEF_STDFILE(_IO_stderr_, 2, &_IO_stdout_.file, _IO_NO_READS+_IO_UNBUFFERED);/* Begin VxWorks specific *//* We define this because we want the standard streams to use streambufs * (that write to file descriptors which are valid across all threads) rather * than stdiobufs */#define _STDIO_USES_IOSTREAM/* End VxWorks specific */#ifdef _STDIO_USES_IOSTREAM_IO_FILE *_IO_list_all = &_IO_stderr_.file;#else /* !_STDIO_USES_IOSTREAM */#include "stdiostream.h"struct _IO_fake_stdiobuf { struct { _IO_FILE file; const void *vtable; } s; FILE *stdio_file;};/* Define stdiobuf_vtable as a name for the virtual function table of the stdiobuf class. */#ifndef stdiobuf_vtable#ifdef __GNUC__extern struct _IO_jump_t stdiobuf_vtable asm (_G_VTABLE_LABEL_PREFIX#if _G_VTABLE_LABEL_HAS_LENGTH "8"#endif "stdiobuf");#else /* !__GNUC__ */#if _G_VTABLE_LABEL_HAS_LENGTH#define stdiobuf_vtable _G_VTABLE_LABEL_PREFIX_ID##8stdiobuf#else#define stdiobuf_vtable _G_VTABLE_LABEL_PREFIX_ID##stdiobuf#endifextern struct _IO_jump_t stdiobuf_vtable;#endif /* !__GNUC__ */#endif /* !stdiobuf_vtable */#ifdef _IO_MTSAFE_IO#define DEF_STDIOFILE(NAME, FD, FILE, FLAGS, CHAIN) \ struct _IO_fake_stdiobuf NAME = \ {{{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+_IO_UNBUFFERED+FLAGS, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD, \ 0, 0, 0, 0, { 0 }, &_IO_stdfile_##FD##_lock},\ &stdiobuf_vtable}, FILE}#else#define DEF_STDIOFILE(NAME, FD, FILE, FLAGS, CHAIN) \ struct _IO_fake_stdiobuf NAME = \ {{{ _IO_MAGIC+_IO_LINKED+_IO_IS_FILEBUF+_IO_UNBUFFERED+FLAGS, \ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, CHAIN, FD}, \ &stdiobuf_vtable}, FILE}#endifDEF_STDIOFILE(_IO_stdin_buf, 0, stdin, _IO_NO_WRITES, &_IO_stderr_.file);DEF_STDIOFILE(_IO_stdout_buf, 1, stdout, _IO_NO_READS, &_IO_stdin_buf.s.file);DEF_STDIOFILE(_IO_stderr_buf, 2, stderr, _IO_NO_READS, &_IO_stdout_buf.s.file);_IO_FILE *_IO_list_all = &_IO_stderr_buf.s.file;#endif /* !_STDIO_USES_IOSTREAM */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -