]>
Commit | Line | Data |
---|---|---|
bd3239d2 MF |
1 | typedef long unsigned int size_t; |
2 | namespace std { | |
3 | template<typename _Tp> _Tp* __addressof(_Tp& __r) { | |
4 | } | |
5 | template<class _Sp, class _Tp> struct __traitor { | |
6 | }; | |
7 | template<typename _Tp> struct __is_integer { | |
8 | }; | |
9 | template<typename _Tp> struct __is_floating { | |
10 | }; | |
11 | template<typename _Tp> struct __is_pointer { | |
12 | }; | |
13 | template<typename _Tp> struct __is_normal_iterator { | |
14 | }; | |
15 | template<typename _Tp> struct __is_arithmetic : public __traitor<__is_integer<_Tp>, __is_floating<_Tp> > { | |
16 | }; | |
17 | template<typename _Tp> struct __is_scalar : public __traitor<__is_arithmetic<_Tp>, __is_pointer<_Tp> > { | |
18 | }; | |
19 | template<typename _Iterator, bool _HasBase> struct _Iter_base { }; | |
20 | ||
21 | template<typename _Iterator> struct _Niter_base : _Iter_base<_Iterator, __is_normal_iterator<_Iterator>::__value> { }; | |
22 | template<typename _Iterator> typename _Niter_base<_Iterator>::iterator_type __niter_base(_Iterator __it) { } | |
23 | template<typename _CharT> struct char_traits; | |
24 | class exception { | |
25 | public: exception() throw() { } | |
26 | virtual ~exception() throw(); | |
27 | }; | |
28 | ||
29 | ||
30 | } | |
31 | namespace __gnu_cxx { | |
32 | template<bool, typename> struct __enable_if { }; | |
33 | template<typename _Iterator, typename _Container> class __normal_iterator { | |
34 | protected: _Iterator _M_current; | |
35 | public: typedef _Iterator iterator_type; | |
36 | __normal_iterator() : _M_current(_Iterator()) { | |
37 | } | |
38 | }; | |
39 | template<typename _Tp> class new_allocator { | |
40 | public: | |
41 | typedef const _Tp* const_pointer; | |
42 | typedef _Tp& reference; | |
43 | }; | |
44 | } | |
45 | namespace std { | |
46 | ||
47 | template<typename _Tp> class allocator: public __gnu_cxx::new_allocator<_Tp> { | |
48 | public: | |
49 | template<typename _Tp1> struct rebind { | |
50 | typedef allocator<_Tp1> other; | |
51 | }; | |
52 | }; | |
53 | template<typename _InputIterator, typename _ForwardIterator, typename _Allocator> _ForwardIterator __uninitialized_copy_a(_InputIterator __first, _InputIterator __last, _ForwardIterator __result, _Allocator& __alloc) { | |
54 | try { | |
55 | } | |
56 | catch(...) { | |
57 | } | |
58 | } | |
59 | ||
60 | } | |
61 | namespace boost { | |
62 | template<class T> class scoped_ptr { | |
63 | private: T * px; | |
64 | public: typedef T element_type; | |
65 | explicit scoped_ptr( T * p = 0 ): px( p ) { | |
66 | } | |
67 | }; | |
68 | } | |
69 | namespace std { | |
70 | template<typename _CharT, typename _Traits = char_traits<_CharT>, typename _Alloc = allocator<_CharT> > class basic_string; | |
71 | typedef basic_string<char> string; | |
72 | template<> struct char_traits<char> { | |
73 | typedef char char_type; | |
74 | static void assign(char_type& __c1, const char_type& __c2) { | |
75 | } | |
76 | } | |
77 | __pthread_unwind_buf_t ; | |
78 | } | |
79 | typedef int _Atomic_word; | |
80 | namespace __gnu_cxx { | |
81 | static _Atomic_word __exchange_and_add_dispatch(_Atomic_word* __mem, int __val) { | |
82 | } | |
83 | } | |
84 | namespace std { | |
85 | template<typename _CharT, typename _Traits, typename _Alloc> class basic_string { | |
86 | typedef typename _Alloc::template rebind<_CharT>::other _CharT_alloc_type; | |
87 | public: typedef _Traits traits_type; | |
88 | typedef _Alloc allocator_type; | |
89 | typedef typename _CharT_alloc_type::reference reference; | |
90 | typedef typename _CharT_alloc_type::const_pointer const_pointer; | |
91 | typedef __gnu_cxx::__normal_iterator<const_pointer, basic_string> const_iterator; | |
92 | private: struct _Rep_base { | |
93 | _Atomic_word _M_refcount; | |
94 | }; | |
95 | struct _Rep : _Rep_base { | |
96 | void _M_set_length_and_sharable(size_t __n) { | |
97 | } | |
98 | _CharT* _M_refdata() throw() { | |
99 | return reinterpret_cast<_CharT*>(this + 1); | |
100 | } | |
101 | void _M_dispose(const _Alloc& __a) { | |
102 | if (__builtin_expect(this != &_S_empty_rep(), false)) { | |
103 | if (__gnu_cxx::__exchange_and_add_dispatch(&this->_M_refcount, -1) <= 0) { | |
104 | _M_destroy(__a); | |
105 | } | |
106 | } | |
107 | } | |
108 | void _M_destroy(const _Alloc&) throw(); | |
109 | }; | |
110 | struct _Alloc_hider : _Alloc { | |
111 | _Alloc_hider(_CharT* __dat, const _Alloc& __a) : _Alloc(__a), _M_p(__dat) { | |
112 | } | |
113 | _CharT* _M_p; | |
114 | }; | |
115 | public: static const size_t npos = static_cast<size_t>(-1); | |
116 | private: mutable _Alloc_hider _M_dataplus; | |
117 | _Rep* _M_rep() const { | |
118 | } | |
119 | size_t _M_limit(size_t __pos, size_t __off) const { | |
120 | } | |
121 | static _Rep& _S_empty_rep() { | |
122 | } | |
123 | public: basic_string() : _M_dataplus(_S_empty_rep()._M_refdata(), _Alloc()) { | |
124 | } | |
125 | ~basic_string() { | |
126 | _M_rep()->_M_dispose(this->get_allocator()); | |
127 | } | |
128 | size_t length() const { | |
129 | } | |
130 | reference operator[](size_t __pos) { | |
131 | } | |
132 | basic_string& erase(size_t __pos = 0, size_t __n = npos) { | |
133 | } | |
134 | allocator_type get_allocator() const { | |
135 | } | |
136 | }; | |
137 | } | |
138 | namespace boost { | |
139 | namespace detail { | |
140 | template <typename T> class empty_base { | |
141 | }; | |
142 | } | |
143 | template <class T, class U, class B = ::boost::detail::empty_base<T> > struct less_than_comparable2 : B { | |
144 | }; | |
145 | template <class T, class U, class B = ::boost::detail::empty_base<T> > struct equality_comparable2 : B { | |
146 | }; | |
147 | namespace detail { | |
148 | struct false_t { | |
149 | }; | |
150 | } | |
151 | template<class T> struct is_chained_base { | |
152 | typedef ::boost::detail::false_t value; | |
153 | }; | |
154 | template <class T ,class U = T ,class B = ::boost::detail::empty_base<T> ,class O = typename is_chained_base<U>::value > struct less_than_comparable : less_than_comparable2<T, U, B> { | |
155 | }; | |
156 | template <class T ,class U = T ,class B = ::boost::detail::empty_base<T> ,class O = typename is_chained_base<U>::value > struct equality_comparable : equality_comparable2<T, U, B> { | |
157 | }; | |
158 | namespace type_traits { | |
159 | } | |
160 | template<class T> class intrusive_ptr { | |
161 | private: typedef intrusive_ptr this_type; | |
162 | public: typedef T element_type; | |
163 | intrusive_ptr(): px( 0 ) { | |
164 | } | |
165 | intrusive_ptr( T * p, bool add_ref = true ): px( p ) { | |
166 | } | |
167 | ~intrusive_ptr() { | |
168 | if( px != 0 ) intrusive_ptr_release( px ); | |
169 | } | |
170 | T * operator->() const { | |
171 | return px; | |
172 | } | |
173 | typedef T * this_type::*unspecified_bool_type; | |
174 | operator unspecified_bool_type() const { | |
175 | } | |
176 | private: T * px; | |
177 | }; | |
178 | } | |
179 | namespace quickbook { | |
180 | struct section_info; | |
181 | struct string_ref : boost::less_than_comparable<string_ref, boost::less_than_comparable<string_ref, std::string, boost::equality_comparable<string_ref, boost::equality_comparable<string_ref, std::string> > > > { | |
182 | public: typedef std::string::const_iterator iterator; | |
183 | private: iterator begin_, end_; | |
184 | public: string_ref() : begin_(), end_() { | |
185 | } | |
186 | }; | |
187 | namespace exception_detail { | |
188 | } | |
189 | } | |
190 | namespace std { | |
191 | class bad_cast : public exception { }; | |
192 | } | |
193 | namespace quickbook { | |
194 | template <typename T> struct intrusive_base { | |
195 | intrusive_base() : ref_count_(0) { | |
196 | } | |
197 | ~intrusive_base() { | |
198 | } | |
199 | friend void intrusive_ptr_release(T* ptr) { | |
200 | if(--ptr->ref_count_ == 0) delete ptr; | |
201 | } | |
202 | private: unsigned ref_count_; | |
203 | }; | |
204 | struct id_category { | |
205 | enum categories { | |
206 | default_category = 0, numbered, generated, generated_heading, generated_section, generated_doc, explicit_id, explicit_section_id, explicit_anchor_id }; | |
207 | categories c; | |
208 | }; | |
209 | struct id_state; | |
210 | struct id_manager { | |
211 | id_manager(); | |
212 | private: boost::scoped_ptr<id_state> state; | |
213 | }; | |
214 | } | |
215 | namespace boost{ | |
216 | namespace detail { | |
217 | } | |
218 | } | |
219 | namespace std { | |
220 | template<typename _Tp, typename _Ref, typename _Ptr> struct _Deque_iterator { | |
221 | }; | |
222 | template<typename _Tp, typename _Alloc> class _Deque_base { | |
223 | public: typedef _Alloc allocator_type; | |
224 | typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; | |
225 | _Deque_base() : _M_impl() { | |
226 | _M_initialize_map(0); | |
227 | } | |
228 | typedef typename _Alloc::template rebind<_Tp>::other _Tp_alloc_type; | |
229 | struct _Deque_impl : public _Tp_alloc_type { | |
230 | _Tp** _M_map; | |
231 | size_t _M_map_size; | |
232 | iterator _M_start; | |
233 | iterator _M_finish; | |
234 | _Deque_impl() : _Tp_alloc_type(), _M_map(0), _M_map_size(0), _M_start(), _M_finish() { | |
235 | } | |
236 | }; | |
237 | protected: void _M_initialize_map(size_t); | |
238 | _Deque_impl _M_impl; | |
239 | }; | |
240 | template<typename _Tp, typename _Alloc = std::allocator<_Tp> > class deque : protected _Deque_base<_Tp, _Alloc> { | |
241 | }; | |
242 | namespace numeric { | |
243 | enum range_check_result { | |
244 | cInRange = 0 , cNegOverflow = 1 , cPosOverflow = 2 } | |
245 | ; | |
246 | class bad_numeric_cast : public std::bad_cast { | |
247 | }; | |
248 | class negative_overflow : public bad_numeric_cast { | |
249 | void operator() ( range_check_result r ) { | |
250 | if ( r == cNegOverflow ) throw negative_overflow() ; | |
251 | } | |
252 | } | |
253 | ; | |
254 | } | |
255 | } | |
256 | namespace quickbook { | |
257 | static const size_t max_size = 32; | |
258 | struct id_placeholder { | |
259 | }; | |
260 | struct file_info; | |
261 | struct doc_info; | |
262 | struct id_state { | |
263 | boost::intrusive_ptr<file_info> current_file; | |
264 | std::deque<id_placeholder> placeholders; | |
265 | private: id_placeholder* add_id_to_section( std::string const& id, id_category category, boost::intrusive_ptr<section_info> const& section); | |
266 | }; | |
267 | struct file_info : intrusive_base<file_info> { | |
268 | boost::intrusive_ptr<file_info> parent; | |
269 | boost::intrusive_ptr<doc_info> document; | |
270 | bool document_root; | |
271 | unsigned compatibility_version; | |
272 | boost::intrusive_ptr<section_info> switched_section; | |
273 | id_placeholder* original_placeholder; | |
274 | std::string doc_id_1_1; | |
275 | file_info(boost::intrusive_ptr<file_info> const& parent, unsigned compatibility_version) : parent(parent), document(parent->document), document_root(false), compatibility_version(compatibility_version), switched_section(), original_placeholder() { | |
276 | } | |
277 | }; | |
278 | struct doc_info : intrusive_base<doc_info> { | |
279 | boost::intrusive_ptr<section_info> current_section; | |
280 | std::string last_title_1_1; | |
281 | std::string section_id_1_1; | |
282 | }; | |
283 | struct section_info : intrusive_base<section_info> { | |
284 | boost::intrusive_ptr<section_info> parent; | |
285 | unsigned compatibility_version; | |
286 | unsigned level; | |
287 | std::string id_1_1; | |
288 | id_placeholder* placeholder_1_6; | |
289 | section_info(boost::intrusive_ptr<section_info> const& parent, unsigned compatibility_version, std::string const& id) : parent(parent), compatibility_version(compatibility_version), level(parent ? parent->level + 1 : 1), id_1_1(), placeholder_1_6(0) { | |
290 | } | |
291 | }; | |
292 | id_manager::id_manager() : state(new id_state) { | |
293 | } | |
294 | namespace { | |
295 | std::string normalize_id( std::string src_id, size_t prefix = 0, size_t size = max_size) { | |
296 | std::string id; | |
297 | size_t src = prefix; | |
298 | size_t dst = prefix; | |
299 | if (src >= id.length()) { | |
300 | if (id[src] == '_') { | |
301 | } | |
302 | } | |
303 | id.erase(dst); | |
304 | } | |
305 | } | |
306 | id_placeholder* id_state::add_id_to_section( std::string const& id, id_category category, boost::intrusive_ptr<section_info> const& section) { | |
307 | std::string id_part = id; | |
308 | if (current_file->compatibility_version >= 106u && category.c < id_category::explicit_id) { | |
309 | id_part = normalize_id(id); | |
310 | } | |
311 | boost::intrusive_ptr<section_info> parent = current_file->document->current_section; | |
312 | boost::intrusive_ptr<section_info> new_section = new section_info(parent, current_file->compatibility_version, id); | |
313 | }; | |
314 | } |