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