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