]>
Commit | Line | Data |
---|---|---|
45516216 | 1 | namespace std { |
2 | extern "C" { | |
3 | typedef struct { | |
4 | } | |
5 | pthread_mutexattr_t; | |
6 | } | |
7 | template<class _CharT> struct char_traits; | |
8 | template<typename _StateT> class fpos { | |
9 | }; | |
10 | template<typename _Iterator, typename _Container> class __normal_iterator { | |
11 | }; | |
12 | template<typename _Tp> inline const _Tp& min(const _Tp& __a, const _Tp& __b) { | |
13 | } | |
14 | } | |
15 | extern "C++" { | |
16 | namespace std { | |
17 | class exception { | |
18 | }; | |
19 | } | |
20 | } | |
21 | namespace __gnu_cxx { | |
22 | template<typename _Tp> class new_allocator { | |
23 | public: | |
24 | typedef _Tp& reference; | |
25 | template<typename _Tp1> struct rebind { | |
26 | typedef new_allocator<_Tp1> other; | |
27 | }; | |
28 | }; | |
29 | } | |
30 | namespace std { | |
31 | template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> { | |
32 | }; | |
33 | template<typename _Tp, typename _Alloc> struct _Vector_base { | |
34 | typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type; | |
35 | }; | |
36 | template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class vector : protected _Vector_base<_Tp, _Alloc> { | |
37 | typedef _Vector_base<_Tp, _Alloc> _Base; | |
38 | typedef typename _Base::_Tp_alloc_type _Tp_alloc_type; | |
39 | public: typedef _Tp value_type; | |
40 | typedef typename _Tp_alloc_type::reference reference; | |
41 | long unsigned int size() const { | |
42 | } | |
43 | reference operator[](long unsigned int __n) { | |
44 | } | |
45 | }; | |
46 | } | |
47 | namespace std { | |
48 | template<typename _CharT, typename _Traits, typename _Alloc> class basic_string { | |
49 | }; | |
50 | } | |
51 | namespace std { | |
52 | class locale { | |
53 | }; | |
54 | enum _Ios_Fmtflags { | |
55 | _S_boolalpha = 1L << 0, _S_dec = 1L << 1, _S_fixed = 1L << 2, _S_hex = 1L << 3, _S_internal = 1L << 4, _S_left = 1L << 5, _S_oct = 1L << 6, _S_right = 1L << 7, _S_scientific = 1L << 8, _S_showbase = 1L << 9, _S_showpoint = 1L << 10, _S_showpos = 1L << 11, _S_skipws = 1L << 12, _S_unitbuf = 1L << 13, _S_uppercase = 1L << 14, _S_adjustfield = _S_left | _S_right | _S_internal, _S_basefield = _S_dec | _S_oct | _S_hex, _S_floatfield = _S_scientific | _S_fixed, _S_ios_fmtflags_end = 1L << 16 }; | |
56 | enum _Ios_Openmode { | |
57 | _S_beg = 0, _S_cur = 1, _S_end = 2, _S_ios_seekdir_end = 1L << 16 }; | |
58 | class ios_base { | |
59 | public: class failure : public exception { | |
60 | }; | |
61 | typedef _Ios_Fmtflags fmtflags; | |
62 | static const fmtflags internal = _S_internal; | |
63 | inline fmtflags flags() const { | |
64 | } | |
65 | inline long int width() const { | |
66 | } | |
67 | }; | |
68 | template<typename _CharT, typename _Traits> class basic_streambuf { | |
69 | }; | |
70 | } | |
71 | extern "C++" { | |
72 | namespace __cxxabiv1 { | |
73 | class type_info { | |
74 | bool operator==(const type_info& __arg) const { | |
75 | } | |
76 | }; | |
77 | } | |
78 | } | |
79 | namespace boost { | |
80 | namespace io { | |
81 | namespace detail { | |
82 | typedef ::std:: locale locale_t; | |
83 | } | |
84 | } | |
85 | } | |
86 | namespace std { | |
87 | template<typename _CharT, typename _Traits> class basic_ios : public ios_base { | |
88 | }; | |
89 | template<typename _CharT, typename _Traits> class basic_ostream : virtual public basic_ios<_CharT, _Traits> { | |
90 | public: typedef _CharT char_type; | |
91 | typedef basic_streambuf<_CharT, _Traits> __streambuf_type; | |
92 | explicit basic_ostream(__streambuf_type* __sb) { | |
93 | } | |
94 | }; | |
95 | } | |
96 | namespace boost { | |
97 | namespace io { | |
98 | } | |
99 | template <class Ch, class Tr = ::std:: char_traits<Ch>, class Alloc = std::allocator<Ch> > class basic_format; | |
100 | typedef basic_format<char > format; | |
101 | namespace io { | |
102 | enum format_error_bits { | |
103 | bad_format_string_bit = 1, too_few_args_bit = 2, too_many_args_bit = 4, out_of_range_bit = 8, all_error_bits = 255, no_error_bits=0 }; | |
104 | namespace detail { | |
105 | template<class Ch, class Tr, class Alloc, class T> basic_format<Ch, Tr, Alloc>& feed (basic_format<Ch,Tr, Alloc>& self, T x); | |
106 | } | |
107 | } | |
108 | } | |
109 | namespace mpl_ { | |
110 | } | |
111 | namespace boost { | |
112 | namespace mpl { | |
113 | using namespace mpl_; | |
114 | } | |
115 | } | |
116 | namespace mpl_ { | |
117 | template< typename T, T N > struct integral_c { | |
118 | static const T value = N; | |
119 | }; | |
120 | } | |
121 | namespace boost{ | |
122 | template <class T, T val> struct integral_constant : public mpl::integral_c<T, val> { | |
123 | typedef integral_constant<bool,false> type; | |
124 | }; | |
125 | namespace detail { | |
126 | } | |
127 | } | |
128 | namespace mpl_ { | |
129 | struct na { | |
130 | }; | |
131 | } | |
132 | namespace boost { | |
133 | namespace mpl { | |
134 | template< bool C , typename T1 , typename T2 > struct if_c { | |
135 | typedef T2 type; | |
136 | }; | |
137 | template< typename T1 = na , typename T2 = na , typename T3 = na > struct if_ { | |
138 | private: typedef if_c< static_cast<bool>(T1::value) , T2 , T3 > almost_type_; | |
139 | public: typedef typename almost_type_::type type; | |
140 | }; | |
141 | } | |
142 | template< typename T > struct is_reference : ::boost::integral_constant<bool,false> { | |
143 | }; | |
144 | namespace detail { | |
145 | template <bool found, long unsigned int target, class TestType> struct lower_alignment_helper { | |
146 | }; | |
147 | } | |
148 | namespace optional_detail { | |
149 | template <class T> class aligned_storage { | |
150 | } | |
151 | ; | |
152 | template<class T> struct types_when_isnt_ref { | |
153 | typedef T * pointer_type ; | |
154 | } | |
155 | ; | |
156 | template<class T> struct types_when_is_ref { | |
157 | } | |
158 | ; | |
159 | struct optional_tag { | |
160 | } | |
161 | ; | |
162 | template<class T> class optional_base : public optional_tag { | |
163 | typedef types_when_isnt_ref<T> types_when_not_ref ; | |
164 | typedef types_when_is_ref<T> types_when_ref ; | |
165 | typedef typename is_reference<T>::type is_reference_predicate ; | |
166 | typedef typename mpl::if_<is_reference_predicate,types_when_ref,types_when_not_ref>::type types ; | |
167 | typedef typename types::pointer_type pointer_type ; | |
168 | } | |
169 | ; | |
170 | } | |
171 | template<class T> class optional : public optional_detail::optional_base<T> { | |
172 | typedef optional_detail::optional_base<T> base ; | |
173 | public : typedef optional<T> this_type ; | |
174 | typedef typename base::pointer_type pointer_type ; | |
175 | } | |
176 | ; | |
177 | template<class T> inline typename optional<T>::pointer_type get_pointer ( optional<T>& opt ) { | |
178 | } | |
179 | template < typename MemberType, int UniqueID = 0 > class base_from_member { | |
180 | protected: MemberType member; | |
181 | template < typename T0 , typename T1 > explicit base_from_member( T0 x0 , T1 x1 ) : member( x0 , x1 ) { | |
182 | } | |
183 | }; | |
184 | namespace detail { | |
185 | typedef int sp_int32_t; | |
186 | inline sp_int32_t atomic_decrement( sp_int32_t * pw ) { | |
187 | return __sync_fetch_and_add( pw, -1 ); | |
188 | for( ; | |
189 | ; | |
190 | ) { | |
191 | } | |
192 | } | |
193 | class sp_counted_base { | |
194 | sp_int32_t use_count_; | |
195 | sp_int32_t weak_count_; | |
196 | public: sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) { | |
197 | } | |
198 | void release() { | |
199 | if( atomic_decrement( &use_count_ ) == 1 ) { | |
200 | } | |
201 | } | |
202 | }; | |
203 | class shared_count { | |
204 | private: sp_counted_base * pi_; | |
205 | public: shared_count(): pi_(0) { | |
206 | } | |
207 | template<class P, class D> shared_count(P p, D d): pi_(0) { | |
208 | if( pi_ != 0 ) pi_->release(); | |
209 | } | |
210 | shared_count & operator= (shared_count const & r) { | |
211 | } | |
212 | }; | |
213 | } | |
214 | template<class T> class shared_ptr { | |
215 | public: typedef T element_type; | |
216 | template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d) { | |
217 | } | |
218 | T * px; | |
219 | boost::detail::shared_count pn; | |
220 | }; | |
221 | namespace io { | |
222 | template<class Ch, class Tr, class Alloc> class basic_altstringbuf : public ::std::basic_streambuf<Ch, Tr> { | |
223 | }; | |
224 | template <class Ch, class Tr, class Alloc> class basic_oaltstringstream : private base_from_member< shared_ptr< basic_altstringbuf< Ch, Tr, Alloc> > >, public ::std::basic_ostream<Ch, Tr> { | |
225 | class No_Op { | |
226 | }; | |
227 | typedef ::std::basic_ostream<Ch, Tr> stream_t; | |
228 | typedef boost::base_from_member<boost::shared_ptr< basic_altstringbuf<Ch,Tr, Alloc> > > pbase_type; | |
229 | typedef basic_altstringbuf<Ch, Tr, Alloc> stringbuf_t; | |
230 | public: typedef Alloc allocator_type; | |
231 | basic_oaltstringstream() : pbase_type(new stringbuf_t), stream_t(rdbuf()) { | |
232 | } | |
233 | basic_oaltstringstream(stringbuf_t * buf) : pbase_type(buf, No_Op() ), stream_t(rdbuf()) { | |
234 | } | |
235 | stringbuf_t * rdbuf() const { | |
236 | } | |
237 | }; | |
238 | namespace detail { | |
239 | template<class Ch, class Tr> struct stream_format_state { | |
240 | }; | |
241 | template<class Ch, class Tr, class Alloc> struct format_item { | |
242 | typedef ::std::basic_string<Ch, Tr, Alloc> string_type; | |
243 | static long int max_streamsize() { | |
244 | } | |
245 | int argN_; | |
246 | string_type res_; | |
247 | }; | |
248 | } | |
249 | } | |
250 | template<class Ch, class Tr, class Alloc> class basic_format { | |
251 | public: typedef Ch CharT; | |
252 | typedef std::basic_string<Ch, Tr, Alloc> string_type; | |
253 | typedef io::detail::format_item<Ch, Tr, Alloc> format_item_t; | |
254 | typedef io::basic_altstringbuf<Ch, Tr, Alloc> internal_streambuf_t; | |
255 | explicit basic_format(const Ch* str=__null); | |
256 | template<class T> basic_format& operator%(const T& x) { | |
257 | return io::detail::feed<CharT, Tr, Alloc, const T&>(*this,x); | |
258 | } | |
259 | std::vector<format_item_t> items_; | |
260 | int cur_arg_; | |
261 | internal_streambuf_t buf_; | |
262 | boost::optional<io::detail::locale_t> loc_; | |
263 | }; | |
264 | namespace io { | |
265 | class format_error : public std::exception { | |
266 | }; | |
267 | namespace detail { | |
268 | template< class Ch, class Tr, class Alloc, class T> void put( T x, const format_item<Ch, Tr, Alloc>& specs, typename basic_format<Ch, Tr, Alloc>::string_type& res, typename basic_format<Ch, Tr, Alloc>::internal_streambuf_t & buf, io::detail::locale_t *loc_p = __null) { | |
269 | basic_oaltstringstream<Ch, Tr, Alloc> oss( &buf); | |
270 | const std::ios_base::fmtflags fl=oss.flags(); | |
271 | const bool internal = (fl & std::ios_base::internal) != 0; | |
272 | const long int w = oss.width(); | |
273 | const bool two_stepped_padding= internal && (w!=0); | |
274 | if(! two_stepped_padding) { | |
275 | } | |
276 | } | |
277 | template< class Ch, class Tr, class Alloc, class T> void distribute (basic_format<Ch,Tr, Alloc>& self, T x) { | |
278 | for(unsigned long i=0; | |
279 | i < self.items_.size(); | |
280 | ++i) { | |
281 | if(self.items_[i].argN_ == self.cur_arg_) { | |
282 | put<Ch, Tr, Alloc, T> (x, self.items_[i], self.items_[i].res_, self.buf_, boost::get_pointer(self.loc_) ); | |
283 | } | |
284 | } | |
285 | } | |
286 | template<class Ch, class Tr, class Alloc, class T> basic_format<Ch, Tr, Alloc>& feed (basic_format<Ch,Tr, Alloc>& self, T x) { | |
287 | distribute<Ch, Tr, Alloc, T> (self, x); | |
288 | } | |
289 | } | |
290 | } | |
291 | } | |
292 | int main() { | |
293 | boost::format f("%d\n"); | |
294 | f %-123; | |
295 | } |