1 | /* Copyright (C) 1993, 1994, 1996, 1997, 1999, 2000 Free Software Foundation, Inc.
|
---|
2 | This file is part of the GNU IO Library.
|
---|
3 |
|
---|
4 | This library is free software; you can redistribute it and/or
|
---|
5 | modify it under the terms of the GNU General Public License as
|
---|
6 | published by the Free Software Foundation; either version 2, or (at
|
---|
7 | your option) any later version.
|
---|
8 |
|
---|
9 | This library is distributed in the hope that it will be useful, but
|
---|
10 | WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
12 | General Public License for more details.
|
---|
13 |
|
---|
14 | You should have received a copy of the GNU General Public License
|
---|
15 | along with this library; see the file COPYING. If not, write to
|
---|
16 | the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
|
---|
17 | MA 02111-1307, USA.
|
---|
18 |
|
---|
19 | As a special exception, if you link this library with files
|
---|
20 | compiled with a GNU compiler to produce an executable, this does
|
---|
21 | not cause the resulting executable to be covered by the GNU General
|
---|
22 | Public License. This exception does not however invalidate any
|
---|
23 | other reasons why the executable file might be covered by the GNU
|
---|
24 | General Public License. */
|
---|
25 |
|
---|
26 |
|
---|
27 | /* This file provides definitions of _IO_stdin, _IO_stdout, and _IO_stderr
|
---|
28 | for C code. Compare stdstreams.cc.
|
---|
29 | (The difference is that here the vtable field is set to 0,
|
---|
30 | so the objects defined are not valid C++ objects. On the other
|
---|
31 | hand, we don't need a C++ compiler to build this file.) */
|
---|
32 |
|
---|
33 | #include "libioP.h"
|
---|
34 |
|
---|
35 | #ifdef _IO_MTSAFE_IO
|
---|
36 | # if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
---|
37 | # define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
---|
38 | static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
---|
39 | static struct _IO_wide_data _IO_wide_data_##FD \
|
---|
40 | = { ._wide_vtable = &_IO_wfile_jumps }; \
|
---|
41 | struct _IO_FILE_plus NAME \
|
---|
42 | = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
|
---|
43 | &_IO_file_jumps};
|
---|
44 | # else
|
---|
45 | # define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
---|
46 | static _IO_lock_t _IO_stdfile_##FD##_lock = _IO_lock_initializer; \
|
---|
47 | struct _IO_FILE_plus NAME \
|
---|
48 | = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
|
---|
49 | &_IO_file_jumps};
|
---|
50 | # endif
|
---|
51 | #else
|
---|
52 | # if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
|
---|
53 | # define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
---|
54 | static struct _IO_wide_data _IO_wide_data_##FD \
|
---|
55 | = { ._wide_vtable = &_IO_wfile_jumps }; \
|
---|
56 | struct _IO_FILE_plus NAME \
|
---|
57 | = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, &_IO_wide_data_##FD), \
|
---|
58 | &_IO_file_jumps};
|
---|
59 | # else
|
---|
60 | # define DEF_STDFILE(NAME, FD, CHAIN, FLAGS) \
|
---|
61 | struct _IO_FILE_plus NAME \
|
---|
62 | = {FILEBUF_LITERAL(CHAIN, FLAGS, FD, NULL), \
|
---|
63 | &_IO_file_jumps};
|
---|
64 | # endif
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | DEF_STDFILE(_IO_2_1_stdin_, 0, 0, _IO_NO_WRITES);
|
---|
68 | DEF_STDFILE(_IO_2_1_stdout_, 1, &_IO_2_1_stdin_, _IO_NO_READS);
|
---|
69 | DEF_STDFILE(_IO_2_1_stderr_, 2, &_IO_2_1_stdout_, _IO_NO_READS+_IO_UNBUFFERED);
|
---|
70 |
|
---|
71 | struct _IO_FILE_plus *_IO_list_all = &_IO_2_1_stderr_;
|
---|