Root/
Source at commit 1083 created 13 years 1 month ago. By meklort, add GetDriveInfo | |
---|---|
1 | /*␉Copyright (C) 2004 Garrett A. Kajmowicz␊ |
2 | ␊ |
3 | ␉This file is part of the uClibc++ Library.␊ |
4 | ␊ |
5 | ␉This library is free software; you can redistribute it and/or␊ |
6 | ␉modify it under the terms of the GNU Lesser General Public␊ |
7 | ␉License as published by the Free Software Foundation; either␊ |
8 | ␉version 2.1 of the License, or (at your option) any later version.␊ |
9 | ␊ |
10 | ␉This library is distributed in the hope that it will be useful,␊ |
11 | ␉but WITHOUT ANY WARRANTY; without even the implied warranty of␊ |
12 | ␉MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU␊ |
13 | ␉Lesser General Public License for more details.␊ |
14 | ␊ |
15 | ␉You should have received a copy of the GNU Lesser General Public␊ |
16 | ␉License along with this library; if not, write to the Free Software␊ |
17 | ␉Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA␊ |
18 | */␊ |
19 | ␊ |
20 | #define __UCLIBCXX_COMPILE_IOS__ 1␊ |
21 | ␊ |
22 | #include <ios>␊ |
23 | #include <ostream>␊ |
24 | #include <istream>␊ |
25 | #include <cstdio>␊ |
26 | #include <fstream>␊ |
27 | ␊ |
28 | namespace std{␊ |
29 | ␊ |
30 | ␊ |
31 | #ifdef __UCLIBCXX_SUPPORT_CDIR__␊ |
32 | ␉_UCXXLOCAL int ios_base::Init::init_cnt = 0;␉//Needed to ensure the static value is created␊ |
33 | ␊ |
34 | //Create buffers first␊ |
35 | #if __UCLIBCXX_SUPPORT_COUT__␊ |
36 | ␉_UCXXEXPORT filebuf _cout_filebuf;␊ |
37 | #endif␊ |
38 | #if __UCLIBCXX_SUPPORT_CIN__␊ |
39 | ␉_UCXXEXPORT filebuf _cin_filebuf;␊ |
40 | #endif␊ |
41 | #if __UCLIBCXX_SUPPORT_CERR__␊ |
42 | ␉_UCXXEXPORT filebuf _cerr_filebuf;␊ |
43 | #endif␊ |
44 | #if __UCLIBCXX_SUPPORT_CLOG__␊ |
45 | ␉_UCXXEXPORT filebuf _clog_filebuf;␊ |
46 | #endif␊ |
47 | #ifdef __UCLIBCXX_SUPPORT_WCOUT__␊ |
48 | ␉_UCXXEXPORT wfilebuf _wcout_filebuf;␊ |
49 | #endif␊ |
50 | #ifdef __UCLIBCXX_SUPPORT_WCIN__␊ |
51 | ␉_UCXXEXPORT wfilebuf _wcin_filebuf;␊ |
52 | #endif␊ |
53 | #ifdef __UCLIBCXX_SUPPORT_WCERR__␊ |
54 | ␉_UCXXEXPORT wfilebuf _wcerr_filebuf;␊ |
55 | #endif␊ |
56 | #ifdef __UCLIBCXX_SUPPORT_WCLOG__␊ |
57 | ␉_UCXXEXPORT wfilebuf _wclog_filebuf;␊ |
58 | #endif␊ |
59 | ␊ |
60 | //Then create streams␊ |
61 | #if __UCLIBCXX_SUPPORT_COUT__␊ |
62 | ␉_UCXXEXPORT ostream cout(&_cout_filebuf);␊ |
63 | #endif␊ |
64 | #if __UCLIBCXX_SUPPORT_CIN__␊ |
65 | ␉_UCXXEXPORT istream cin(&_cin_filebuf);␊ |
66 | #endif␊ |
67 | #if __UCLIBCXX_SUPPORT_CERR__␊ |
68 | ␉_UCXXEXPORT ostream cerr(&_cerr_filebuf);␊ |
69 | #endif␊ |
70 | #if __UCLIBCXX_SUPPORT_CLOG__␊ |
71 | ␉_UCXXEXPORT ostream clog(&_clog_filebuf);␊ |
72 | #endif␊ |
73 | #ifdef __UCLIBCXX_SUPPORT_WCOUT__␊ |
74 | ␉_UCXXEXPORT wostream wcout(&_wcout_filebuf);␊ |
75 | #endif␊ |
76 | #ifdef __UCLIBCXX_SUPPORT_WCIN__␊ |
77 | ␉_UCXXEXPORT wistream wcin(&_wcin_filebuf);␊ |
78 | #endif␊ |
79 | #ifdef __UCLIBCXX_SUPPORT_WCERR__␊ |
80 | ␉_UCXXEXPORT wostream wcerr(&_wcerr_filebuf);␊ |
81 | #endif␊ |
82 | #ifdef __UCLIBCXX_SUPPORT_WCLOG__␊ |
83 | ␉_UCXXEXPORT wostream wclog(&_wclog_filebuf);␊ |
84 | #endif␊ |
85 | ␊ |
86 | ␊ |
87 | ␉_UCXXEXPORT ios_base::Init::Init(){␊ |
88 | ␉␉if(init_cnt == 0){␉//Need to construct cout et al␊ |
89 | #if __UCLIBCXX_SUPPORT_COUT__␊ |
90 | ␉␉␉_cout_filebuf.fp = stdout;␊ |
91 | ␉␉␉_cout_filebuf.openedFor = ios_base::out;␊ |
92 | #endif␊ |
93 | #if __UCLIBCXX_SUPPORT_CERR__␊ |
94 | ␉␉␉_cerr_filebuf.fp = stderr;␊ |
95 | ␉␉␉_cerr_filebuf.openedFor = ios_base::out;␊ |
96 | ␉␉␉cerr.mformat |= ios_base::unitbuf;␊ |
97 | #endif␊ |
98 | #if __UCLIBCXX_SUPPORT_CLOG__␊ |
99 | ␉␉␉_clog_filebuf.fp = stderr;␊ |
100 | ␉␉␉_clog_filebuf.openedFor = ios_base::out;␊ |
101 | #endif␊ |
102 | #if __UCLIBCXX_SUPPORT_CIN__␊ |
103 | ␉␉␉_cin_filebuf.fp = stdin;␊ |
104 | ␉␉␉_cin_filebuf.openedFor = ios_base::in;␊ |
105 | ␊ |
106 | #if __UCLIBCXX_SUPPORT_COUT__␊ |
107 | ␉␉␉cin.tie(&cout);␊ |
108 | #endif␊ |
109 | ␊ |
110 | #endif␊ |
111 | #ifdef __UCLIBCXX_SUPPORT_WCOUT__␊ |
112 | ␉␉␉_wcout_filebuf.fp = stdout;␊ |
113 | ␉␉␉_wcout_filebuf.openedFor = ios_base::out;␊ |
114 | #endif␊ |
115 | #ifdef __UCLIBCXX_SUPPORT_WCERR__␊ |
116 | ␉␉␉_wcerr_filebuf.fp = stderr;␊ |
117 | ␉␉␉_wcerr_filebuf.openedFor = ios_base::out;␊ |
118 | ␉␉␉wcerr.mformat |= ios_base::unitbuf;␊ |
119 | #endif␊ |
120 | #ifdef __UCLIBCXX_SUPPORT_WCLOG__␊ |
121 | ␉␉␉_wclog_filebuf.fp = stderr;␊ |
122 | ␉␉␉_wclog_filebuf.openedFor = ios_base::out;␊ |
123 | #endif␊ |
124 | #ifdef __UCLIBCXX_SUPPORT_WCIN__␊ |
125 | ␉␉␉_wcin_filebuf.fp = stdin;␊ |
126 | ␉␉␉_wcin_filebuf.openedFor = ios_base::in;␊ |
127 | ␊ |
128 | #ifdef __UCLIBCXX_SUPPORT_WCOUT__␊ |
129 | ␉␉␉wcin.tie(&wcout);␊ |
130 | #endif␊ |
131 | ␊ |
132 | #endif␊ |
133 | ␉␉}␊ |
134 | ␉␉init_cnt++;␊ |
135 | ␉}␊ |
136 | ␊ |
137 | ␉_UCXXEXPORT ios_base::Init::~Init(){␊ |
138 | ␉␉--init_cnt;␊ |
139 | ␉␉if(init_cnt==0){␊ |
140 | ␊ |
141 | ␉␉}␊ |
142 | ␉}␊ |
143 | #endif␊ |
144 | ␊ |
145 | ␊ |
146 | #ifdef __UCLIBCXX_EXPAND_IOS_CHAR__␊ |
147 | ␊ |
148 | ␉template _UCXXEXPORT void basic_ios<char, char_traits<char> >::clear(iostate state);␊ |
149 | ␉template _UCXXEXPORT void basic_ios<char, char_traits<char> >::setstate(iostate state);␊ |
150 | ␊ |
151 | #endif␊ |
152 | ␊ |
153 | ␊ |
154 | ␉_UCXXEXPORT ios_base::fmtflags ios_base::flags(fmtflags fmtfl){␊ |
155 | ␉␉fmtflags temp = mformat;␊ |
156 | ␉␉mformat = fmtfl;␊ |
157 | ␉␉return temp;␊ |
158 | ␉}␊ |
159 | ␊ |
160 | ␉_UCXXEXPORT ios_base::fmtflags ios_base::setf(fmtflags fmtfl){␊ |
161 | ␉␉return flags(flags() | fmtfl);␊ |
162 | ␉}␊ |
163 | ␊ |
164 | ␉_UCXXEXPORT ios_base::fmtflags ios_base::setf(fmtflags fmtfl, fmtflags mask ){␊ |
165 | ␉␉return flags( (flags()& ~mask) | (fmtfl & mask));␊ |
166 | ␉}␊ |
167 | ␊ |
168 | ␉_UCXXEXPORT streamsize ios_base::precision(streamsize prec){␊ |
169 | ␉␉streamsize temp = mprecision;␊ |
170 | ␉␉mprecision = prec;␊ |
171 | ␉␉return temp;␊ |
172 | ␉}␊ |
173 | ␊ |
174 | ␉_UCXXEXPORT streamsize ios_base::width(streamsize wide){␊ |
175 | ␉␉streamsize temp = mwidth;␊ |
176 | ␉␉mwidth = wide;␊ |
177 | ␉␉return temp;␊ |
178 | ␉}␊ |
179 | ␊ |
180 | ␉_UCXXEXPORT locale ios_base::imbue(const locale& loc){␊ |
181 | ␉␉locale retval = mLocale;␊ |
182 | ␉␉mLocale = loc;␊ |
183 | ␉␉return retval;␊ |
184 | ␉}␉␊ |
185 | ␊ |
186 | }␊ |
187 | ␊ |
188 | ␊ |
189 | ␊ |
190 |