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