]> git.wh0rd.org Git - ICEs.git/blob - 411691/id_manager.i.3
more
[ICEs.git] / 411691 / id_manager.i.3
1 typedef int _Atomic_word;
2 typedef long unsigned int size_t;
3
4
5 namespace __gnu_cxx {
6         template < typename _Tp > class new_allocator {
7               public:typedef const _Tp *const_pointer;
8                 typedef _Tp & reference;
9         };
10         static _Atomic_word __exchange_and_add_dispatch(_Atomic_word * __mem,
11                                                         int __val) {}
12 }
13
14 namespace std {
15         template < typename _CharT > struct char_traits;
16         class exception {
17               public:exception() throw() {
18                 } virtual ~ exception() throw();
19         };
20         class bad_cast:public exception {       };
21         template < typename _Tp >
22             class allocator:public __gnu_cxx::new_allocator < _Tp > {
23               public:template < typename _Tp1 > struct rebind {
24                         typedef allocator < _Tp1 > other;
25                 };
26         };
27         template < typename _CharT, typename _Traits =
28             char_traits < _CharT >, typename _Alloc =
29             allocator < _CharT > >class basic_string;
30         typedef basic_string < char >string;
31          template <> struct char_traits <char > {
32         } __pthread_unwind_buf_t;
33
34         template < typename _CharT, typename _Traits,
35             typename _Alloc > class basic_string {
36                 typedef typename _Alloc::template rebind <
37                     _CharT >::other _CharT_alloc_type;
38                 typedef _Alloc allocator_type;
39                 typedef typename _CharT_alloc_type::reference reference;
40               private:struct _Rep_base {
41                         _Atomic_word _M_refcount;
42                 };
43                 struct _Rep:_Rep_base {
44                         _CharT *_M_refdata() throw() {
45                                 return reinterpret_cast < _CharT * >(this + 1);
46                         } void _M_dispose(const _Alloc & __a) {
47                                 if (__builtin_expect
48                                     (this != &_S_empty_rep(), false)) {
49                                         if (__gnu_cxx::
50                                             __exchange_and_add_dispatch(&this->
51                                                                         _M_refcount,
52                                                                         -1) <=
53                                             0) {
54                                                 _M_destroy(__a);
55                                         }
56                                 }
57                         } void _M_destroy(const _Alloc &) throw();
58                 };
59                 struct _Alloc_hider:_Alloc {
60                         _Alloc_hider(_CharT * __dat,
61                                      const _Alloc & __a):_Alloc(__a),
62                             _M_p(__dat) {
63                         } _CharT *_M_p;
64                 };
65               public:static const size_t npos =
66                     static_cast < size_t > (-1);
67               private:mutable _Alloc_hider _M_dataplus;
68                 _Rep *_M_rep() const {
69                 } static _Rep & _S_empty_rep() {
70                 }
71               public: basic_string():_M_dataplus(_S_empty_rep()._M_refdata(),
72                             _Alloc()) {
73                 }
74                 ~basic_string() {
75                         _M_rep()->_M_dispose(this->get_allocator());
76                 }
77                 size_t length() const {
78                 } reference operator[] (size_t __pos) {
79                 }
80                 basic_string & erase(size_t __pos = 0, size_t __n = npos) {
81                 }
82                 allocator_type get_allocator() const {
83         }};
84         template < typename _Tp, typename _Ref, typename _Ptr > struct _Deque_iterator {
85         };
86          template < typename _Tp, typename _Alloc > class _Deque_base {
87               public:typedef _Alloc allocator_type;
88                 typedef _Deque_iterator < _Tp, _Tp &, _Tp * >iterator;
89                  _Deque_base():_M_impl() {
90                         _M_initialize_map(0);
91                 } typedef typename _Alloc::template rebind <
92                     _Tp >::other _Tp_alloc_type;
93                 struct _Deque_impl:public _Tp_alloc_type {
94                         _Tp **_M_map;
95                         size_t _M_map_size;
96                         iterator _M_start;
97                         iterator _M_finish;
98                          _Deque_impl():_Tp_alloc_type(), _M_map(0),
99                             _M_map_size(0), _M_start(), _M_finish() {
100                 }};
101               protected:void _M_initialize_map(size_t);
102                 _Deque_impl _M_impl;
103         };
104       template < typename _Tp, typename _Alloc = std::allocator < _Tp > >class deque:protected _Deque_base < _Tp,
105             _Alloc >
106         {
107         };
108         namespace numeric {
109                 enum range_check_result {
110                         cInRange = 0, cNegOverflow = 1, cPosOverflow = 2
111                 };
112                 class bad_numeric_cast:public std::bad_cast {
113                 };
114                 class negative_overflow:public bad_numeric_cast {
115                         void operator() (range_check_result r) {
116                                 if (r == cNegOverflow)
117                                         throw negative_overflow();
118                 }};
119         }
120 }
121
122 namespace boost {
123         template < class T > class scoped_ptr {
124               private:T * px;
125               public:typedef T element_type;
126               explicit scoped_ptr(T * p = 0):px(p) {
127         }};
128         template < class T > class intrusive_ptr {
129               private:typedef intrusive_ptr this_type;
130               public:typedef T element_type;
131                  intrusive_ptr():px(0) {
132               } intrusive_ptr(T * p, bool add_ref = true):px(p) {
133                 }
134                 ~intrusive_ptr() {
135                         if (px != 0)
136                                 intrusive_ptr_release(px);
137                 }
138                 T *operator->() const {
139                         return px;
140                 } typedef T *this_type::*unspecified_bool_type;
141                 operator  unspecified_bool_type() const {
142               } private: T * px;
143         };
144 }
145
146 namespace quickbook {
147         struct section_info;
148         template < typename T > struct intrusive_base {
149                 intrusive_base():ref_count_(0) {
150                 } ~intrusive_base() {
151                 } friend void intrusive_ptr_release(T * ptr) {
152                         if (--ptr->ref_count_ == 0)
153                                 delete ptr;
154                 }
155               private:unsigned ref_count_;
156         };
157         struct id_category {
158                 enum categories {
159                         default_category =
160                             0, numbered, generated, generated_heading,
161                             generated_section, generated_doc, explicit_id,
162                             explicit_section_id, explicit_anchor_id
163                 };
164                 categories c;
165         };
166         struct id_state;
167         struct id_manager {
168                 id_manager();
169               private:boost::scoped_ptr < id_state > state;
170         };
171         static const size_t max_size = 32;
172         struct id_placeholder;
173         struct file_info;
174         struct doc_info;
175         struct id_state {
176                 boost::intrusive_ptr < file_info > current_file;
177                 std::deque < id_placeholder > placeholders;
178               private:id_placeholder * add_id_to_section(std::string const &id,
179                                                    id_category category,
180                                                    boost::intrusive_ptr <
181                                                    section_info >
182                                                    const &section);
183         };
184         struct file_info:intrusive_base < file_info > {
185                 boost::intrusive_ptr < file_info > parent;
186                 boost::intrusive_ptr < doc_info > document;
187                 bool document_root;
188                 unsigned compatibility_version;
189                  boost::intrusive_ptr < section_info > switched_section;
190                 id_placeholder *original_placeholder;
191                  std::string doc_id_1_1;
192                  file_info(boost::intrusive_ptr < file_info > const &parent,
193                            unsigned compatibility_version):parent(parent),
194                     document(parent->document), document_root(false),
195                     compatibility_version(compatibility_version),
196                     switched_section(), original_placeholder() {
197         }};
198         struct doc_info:intrusive_base < doc_info > {
199                 boost::intrusive_ptr < section_info > current_section;
200                 std::string last_title_1_1;
201                 std::string section_id_1_1;
202         };
203         struct section_info:intrusive_base < section_info > {
204                 boost::intrusive_ptr < section_info > parent;
205                 unsigned compatibility_version;
206                 unsigned level;
207                  std::string id_1_1;
208                 id_placeholder *placeholder_1_6;
209                  section_info(boost::intrusive_ptr < section_info >
210                               const &parent, unsigned compatibility_version,
211                               std::string const &id):parent(parent),
212                     compatibility_version(compatibility_version),
213                     level(parent ? parent->level + 1 : 1), id_1_1(),
214                     placeholder_1_6(0) {
215         }};
216       id_manager::id_manager():state(new id_state) {
217         }
218         namespace {
219                 std::string normalize_id(std::string src_id) {
220  size_t prefix; prefix =                                         0; size_t size; size = max_size;
221                         std::string id;
222                         size_t src; src = prefix;
223                         size_t dst; dst = prefix;
224                         if (src >= id.length()) {
225                                 if (id[src] == '_') {
226                                 }
227                         }
228                         id.erase(dst);
229                 }
230         }
231         id_placeholder *id_state::add_id_to_section(std::string const &id,
232                                                     id_category category,
233                                                     boost::intrusive_ptr <
234                                                     section_info >
235                                                     const &section) {
236                 std::string id_part = id;
237                 if (current_file->compatibility_version >= 106u
238                     && category.c < id_category::explicit_id) {
239                         id_part = normalize_id(id);
240                 }
241                 boost::intrusive_ptr < section_info > parent =
242                     current_file->document->current_section;
243                 boost::intrusive_ptr < section_info > new_section =
244                     new section_info(parent,
245                                      current_file->compatibility_version, id);
246         };
247 }