1 /* girdocumentationimporter.c generated by valac, the Vala compiler
2 * generated from girdocumentationimporter.vala, do not modify */
3
4 /* girdocumentationimporter.vala
5 *
6 * Copyright (C) 2008-2010 Jürg Billeter
7 * Copyright (C) 2011 Luca Bruno
8 * Copyright (C) 2011-2014 Florian Brosch
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public
12 * License as published by the Free Software Foundation; either
13 * version 2.1 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with this library; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23 *
24 * Author:
25 * Jürg Billeter <j@bitron.ch>
26 * Luca Bruno <lucabru@src.gnome.org>
27 * Florian Brosch <flo.brosch@gmail.com>
28 */
29
30 #include "valadoc.h"
31 #include <vala.h>
32 #include <stdlib.h>
33 #include <string.h>
34 #include <glib.h>
35 #include <valagee.h>
36 #include <glib-object.h>
37
38 enum {
39 VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_0_PROPERTY,
40 VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY,
41 VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_NUM_PROPERTIES
42 };
43 static GParamSpec* valadoc_importer_gir_documentation_importer_properties[VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_NUM_PROPERTIES];
44 #define _vala_markup_reader_unref0(var) ((var == NULL) ? NULL : (var = (vala_markup_reader_unref (var), NULL)))
45 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
46 #define _g_free0(var) (var = (g_free (var), NULL))
47 #define _vala_source_file_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_file_unref (var), NULL)))
48 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
49
50 #define VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_TYPE_IMPLICIT_PARAMETER_POS (valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type ())
51 typedef struct _ValadocImporterGirDocumentationImporterImplicitParameterPos ValadocImporterGirDocumentationImporterImplicitParameterPos;
52 #define _vala_source_reference_unref0(var) ((var == NULL) ? NULL : (var = (vala_source_reference_unref (var), NULL)))
53 #define _valadoc_api_source_comment_unref0(var) ((var == NULL) ? NULL : (var = (valadoc_api_source_comment_unref (var), NULL)))
54 #define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
55
56 struct _ValadocImporterGirDocumentationImporterPrivate {
57 ValaMarkupTokenType current_token;
58 ValaSourceLocation begin;
59 ValaSourceLocation end;
60 ValaMarkupReader* reader;
61 ValadocDocumentationParser* parser;
62 ValadocApiSourceFile* file;
63 gchar* parent_c_identifier;
64 };
65
66 struct _ValadocImporterGirDocumentationImporterImplicitParameterPos {
67 gint parameter;
68 gint position;
69 };
70
71 static gint ValadocImporterGirDocumentationImporter_private_offset;
72 static gpointer valadoc_importer_gir_documentation_importer_parent_class = NULL;
73
74 #define VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_GIR_VERSION "1.2"
75 static void valadoc_importer_gir_documentation_importer_real_process (ValadocImporterDocumentationImporter* base,
76 const gchar* source_file);
77 static void valadoc_importer_gir_documentation_importer_next (ValadocImporterGirDocumentationImporter* self);
78 static void valadoc_importer_gir_documentation_importer_error (ValadocImporterGirDocumentationImporter* self,
79 const gchar* message);
80 static void valadoc_importer_gir_documentation_importer_parse_repository (ValadocImporterGirDocumentationImporter* self);
81 static ValadocApiParameter* valadoc_importer_gir_documentation_importer_find_parameter (ValadocImporterGirDocumentationImporter* self,
82 ValadocApiNode* node,
83 const gchar* name);
84 static inline gchar* valadoc_importer_gir_documentation_importer_get_cparameter_name (ValadocImporterGirDocumentationImporter* self,
85 gchar** param_names,
86 gint param_names_length1,
87 gint length_pos);
88 static GType valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type (void) G_GNUC_CONST G_GNUC_UNUSED;
89 static ValadocImporterGirDocumentationImporterImplicitParameterPos* valadoc_importer_gir_documentation_importer_implicit_parameter_pos_dup (const ValadocImporterGirDocumentationImporterImplicitParameterPos* self);
90 static void valadoc_importer_gir_documentation_importer_implicit_parameter_pos_free (ValadocImporterGirDocumentationImporterImplicitParameterPos* self);
91 static void valadoc_importer_gir_documentation_importer_attach_comment (ValadocImporterGirDocumentationImporter* self,
92 const gchar* cname,
93 ValadocApiGirSourceComment* comment,
94 gchar** param_names,
95 gint param_names_length1,
96 ValadocImporterGirDocumentationImporterImplicitParameterPos* destroy_notifies,
97 gint destroy_notifies_length1,
98 ValadocImporterGirDocumentationImporterImplicitParameterPos* closures,
99 gint closures_length1,
100 ValadocImporterGirDocumentationImporterImplicitParameterPos* array_lengths,
101 gint array_lengths_length1,
102 gint array_length_ret);
103 G_GNUC_INTERNAL void valadoc_api_parameter_set_implicit_destroy_cparameter_name (ValadocApiParameter* self,
104 const gchar* value);
105 G_GNUC_INTERNAL void valadoc_api_parameter_set_implicit_closure_cparameter_name (ValadocApiParameter* self,
106 const gchar* value);
107 G_GNUC_INTERNAL void valadoc_api_parameter_set_implicit_array_length_cparameter_name (ValadocApiParameter* self,
108 const gchar* value);
109 G_GNUC_INTERNAL void valadoc_api_callable_set_implicit_array_length_cparameter_name (ValadocApiCallable* self,
110 const gchar* value);
111 G_GNUC_INTERNAL void valadoc_api_node_set_documentation (ValadocApiNode* self,
112 ValadocContentComment* value);
113 static void valadoc_importer_gir_documentation_importer_warning (ValadocImporterGirDocumentationImporter* self,
114 const gchar* message);
115 static void valadoc_importer_gir_documentation_importer_start_element (ValadocImporterGirDocumentationImporter* self,
116 const gchar* name);
117 static void valadoc_importer_gir_documentation_importer_end_element (ValadocImporterGirDocumentationImporter* self,
118 const gchar* name);
119 static void valadoc_importer_gir_documentation_importer_parse_namespace (ValadocImporterGirDocumentationImporter* self);
120 static void valadoc_importer_gir_documentation_importer_parse_include (ValadocImporterGirDocumentationImporter* self);
121 static void valadoc_importer_gir_documentation_importer_parse_package (ValadocImporterGirDocumentationImporter* self);
122 static void valadoc_importer_gir_documentation_importer_parse_c_include (ValadocImporterGirDocumentationImporter* self);
123 static void valadoc_importer_gir_documentation_importer_skip_element (ValadocImporterGirDocumentationImporter* self);
124 static void valadoc_importer_gir_documentation_importer_parse_alias (ValadocImporterGirDocumentationImporter* self);
125 static void valadoc_importer_gir_documentation_importer_parse_enumeration (ValadocImporterGirDocumentationImporter* self,
126 const gchar* element_name);
127 static void valadoc_importer_gir_documentation_importer_parse_bitfield (ValadocImporterGirDocumentationImporter* self);
128 static void valadoc_importer_gir_documentation_importer_parse_method (ValadocImporterGirDocumentationImporter* self,
129 const gchar* element_name);
130 static void valadoc_importer_gir_documentation_importer_parse_callback (ValadocImporterGirDocumentationImporter* self);
131 static void valadoc_importer_gir_documentation_importer_parse_record (ValadocImporterGirDocumentationImporter* self);
132 static void valadoc_importer_gir_documentation_importer_parse_class (ValadocImporterGirDocumentationImporter* self);
133 static void valadoc_importer_gir_documentation_importer_parse_interface (ValadocImporterGirDocumentationImporter* self);
134 static void valadoc_importer_gir_documentation_importer_parse_boxed (ValadocImporterGirDocumentationImporter* self,
135 const gchar* element_name);
136 static void valadoc_importer_gir_documentation_importer_parse_union (ValadocImporterGirDocumentationImporter* self);
137 static void valadoc_importer_gir_documentation_importer_parse_constant (ValadocImporterGirDocumentationImporter* self);
138 static ValadocApiGirSourceComment* valadoc_importer_gir_documentation_importer_parse_symbol_doc (ValadocImporterGirDocumentationImporter* self);
139 static void valadoc_importer_gir_documentation_importer_parse_type (ValadocImporterGirDocumentationImporter* self,
140 gint* array_length_pos);
141 static ValadocApiSourceComment* valadoc_importer_gir_documentation_importer_parse_doc (ValadocImporterGirDocumentationImporter* self,
142 const gchar* element_name);
143 static void valadoc_importer_gir_documentation_importer_parse_enumeration_member (ValadocImporterGirDocumentationImporter* self);
144 static void valadoc_importer_gir_documentation_importer_parse_return_value (ValadocImporterGirDocumentationImporter* self,
145 ValadocApiSourceComment* * comment,
146 gint* array_length_ret);
147 static void valadoc_importer_gir_documentation_importer_parse_parameter (ValadocImporterGirDocumentationImporter* self,
148 ValadocApiSourceComment* * comment,
149 gchar* * param_name,
150 gint* destroy_pos,
151 gint* closure_pos,
152 gint* array_length_pos);
153 static void valadoc_importer_gir_documentation_importer_parse_field (ValadocImporterGirDocumentationImporter* self);
154 static void valadoc_importer_gir_documentation_importer_parse_constructor (ValadocImporterGirDocumentationImporter* self);
155 static void valadoc_importer_gir_documentation_importer_parse_property (ValadocImporterGirDocumentationImporter* self);
156 static void valadoc_importer_gir_documentation_importer_parse_signal (ValadocImporterGirDocumentationImporter* self);
157 static void valadoc_importer_gir_documentation_importer_parse_function (ValadocImporterGirDocumentationImporter* self,
158 const gchar* element_name);
159 static void _vala_array_add3 (gchar** * array,
160 gint* length,
161 gint* size,
162 gchar* value);
163 static void valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (ValadocImporterGirDocumentationImporterImplicitParameterPos *self,
164 gint parameter,
165 gint position);
166 static void _vala_array_add4 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array,
167 gint* length,
168 gint* size,
169 const ValadocImporterGirDocumentationImporterImplicitParameterPos* value);
170 static void _vala_array_add5 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array,
171 gint* length,
172 gint* size,
173 const ValadocImporterGirDocumentationImporterImplicitParameterPos* value);
174 static void _vala_array_add6 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array,
175 gint* length,
176 gint* size,
177 const ValadocImporterGirDocumentationImporterImplicitParameterPos* value);
178 static void valadoc_importer_gir_documentation_importer_finalize (GObject * obj);
179 static GType valadoc_importer_gir_documentation_importer_get_type_once (void);
180 static void _vala_valadoc_importer_gir_documentation_importer_get_property (GObject * object,
181 guint property_id,
182 GValue * value,
183 GParamSpec * pspec);
184 static void _vala_array_destroy (gpointer array,
185 gint array_length,
186 GDestroyNotify destroy_func);
187 static void _vala_array_free (gpointer array,
188 gint array_length,
189 GDestroyNotify destroy_func);
190
191 static inline gpointer
valadoc_importer_gir_documentation_importer_get_instance_private(ValadocImporterGirDocumentationImporter * self)192 valadoc_importer_gir_documentation_importer_get_instance_private (ValadocImporterGirDocumentationImporter* self)
193 {
194 return G_STRUCT_MEMBER_P (self, ValadocImporterGirDocumentationImporter_private_offset);
195 }
196
197 static const gchar*
valadoc_importer_gir_documentation_importer_real_get_file_extension(ValadocImporterDocumentationImporter * base)198 valadoc_importer_gir_documentation_importer_real_get_file_extension (ValadocImporterDocumentationImporter* base)
199 {
200 const gchar* result;
201 ValadocImporterGirDocumentationImporter* self;
202 self = (ValadocImporterGirDocumentationImporter*) base;
203 result = "gir";
204 return result;
205 }
206
207 static gpointer
_g_object_ref0(gpointer self)208 _g_object_ref0 (gpointer self)
209 {
210 return self ? g_object_ref (self) : NULL;
211 }
212
213 ValadocImporterGirDocumentationImporter*
valadoc_importer_gir_documentation_importer_construct(GType object_type,ValadocApiTree * tree,ValadocDocumentationParser * parser,ValadocModuleLoader * modules,ValadocSettings * settings,ValadocErrorReporter * reporter)214 valadoc_importer_gir_documentation_importer_construct (GType object_type,
215 ValadocApiTree* tree,
216 ValadocDocumentationParser* parser,
217 ValadocModuleLoader* modules,
218 ValadocSettings* settings,
219 ValadocErrorReporter* reporter)
220 {
221 ValadocImporterGirDocumentationImporter * self = NULL;
222 ValadocDocumentationParser* _tmp0_;
223 g_return_val_if_fail (tree != NULL, NULL);
224 g_return_val_if_fail (parser != NULL, NULL);
225 g_return_val_if_fail (modules != NULL, NULL);
226 g_return_val_if_fail (settings != NULL, NULL);
227 g_return_val_if_fail (reporter != NULL, NULL);
228 self = (ValadocImporterGirDocumentationImporter*) valadoc_importer_documentation_importer_construct (object_type, tree, modules, settings);
229 _tmp0_ = _g_object_ref0 (parser);
230 _g_object_unref0 (self->priv->parser);
231 self->priv->parser = _tmp0_;
232 return self;
233 }
234
235 ValadocImporterGirDocumentationImporter*
valadoc_importer_gir_documentation_importer_new(ValadocApiTree * tree,ValadocDocumentationParser * parser,ValadocModuleLoader * modules,ValadocSettings * settings,ValadocErrorReporter * reporter)236 valadoc_importer_gir_documentation_importer_new (ValadocApiTree* tree,
237 ValadocDocumentationParser* parser,
238 ValadocModuleLoader* modules,
239 ValadocSettings* settings,
240 ValadocErrorReporter* reporter)
241 {
242 return valadoc_importer_gir_documentation_importer_construct (VALADOC_IMPORTER_TYPE_GIR_DOCUMENTATION_IMPORTER, tree, parser, modules, settings, reporter);
243 }
244
245 static void
valadoc_importer_gir_documentation_importer_real_process(ValadocImporterDocumentationImporter * base,const gchar * source_file)246 valadoc_importer_gir_documentation_importer_real_process (ValadocImporterDocumentationImporter* base,
247 const gchar* source_file)
248 {
249 ValadocImporterGirDocumentationImporter * self;
250 ValaSourceFile* data = NULL;
251 ValadocApiTree* _tmp0_;
252 ValaCodeContext* _tmp1_;
253 ValaCodeContext* _tmp2_;
254 gchar* _tmp3_;
255 gchar* _tmp4_;
256 ValaSourceFile* _tmp5_;
257 ValaSourceFile* _tmp6_;
258 gchar* _tmp7_;
259 gchar* _tmp8_;
260 ValadocApiPackage* _tmp9_;
261 ValadocApiPackage* _tmp10_;
262 ValaSourceFile* _tmp11_;
263 ValadocApiSourceFile* _tmp12_;
264 ValaMarkupReader* _tmp13_;
265 self = (ValadocImporterGirDocumentationImporter*) base;
266 g_return_if_fail (source_file != NULL);
267 _tmp0_ = ((ValadocImporterDocumentationImporter*) self)->tree;
268 _tmp1_ = valadoc_api_tree_get_context (_tmp0_);
269 _tmp2_ = _tmp1_;
270 _tmp3_ = g_path_get_basename (source_file);
271 _tmp4_ = _tmp3_;
272 _tmp5_ = vala_source_file_new (_tmp2_, VALA_SOURCE_FILE_TYPE_PACKAGE, _tmp4_, NULL, FALSE);
273 _tmp6_ = _tmp5_;
274 _g_free0 (_tmp4_);
275 data = _tmp6_;
276 _tmp7_ = g_path_get_basename (source_file);
277 _tmp8_ = _tmp7_;
278 _tmp9_ = valadoc_api_package_new (_tmp8_, TRUE, NULL);
279 _tmp10_ = _tmp9_;
280 _tmp11_ = data;
281 _tmp12_ = valadoc_api_source_file_new (_tmp10_, source_file, NULL, _tmp11_);
282 _g_object_unref0 (self->priv->file);
283 self->priv->file = _tmp12_;
284 _g_object_unref0 (_tmp10_);
285 _g_free0 (_tmp8_);
286 _tmp13_ = vala_markup_reader_new (source_file);
287 _vala_markup_reader_unref0 (self->priv->reader);
288 self->priv->reader = _tmp13_;
289 {
290 gboolean _tmp14_ = FALSE;
291 _tmp14_ = TRUE;
292 while (TRUE) {
293 ValaMarkupTokenType _tmp20_;
294 if (!_tmp14_) {
295 gboolean _tmp15_ = FALSE;
296 ValaMarkupTokenType _tmp16_;
297 _tmp16_ = self->priv->current_token;
298 if (_tmp16_ != VALA_MARKUP_TOKEN_TYPE_START_ELEMENT) {
299 ValaMarkupReader* _tmp17_;
300 const gchar* _tmp18_;
301 const gchar* _tmp19_;
302 _tmp17_ = self->priv->reader;
303 _tmp18_ = vala_markup_reader_get_name (_tmp17_);
304 _tmp19_ = _tmp18_;
305 _tmp15_ = g_strcmp0 (_tmp19_, "repository") != 0;
306 } else {
307 _tmp15_ = FALSE;
308 }
309 if (!_tmp15_) {
310 break;
311 }
312 }
313 _tmp14_ = FALSE;
314 valadoc_importer_gir_documentation_importer_next (self);
315 _tmp20_ = self->priv->current_token;
316 if (_tmp20_ == VALA_MARKUP_TOKEN_TYPE_EOF) {
317 valadoc_importer_gir_documentation_importer_error (self, "unexpected end of file");
318 _vala_source_file_unref0 (data);
319 return;
320 }
321 }
322 }
323 valadoc_importer_gir_documentation_importer_parse_repository (self);
324 _vala_markup_reader_unref0 (self->priv->reader);
325 self->priv->reader = NULL;
326 _g_object_unref0 (self->priv->file);
327 self->priv->file = NULL;
328 _vala_source_file_unref0 (data);
329 }
330
331 static gpointer
_vala_iterable_ref0(gpointer self)332 _vala_iterable_ref0 (gpointer self)
333 {
334 return self ? vala_iterable_ref (self) : NULL;
335 }
336
337 static ValadocApiParameter*
valadoc_importer_gir_documentation_importer_find_parameter(ValadocImporterGirDocumentationImporter * self,ValadocApiNode * node,const gchar * name)338 valadoc_importer_gir_documentation_importer_find_parameter (ValadocImporterGirDocumentationImporter* self,
339 ValadocApiNode* node,
340 const gchar* name)
341 {
342 ValaList* parameters = NULL;
343 ValaList* _tmp0_;
344 ValadocApiParameter* result = NULL;
345 g_return_val_if_fail (self != NULL, NULL);
346 g_return_val_if_fail (node != NULL, NULL);
347 g_return_val_if_fail (name != NULL, NULL);
348 _tmp0_ = valadoc_api_node_get_children_by_type (node, VALADOC_API_NODE_TYPE_FORMAL_PARAMETER, FALSE);
349 parameters = _tmp0_;
350 {
351 ValaList* _param_list = NULL;
352 ValaList* _tmp1_;
353 ValaList* _tmp2_;
354 gint _param_size = 0;
355 ValaList* _tmp3_;
356 gint _tmp4_;
357 gint _tmp5_;
358 gint _param_index = 0;
359 _tmp1_ = parameters;
360 _tmp2_ = _vala_iterable_ref0 (_tmp1_);
361 _param_list = _tmp2_;
362 _tmp3_ = _param_list;
363 _tmp4_ = vala_collection_get_size ((ValaCollection*) _tmp3_);
364 _tmp5_ = _tmp4_;
365 _param_size = _tmp5_;
366 _param_index = -1;
367 while (TRUE) {
368 gint _tmp6_;
369 gint _tmp7_;
370 ValadocApiNode* param = NULL;
371 ValaList* _tmp8_;
372 gpointer _tmp9_;
373 ValadocApiNode* _tmp10_;
374 const gchar* _tmp11_;
375 const gchar* _tmp12_;
376 _param_index = _param_index + 1;
377 _tmp6_ = _param_index;
378 _tmp7_ = _param_size;
379 if (!(_tmp6_ < _tmp7_)) {
380 break;
381 }
382 _tmp8_ = _param_list;
383 _tmp9_ = vala_list_get (_tmp8_, _param_index);
384 param = (ValadocApiNode*) _tmp9_;
385 _tmp10_ = param;
386 _tmp11_ = valadoc_api_node_get_name ((ValadocApiNode*) G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, VALADOC_API_TYPE_PARAMETER, ValadocApiParameter));
387 _tmp12_ = _tmp11_;
388 if (g_strcmp0 (_tmp12_, name) == 0) {
389 ValadocApiNode* _tmp13_;
390 ValadocApiParameter* _tmp14_;
391 _tmp13_ = param;
392 _tmp14_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp13_, VALADOC_API_TYPE_PARAMETER, ValadocApiParameter));
393 result = _tmp14_;
394 _g_object_unref0 (param);
395 _vala_iterable_unref0 (_param_list);
396 _vala_iterable_unref0 (parameters);
397 return result;
398 }
399 _g_object_unref0 (param);
400 }
401 _vala_iterable_unref0 (_param_list);
402 }
403 result = NULL;
404 _vala_iterable_unref0 (parameters);
405 return result;
406 }
407
408 static inline gchar*
valadoc_importer_gir_documentation_importer_get_cparameter_name(ValadocImporterGirDocumentationImporter * self,gchar ** param_names,gint param_names_length1,gint length_pos)409 valadoc_importer_gir_documentation_importer_get_cparameter_name (ValadocImporterGirDocumentationImporter* self,
410 gchar** param_names,
411 gint param_names_length1,
412 gint length_pos)
413 {
414 gboolean _tmp0_ = FALSE;
415 const gchar* _tmp1_;
416 gchar* _tmp2_;
417 gchar* result = NULL;
418 g_return_val_if_fail (self != NULL, NULL);
419 if (length_pos < 0) {
420 _tmp0_ = TRUE;
421 } else {
422 _tmp0_ = param_names_length1 < length_pos;
423 }
424 if (_tmp0_) {
425 result = NULL;
426 return result;
427 }
428 _tmp1_ = param_names[length_pos];
429 _tmp2_ = g_strdup (_tmp1_);
430 result = _tmp2_;
431 return result;
432 }
433
434 static void
valadoc_importer_gir_documentation_importer_attach_comment(ValadocImporterGirDocumentationImporter * self,const gchar * cname,ValadocApiGirSourceComment * comment,gchar ** param_names,gint param_names_length1,ValadocImporterGirDocumentationImporterImplicitParameterPos * destroy_notifies,gint destroy_notifies_length1,ValadocImporterGirDocumentationImporterImplicitParameterPos * closures,gint closures_length1,ValadocImporterGirDocumentationImporterImplicitParameterPos * array_lengths,gint array_lengths_length1,gint array_length_ret)435 valadoc_importer_gir_documentation_importer_attach_comment (ValadocImporterGirDocumentationImporter* self,
436 const gchar* cname,
437 ValadocApiGirSourceComment* comment,
438 gchar** param_names,
439 gint param_names_length1,
440 ValadocImporterGirDocumentationImporterImplicitParameterPos* destroy_notifies,
441 gint destroy_notifies_length1,
442 ValadocImporterGirDocumentationImporterImplicitParameterPos* closures,
443 gint closures_length1,
444 ValadocImporterGirDocumentationImporterImplicitParameterPos* array_lengths,
445 gint array_lengths_length1,
446 gint array_length_ret)
447 {
448 ValadocApiNode* node = NULL;
449 ValadocApiTree* _tmp0_;
450 ValadocApiNode* _tmp1_;
451 ValadocApiNode* _tmp2_;
452 ValadocContentComment* content = NULL;
453 ValadocDocumentationParser* _tmp34_;
454 ValadocApiNode* _tmp35_;
455 ValadocContentComment* _tmp36_;
456 ValadocContentComment* _tmp37_;
457 ValadocApiNode* _tmp38_;
458 ValadocContentComment* _tmp39_;
459 g_return_if_fail (self != NULL);
460 g_return_if_fail (cname != NULL);
461 if (comment == NULL) {
462 return;
463 }
464 _tmp0_ = ((ValadocImporterDocumentationImporter*) self)->tree;
465 _tmp1_ = valadoc_api_tree_search_symbol_cstr (_tmp0_, NULL, cname);
466 node = _tmp1_;
467 _tmp2_ = node;
468 if (_tmp2_ == NULL) {
469 _g_object_unref0 (node);
470 return;
471 }
472 if (param_names != NULL) {
473 ValadocApiNode* _tmp30_;
474 {
475 ValadocImporterGirDocumentationImporterImplicitParameterPos* pos_collection = NULL;
476 gint pos_collection_length1 = 0;
477 gint _pos_collection_size_ = 0;
478 gint pos_it = 0;
479 pos_collection = destroy_notifies;
480 pos_collection_length1 = destroy_notifies_length1;
481 for (pos_it = 0; pos_it < pos_collection_length1; pos_it = pos_it + 1) {
482 ValadocImporterGirDocumentationImporterImplicitParameterPos pos = {0};
483 pos = pos_collection[pos_it];
484 {
485 ValadocApiParameter* param = NULL;
486 ValadocApiNode* _tmp3_;
487 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp4_;
488 const gchar* _tmp5_;
489 ValadocApiParameter* _tmp6_;
490 ValadocApiParameter* _tmp7_;
491 ValadocApiParameter* _tmp8_;
492 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp9_;
493 gchar* _tmp10_;
494 gchar* _tmp11_;
495 _tmp3_ = node;
496 _tmp4_ = pos;
497 _tmp5_ = param_names[_tmp4_.parameter];
498 _tmp6_ = valadoc_importer_gir_documentation_importer_find_parameter (self, _tmp3_, _tmp5_);
499 param = _tmp6_;
500 _tmp7_ = param;
501 if (_tmp7_ == NULL) {
502 _g_object_unref0 (param);
503 continue;
504 }
505 _tmp8_ = param;
506 _tmp9_ = pos;
507 _tmp10_ = valadoc_importer_gir_documentation_importer_get_cparameter_name (self, param_names, (gint) param_names_length1, _tmp9_.position);
508 _tmp11_ = _tmp10_;
509 valadoc_api_parameter_set_implicit_destroy_cparameter_name (_tmp8_, _tmp11_);
510 _g_free0 (_tmp11_);
511 _g_object_unref0 (param);
512 }
513 }
514 }
515 {
516 ValadocImporterGirDocumentationImporterImplicitParameterPos* pos_collection = NULL;
517 gint pos_collection_length1 = 0;
518 gint _pos_collection_size_ = 0;
519 gint pos_it = 0;
520 pos_collection = closures;
521 pos_collection_length1 = closures_length1;
522 for (pos_it = 0; pos_it < pos_collection_length1; pos_it = pos_it + 1) {
523 ValadocImporterGirDocumentationImporterImplicitParameterPos pos = {0};
524 pos = pos_collection[pos_it];
525 {
526 ValadocApiParameter* param = NULL;
527 ValadocApiNode* _tmp12_;
528 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp13_;
529 const gchar* _tmp14_;
530 ValadocApiParameter* _tmp15_;
531 ValadocApiParameter* _tmp16_;
532 ValadocApiParameter* _tmp17_;
533 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp18_;
534 gchar* _tmp19_;
535 gchar* _tmp20_;
536 _tmp12_ = node;
537 _tmp13_ = pos;
538 _tmp14_ = param_names[_tmp13_.parameter];
539 _tmp15_ = valadoc_importer_gir_documentation_importer_find_parameter (self, _tmp12_, _tmp14_);
540 param = _tmp15_;
541 _tmp16_ = param;
542 if (_tmp16_ == NULL) {
543 _g_object_unref0 (param);
544 continue;
545 }
546 _tmp17_ = param;
547 _tmp18_ = pos;
548 _tmp19_ = valadoc_importer_gir_documentation_importer_get_cparameter_name (self, param_names, (gint) param_names_length1, _tmp18_.position);
549 _tmp20_ = _tmp19_;
550 valadoc_api_parameter_set_implicit_closure_cparameter_name (_tmp17_, _tmp20_);
551 _g_free0 (_tmp20_);
552 _g_object_unref0 (param);
553 }
554 }
555 }
556 {
557 ValadocImporterGirDocumentationImporterImplicitParameterPos* pos_collection = NULL;
558 gint pos_collection_length1 = 0;
559 gint _pos_collection_size_ = 0;
560 gint pos_it = 0;
561 pos_collection = array_lengths;
562 pos_collection_length1 = array_lengths_length1;
563 for (pos_it = 0; pos_it < pos_collection_length1; pos_it = pos_it + 1) {
564 ValadocImporterGirDocumentationImporterImplicitParameterPos pos = {0};
565 pos = pos_collection[pos_it];
566 {
567 ValadocApiParameter* param = NULL;
568 ValadocApiNode* _tmp21_;
569 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp22_;
570 const gchar* _tmp23_;
571 ValadocApiParameter* _tmp24_;
572 ValadocApiParameter* _tmp25_;
573 ValadocApiParameter* _tmp26_;
574 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp27_;
575 gchar* _tmp28_;
576 gchar* _tmp29_;
577 _tmp21_ = node;
578 _tmp22_ = pos;
579 _tmp23_ = param_names[_tmp22_.parameter];
580 _tmp24_ = valadoc_importer_gir_documentation_importer_find_parameter (self, _tmp21_, _tmp23_);
581 param = _tmp24_;
582 _tmp25_ = param;
583 if (_tmp25_ == NULL) {
584 _g_object_unref0 (param);
585 continue;
586 }
587 _tmp26_ = param;
588 _tmp27_ = pos;
589 _tmp28_ = valadoc_importer_gir_documentation_importer_get_cparameter_name (self, param_names, (gint) param_names_length1, _tmp27_.position);
590 _tmp29_ = _tmp28_;
591 valadoc_api_parameter_set_implicit_array_length_cparameter_name (_tmp26_, _tmp29_);
592 _g_free0 (_tmp29_);
593 _g_object_unref0 (param);
594 }
595 }
596 }
597 _tmp30_ = node;
598 if (VALADOC_API_IS_CALLABLE (_tmp30_)) {
599 ValadocApiNode* _tmp31_;
600 gchar* _tmp32_;
601 gchar* _tmp33_;
602 _tmp31_ = node;
603 _tmp32_ = valadoc_importer_gir_documentation_importer_get_cparameter_name (self, param_names, (gint) param_names_length1, array_length_ret);
604 _tmp33_ = _tmp32_;
605 valadoc_api_callable_set_implicit_array_length_cparameter_name (G_TYPE_CHECK_INSTANCE_CAST (_tmp31_, VALADOC_API_TYPE_CALLABLE, ValadocApiCallable), _tmp33_);
606 _g_free0 (_tmp33_);
607 }
608 }
609 _tmp34_ = self->priv->parser;
610 _tmp35_ = node;
611 _tmp36_ = valadoc_documentation_parser_parse (_tmp34_, _tmp35_, (ValadocApiSourceComment*) comment);
612 content = _tmp36_;
613 _tmp37_ = content;
614 if (_tmp37_ == NULL) {
615 _g_object_unref0 (content);
616 _g_object_unref0 (node);
617 return;
618 }
619 _tmp38_ = node;
620 _tmp39_ = content;
621 valadoc_api_node_set_documentation (_tmp38_, _tmp39_);
622 _g_object_unref0 (content);
623 _g_object_unref0 (node);
624 }
625
626 static void
valadoc_importer_gir_documentation_importer_warning(ValadocImporterGirDocumentationImporter * self,const gchar * message)627 valadoc_importer_gir_documentation_importer_warning (ValadocImporterGirDocumentationImporter* self,
628 const gchar* message)
629 {
630 ValadocApiSourceFile* _tmp0_;
631 ValaSourceFile* _tmp1_;
632 ValaSourceFile* _tmp2_;
633 ValaSourceLocation _tmp3_;
634 ValaSourceLocation _tmp4_;
635 ValaSourceReference* _tmp5_;
636 ValaSourceReference* _tmp6_;
637 g_return_if_fail (self != NULL);
638 g_return_if_fail (message != NULL);
639 _tmp0_ = self->priv->file;
640 _tmp1_ = valadoc_api_source_file_get_data (_tmp0_);
641 _tmp2_ = _tmp1_;
642 _tmp3_ = self->priv->begin;
643 _tmp4_ = self->priv->end;
644 _tmp5_ = vala_source_reference_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, VALA_TYPE_SOURCE_FILE, ValaSourceFile), &_tmp3_, &_tmp4_);
645 _tmp6_ = _tmp5_;
646 vala_report_warning (_tmp6_, message);
647 _vala_source_reference_unref0 (_tmp6_);
648 }
649
650 static void
valadoc_importer_gir_documentation_importer_error(ValadocImporterGirDocumentationImporter * self,const gchar * message)651 valadoc_importer_gir_documentation_importer_error (ValadocImporterGirDocumentationImporter* self,
652 const gchar* message)
653 {
654 ValadocApiSourceFile* _tmp0_;
655 ValaSourceFile* _tmp1_;
656 ValaSourceFile* _tmp2_;
657 ValaSourceLocation _tmp3_;
658 ValaSourceLocation _tmp4_;
659 ValaSourceReference* _tmp5_;
660 ValaSourceReference* _tmp6_;
661 g_return_if_fail (self != NULL);
662 g_return_if_fail (message != NULL);
663 _tmp0_ = self->priv->file;
664 _tmp1_ = valadoc_api_source_file_get_data (_tmp0_);
665 _tmp2_ = _tmp1_;
666 _tmp3_ = self->priv->begin;
667 _tmp4_ = self->priv->end;
668 _tmp5_ = vala_source_reference_new (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, VALA_TYPE_SOURCE_FILE, ValaSourceFile), &_tmp3_, &_tmp4_);
669 _tmp6_ = _tmp5_;
670 vala_report_error (_tmp6_, message);
671 _vala_source_reference_unref0 (_tmp6_);
672 }
673
674 static void
valadoc_importer_gir_documentation_importer_next(ValadocImporterGirDocumentationImporter * self)675 valadoc_importer_gir_documentation_importer_next (ValadocImporterGirDocumentationImporter* self)
676 {
677 ValaMarkupReader* _tmp0_;
678 ValaSourceLocation _tmp1_ = {0};
679 ValaSourceLocation _tmp2_ = {0};
680 ValaMarkupTokenType _tmp3_;
681 gboolean _tmp4_ = FALSE;
682 ValaMarkupTokenType _tmp5_;
683 g_return_if_fail (self != NULL);
684 _tmp0_ = self->priv->reader;
685 _tmp3_ = vala_markup_reader_read_token (_tmp0_, &_tmp1_, &_tmp2_);
686 self->priv->begin = _tmp1_;
687 self->priv->end = _tmp2_;
688 self->priv->current_token = _tmp3_;
689 _tmp5_ = self->priv->current_token;
690 if (_tmp5_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT) {
691 ValaMarkupReader* _tmp6_;
692 const gchar* _tmp7_;
693 const gchar* _tmp8_;
694 _tmp6_ = self->priv->reader;
695 _tmp7_ = vala_markup_reader_get_name (_tmp6_);
696 _tmp8_ = _tmp7_;
697 _tmp4_ = g_strcmp0 (_tmp8_, "annotation") == 0;
698 } else {
699 _tmp4_ = FALSE;
700 }
701 if (_tmp4_) {
702 valadoc_importer_gir_documentation_importer_next (self);
703 valadoc_importer_gir_documentation_importer_next (self);
704 }
705 }
706
707 static void
valadoc_importer_gir_documentation_importer_start_element(ValadocImporterGirDocumentationImporter * self,const gchar * name)708 valadoc_importer_gir_documentation_importer_start_element (ValadocImporterGirDocumentationImporter* self,
709 const gchar* name)
710 {
711 gboolean _tmp0_ = FALSE;
712 ValaMarkupTokenType _tmp1_;
713 g_return_if_fail (self != NULL);
714 g_return_if_fail (name != NULL);
715 _tmp1_ = self->priv->current_token;
716 if (_tmp1_ != VALA_MARKUP_TOKEN_TYPE_START_ELEMENT) {
717 _tmp0_ = TRUE;
718 } else {
719 ValaMarkupReader* _tmp2_;
720 const gchar* _tmp3_;
721 const gchar* _tmp4_;
722 _tmp2_ = self->priv->reader;
723 _tmp3_ = vala_markup_reader_get_name (_tmp2_);
724 _tmp4_ = _tmp3_;
725 _tmp0_ = g_strcmp0 (_tmp4_, name) != 0;
726 }
727 if (_tmp0_) {
728 gchar* _tmp5_;
729 gchar* _tmp6_;
730 _tmp5_ = g_strdup_printf ("expected start element of `%s'", name);
731 _tmp6_ = _tmp5_;
732 valadoc_importer_gir_documentation_importer_error (self, _tmp6_);
733 _g_free0 (_tmp6_);
734 }
735 }
736
737 static void
valadoc_importer_gir_documentation_importer_end_element(ValadocImporterGirDocumentationImporter * self,const gchar * name)738 valadoc_importer_gir_documentation_importer_end_element (ValadocImporterGirDocumentationImporter* self,
739 const gchar* name)
740 {
741 gboolean _tmp0_ = FALSE;
742 ValaMarkupTokenType _tmp1_;
743 g_return_if_fail (self != NULL);
744 g_return_if_fail (name != NULL);
745 _tmp1_ = self->priv->current_token;
746 if (_tmp1_ != VALA_MARKUP_TOKEN_TYPE_END_ELEMENT) {
747 _tmp0_ = TRUE;
748 } else {
749 ValaMarkupReader* _tmp2_;
750 const gchar* _tmp3_;
751 const gchar* _tmp4_;
752 _tmp2_ = self->priv->reader;
753 _tmp3_ = vala_markup_reader_get_name (_tmp2_);
754 _tmp4_ = _tmp3_;
755 _tmp0_ = g_strcmp0 (_tmp4_, name) != 0;
756 }
757 if (_tmp0_) {
758 gchar* _tmp5_;
759 gchar* _tmp6_;
760 _tmp5_ = g_strdup_printf ("expected end element of `%s'", name);
761 _tmp6_ = _tmp5_;
762 valadoc_importer_gir_documentation_importer_error (self, _tmp6_);
763 _g_free0 (_tmp6_);
764 }
765 valadoc_importer_gir_documentation_importer_next (self);
766 }
767
768 static void
valadoc_importer_gir_documentation_importer_parse_repository(ValadocImporterGirDocumentationImporter * self)769 valadoc_importer_gir_documentation_importer_parse_repository (ValadocImporterGirDocumentationImporter* self)
770 {
771 ValaMarkupReader* _tmp0_;
772 gchar* _tmp1_;
773 gchar* _tmp2_;
774 gboolean _tmp3_;
775 g_return_if_fail (self != NULL);
776 valadoc_importer_gir_documentation_importer_start_element (self, "repository");
777 _tmp0_ = self->priv->reader;
778 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "version");
779 _tmp2_ = _tmp1_;
780 _tmp3_ = g_strcmp0 (_tmp2_, VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_GIR_VERSION) != 0;
781 _g_free0 (_tmp2_);
782 if (_tmp3_) {
783 ValaMarkupReader* _tmp4_;
784 gchar* _tmp5_;
785 gchar* _tmp6_;
786 gchar* _tmp7_;
787 gchar* _tmp8_;
788 _tmp4_ = self->priv->reader;
789 _tmp5_ = vala_markup_reader_get_attribute (_tmp4_, "version");
790 _tmp6_ = _tmp5_;
791 _tmp7_ = g_strdup_printf ("unsupported GIR version %s (supported: %s)", _tmp6_, VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_GIR_VERSION);
792 _tmp8_ = _tmp7_;
793 valadoc_importer_gir_documentation_importer_error (self, _tmp8_);
794 _g_free0 (_tmp8_);
795 _g_free0 (_tmp6_);
796 return;
797 }
798 valadoc_importer_gir_documentation_importer_next (self);
799 while (TRUE) {
800 ValaMarkupTokenType _tmp9_;
801 ValaMarkupReader* _tmp10_;
802 const gchar* _tmp11_;
803 const gchar* _tmp12_;
804 _tmp9_ = self->priv->current_token;
805 if (!(_tmp9_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
806 break;
807 }
808 _tmp10_ = self->priv->reader;
809 _tmp11_ = vala_markup_reader_get_name (_tmp10_);
810 _tmp12_ = _tmp11_;
811 if (g_strcmp0 (_tmp12_, "namespace") == 0) {
812 valadoc_importer_gir_documentation_importer_parse_namespace (self);
813 } else {
814 ValaMarkupReader* _tmp13_;
815 const gchar* _tmp14_;
816 const gchar* _tmp15_;
817 _tmp13_ = self->priv->reader;
818 _tmp14_ = vala_markup_reader_get_name (_tmp13_);
819 _tmp15_ = _tmp14_;
820 if (g_strcmp0 (_tmp15_, "include") == 0) {
821 valadoc_importer_gir_documentation_importer_parse_include (self);
822 } else {
823 ValaMarkupReader* _tmp16_;
824 const gchar* _tmp17_;
825 const gchar* _tmp18_;
826 _tmp16_ = self->priv->reader;
827 _tmp17_ = vala_markup_reader_get_name (_tmp16_);
828 _tmp18_ = _tmp17_;
829 if (g_strcmp0 (_tmp18_, "package") == 0) {
830 valadoc_importer_gir_documentation_importer_parse_package (self);
831 } else {
832 ValaMarkupReader* _tmp19_;
833 const gchar* _tmp20_;
834 const gchar* _tmp21_;
835 _tmp19_ = self->priv->reader;
836 _tmp20_ = vala_markup_reader_get_name (_tmp19_);
837 _tmp21_ = _tmp20_;
838 if (g_strcmp0 (_tmp21_, "c:include") == 0) {
839 valadoc_importer_gir_documentation_importer_parse_c_include (self);
840 } else {
841 ValaMarkupReader* _tmp22_;
842 const gchar* _tmp23_;
843 const gchar* _tmp24_;
844 gchar* _tmp25_;
845 gchar* _tmp26_;
846 _tmp22_ = self->priv->reader;
847 _tmp23_ = vala_markup_reader_get_name (_tmp22_);
848 _tmp24_ = _tmp23_;
849 _tmp25_ = g_strdup_printf ("unknown child element `%s' in `repository'", _tmp24_);
850 _tmp26_ = _tmp25_;
851 valadoc_importer_gir_documentation_importer_error (self, _tmp26_);
852 _g_free0 (_tmp26_);
853 valadoc_importer_gir_documentation_importer_skip_element (self);
854 }
855 }
856 }
857 }
858 }
859 valadoc_importer_gir_documentation_importer_end_element (self, "repository");
860 }
861
862 static void
valadoc_importer_gir_documentation_importer_parse_include(ValadocImporterGirDocumentationImporter * self)863 valadoc_importer_gir_documentation_importer_parse_include (ValadocImporterGirDocumentationImporter* self)
864 {
865 g_return_if_fail (self != NULL);
866 valadoc_importer_gir_documentation_importer_start_element (self, "include");
867 valadoc_importer_gir_documentation_importer_next (self);
868 valadoc_importer_gir_documentation_importer_end_element (self, "include");
869 }
870
871 static void
valadoc_importer_gir_documentation_importer_parse_package(ValadocImporterGirDocumentationImporter * self)872 valadoc_importer_gir_documentation_importer_parse_package (ValadocImporterGirDocumentationImporter* self)
873 {
874 g_return_if_fail (self != NULL);
875 valadoc_importer_gir_documentation_importer_start_element (self, "package");
876 valadoc_importer_gir_documentation_importer_next (self);
877 valadoc_importer_gir_documentation_importer_end_element (self, "package");
878 }
879
880 static void
valadoc_importer_gir_documentation_importer_parse_c_include(ValadocImporterGirDocumentationImporter * self)881 valadoc_importer_gir_documentation_importer_parse_c_include (ValadocImporterGirDocumentationImporter* self)
882 {
883 g_return_if_fail (self != NULL);
884 valadoc_importer_gir_documentation_importer_start_element (self, "c:include");
885 valadoc_importer_gir_documentation_importer_next (self);
886 valadoc_importer_gir_documentation_importer_end_element (self, "c:include");
887 }
888
889 static void
valadoc_importer_gir_documentation_importer_skip_element(ValadocImporterGirDocumentationImporter * self)890 valadoc_importer_gir_documentation_importer_skip_element (ValadocImporterGirDocumentationImporter* self)
891 {
892 gint level = 0;
893 g_return_if_fail (self != NULL);
894 valadoc_importer_gir_documentation_importer_next (self);
895 level = 1;
896 while (TRUE) {
897 ValaMarkupTokenType _tmp0_;
898 if (!(level > 0)) {
899 break;
900 }
901 _tmp0_ = self->priv->current_token;
902 if (_tmp0_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT) {
903 gint _tmp1_;
904 _tmp1_ = level;
905 level = _tmp1_ + 1;
906 } else {
907 ValaMarkupTokenType _tmp2_;
908 _tmp2_ = self->priv->current_token;
909 if (_tmp2_ == VALA_MARKUP_TOKEN_TYPE_END_ELEMENT) {
910 gint _tmp3_;
911 _tmp3_ = level;
912 level = _tmp3_ - 1;
913 } else {
914 ValaMarkupTokenType _tmp4_;
915 _tmp4_ = self->priv->current_token;
916 if (_tmp4_ == VALA_MARKUP_TOKEN_TYPE_EOF) {
917 valadoc_importer_gir_documentation_importer_error (self, "unexpected end of file");
918 break;
919 }
920 }
921 }
922 valadoc_importer_gir_documentation_importer_next (self);
923 }
924 }
925
926 static void
valadoc_importer_gir_documentation_importer_parse_namespace(ValadocImporterGirDocumentationImporter * self)927 valadoc_importer_gir_documentation_importer_parse_namespace (ValadocImporterGirDocumentationImporter* self)
928 {
929 g_return_if_fail (self != NULL);
930 valadoc_importer_gir_documentation_importer_start_element (self, "namespace");
931 valadoc_importer_gir_documentation_importer_next (self);
932 while (TRUE) {
933 ValaMarkupTokenType _tmp0_;
934 ValaMarkupReader* _tmp1_;
935 const gchar* _tmp2_;
936 const gchar* _tmp3_;
937 _tmp0_ = self->priv->current_token;
938 if (!(_tmp0_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
939 break;
940 }
941 _tmp1_ = self->priv->reader;
942 _tmp2_ = vala_markup_reader_get_name (_tmp1_);
943 _tmp3_ = _tmp2_;
944 if (g_strcmp0 (_tmp3_, "alias") == 0) {
945 valadoc_importer_gir_documentation_importer_parse_alias (self);
946 } else {
947 ValaMarkupReader* _tmp4_;
948 const gchar* _tmp5_;
949 const gchar* _tmp6_;
950 _tmp4_ = self->priv->reader;
951 _tmp5_ = vala_markup_reader_get_name (_tmp4_);
952 _tmp6_ = _tmp5_;
953 if (g_strcmp0 (_tmp6_, "enumeration") == 0) {
954 valadoc_importer_gir_documentation_importer_parse_enumeration (self, "enumeration");
955 } else {
956 ValaMarkupReader* _tmp7_;
957 const gchar* _tmp8_;
958 const gchar* _tmp9_;
959 _tmp7_ = self->priv->reader;
960 _tmp8_ = vala_markup_reader_get_name (_tmp7_);
961 _tmp9_ = _tmp8_;
962 if (g_strcmp0 (_tmp9_, "bitfield") == 0) {
963 valadoc_importer_gir_documentation_importer_parse_bitfield (self);
964 } else {
965 ValaMarkupReader* _tmp10_;
966 const gchar* _tmp11_;
967 const gchar* _tmp12_;
968 _tmp10_ = self->priv->reader;
969 _tmp11_ = vala_markup_reader_get_name (_tmp10_);
970 _tmp12_ = _tmp11_;
971 if (g_strcmp0 (_tmp12_, "function") == 0) {
972 valadoc_importer_gir_documentation_importer_parse_method (self, "function");
973 } else {
974 ValaMarkupReader* _tmp13_;
975 const gchar* _tmp14_;
976 const gchar* _tmp15_;
977 _tmp13_ = self->priv->reader;
978 _tmp14_ = vala_markup_reader_get_name (_tmp13_);
979 _tmp15_ = _tmp14_;
980 if (g_strcmp0 (_tmp15_, "function-macro") == 0) {
981 valadoc_importer_gir_documentation_importer_skip_element (self);
982 } else {
983 ValaMarkupReader* _tmp16_;
984 const gchar* _tmp17_;
985 const gchar* _tmp18_;
986 _tmp16_ = self->priv->reader;
987 _tmp17_ = vala_markup_reader_get_name (_tmp16_);
988 _tmp18_ = _tmp17_;
989 if (g_strcmp0 (_tmp18_, "callback") == 0) {
990 valadoc_importer_gir_documentation_importer_parse_callback (self);
991 } else {
992 ValaMarkupReader* _tmp19_;
993 const gchar* _tmp20_;
994 const gchar* _tmp21_;
995 _tmp19_ = self->priv->reader;
996 _tmp20_ = vala_markup_reader_get_name (_tmp19_);
997 _tmp21_ = _tmp20_;
998 if (g_strcmp0 (_tmp21_, "record") == 0) {
999 valadoc_importer_gir_documentation_importer_parse_record (self);
1000 } else {
1001 ValaMarkupReader* _tmp22_;
1002 const gchar* _tmp23_;
1003 const gchar* _tmp24_;
1004 _tmp22_ = self->priv->reader;
1005 _tmp23_ = vala_markup_reader_get_name (_tmp22_);
1006 _tmp24_ = _tmp23_;
1007 if (g_strcmp0 (_tmp24_, "class") == 0) {
1008 valadoc_importer_gir_documentation_importer_parse_class (self);
1009 } else {
1010 ValaMarkupReader* _tmp25_;
1011 const gchar* _tmp26_;
1012 const gchar* _tmp27_;
1013 _tmp25_ = self->priv->reader;
1014 _tmp26_ = vala_markup_reader_get_name (_tmp25_);
1015 _tmp27_ = _tmp26_;
1016 if (g_strcmp0 (_tmp27_, "interface") == 0) {
1017 valadoc_importer_gir_documentation_importer_parse_interface (self);
1018 } else {
1019 ValaMarkupReader* _tmp28_;
1020 const gchar* _tmp29_;
1021 const gchar* _tmp30_;
1022 _tmp28_ = self->priv->reader;
1023 _tmp29_ = vala_markup_reader_get_name (_tmp28_);
1024 _tmp30_ = _tmp29_;
1025 if (g_strcmp0 (_tmp30_, "glib:boxed") == 0) {
1026 valadoc_importer_gir_documentation_importer_parse_boxed (self, "glib:boxed");
1027 } else {
1028 ValaMarkupReader* _tmp31_;
1029 const gchar* _tmp32_;
1030 const gchar* _tmp33_;
1031 _tmp31_ = self->priv->reader;
1032 _tmp32_ = vala_markup_reader_get_name (_tmp31_);
1033 _tmp33_ = _tmp32_;
1034 if (g_strcmp0 (_tmp33_, "union") == 0) {
1035 valadoc_importer_gir_documentation_importer_parse_union (self);
1036 } else {
1037 ValaMarkupReader* _tmp34_;
1038 const gchar* _tmp35_;
1039 const gchar* _tmp36_;
1040 _tmp34_ = self->priv->reader;
1041 _tmp35_ = vala_markup_reader_get_name (_tmp34_);
1042 _tmp36_ = _tmp35_;
1043 if (g_strcmp0 (_tmp36_, "constant") == 0) {
1044 valadoc_importer_gir_documentation_importer_parse_constant (self);
1045 } else {
1046 ValaMarkupReader* _tmp37_;
1047 const gchar* _tmp38_;
1048 const gchar* _tmp39_;
1049 _tmp37_ = self->priv->reader;
1050 _tmp38_ = vala_markup_reader_get_name (_tmp37_);
1051 _tmp39_ = _tmp38_;
1052 if (g_strcmp0 (_tmp39_, "docsection") == 0) {
1053 valadoc_importer_gir_documentation_importer_skip_element (self);
1054 } else {
1055 ValaMarkupReader* _tmp40_;
1056 const gchar* _tmp41_;
1057 const gchar* _tmp42_;
1058 gchar* _tmp43_;
1059 gchar* _tmp44_;
1060 _tmp40_ = self->priv->reader;
1061 _tmp41_ = vala_markup_reader_get_name (_tmp40_);
1062 _tmp42_ = _tmp41_;
1063 _tmp43_ = g_strdup_printf ("unknown child element `%s' in `namespace'", _tmp42_);
1064 _tmp44_ = _tmp43_;
1065 valadoc_importer_gir_documentation_importer_error (self, _tmp44_);
1066 _g_free0 (_tmp44_);
1067 valadoc_importer_gir_documentation_importer_skip_element (self);
1068 }
1069 }
1070 }
1071 }
1072 }
1073 }
1074 }
1075 }
1076 }
1077 }
1078 }
1079 }
1080 }
1081 }
1082 valadoc_importer_gir_documentation_importer_end_element (self, "namespace");
1083 }
1084
1085 static void
valadoc_importer_gir_documentation_importer_parse_alias(ValadocImporterGirDocumentationImporter * self)1086 valadoc_importer_gir_documentation_importer_parse_alias (ValadocImporterGirDocumentationImporter* self)
1087 {
1088 gchar* c_identifier = NULL;
1089 ValaMarkupReader* _tmp0_;
1090 gchar* _tmp1_;
1091 ValadocApiGirSourceComment* comment = NULL;
1092 ValadocApiGirSourceComment* _tmp2_;
1093 g_return_if_fail (self != NULL);
1094 valadoc_importer_gir_documentation_importer_start_element (self, "alias");
1095 _tmp0_ = self->priv->reader;
1096 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "c:type");
1097 c_identifier = _tmp1_;
1098 valadoc_importer_gir_documentation_importer_next (self);
1099 _tmp2_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
1100 comment = _tmp2_;
1101 valadoc_importer_gir_documentation_importer_attach_comment (self, c_identifier, comment, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
1102 valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
1103 valadoc_importer_gir_documentation_importer_end_element (self, "alias");
1104 _valadoc_api_source_comment_unref0 (comment);
1105 _g_free0 (c_identifier);
1106 }
1107
1108 static ValadocApiGirSourceComment*
valadoc_importer_gir_documentation_importer_parse_symbol_doc(ValadocImporterGirDocumentationImporter * self)1109 valadoc_importer_gir_documentation_importer_parse_symbol_doc (ValadocImporterGirDocumentationImporter* self)
1110 {
1111 ValadocApiGirSourceComment* comment = NULL;
1112 ValadocApiSourceComment* doc_deprecated = NULL;
1113 ValadocApiSourceComment* doc_version = NULL;
1114 ValadocApiSourceComment* doc_stability = NULL;
1115 ValadocApiGirSourceComment* _tmp32_;
1116 ValadocApiGirSourceComment* result = NULL;
1117 g_return_val_if_fail (self != NULL, NULL);
1118 comment = NULL;
1119 doc_deprecated = NULL;
1120 doc_version = NULL;
1121 doc_stability = NULL;
1122 while (TRUE) {
1123 ValaMarkupTokenType _tmp0_;
1124 ValaMarkupReader* _tmp1_;
1125 const gchar* _tmp2_;
1126 const gchar* _tmp3_;
1127 _tmp0_ = self->priv->current_token;
1128 if (!(_tmp0_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
1129 break;
1130 }
1131 _tmp1_ = self->priv->reader;
1132 _tmp2_ = vala_markup_reader_get_name (_tmp1_);
1133 _tmp3_ = _tmp2_;
1134 if (g_strcmp0 (_tmp3_, "doc") == 0) {
1135 ValaMarkupTokenType _tmp4_;
1136 valadoc_importer_gir_documentation_importer_start_element (self, "doc");
1137 valadoc_importer_gir_documentation_importer_next (self);
1138 _tmp4_ = self->priv->current_token;
1139 if (_tmp4_ == VALA_MARKUP_TOKEN_TYPE_TEXT) {
1140 ValaMarkupReader* _tmp5_;
1141 const gchar* _tmp6_;
1142 const gchar* _tmp7_;
1143 ValadocApiSourceFile* _tmp8_;
1144 ValaSourceLocation _tmp9_;
1145 ValaSourceLocation _tmp10_;
1146 ValaSourceLocation _tmp11_;
1147 ValaSourceLocation _tmp12_;
1148 ValadocApiGirSourceComment* _tmp13_;
1149 _tmp5_ = self->priv->reader;
1150 _tmp6_ = vala_markup_reader_get_content (_tmp5_);
1151 _tmp7_ = _tmp6_;
1152 _tmp8_ = self->priv->file;
1153 _tmp9_ = self->priv->begin;
1154 _tmp10_ = self->priv->begin;
1155 _tmp11_ = self->priv->end;
1156 _tmp12_ = self->priv->end;
1157 _tmp13_ = valadoc_api_gir_source_comment_new (_tmp7_, _tmp8_, _tmp9_.line, _tmp10_.column, _tmp11_.line, _tmp12_.column);
1158 _valadoc_api_source_comment_unref0 (comment);
1159 comment = _tmp13_;
1160 valadoc_importer_gir_documentation_importer_next (self);
1161 }
1162 valadoc_importer_gir_documentation_importer_end_element (self, "doc");
1163 } else {
1164 ValaMarkupReader* _tmp14_;
1165 const gchar* _tmp15_;
1166 const gchar* _tmp16_;
1167 _tmp14_ = self->priv->reader;
1168 _tmp15_ = vala_markup_reader_get_name (_tmp14_);
1169 _tmp16_ = _tmp15_;
1170 if (g_strcmp0 (_tmp16_, "doc-deprecated") == 0) {
1171 ValadocApiSourceComment* _tmp17_;
1172 _tmp17_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc-deprecated");
1173 _valadoc_api_source_comment_unref0 (doc_deprecated);
1174 doc_deprecated = _tmp17_;
1175 } else {
1176 ValaMarkupReader* _tmp18_;
1177 const gchar* _tmp19_;
1178 const gchar* _tmp20_;
1179 _tmp18_ = self->priv->reader;
1180 _tmp19_ = vala_markup_reader_get_name (_tmp18_);
1181 _tmp20_ = _tmp19_;
1182 if (g_strcmp0 (_tmp20_, "doc-version") == 0) {
1183 ValadocApiSourceComment* _tmp21_;
1184 _tmp21_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc-version");
1185 _valadoc_api_source_comment_unref0 (doc_version);
1186 doc_version = _tmp21_;
1187 } else {
1188 ValaMarkupReader* _tmp22_;
1189 const gchar* _tmp23_;
1190 const gchar* _tmp24_;
1191 _tmp22_ = self->priv->reader;
1192 _tmp23_ = vala_markup_reader_get_name (_tmp22_);
1193 _tmp24_ = _tmp23_;
1194 if (g_strcmp0 (_tmp24_, "doc-stability") == 0) {
1195 ValadocApiSourceComment* _tmp25_;
1196 _tmp25_ = valadoc_importer_gir_documentation_importer_parse_doc (self, "doc-stability");
1197 _valadoc_api_source_comment_unref0 (doc_stability);
1198 doc_stability = _tmp25_;
1199 } else {
1200 ValaMarkupReader* _tmp26_;
1201 const gchar* _tmp27_;
1202 const gchar* _tmp28_;
1203 _tmp26_ = self->priv->reader;
1204 _tmp27_ = vala_markup_reader_get_name (_tmp26_);
1205 _tmp28_ = _tmp27_;
1206 if (g_strcmp0 (_tmp28_, "source-position") == 0) {
1207 valadoc_importer_gir_documentation_importer_skip_element (self);
1208 } else {
1209 ValaMarkupReader* _tmp29_;
1210 const gchar* _tmp30_;
1211 const gchar* _tmp31_;
1212 _tmp29_ = self->priv->reader;
1213 _tmp30_ = vala_markup_reader_get_name (_tmp29_);
1214 _tmp31_ = _tmp30_;
1215 if (g_strcmp0 (_tmp31_, "attribute") == 0) {
1216 valadoc_importer_gir_documentation_importer_skip_element (self);
1217 } else {
1218 break;
1219 }
1220 }
1221 }
1222 }
1223 }
1224 }
1225 }
1226 _tmp32_ = comment;
1227 if (_tmp32_ != NULL) {
1228 ValadocApiGirSourceComment* _tmp33_;
1229 ValadocApiSourceComment* _tmp34_;
1230 ValadocApiGirSourceComment* _tmp35_;
1231 ValadocApiSourceComment* _tmp36_;
1232 ValadocApiGirSourceComment* _tmp37_;
1233 ValadocApiSourceComment* _tmp38_;
1234 _tmp33_ = comment;
1235 _tmp34_ = doc_deprecated;
1236 valadoc_api_gir_source_comment_set_deprecated_comment (_tmp33_, _tmp34_);
1237 _tmp35_ = comment;
1238 _tmp36_ = doc_version;
1239 valadoc_api_gir_source_comment_set_version_comment (_tmp35_, _tmp36_);
1240 _tmp37_ = comment;
1241 _tmp38_ = doc_stability;
1242 valadoc_api_gir_source_comment_set_stability_comment (_tmp37_, _tmp38_);
1243 }
1244 result = comment;
1245 _valadoc_api_source_comment_unref0 (doc_stability);
1246 _valadoc_api_source_comment_unref0 (doc_version);
1247 _valadoc_api_source_comment_unref0 (doc_deprecated);
1248 return result;
1249 }
1250
1251 static ValadocApiSourceComment*
valadoc_importer_gir_documentation_importer_parse_doc(ValadocImporterGirDocumentationImporter * self,const gchar * element_name)1252 valadoc_importer_gir_documentation_importer_parse_doc (ValadocImporterGirDocumentationImporter* self,
1253 const gchar* element_name)
1254 {
1255 ValaMarkupReader* _tmp0_;
1256 const gchar* _tmp1_;
1257 const gchar* _tmp2_;
1258 ValadocApiSourceComment* comment = NULL;
1259 ValaMarkupTokenType _tmp3_;
1260 ValadocApiSourceComment* result = NULL;
1261 g_return_val_if_fail (self != NULL, NULL);
1262 g_return_val_if_fail (element_name != NULL, NULL);
1263 _tmp0_ = self->priv->reader;
1264 _tmp1_ = vala_markup_reader_get_name (_tmp0_);
1265 _tmp2_ = _tmp1_;
1266 if (g_strcmp0 (_tmp2_, element_name) != 0) {
1267 result = NULL;
1268 return result;
1269 }
1270 valadoc_importer_gir_documentation_importer_start_element (self, element_name);
1271 valadoc_importer_gir_documentation_importer_next (self);
1272 comment = NULL;
1273 _tmp3_ = self->priv->current_token;
1274 if (_tmp3_ == VALA_MARKUP_TOKEN_TYPE_TEXT) {
1275 ValaMarkupReader* _tmp4_;
1276 const gchar* _tmp5_;
1277 const gchar* _tmp6_;
1278 ValadocApiSourceFile* _tmp7_;
1279 ValaSourceLocation _tmp8_;
1280 ValaSourceLocation _tmp9_;
1281 ValaSourceLocation _tmp10_;
1282 ValaSourceLocation _tmp11_;
1283 ValadocApiSourceComment* _tmp12_;
1284 _tmp4_ = self->priv->reader;
1285 _tmp5_ = vala_markup_reader_get_content (_tmp4_);
1286 _tmp6_ = _tmp5_;
1287 _tmp7_ = self->priv->file;
1288 _tmp8_ = self->priv->begin;
1289 _tmp9_ = self->priv->begin;
1290 _tmp10_ = self->priv->end;
1291 _tmp11_ = self->priv->end;
1292 _tmp12_ = valadoc_api_source_comment_new (_tmp6_, _tmp7_, _tmp8_.line, _tmp9_.column, _tmp10_.line, _tmp11_.column);
1293 _valadoc_api_source_comment_unref0 (comment);
1294 comment = _tmp12_;
1295 valadoc_importer_gir_documentation_importer_next (self);
1296 }
1297 valadoc_importer_gir_documentation_importer_end_element (self, element_name);
1298 result = comment;
1299 return result;
1300 }
1301
1302 static void
valadoc_importer_gir_documentation_importer_parse_enumeration(ValadocImporterGirDocumentationImporter * self,const gchar * element_name)1303 valadoc_importer_gir_documentation_importer_parse_enumeration (ValadocImporterGirDocumentationImporter* self,
1304 const gchar* element_name)
1305 {
1306 ValaMarkupReader* _tmp0_;
1307 gchar* _tmp1_;
1308 ValadocApiGirSourceComment* comment = NULL;
1309 ValadocApiGirSourceComment* _tmp2_;
1310 const gchar* _tmp3_;
1311 ValadocApiGirSourceComment* _tmp4_;
1312 g_return_if_fail (self != NULL);
1313 g_return_if_fail (element_name != NULL);
1314 valadoc_importer_gir_documentation_importer_start_element (self, element_name);
1315 _tmp0_ = self->priv->reader;
1316 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "c:type");
1317 _g_free0 (self->priv->parent_c_identifier);
1318 self->priv->parent_c_identifier = _tmp1_;
1319 valadoc_importer_gir_documentation_importer_next (self);
1320 _tmp2_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
1321 comment = _tmp2_;
1322 _tmp3_ = self->priv->parent_c_identifier;
1323 _tmp4_ = comment;
1324 valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp3_, _tmp4_, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
1325 while (TRUE) {
1326 ValaMarkupTokenType _tmp5_;
1327 ValaMarkupReader* _tmp6_;
1328 const gchar* _tmp7_;
1329 const gchar* _tmp8_;
1330 _tmp5_ = self->priv->current_token;
1331 if (!(_tmp5_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
1332 break;
1333 }
1334 _tmp6_ = self->priv->reader;
1335 _tmp7_ = vala_markup_reader_get_name (_tmp6_);
1336 _tmp8_ = _tmp7_;
1337 if (g_strcmp0 (_tmp8_, "member") == 0) {
1338 valadoc_importer_gir_documentation_importer_parse_enumeration_member (self);
1339 } else {
1340 ValaMarkupReader* _tmp9_;
1341 const gchar* _tmp10_;
1342 const gchar* _tmp11_;
1343 _tmp9_ = self->priv->reader;
1344 _tmp10_ = vala_markup_reader_get_name (_tmp9_);
1345 _tmp11_ = _tmp10_;
1346 if (g_strcmp0 (_tmp11_, "function") == 0) {
1347 valadoc_importer_gir_documentation_importer_skip_element (self);
1348 } else {
1349 ValaMarkupReader* _tmp12_;
1350 const gchar* _tmp13_;
1351 const gchar* _tmp14_;
1352 gchar* _tmp15_;
1353 gchar* _tmp16_;
1354 _tmp12_ = self->priv->reader;
1355 _tmp13_ = vala_markup_reader_get_name (_tmp12_);
1356 _tmp14_ = _tmp13_;
1357 _tmp15_ = g_strdup_printf ("unknown child element `%s' in `%s'", _tmp14_, element_name);
1358 _tmp16_ = _tmp15_;
1359 valadoc_importer_gir_documentation_importer_error (self, _tmp16_);
1360 _g_free0 (_tmp16_);
1361 valadoc_importer_gir_documentation_importer_skip_element (self);
1362 }
1363 }
1364 }
1365 _g_free0 (self->priv->parent_c_identifier);
1366 self->priv->parent_c_identifier = NULL;
1367 valadoc_importer_gir_documentation_importer_end_element (self, element_name);
1368 _valadoc_api_source_comment_unref0 (comment);
1369 }
1370
1371 static void
valadoc_importer_gir_documentation_importer_parse_bitfield(ValadocImporterGirDocumentationImporter * self)1372 valadoc_importer_gir_documentation_importer_parse_bitfield (ValadocImporterGirDocumentationImporter* self)
1373 {
1374 g_return_if_fail (self != NULL);
1375 valadoc_importer_gir_documentation_importer_parse_enumeration (self, "bitfield");
1376 }
1377
1378 static void
valadoc_importer_gir_documentation_importer_parse_enumeration_member(ValadocImporterGirDocumentationImporter * self)1379 valadoc_importer_gir_documentation_importer_parse_enumeration_member (ValadocImporterGirDocumentationImporter* self)
1380 {
1381 gchar* c_identifier = NULL;
1382 ValaMarkupReader* _tmp0_;
1383 gchar* _tmp1_;
1384 ValadocApiGirSourceComment* comment = NULL;
1385 ValadocApiGirSourceComment* _tmp2_;
1386 g_return_if_fail (self != NULL);
1387 valadoc_importer_gir_documentation_importer_start_element (self, "member");
1388 _tmp0_ = self->priv->reader;
1389 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "c:identifier");
1390 c_identifier = _tmp1_;
1391 valadoc_importer_gir_documentation_importer_next (self);
1392 _tmp2_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
1393 comment = _tmp2_;
1394 valadoc_importer_gir_documentation_importer_attach_comment (self, c_identifier, comment, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
1395 valadoc_importer_gir_documentation_importer_end_element (self, "member");
1396 _valadoc_api_source_comment_unref0 (comment);
1397 _g_free0 (c_identifier);
1398 }
1399
1400 static void
valadoc_importer_gir_documentation_importer_parse_return_value(ValadocImporterGirDocumentationImporter * self,ValadocApiSourceComment ** comment,gint * array_length_ret)1401 valadoc_importer_gir_documentation_importer_parse_return_value (ValadocImporterGirDocumentationImporter* self,
1402 ValadocApiSourceComment* * comment,
1403 gint* array_length_ret)
1404 {
1405 ValadocApiSourceComment* _vala_comment = NULL;
1406 gint _vala_array_length_ret = 0;
1407 ValadocApiGirSourceComment* _tmp0_;
1408 gint _tmp1_ = 0;
1409 g_return_if_fail (self != NULL);
1410 valadoc_importer_gir_documentation_importer_start_element (self, "return-value");
1411 valadoc_importer_gir_documentation_importer_next (self);
1412 _tmp0_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
1413 _valadoc_api_source_comment_unref0 (_vala_comment);
1414 _vala_comment = (ValadocApiSourceComment*) _tmp0_;
1415 valadoc_importer_gir_documentation_importer_parse_type (self, &_tmp1_);
1416 _vala_array_length_ret = _tmp1_;
1417 valadoc_importer_gir_documentation_importer_end_element (self, "return-value");
1418 if (comment) {
1419 *comment = _vala_comment;
1420 } else {
1421 _valadoc_api_source_comment_unref0 (_vala_comment);
1422 }
1423 if (array_length_ret) {
1424 *array_length_ret = _vala_array_length_ret;
1425 }
1426 }
1427
1428 static void
valadoc_importer_gir_documentation_importer_parse_parameter(ValadocImporterGirDocumentationImporter * self,ValadocApiSourceComment ** comment,gchar ** param_name,gint * destroy_pos,gint * closure_pos,gint * array_length_pos)1429 valadoc_importer_gir_documentation_importer_parse_parameter (ValadocImporterGirDocumentationImporter* self,
1430 ValadocApiSourceComment* * comment,
1431 gchar* * param_name,
1432 gint* destroy_pos,
1433 gint* closure_pos,
1434 gint* array_length_pos)
1435 {
1436 ValadocApiSourceComment* _vala_comment = NULL;
1437 gchar* _vala_param_name = NULL;
1438 gint _vala_destroy_pos = 0;
1439 gint _vala_closure_pos = 0;
1440 gint _vala_array_length_pos = 0;
1441 ValaMarkupReader* _tmp0_;
1442 gchar* _tmp1_;
1443 gchar* closure = NULL;
1444 ValaMarkupReader* _tmp2_;
1445 gchar* _tmp3_;
1446 const gchar* _tmp4_;
1447 gchar* destroy = NULL;
1448 ValaMarkupReader* _tmp6_;
1449 gchar* _tmp7_;
1450 const gchar* _tmp8_;
1451 ValadocApiGirSourceComment* _tmp10_;
1452 ValaMarkupReader* _tmp11_;
1453 const gchar* _tmp12_;
1454 const gchar* _tmp13_;
1455 g_return_if_fail (self != NULL);
1456 valadoc_importer_gir_documentation_importer_start_element (self, "parameter");
1457 _tmp0_ = self->priv->reader;
1458 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "name");
1459 _g_free0 (_vala_param_name);
1460 _vala_param_name = _tmp1_;
1461 _vala_array_length_pos = -1;
1462 _vala_destroy_pos = -1;
1463 _vala_closure_pos = -1;
1464 _tmp2_ = self->priv->reader;
1465 _tmp3_ = vala_markup_reader_get_attribute (_tmp2_, "closure");
1466 closure = _tmp3_;
1467 _tmp4_ = closure;
1468 if (_tmp4_ != NULL) {
1469 const gchar* _tmp5_;
1470 _tmp5_ = closure;
1471 _vala_closure_pos = atoi (_tmp5_);
1472 if (_vala_closure_pos < 0) {
1473 valadoc_importer_gir_documentation_importer_warning (self, "invalid closure position");
1474 }
1475 }
1476 _tmp6_ = self->priv->reader;
1477 _tmp7_ = vala_markup_reader_get_attribute (_tmp6_, "destroy");
1478 destroy = _tmp7_;
1479 _tmp8_ = destroy;
1480 if (_tmp8_ != NULL) {
1481 const gchar* _tmp9_;
1482 _tmp9_ = destroy;
1483 _vala_destroy_pos = atoi (_tmp9_);
1484 if (_vala_destroy_pos < 0) {
1485 valadoc_importer_gir_documentation_importer_warning (self, "invalid destroy position");
1486 }
1487 }
1488 valadoc_importer_gir_documentation_importer_next (self);
1489 _tmp10_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
1490 _valadoc_api_source_comment_unref0 (_vala_comment);
1491 _vala_comment = (ValadocApiSourceComment*) _tmp10_;
1492 _tmp11_ = self->priv->reader;
1493 _tmp12_ = vala_markup_reader_get_name (_tmp11_);
1494 _tmp13_ = _tmp12_;
1495 if (g_strcmp0 (_tmp13_, "varargs") == 0) {
1496 gchar* _tmp14_;
1497 valadoc_importer_gir_documentation_importer_start_element (self, "varargs");
1498 _tmp14_ = g_strdup ("...");
1499 _g_free0 (_vala_param_name);
1500 _vala_param_name = _tmp14_;
1501 valadoc_importer_gir_documentation_importer_next (self);
1502 valadoc_importer_gir_documentation_importer_end_element (self, "varargs");
1503 } else {
1504 gint _tmp15_ = 0;
1505 valadoc_importer_gir_documentation_importer_parse_type (self, &_tmp15_);
1506 _vala_array_length_pos = _tmp15_;
1507 }
1508 valadoc_importer_gir_documentation_importer_end_element (self, "parameter");
1509 _g_free0 (destroy);
1510 _g_free0 (closure);
1511 if (comment) {
1512 *comment = _vala_comment;
1513 } else {
1514 _valadoc_api_source_comment_unref0 (_vala_comment);
1515 }
1516 if (param_name) {
1517 *param_name = _vala_param_name;
1518 } else {
1519 _g_free0 (_vala_param_name);
1520 }
1521 if (destroy_pos) {
1522 *destroy_pos = _vala_destroy_pos;
1523 }
1524 if (closure_pos) {
1525 *closure_pos = _vala_closure_pos;
1526 }
1527 if (array_length_pos) {
1528 *array_length_pos = _vala_array_length_pos;
1529 }
1530 }
1531
1532 static void
valadoc_importer_gir_documentation_importer_parse_type(ValadocImporterGirDocumentationImporter * self,gint * array_length_pos)1533 valadoc_importer_gir_documentation_importer_parse_type (ValadocImporterGirDocumentationImporter* self,
1534 gint* array_length_pos)
1535 {
1536 gint _vala_array_length_pos = 0;
1537 ValaMarkupReader* _tmp0_;
1538 const gchar* _tmp1_;
1539 const gchar* _tmp2_;
1540 g_return_if_fail (self != NULL);
1541 _vala_array_length_pos = -1;
1542 _tmp0_ = self->priv->reader;
1543 _tmp1_ = vala_markup_reader_get_name (_tmp0_);
1544 _tmp2_ = _tmp1_;
1545 if (g_strcmp0 (_tmp2_, "array") == 0) {
1546 gchar* length = NULL;
1547 ValaMarkupReader* _tmp3_;
1548 gchar* _tmp4_;
1549 const gchar* _tmp5_;
1550 _tmp3_ = self->priv->reader;
1551 _tmp4_ = vala_markup_reader_get_attribute (_tmp3_, "length");
1552 length = _tmp4_;
1553 _tmp5_ = length;
1554 if (_tmp5_ != NULL) {
1555 const gchar* _tmp6_;
1556 _tmp6_ = length;
1557 _vala_array_length_pos = atoi (_tmp6_);
1558 if (_vala_array_length_pos < 0) {
1559 valadoc_importer_gir_documentation_importer_warning (self, "invalid array length position");
1560 }
1561 }
1562 valadoc_importer_gir_documentation_importer_skip_element (self);
1563 _g_free0 (length);
1564 } else {
1565 valadoc_importer_gir_documentation_importer_skip_element (self);
1566 }
1567 if (array_length_pos) {
1568 *array_length_pos = _vala_array_length_pos;
1569 }
1570 }
1571
1572 static void
valadoc_importer_gir_documentation_importer_parse_record(ValadocImporterGirDocumentationImporter * self)1573 valadoc_importer_gir_documentation_importer_parse_record (ValadocImporterGirDocumentationImporter* self)
1574 {
1575 ValaMarkupReader* _tmp0_;
1576 gchar* _tmp1_;
1577 const gchar* _tmp2_;
1578 const gchar* _tmp5_;
1579 gboolean is_type_struct = FALSE;
1580 ValaMarkupReader* _tmp6_;
1581 gchar* _tmp7_;
1582 gchar* _tmp8_;
1583 gboolean _tmp9_;
1584 ValadocApiGirSourceComment* comment = NULL;
1585 ValadocApiGirSourceComment* _tmp10_;
1586 g_return_if_fail (self != NULL);
1587 valadoc_importer_gir_documentation_importer_start_element (self, "record");
1588 _tmp0_ = self->priv->reader;
1589 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "c:type");
1590 _g_free0 (self->priv->parent_c_identifier);
1591 self->priv->parent_c_identifier = _tmp1_;
1592 _tmp2_ = self->priv->parent_c_identifier;
1593 if (_tmp2_ == NULL) {
1594 ValaMarkupReader* _tmp3_;
1595 gchar* _tmp4_;
1596 _tmp3_ = self->priv->reader;
1597 _tmp4_ = vala_markup_reader_get_attribute (_tmp3_, "glib:type-name");
1598 _g_free0 (self->priv->parent_c_identifier);
1599 self->priv->parent_c_identifier = _tmp4_;
1600 }
1601 _tmp5_ = self->priv->parent_c_identifier;
1602 if (g_str_has_suffix (_tmp5_, "Private")) {
1603 _g_free0 (self->priv->parent_c_identifier);
1604 self->priv->parent_c_identifier = NULL;
1605 valadoc_importer_gir_documentation_importer_skip_element (self);
1606 return;
1607 }
1608 _tmp6_ = self->priv->reader;
1609 _tmp7_ = vala_markup_reader_get_attribute (_tmp6_, "glib:is-gtype-struct-for");
1610 _tmp8_ = _tmp7_;
1611 _tmp9_ = _tmp8_ != NULL;
1612 _g_free0 (_tmp8_);
1613 is_type_struct = _tmp9_;
1614 valadoc_importer_gir_documentation_importer_next (self);
1615 _tmp10_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
1616 comment = _tmp10_;
1617 if (is_type_struct == FALSE) {
1618 const gchar* _tmp11_;
1619 ValadocApiGirSourceComment* _tmp12_;
1620 _tmp11_ = self->priv->parent_c_identifier;
1621 _tmp12_ = comment;
1622 valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp11_, _tmp12_, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
1623 }
1624 while (TRUE) {
1625 ValaMarkupTokenType _tmp13_;
1626 ValaMarkupReader* _tmp14_;
1627 const gchar* _tmp15_;
1628 const gchar* _tmp16_;
1629 _tmp13_ = self->priv->current_token;
1630 if (!(_tmp13_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
1631 break;
1632 }
1633 _tmp14_ = self->priv->reader;
1634 _tmp15_ = vala_markup_reader_get_name (_tmp14_);
1635 _tmp16_ = _tmp15_;
1636 if (g_strcmp0 (_tmp16_, "field") == 0) {
1637 valadoc_importer_gir_documentation_importer_parse_field (self);
1638 } else {
1639 ValaMarkupReader* _tmp17_;
1640 const gchar* _tmp18_;
1641 const gchar* _tmp19_;
1642 _tmp17_ = self->priv->reader;
1643 _tmp18_ = vala_markup_reader_get_name (_tmp17_);
1644 _tmp19_ = _tmp18_;
1645 if (g_strcmp0 (_tmp19_, "constructor") == 0) {
1646 valadoc_importer_gir_documentation_importer_parse_constructor (self);
1647 } else {
1648 ValaMarkupReader* _tmp20_;
1649 const gchar* _tmp21_;
1650 const gchar* _tmp22_;
1651 _tmp20_ = self->priv->reader;
1652 _tmp21_ = vala_markup_reader_get_name (_tmp20_);
1653 _tmp22_ = _tmp21_;
1654 if (g_strcmp0 (_tmp22_, "method") == 0) {
1655 valadoc_importer_gir_documentation_importer_parse_method (self, "method");
1656 } else {
1657 ValaMarkupReader* _tmp23_;
1658 const gchar* _tmp24_;
1659 const gchar* _tmp25_;
1660 _tmp23_ = self->priv->reader;
1661 _tmp24_ = vala_markup_reader_get_name (_tmp23_);
1662 _tmp25_ = _tmp24_;
1663 if (g_strcmp0 (_tmp25_, "function") == 0) {
1664 valadoc_importer_gir_documentation_importer_skip_element (self);
1665 } else {
1666 ValaMarkupReader* _tmp26_;
1667 const gchar* _tmp27_;
1668 const gchar* _tmp28_;
1669 _tmp26_ = self->priv->reader;
1670 _tmp27_ = vala_markup_reader_get_name (_tmp26_);
1671 _tmp28_ = _tmp27_;
1672 if (g_strcmp0 (_tmp28_, "union") == 0) {
1673 valadoc_importer_gir_documentation_importer_parse_union (self);
1674 } else {
1675 ValaMarkupReader* _tmp29_;
1676 const gchar* _tmp30_;
1677 const gchar* _tmp31_;
1678 gchar* _tmp32_;
1679 gchar* _tmp33_;
1680 _tmp29_ = self->priv->reader;
1681 _tmp30_ = vala_markup_reader_get_name (_tmp29_);
1682 _tmp31_ = _tmp30_;
1683 _tmp32_ = g_strdup_printf ("unknown child element `%s' in `record'", _tmp31_);
1684 _tmp33_ = _tmp32_;
1685 valadoc_importer_gir_documentation_importer_error (self, _tmp33_);
1686 _g_free0 (_tmp33_);
1687 valadoc_importer_gir_documentation_importer_skip_element (self);
1688 }
1689 }
1690 }
1691 }
1692 }
1693 }
1694 _g_free0 (self->priv->parent_c_identifier);
1695 self->priv->parent_c_identifier = NULL;
1696 valadoc_importer_gir_documentation_importer_end_element (self, "record");
1697 _valadoc_api_source_comment_unref0 (comment);
1698 }
1699
1700 static void
valadoc_importer_gir_documentation_importer_parse_class(ValadocImporterGirDocumentationImporter * self)1701 valadoc_importer_gir_documentation_importer_parse_class (ValadocImporterGirDocumentationImporter* self)
1702 {
1703 ValaMarkupReader* _tmp0_;
1704 gchar* _tmp1_;
1705 const gchar* _tmp2_;
1706 ValadocApiGirSourceComment* comment = NULL;
1707 ValadocApiGirSourceComment* _tmp5_;
1708 const gchar* _tmp6_;
1709 ValadocApiGirSourceComment* _tmp7_;
1710 g_return_if_fail (self != NULL);
1711 valadoc_importer_gir_documentation_importer_start_element (self, "class");
1712 _tmp0_ = self->priv->reader;
1713 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "c:type");
1714 _g_free0 (self->priv->parent_c_identifier);
1715 self->priv->parent_c_identifier = _tmp1_;
1716 _tmp2_ = self->priv->parent_c_identifier;
1717 if (_tmp2_ == NULL) {
1718 ValaMarkupReader* _tmp3_;
1719 gchar* _tmp4_;
1720 _tmp3_ = self->priv->reader;
1721 _tmp4_ = vala_markup_reader_get_attribute (_tmp3_, "glib:type-name");
1722 _g_free0 (self->priv->parent_c_identifier);
1723 self->priv->parent_c_identifier = _tmp4_;
1724 }
1725 valadoc_importer_gir_documentation_importer_next (self);
1726 _tmp5_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
1727 comment = _tmp5_;
1728 _tmp6_ = self->priv->parent_c_identifier;
1729 _tmp7_ = comment;
1730 valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp6_, _tmp7_, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
1731 while (TRUE) {
1732 ValaMarkupTokenType _tmp8_;
1733 ValaMarkupReader* _tmp9_;
1734 const gchar* _tmp10_;
1735 const gchar* _tmp11_;
1736 _tmp8_ = self->priv->current_token;
1737 if (!(_tmp8_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
1738 break;
1739 }
1740 _tmp9_ = self->priv->reader;
1741 _tmp10_ = vala_markup_reader_get_name (_tmp9_);
1742 _tmp11_ = _tmp10_;
1743 if (g_strcmp0 (_tmp11_, "implements") == 0) {
1744 valadoc_importer_gir_documentation_importer_skip_element (self);
1745 } else {
1746 ValaMarkupReader* _tmp12_;
1747 const gchar* _tmp13_;
1748 const gchar* _tmp14_;
1749 _tmp12_ = self->priv->reader;
1750 _tmp13_ = vala_markup_reader_get_name (_tmp12_);
1751 _tmp14_ = _tmp13_;
1752 if (g_strcmp0 (_tmp14_, "constant") == 0) {
1753 valadoc_importer_gir_documentation_importer_parse_constant (self);
1754 } else {
1755 ValaMarkupReader* _tmp15_;
1756 const gchar* _tmp16_;
1757 const gchar* _tmp17_;
1758 _tmp15_ = self->priv->reader;
1759 _tmp16_ = vala_markup_reader_get_name (_tmp15_);
1760 _tmp17_ = _tmp16_;
1761 if (g_strcmp0 (_tmp17_, "field") == 0) {
1762 valadoc_importer_gir_documentation_importer_parse_field (self);
1763 } else {
1764 ValaMarkupReader* _tmp18_;
1765 const gchar* _tmp19_;
1766 const gchar* _tmp20_;
1767 _tmp18_ = self->priv->reader;
1768 _tmp19_ = vala_markup_reader_get_name (_tmp18_);
1769 _tmp20_ = _tmp19_;
1770 if (g_strcmp0 (_tmp20_, "property") == 0) {
1771 valadoc_importer_gir_documentation_importer_parse_property (self);
1772 } else {
1773 ValaMarkupReader* _tmp21_;
1774 const gchar* _tmp22_;
1775 const gchar* _tmp23_;
1776 _tmp21_ = self->priv->reader;
1777 _tmp22_ = vala_markup_reader_get_name (_tmp21_);
1778 _tmp23_ = _tmp22_;
1779 if (g_strcmp0 (_tmp23_, "constructor") == 0) {
1780 valadoc_importer_gir_documentation_importer_parse_constructor (self);
1781 } else {
1782 ValaMarkupReader* _tmp24_;
1783 const gchar* _tmp25_;
1784 const gchar* _tmp26_;
1785 _tmp24_ = self->priv->reader;
1786 _tmp25_ = vala_markup_reader_get_name (_tmp24_);
1787 _tmp26_ = _tmp25_;
1788 if (g_strcmp0 (_tmp26_, "function") == 0) {
1789 valadoc_importer_gir_documentation_importer_parse_method (self, "function");
1790 } else {
1791 ValaMarkupReader* _tmp27_;
1792 const gchar* _tmp28_;
1793 const gchar* _tmp29_;
1794 _tmp27_ = self->priv->reader;
1795 _tmp28_ = vala_markup_reader_get_name (_tmp27_);
1796 _tmp29_ = _tmp28_;
1797 if (g_strcmp0 (_tmp29_, "method") == 0) {
1798 valadoc_importer_gir_documentation_importer_parse_method (self, "method");
1799 } else {
1800 ValaMarkupReader* _tmp30_;
1801 const gchar* _tmp31_;
1802 const gchar* _tmp32_;
1803 _tmp30_ = self->priv->reader;
1804 _tmp31_ = vala_markup_reader_get_name (_tmp30_);
1805 _tmp32_ = _tmp31_;
1806 if (g_strcmp0 (_tmp32_, "virtual-method") == 0) {
1807 valadoc_importer_gir_documentation_importer_parse_method (self, "virtual-method");
1808 } else {
1809 ValaMarkupReader* _tmp33_;
1810 const gchar* _tmp34_;
1811 const gchar* _tmp35_;
1812 _tmp33_ = self->priv->reader;
1813 _tmp34_ = vala_markup_reader_get_name (_tmp33_);
1814 _tmp35_ = _tmp34_;
1815 if (g_strcmp0 (_tmp35_, "union") == 0) {
1816 valadoc_importer_gir_documentation_importer_parse_union (self);
1817 } else {
1818 ValaMarkupReader* _tmp36_;
1819 const gchar* _tmp37_;
1820 const gchar* _tmp38_;
1821 _tmp36_ = self->priv->reader;
1822 _tmp37_ = vala_markup_reader_get_name (_tmp36_);
1823 _tmp38_ = _tmp37_;
1824 if (g_strcmp0 (_tmp38_, "glib:signal") == 0) {
1825 valadoc_importer_gir_documentation_importer_parse_signal (self);
1826 } else {
1827 ValaMarkupReader* _tmp39_;
1828 const gchar* _tmp40_;
1829 const gchar* _tmp41_;
1830 gchar* _tmp42_;
1831 gchar* _tmp43_;
1832 _tmp39_ = self->priv->reader;
1833 _tmp40_ = vala_markup_reader_get_name (_tmp39_);
1834 _tmp41_ = _tmp40_;
1835 _tmp42_ = g_strdup_printf ("unknown child element `%s' in `class'", _tmp41_);
1836 _tmp43_ = _tmp42_;
1837 valadoc_importer_gir_documentation_importer_error (self, _tmp43_);
1838 _g_free0 (_tmp43_);
1839 valadoc_importer_gir_documentation_importer_skip_element (self);
1840 }
1841 }
1842 }
1843 }
1844 }
1845 }
1846 }
1847 }
1848 }
1849 }
1850 }
1851 _g_free0 (self->priv->parent_c_identifier);
1852 self->priv->parent_c_identifier = NULL;
1853 valadoc_importer_gir_documentation_importer_end_element (self, "class");
1854 _valadoc_api_source_comment_unref0 (comment);
1855 }
1856
1857 static void
valadoc_importer_gir_documentation_importer_parse_interface(ValadocImporterGirDocumentationImporter * self)1858 valadoc_importer_gir_documentation_importer_parse_interface (ValadocImporterGirDocumentationImporter* self)
1859 {
1860 ValaMarkupReader* _tmp0_;
1861 gchar* _tmp1_;
1862 const gchar* _tmp2_;
1863 ValadocApiGirSourceComment* comment = NULL;
1864 ValadocApiGirSourceComment* _tmp5_;
1865 const gchar* _tmp6_;
1866 ValadocApiGirSourceComment* _tmp7_;
1867 g_return_if_fail (self != NULL);
1868 valadoc_importer_gir_documentation_importer_start_element (self, "interface");
1869 _tmp0_ = self->priv->reader;
1870 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "c:type");
1871 _g_free0 (self->priv->parent_c_identifier);
1872 self->priv->parent_c_identifier = _tmp1_;
1873 _tmp2_ = self->priv->parent_c_identifier;
1874 if (_tmp2_ == NULL) {
1875 ValaMarkupReader* _tmp3_;
1876 gchar* _tmp4_;
1877 _tmp3_ = self->priv->reader;
1878 _tmp4_ = vala_markup_reader_get_attribute (_tmp3_, "glib:type-name");
1879 _g_free0 (self->priv->parent_c_identifier);
1880 self->priv->parent_c_identifier = _tmp4_;
1881 }
1882 valadoc_importer_gir_documentation_importer_next (self);
1883 _tmp5_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
1884 comment = _tmp5_;
1885 _tmp6_ = self->priv->parent_c_identifier;
1886 _tmp7_ = comment;
1887 valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp6_, _tmp7_, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
1888 while (TRUE) {
1889 ValaMarkupTokenType _tmp8_;
1890 ValaMarkupReader* _tmp9_;
1891 const gchar* _tmp10_;
1892 const gchar* _tmp11_;
1893 _tmp8_ = self->priv->current_token;
1894 if (!(_tmp8_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
1895 break;
1896 }
1897 _tmp9_ = self->priv->reader;
1898 _tmp10_ = vala_markup_reader_get_name (_tmp9_);
1899 _tmp11_ = _tmp10_;
1900 if (g_strcmp0 (_tmp11_, "prerequisite") == 0) {
1901 valadoc_importer_gir_documentation_importer_skip_element (self);
1902 } else {
1903 ValaMarkupReader* _tmp12_;
1904 const gchar* _tmp13_;
1905 const gchar* _tmp14_;
1906 _tmp12_ = self->priv->reader;
1907 _tmp13_ = vala_markup_reader_get_name (_tmp12_);
1908 _tmp14_ = _tmp13_;
1909 if (g_strcmp0 (_tmp14_, "field") == 0) {
1910 valadoc_importer_gir_documentation_importer_parse_field (self);
1911 } else {
1912 ValaMarkupReader* _tmp15_;
1913 const gchar* _tmp16_;
1914 const gchar* _tmp17_;
1915 _tmp15_ = self->priv->reader;
1916 _tmp16_ = vala_markup_reader_get_name (_tmp15_);
1917 _tmp17_ = _tmp16_;
1918 if (g_strcmp0 (_tmp17_, "property") == 0) {
1919 valadoc_importer_gir_documentation_importer_parse_property (self);
1920 } else {
1921 ValaMarkupReader* _tmp18_;
1922 const gchar* _tmp19_;
1923 const gchar* _tmp20_;
1924 _tmp18_ = self->priv->reader;
1925 _tmp19_ = vala_markup_reader_get_name (_tmp18_);
1926 _tmp20_ = _tmp19_;
1927 if (g_strcmp0 (_tmp20_, "virtual-method") == 0) {
1928 valadoc_importer_gir_documentation_importer_parse_method (self, "virtual-method");
1929 } else {
1930 ValaMarkupReader* _tmp21_;
1931 const gchar* _tmp22_;
1932 const gchar* _tmp23_;
1933 _tmp21_ = self->priv->reader;
1934 _tmp22_ = vala_markup_reader_get_name (_tmp21_);
1935 _tmp23_ = _tmp22_;
1936 if (g_strcmp0 (_tmp23_, "function") == 0) {
1937 valadoc_importer_gir_documentation_importer_parse_method (self, "function");
1938 } else {
1939 ValaMarkupReader* _tmp24_;
1940 const gchar* _tmp25_;
1941 const gchar* _tmp26_;
1942 _tmp24_ = self->priv->reader;
1943 _tmp25_ = vala_markup_reader_get_name (_tmp24_);
1944 _tmp26_ = _tmp25_;
1945 if (g_strcmp0 (_tmp26_, "method") == 0) {
1946 valadoc_importer_gir_documentation_importer_parse_method (self, "method");
1947 } else {
1948 ValaMarkupReader* _tmp27_;
1949 const gchar* _tmp28_;
1950 const gchar* _tmp29_;
1951 _tmp27_ = self->priv->reader;
1952 _tmp28_ = vala_markup_reader_get_name (_tmp27_);
1953 _tmp29_ = _tmp28_;
1954 if (g_strcmp0 (_tmp29_, "glib:signal") == 0) {
1955 valadoc_importer_gir_documentation_importer_parse_signal (self);
1956 } else {
1957 ValaMarkupReader* _tmp30_;
1958 const gchar* _tmp31_;
1959 const gchar* _tmp32_;
1960 gchar* _tmp33_;
1961 gchar* _tmp34_;
1962 _tmp30_ = self->priv->reader;
1963 _tmp31_ = vala_markup_reader_get_name (_tmp30_);
1964 _tmp32_ = _tmp31_;
1965 _tmp33_ = g_strdup_printf ("unknown child element `%s' in `interface'", _tmp32_);
1966 _tmp34_ = _tmp33_;
1967 valadoc_importer_gir_documentation_importer_error (self, _tmp34_);
1968 _g_free0 (_tmp34_);
1969 valadoc_importer_gir_documentation_importer_skip_element (self);
1970 }
1971 }
1972 }
1973 }
1974 }
1975 }
1976 }
1977 }
1978 _g_free0 (self->priv->parent_c_identifier);
1979 self->priv->parent_c_identifier = NULL;
1980 valadoc_importer_gir_documentation_importer_end_element (self, "interface");
1981 _valadoc_api_source_comment_unref0 (comment);
1982 }
1983
1984 static void
valadoc_importer_gir_documentation_importer_parse_field(ValadocImporterGirDocumentationImporter * self)1985 valadoc_importer_gir_documentation_importer_parse_field (ValadocImporterGirDocumentationImporter* self)
1986 {
1987 gchar* c_identifier = NULL;
1988 ValaMarkupReader* _tmp0_;
1989 gchar* _tmp1_;
1990 const gchar* _tmp2_;
1991 ValadocApiGirSourceComment* _tmp8_;
1992 ValadocApiGirSourceComment* _tmp9_;
1993 g_return_if_fail (self != NULL);
1994 valadoc_importer_gir_documentation_importer_start_element (self, "field");
1995 _tmp0_ = self->priv->reader;
1996 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "name");
1997 c_identifier = _tmp1_;
1998 _tmp2_ = self->priv->parent_c_identifier;
1999 if (_tmp2_ != NULL) {
2000 const gchar* _tmp3_;
2001 gchar* _tmp4_;
2002 gchar* _tmp5_;
2003 const gchar* _tmp6_;
2004 gchar* _tmp7_;
2005 _tmp3_ = self->priv->parent_c_identifier;
2006 _tmp4_ = g_strconcat (_tmp3_, ".", NULL);
2007 _tmp5_ = _tmp4_;
2008 _tmp6_ = c_identifier;
2009 _tmp7_ = g_strconcat (_tmp5_, _tmp6_, NULL);
2010 _g_free0 (c_identifier);
2011 c_identifier = _tmp7_;
2012 _g_free0 (_tmp5_);
2013 }
2014 valadoc_importer_gir_documentation_importer_next (self);
2015 _tmp8_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
2016 _tmp9_ = _tmp8_;
2017 _valadoc_api_source_comment_unref0 (_tmp9_);
2018 valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
2019 valadoc_importer_gir_documentation_importer_end_element (self, "field");
2020 _g_free0 (c_identifier);
2021 }
2022
2023 static gchar*
string_replace(const gchar * self,const gchar * old,const gchar * replacement)2024 string_replace (const gchar* self,
2025 const gchar* old,
2026 const gchar* replacement)
2027 {
2028 gboolean _tmp0_ = FALSE;
2029 gboolean _tmp1_ = FALSE;
2030 GError* _inner_error0_ = NULL;
2031 gchar* result = NULL;
2032 g_return_val_if_fail (self != NULL, NULL);
2033 g_return_val_if_fail (old != NULL, NULL);
2034 g_return_val_if_fail (replacement != NULL, NULL);
2035 if ((*((gchar*) self)) == '\0') {
2036 _tmp1_ = TRUE;
2037 } else {
2038 _tmp1_ = (*((gchar*) old)) == '\0';
2039 }
2040 if (_tmp1_) {
2041 _tmp0_ = TRUE;
2042 } else {
2043 _tmp0_ = g_strcmp0 (old, replacement) == 0;
2044 }
2045 if (_tmp0_) {
2046 gchar* _tmp2_;
2047 _tmp2_ = g_strdup (self);
2048 result = _tmp2_;
2049 return result;
2050 }
2051 {
2052 GRegex* regex = NULL;
2053 gchar* _tmp3_;
2054 gchar* _tmp4_;
2055 GRegex* _tmp5_;
2056 GRegex* _tmp6_;
2057 gchar* _tmp7_ = NULL;
2058 GRegex* _tmp8_;
2059 gchar* _tmp9_;
2060 gchar* _tmp10_;
2061 _tmp3_ = g_regex_escape_string (old, -1);
2062 _tmp4_ = _tmp3_;
2063 _tmp5_ = g_regex_new (_tmp4_, 0, 0, &_inner_error0_);
2064 _tmp6_ = _tmp5_;
2065 _g_free0 (_tmp4_);
2066 regex = _tmp6_;
2067 if (G_UNLIKELY (_inner_error0_ != NULL)) {
2068 _g_free0 (_tmp7_);
2069 _g_regex_unref0 (regex);
2070 if (_inner_error0_->domain == G_REGEX_ERROR) {
2071 goto __catch0_g_regex_error;
2072 }
2073 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
2074 g_clear_error (&_inner_error0_);
2075 return NULL;
2076 }
2077 _tmp8_ = regex;
2078 _tmp9_ = g_regex_replace_literal (_tmp8_, self, (gssize) -1, 0, replacement, 0, &_inner_error0_);
2079 _tmp7_ = _tmp9_;
2080 if (G_UNLIKELY (_inner_error0_ != NULL)) {
2081 _g_free0 (_tmp7_);
2082 _g_regex_unref0 (regex);
2083 if (_inner_error0_->domain == G_REGEX_ERROR) {
2084 goto __catch0_g_regex_error;
2085 }
2086 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
2087 g_clear_error (&_inner_error0_);
2088 return NULL;
2089 }
2090 _tmp10_ = _tmp7_;
2091 _tmp7_ = NULL;
2092 result = _tmp10_;
2093 _g_free0 (_tmp7_);
2094 _g_regex_unref0 (regex);
2095 return result;
2096 }
2097 goto __finally0;
2098 __catch0_g_regex_error:
2099 {
2100 g_clear_error (&_inner_error0_);
2101 g_assert_not_reached ();
2102 }
2103 __finally0:
2104 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
2105 g_clear_error (&_inner_error0_);
2106 return NULL;
2107 }
2108
2109 static void
valadoc_importer_gir_documentation_importer_parse_property(ValadocImporterGirDocumentationImporter * self)2110 valadoc_importer_gir_documentation_importer_parse_property (ValadocImporterGirDocumentationImporter* self)
2111 {
2112 gchar* c_identifier = NULL;
2113 const gchar* _tmp0_;
2114 ValaMarkupReader* _tmp1_;
2115 gchar* _tmp2_;
2116 gchar* _tmp3_;
2117 gchar* _tmp4_;
2118 gchar* _tmp5_;
2119 gchar* _tmp6_;
2120 gchar* _tmp7_;
2121 ValadocApiGirSourceComment* comment = NULL;
2122 ValadocApiGirSourceComment* _tmp8_;
2123 g_return_if_fail (self != NULL);
2124 valadoc_importer_gir_documentation_importer_start_element (self, "property");
2125 _tmp0_ = self->priv->parent_c_identifier;
2126 _tmp1_ = self->priv->reader;
2127 _tmp2_ = vala_markup_reader_get_attribute (_tmp1_, "name");
2128 _tmp3_ = _tmp2_;
2129 _tmp4_ = string_replace (_tmp3_, "-", "_");
2130 _tmp5_ = _tmp4_;
2131 _tmp6_ = g_strdup_printf ("%s:%s", _tmp0_, _tmp5_);
2132 _tmp7_ = _tmp6_;
2133 _g_free0 (_tmp5_);
2134 _g_free0 (_tmp3_);
2135 c_identifier = _tmp7_;
2136 valadoc_importer_gir_documentation_importer_next (self);
2137 _tmp8_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
2138 comment = _tmp8_;
2139 valadoc_importer_gir_documentation_importer_attach_comment (self, c_identifier, comment, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
2140 valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
2141 valadoc_importer_gir_documentation_importer_end_element (self, "property");
2142 _valadoc_api_source_comment_unref0 (comment);
2143 _g_free0 (c_identifier);
2144 }
2145
2146 static void
valadoc_importer_gir_documentation_importer_parse_callback(ValadocImporterGirDocumentationImporter * self)2147 valadoc_importer_gir_documentation_importer_parse_callback (ValadocImporterGirDocumentationImporter* self)
2148 {
2149 g_return_if_fail (self != NULL);
2150 valadoc_importer_gir_documentation_importer_parse_function (self, "callback");
2151 }
2152
2153 static void
valadoc_importer_gir_documentation_importer_parse_constructor(ValadocImporterGirDocumentationImporter * self)2154 valadoc_importer_gir_documentation_importer_parse_constructor (ValadocImporterGirDocumentationImporter* self)
2155 {
2156 g_return_if_fail (self != NULL);
2157 valadoc_importer_gir_documentation_importer_parse_function (self, "constructor");
2158 }
2159
2160 static void
_vala_array_add3(gchar *** array,gint * length,gint * size,gchar * value)2161 _vala_array_add3 (gchar** * array,
2162 gint* length,
2163 gint* size,
2164 gchar* value)
2165 {
2166 if ((*length) == (*size)) {
2167 *size = (*size) ? (2 * (*size)) : 4;
2168 *array = g_renew (gchar*, *array, (*size) + 1);
2169 }
2170 (*array)[(*length)++] = value;
2171 (*array)[*length] = NULL;
2172 }
2173
2174 static void
_vala_array_add4(ValadocImporterGirDocumentationImporterImplicitParameterPos ** array,gint * length,gint * size,const ValadocImporterGirDocumentationImporterImplicitParameterPos * value)2175 _vala_array_add4 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array,
2176 gint* length,
2177 gint* size,
2178 const ValadocImporterGirDocumentationImporterImplicitParameterPos* value)
2179 {
2180 if ((*length) == (*size)) {
2181 *size = (*size) ? (2 * (*size)) : 4;
2182 *array = g_renew (ValadocImporterGirDocumentationImporterImplicitParameterPos, *array, *size);
2183 }
2184 (*array)[(*length)++] = *value;
2185 }
2186
2187 static void
_vala_array_add5(ValadocImporterGirDocumentationImporterImplicitParameterPos ** array,gint * length,gint * size,const ValadocImporterGirDocumentationImporterImplicitParameterPos * value)2188 _vala_array_add5 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array,
2189 gint* length,
2190 gint* size,
2191 const ValadocImporterGirDocumentationImporterImplicitParameterPos* value)
2192 {
2193 if ((*length) == (*size)) {
2194 *size = (*size) ? (2 * (*size)) : 4;
2195 *array = g_renew (ValadocImporterGirDocumentationImporterImplicitParameterPos, *array, *size);
2196 }
2197 (*array)[(*length)++] = *value;
2198 }
2199
2200 static void
_vala_array_add6(ValadocImporterGirDocumentationImporterImplicitParameterPos ** array,gint * length,gint * size,const ValadocImporterGirDocumentationImporterImplicitParameterPos * value)2201 _vala_array_add6 (ValadocImporterGirDocumentationImporterImplicitParameterPos* * array,
2202 gint* length,
2203 gint* size,
2204 const ValadocImporterGirDocumentationImporterImplicitParameterPos* value)
2205 {
2206 if ((*length) == (*size)) {
2207 *size = (*size) ? (2 * (*size)) : 4;
2208 *array = g_renew (ValadocImporterGirDocumentationImporterImplicitParameterPos, *array, *size);
2209 }
2210 (*array)[(*length)++] = *value;
2211 }
2212
2213 static void
valadoc_importer_gir_documentation_importer_parse_function(ValadocImporterGirDocumentationImporter * self,const gchar * element_name)2214 valadoc_importer_gir_documentation_importer_parse_function (ValadocImporterGirDocumentationImporter* self,
2215 const gchar* element_name)
2216 {
2217 gchar* c_identifier = NULL;
2218 const gchar* _tmp0_;
2219 GQuark _tmp2_ = 0U;
2220 static GQuark _tmp1_label0 = 0;
2221 static GQuark _tmp1_label1 = 0;
2222 static GQuark _tmp1_label2 = 0;
2223 static GQuark _tmp1_label3 = 0;
2224 static GQuark _tmp1_label4 = 0;
2225 static GQuark _tmp1_label5 = 0;
2226 ValadocApiGirSourceComment* comment = NULL;
2227 ValadocApiGirSourceComment* _tmp24_;
2228 ValadocImporterGirDocumentationImporterImplicitParameterPos* destroy_notifies = NULL;
2229 ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp25_;
2230 gint destroy_notifies_length1;
2231 gint _destroy_notifies_size_;
2232 ValadocImporterGirDocumentationImporterImplicitParameterPos* array_lengths = NULL;
2233 ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp26_;
2234 gint array_lengths_length1;
2235 gint _array_lengths_size_;
2236 ValadocImporterGirDocumentationImporterImplicitParameterPos* closures = NULL;
2237 ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp27_;
2238 gint closures_length1;
2239 gint _closures_size_;
2240 gchar** param_names = NULL;
2241 gchar** _tmp28_;
2242 gint param_names_length1;
2243 gint _param_names_size_;
2244 gint array_length_ret = 0;
2245 gboolean _tmp29_ = FALSE;
2246 ValaMarkupTokenType _tmp30_;
2247 gboolean _tmp46_ = FALSE;
2248 ValaMarkupTokenType _tmp47_;
2249 const gchar* _tmp99_;
2250 ValadocApiGirSourceComment* _tmp100_;
2251 gchar** _tmp101_;
2252 gint _tmp101__length1;
2253 ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp102_;
2254 gint _tmp102__length1;
2255 ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp103_;
2256 gint _tmp103__length1;
2257 ValadocImporterGirDocumentationImporterImplicitParameterPos* _tmp104_;
2258 gint _tmp104__length1;
2259 g_return_if_fail (self != NULL);
2260 g_return_if_fail (element_name != NULL);
2261 valadoc_importer_gir_documentation_importer_start_element (self, element_name);
2262 c_identifier = NULL;
2263 _tmp0_ = element_name;
2264 _tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
2265 if (((_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string ("constructor")))) || (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string ("function"))))) || (_tmp2_ == ((0 != _tmp1_label2) ? _tmp1_label2 : (_tmp1_label2 = g_quark_from_static_string ("method"))))) {
2266 switch (0) {
2267 default:
2268 {
2269 ValaMarkupReader* _tmp3_;
2270 gchar* _tmp4_;
2271 _tmp3_ = self->priv->reader;
2272 _tmp4_ = vala_markup_reader_get_attribute (_tmp3_, "c:identifier");
2273 _g_free0 (c_identifier);
2274 c_identifier = _tmp4_;
2275 break;
2276 }
2277 }
2278 } else if (_tmp2_ == ((0 != _tmp1_label3) ? _tmp1_label3 : (_tmp1_label3 = g_quark_from_static_string ("callback")))) {
2279 switch (0) {
2280 default:
2281 {
2282 ValaMarkupReader* _tmp5_;
2283 gchar* _tmp6_;
2284 const gchar* _tmp7_;
2285 _tmp5_ = self->priv->reader;
2286 _tmp6_ = vala_markup_reader_get_attribute (_tmp5_, "c:type");
2287 _g_free0 (c_identifier);
2288 c_identifier = _tmp6_;
2289 _tmp7_ = c_identifier;
2290 if (_tmp7_ == NULL) {
2291 ValaMarkupReader* _tmp8_;
2292 gchar* _tmp9_;
2293 _tmp8_ = self->priv->reader;
2294 _tmp9_ = vala_markup_reader_get_attribute (_tmp8_, "name");
2295 _g_free0 (c_identifier);
2296 c_identifier = _tmp9_;
2297 }
2298 break;
2299 }
2300 }
2301 } else if (_tmp2_ == ((0 != _tmp1_label4) ? _tmp1_label4 : (_tmp1_label4 = g_quark_from_static_string ("virtual-method")))) {
2302 switch (0) {
2303 default:
2304 {
2305 const gchar* _tmp10_;
2306 ValaMarkupReader* _tmp11_;
2307 gchar* _tmp12_;
2308 gchar* _tmp13_;
2309 gchar* _tmp14_;
2310 gchar* _tmp15_;
2311 gchar* _tmp16_;
2312 _tmp10_ = self->priv->parent_c_identifier;
2313 _tmp11_ = self->priv->reader;
2314 _tmp12_ = vala_markup_reader_get_attribute (_tmp11_, "name");
2315 _tmp13_ = _tmp12_;
2316 _tmp14_ = string_replace (_tmp13_, "-", "_");
2317 _tmp15_ = _tmp14_;
2318 _tmp16_ = g_strdup_printf ("%s->%s", _tmp10_, _tmp15_);
2319 _g_free0 (c_identifier);
2320 c_identifier = _tmp16_;
2321 _g_free0 (_tmp15_);
2322 _g_free0 (_tmp13_);
2323 break;
2324 }
2325 }
2326 } else if (_tmp2_ == ((0 != _tmp1_label5) ? _tmp1_label5 : (_tmp1_label5 = g_quark_from_static_string ("glib:signal")))) {
2327 switch (0) {
2328 default:
2329 {
2330 const gchar* _tmp17_;
2331 ValaMarkupReader* _tmp18_;
2332 gchar* _tmp19_;
2333 gchar* _tmp20_;
2334 gchar* _tmp21_;
2335 gchar* _tmp22_;
2336 gchar* _tmp23_;
2337 _tmp17_ = self->priv->parent_c_identifier;
2338 _tmp18_ = self->priv->reader;
2339 _tmp19_ = vala_markup_reader_get_attribute (_tmp18_, "name");
2340 _tmp20_ = _tmp19_;
2341 _tmp21_ = string_replace (_tmp20_, "-", "_");
2342 _tmp22_ = _tmp21_;
2343 _tmp23_ = g_strdup_printf ("%s::%s", _tmp17_, _tmp22_);
2344 _g_free0 (c_identifier);
2345 c_identifier = _tmp23_;
2346 _g_free0 (_tmp22_);
2347 _g_free0 (_tmp20_);
2348 break;
2349 }
2350 }
2351 } else {
2352 switch (0) {
2353 default:
2354 {
2355 valadoc_importer_gir_documentation_importer_skip_element (self);
2356 _g_free0 (c_identifier);
2357 return;
2358 }
2359 }
2360 }
2361 valadoc_importer_gir_documentation_importer_next (self);
2362 _tmp24_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
2363 comment = _tmp24_;
2364 _tmp25_ = g_new0 (ValadocImporterGirDocumentationImporterImplicitParameterPos, 0);
2365 destroy_notifies = _tmp25_;
2366 destroy_notifies_length1 = 0;
2367 _destroy_notifies_size_ = destroy_notifies_length1;
2368 _tmp26_ = g_new0 (ValadocImporterGirDocumentationImporterImplicitParameterPos, 0);
2369 array_lengths = _tmp26_;
2370 array_lengths_length1 = 0;
2371 _array_lengths_size_ = array_lengths_length1;
2372 _tmp27_ = g_new0 (ValadocImporterGirDocumentationImporterImplicitParameterPos, 0);
2373 closures = _tmp27_;
2374 closures_length1 = 0;
2375 _closures_size_ = closures_length1;
2376 _tmp28_ = g_new0 (gchar*, 0 + 1);
2377 param_names = _tmp28_;
2378 param_names_length1 = 0;
2379 _param_names_size_ = param_names_length1;
2380 array_length_ret = -1;
2381 _tmp30_ = self->priv->current_token;
2382 if (_tmp30_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT) {
2383 ValaMarkupReader* _tmp31_;
2384 const gchar* _tmp32_;
2385 const gchar* _tmp33_;
2386 _tmp31_ = self->priv->reader;
2387 _tmp32_ = vala_markup_reader_get_name (_tmp31_);
2388 _tmp33_ = _tmp32_;
2389 _tmp29_ = g_strcmp0 (_tmp33_, "return-value") == 0;
2390 } else {
2391 _tmp29_ = FALSE;
2392 }
2393 if (_tmp29_) {
2394 ValadocApiSourceComment* return_comment = NULL;
2395 ValadocApiSourceComment* _tmp34_ = NULL;
2396 gint _tmp35_ = 0;
2397 ValadocApiSourceComment* _tmp36_;
2398 valadoc_importer_gir_documentation_importer_parse_return_value (self, &_tmp34_, &_tmp35_);
2399 _valadoc_api_source_comment_unref0 (return_comment);
2400 return_comment = _tmp34_;
2401 array_length_ret = _tmp35_;
2402 _tmp36_ = return_comment;
2403 if (_tmp36_ != NULL) {
2404 ValadocApiGirSourceComment* _tmp37_;
2405 ValadocApiGirSourceComment* _tmp44_;
2406 ValadocApiSourceComment* _tmp45_;
2407 _tmp37_ = comment;
2408 if (_tmp37_ == NULL) {
2409 ValadocApiSourceFile* _tmp38_;
2410 ValaSourceLocation _tmp39_;
2411 ValaSourceLocation _tmp40_;
2412 ValaSourceLocation _tmp41_;
2413 ValaSourceLocation _tmp42_;
2414 ValadocApiGirSourceComment* _tmp43_;
2415 _tmp38_ = self->priv->file;
2416 _tmp39_ = self->priv->begin;
2417 _tmp40_ = self->priv->begin;
2418 _tmp41_ = self->priv->end;
2419 _tmp42_ = self->priv->end;
2420 _tmp43_ = valadoc_api_gir_source_comment_new ("", _tmp38_, _tmp39_.line, _tmp40_.column, _tmp41_.line, _tmp42_.column);
2421 _valadoc_api_source_comment_unref0 (comment);
2422 comment = _tmp43_;
2423 }
2424 _tmp44_ = comment;
2425 _tmp45_ = return_comment;
2426 valadoc_api_gir_source_comment_set_return_comment (_tmp44_, _tmp45_);
2427 }
2428 _valadoc_api_source_comment_unref0 (return_comment);
2429 }
2430 _tmp47_ = self->priv->current_token;
2431 if (_tmp47_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT) {
2432 ValaMarkupReader* _tmp48_;
2433 const gchar* _tmp49_;
2434 const gchar* _tmp50_;
2435 _tmp48_ = self->priv->reader;
2436 _tmp49_ = vala_markup_reader_get_name (_tmp48_);
2437 _tmp50_ = _tmp49_;
2438 _tmp46_ = g_strcmp0 (_tmp50_, "parameters") == 0;
2439 } else {
2440 _tmp46_ = FALSE;
2441 }
2442 if (_tmp46_) {
2443 gboolean _tmp51_ = FALSE;
2444 ValaMarkupTokenType _tmp52_;
2445 valadoc_importer_gir_documentation_importer_start_element (self, "parameters");
2446 valadoc_importer_gir_documentation_importer_next (self);
2447 _tmp52_ = self->priv->current_token;
2448 if (_tmp52_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT) {
2449 ValaMarkupReader* _tmp53_;
2450 const gchar* _tmp54_;
2451 const gchar* _tmp55_;
2452 _tmp53_ = self->priv->reader;
2453 _tmp54_ = vala_markup_reader_get_name (_tmp53_);
2454 _tmp55_ = _tmp54_;
2455 _tmp51_ = g_strcmp0 (_tmp55_, "instance-parameter") == 0;
2456 } else {
2457 _tmp51_ = FALSE;
2458 }
2459 if (_tmp51_) {
2460 gchar* instance_param_name = NULL;
2461 ValaMarkupReader* _tmp56_;
2462 gchar* _tmp57_;
2463 ValadocApiSourceComment* param_comment = NULL;
2464 ValadocApiGirSourceComment* _tmp58_;
2465 ValadocApiSourceComment* _tmp59_;
2466 _tmp56_ = self->priv->reader;
2467 _tmp57_ = vala_markup_reader_get_attribute (_tmp56_, "name");
2468 instance_param_name = _tmp57_;
2469 valadoc_importer_gir_documentation_importer_next (self);
2470 _tmp58_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
2471 param_comment = (ValadocApiSourceComment*) _tmp58_;
2472 valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
2473 valadoc_importer_gir_documentation_importer_end_element (self, "instance-parameter");
2474 _tmp59_ = param_comment;
2475 if (_tmp59_ != NULL) {
2476 ValadocApiGirSourceComment* _tmp60_;
2477 ValadocApiGirSourceComment* _tmp67_;
2478 const gchar* _tmp68_;
2479 ValadocApiSourceComment* _tmp69_;
2480 ValadocApiGirSourceComment* _tmp70_;
2481 const gchar* _tmp71_;
2482 _tmp60_ = comment;
2483 if (_tmp60_ == NULL) {
2484 ValadocApiSourceFile* _tmp61_;
2485 ValaSourceLocation _tmp62_;
2486 ValaSourceLocation _tmp63_;
2487 ValaSourceLocation _tmp64_;
2488 ValaSourceLocation _tmp65_;
2489 ValadocApiGirSourceComment* _tmp66_;
2490 _tmp61_ = self->priv->file;
2491 _tmp62_ = self->priv->begin;
2492 _tmp63_ = self->priv->begin;
2493 _tmp64_ = self->priv->end;
2494 _tmp65_ = self->priv->end;
2495 _tmp66_ = valadoc_api_gir_source_comment_new ("", _tmp61_, _tmp62_.line, _tmp63_.column, _tmp64_.line, _tmp65_.column);
2496 _valadoc_api_source_comment_unref0 (comment);
2497 comment = _tmp66_;
2498 }
2499 _tmp67_ = comment;
2500 _tmp68_ = instance_param_name;
2501 _tmp69_ = param_comment;
2502 valadoc_api_gir_source_comment_add_parameter_content (_tmp67_, _tmp68_, _tmp69_);
2503 _tmp70_ = comment;
2504 _tmp71_ = instance_param_name;
2505 valadoc_api_gir_source_comment_set_instance_param_name (_tmp70_, _tmp71_);
2506 }
2507 _valadoc_api_source_comment_unref0 (param_comment);
2508 _g_free0 (instance_param_name);
2509 }
2510 {
2511 gint pcount = 0;
2512 pcount = 0;
2513 {
2514 gboolean _tmp72_ = FALSE;
2515 _tmp72_ = TRUE;
2516 while (TRUE) {
2517 ValaMarkupTokenType _tmp74_;
2518 ValadocApiSourceComment* param_comment = NULL;
2519 gint array_length_pos = 0;
2520 gint destroy_pos = 0;
2521 gint closure_pos = 0;
2522 gchar* param_name = NULL;
2523 ValadocApiSourceComment* _tmp75_ = NULL;
2524 gchar* _tmp76_ = NULL;
2525 gint _tmp77_ = 0;
2526 gint _tmp78_ = 0;
2527 gint _tmp79_ = 0;
2528 const gchar* _tmp80_;
2529 gchar* _tmp81_;
2530 gboolean _tmp82_ = FALSE;
2531 gboolean _tmp84_ = FALSE;
2532 gboolean _tmp86_ = FALSE;
2533 ValadocApiSourceComment* _tmp88_;
2534 if (!_tmp72_) {
2535 gint _tmp73_;
2536 _tmp73_ = pcount;
2537 pcount = _tmp73_ + 1;
2538 }
2539 _tmp72_ = FALSE;
2540 _tmp74_ = self->priv->current_token;
2541 if (!(_tmp74_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
2542 break;
2543 }
2544 valadoc_importer_gir_documentation_importer_parse_parameter (self, &_tmp75_, &_tmp76_, &_tmp77_, &_tmp78_, &_tmp79_);
2545 _valadoc_api_source_comment_unref0 (param_comment);
2546 param_comment = _tmp75_;
2547 _g_free0 (param_name);
2548 param_name = _tmp76_;
2549 destroy_pos = _tmp77_;
2550 closure_pos = _tmp78_;
2551 array_length_pos = _tmp79_;
2552 _tmp80_ = param_name;
2553 _tmp81_ = g_strdup (_tmp80_);
2554 _vala_array_add3 (¶m_names, ¶m_names_length1, &_param_names_size_, _tmp81_);
2555 if (destroy_pos >= 0) {
2556 _tmp82_ = pcount != destroy_pos;
2557 } else {
2558 _tmp82_ = FALSE;
2559 }
2560 if (_tmp82_) {
2561 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp83_ = {0};
2562 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (&_tmp83_, pcount, destroy_pos);
2563 _vala_array_add4 (&destroy_notifies, &destroy_notifies_length1, &_destroy_notifies_size_, &_tmp83_);
2564 }
2565 if (closure_pos >= 0) {
2566 _tmp84_ = pcount != closure_pos;
2567 } else {
2568 _tmp84_ = FALSE;
2569 }
2570 if (_tmp84_) {
2571 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp85_ = {0};
2572 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (&_tmp85_, pcount, closure_pos);
2573 _vala_array_add5 (&closures, &closures_length1, &_closures_size_, &_tmp85_);
2574 }
2575 if (array_length_pos >= 0) {
2576 _tmp86_ = pcount != destroy_pos;
2577 } else {
2578 _tmp86_ = FALSE;
2579 }
2580 if (_tmp86_) {
2581 ValadocImporterGirDocumentationImporterImplicitParameterPos _tmp87_ = {0};
2582 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (&_tmp87_, pcount, array_length_pos);
2583 _vala_array_add6 (&array_lengths, &array_lengths_length1, &_array_lengths_size_, &_tmp87_);
2584 }
2585 _tmp88_ = param_comment;
2586 if (_tmp88_ != NULL) {
2587 ValadocApiGirSourceComment* _tmp89_;
2588 ValadocApiGirSourceComment* _tmp96_;
2589 const gchar* _tmp97_;
2590 ValadocApiSourceComment* _tmp98_;
2591 _tmp89_ = comment;
2592 if (_tmp89_ == NULL) {
2593 ValadocApiSourceFile* _tmp90_;
2594 ValaSourceLocation _tmp91_;
2595 ValaSourceLocation _tmp92_;
2596 ValaSourceLocation _tmp93_;
2597 ValaSourceLocation _tmp94_;
2598 ValadocApiGirSourceComment* _tmp95_;
2599 _tmp90_ = self->priv->file;
2600 _tmp91_ = self->priv->begin;
2601 _tmp92_ = self->priv->begin;
2602 _tmp93_ = self->priv->end;
2603 _tmp94_ = self->priv->end;
2604 _tmp95_ = valadoc_api_gir_source_comment_new ("", _tmp90_, _tmp91_.line, _tmp92_.column, _tmp93_.line, _tmp94_.column);
2605 _valadoc_api_source_comment_unref0 (comment);
2606 comment = _tmp95_;
2607 }
2608 _tmp96_ = comment;
2609 _tmp97_ = param_name;
2610 _tmp98_ = param_comment;
2611 valadoc_api_gir_source_comment_add_parameter_content (_tmp96_, _tmp97_, _tmp98_);
2612 }
2613 _g_free0 (param_name);
2614 _valadoc_api_source_comment_unref0 (param_comment);
2615 }
2616 }
2617 }
2618 valadoc_importer_gir_documentation_importer_end_element (self, "parameters");
2619 }
2620 _tmp99_ = c_identifier;
2621 _tmp100_ = comment;
2622 _tmp101_ = param_names;
2623 _tmp101__length1 = param_names_length1;
2624 _tmp102_ = destroy_notifies;
2625 _tmp102__length1 = destroy_notifies_length1;
2626 _tmp103_ = closures;
2627 _tmp103__length1 = closures_length1;
2628 _tmp104_ = array_lengths;
2629 _tmp104__length1 = array_lengths_length1;
2630 valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp99_, _tmp100_, _tmp101_, (gint) _tmp101__length1, _tmp102_, (gint) _tmp102__length1, _tmp103_, (gint) _tmp103__length1, _tmp104_, (gint) _tmp104__length1, array_length_ret);
2631 valadoc_importer_gir_documentation_importer_end_element (self, element_name);
2632 param_names = (_vala_array_free (param_names, param_names_length1, (GDestroyNotify) g_free), NULL);
2633 closures = (g_free (closures), NULL);
2634 array_lengths = (g_free (array_lengths), NULL);
2635 destroy_notifies = (g_free (destroy_notifies), NULL);
2636 _valadoc_api_source_comment_unref0 (comment);
2637 _g_free0 (c_identifier);
2638 }
2639
2640 static void
valadoc_importer_gir_documentation_importer_parse_method(ValadocImporterGirDocumentationImporter * self,const gchar * element_name)2641 valadoc_importer_gir_documentation_importer_parse_method (ValadocImporterGirDocumentationImporter* self,
2642 const gchar* element_name)
2643 {
2644 g_return_if_fail (self != NULL);
2645 g_return_if_fail (element_name != NULL);
2646 valadoc_importer_gir_documentation_importer_parse_function (self, element_name);
2647 }
2648
2649 static void
valadoc_importer_gir_documentation_importer_parse_signal(ValadocImporterGirDocumentationImporter * self)2650 valadoc_importer_gir_documentation_importer_parse_signal (ValadocImporterGirDocumentationImporter* self)
2651 {
2652 g_return_if_fail (self != NULL);
2653 valadoc_importer_gir_documentation_importer_parse_function (self, "glib:signal");
2654 }
2655
2656 static void
valadoc_importer_gir_documentation_importer_parse_boxed(ValadocImporterGirDocumentationImporter * self,const gchar * element_name)2657 valadoc_importer_gir_documentation_importer_parse_boxed (ValadocImporterGirDocumentationImporter* self,
2658 const gchar* element_name)
2659 {
2660 ValaMarkupReader* _tmp0_;
2661 gchar* _tmp1_;
2662 const gchar* _tmp2_;
2663 ValadocApiGirSourceComment* _tmp5_;
2664 ValadocApiGirSourceComment* _tmp6_;
2665 g_return_if_fail (self != NULL);
2666 g_return_if_fail (element_name != NULL);
2667 valadoc_importer_gir_documentation_importer_start_element (self, element_name);
2668 _tmp0_ = self->priv->reader;
2669 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "name");
2670 _g_free0 (self->priv->parent_c_identifier);
2671 self->priv->parent_c_identifier = _tmp1_;
2672 _tmp2_ = self->priv->parent_c_identifier;
2673 if (_tmp2_ == NULL) {
2674 ValaMarkupReader* _tmp3_;
2675 gchar* _tmp4_;
2676 _tmp3_ = self->priv->reader;
2677 _tmp4_ = vala_markup_reader_get_attribute (_tmp3_, "glib:name");
2678 _g_free0 (self->priv->parent_c_identifier);
2679 self->priv->parent_c_identifier = _tmp4_;
2680 }
2681 valadoc_importer_gir_documentation_importer_next (self);
2682 _tmp5_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
2683 _tmp6_ = _tmp5_;
2684 _valadoc_api_source_comment_unref0 (_tmp6_);
2685 while (TRUE) {
2686 ValaMarkupTokenType _tmp7_;
2687 ValaMarkupReader* _tmp8_;
2688 const gchar* _tmp9_;
2689 const gchar* _tmp10_;
2690 _tmp7_ = self->priv->current_token;
2691 if (!(_tmp7_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
2692 break;
2693 }
2694 _tmp8_ = self->priv->reader;
2695 _tmp9_ = vala_markup_reader_get_name (_tmp8_);
2696 _tmp10_ = _tmp9_;
2697 if (g_strcmp0 (_tmp10_, "field") == 0) {
2698 valadoc_importer_gir_documentation_importer_parse_field (self);
2699 } else {
2700 ValaMarkupReader* _tmp11_;
2701 const gchar* _tmp12_;
2702 const gchar* _tmp13_;
2703 _tmp11_ = self->priv->reader;
2704 _tmp12_ = vala_markup_reader_get_name (_tmp11_);
2705 _tmp13_ = _tmp12_;
2706 if (g_strcmp0 (_tmp13_, "constructor") == 0) {
2707 valadoc_importer_gir_documentation_importer_parse_constructor (self);
2708 } else {
2709 ValaMarkupReader* _tmp14_;
2710 const gchar* _tmp15_;
2711 const gchar* _tmp16_;
2712 _tmp14_ = self->priv->reader;
2713 _tmp15_ = vala_markup_reader_get_name (_tmp14_);
2714 _tmp16_ = _tmp15_;
2715 if (g_strcmp0 (_tmp16_, "method") == 0) {
2716 valadoc_importer_gir_documentation_importer_parse_method (self, "method");
2717 } else {
2718 ValaMarkupReader* _tmp17_;
2719 const gchar* _tmp18_;
2720 const gchar* _tmp19_;
2721 _tmp17_ = self->priv->reader;
2722 _tmp18_ = vala_markup_reader_get_name (_tmp17_);
2723 _tmp19_ = _tmp18_;
2724 if (g_strcmp0 (_tmp19_, "function") == 0) {
2725 valadoc_importer_gir_documentation_importer_skip_element (self);
2726 } else {
2727 ValaMarkupReader* _tmp20_;
2728 const gchar* _tmp21_;
2729 const gchar* _tmp22_;
2730 _tmp20_ = self->priv->reader;
2731 _tmp21_ = vala_markup_reader_get_name (_tmp20_);
2732 _tmp22_ = _tmp21_;
2733 if (g_strcmp0 (_tmp22_, "union") == 0) {
2734 valadoc_importer_gir_documentation_importer_parse_union (self);
2735 } else {
2736 ValaMarkupReader* _tmp23_;
2737 const gchar* _tmp24_;
2738 const gchar* _tmp25_;
2739 gchar* _tmp26_;
2740 gchar* _tmp27_;
2741 _tmp23_ = self->priv->reader;
2742 _tmp24_ = vala_markup_reader_get_name (_tmp23_);
2743 _tmp25_ = _tmp24_;
2744 _tmp26_ = g_strdup_printf ("unknown child element `%s' in `class'", _tmp25_);
2745 _tmp27_ = _tmp26_;
2746 valadoc_importer_gir_documentation_importer_error (self, _tmp27_);
2747 _g_free0 (_tmp27_);
2748 valadoc_importer_gir_documentation_importer_skip_element (self);
2749 }
2750 }
2751 }
2752 }
2753 }
2754 }
2755 _g_free0 (self->priv->parent_c_identifier);
2756 self->priv->parent_c_identifier = NULL;
2757 valadoc_importer_gir_documentation_importer_end_element (self, element_name);
2758 }
2759
2760 static void
valadoc_importer_gir_documentation_importer_parse_union(ValadocImporterGirDocumentationImporter * self)2761 valadoc_importer_gir_documentation_importer_parse_union (ValadocImporterGirDocumentationImporter* self)
2762 {
2763 ValaMarkupReader* _tmp0_;
2764 gchar* _tmp1_;
2765 const gchar* _tmp2_;
2766 ValadocApiGirSourceComment* comment = NULL;
2767 ValadocApiGirSourceComment* _tmp3_;
2768 const gchar* _tmp4_;
2769 ValadocApiGirSourceComment* _tmp5_;
2770 g_return_if_fail (self != NULL);
2771 valadoc_importer_gir_documentation_importer_start_element (self, "union");
2772 _tmp0_ = self->priv->reader;
2773 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "c:type");
2774 _g_free0 (self->priv->parent_c_identifier);
2775 self->priv->parent_c_identifier = _tmp1_;
2776 _tmp2_ = self->priv->parent_c_identifier;
2777 if (_tmp2_ == NULL) {
2778 valadoc_importer_gir_documentation_importer_skip_element (self);
2779 return;
2780 }
2781 valadoc_importer_gir_documentation_importer_next (self);
2782 _tmp3_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
2783 comment = _tmp3_;
2784 _tmp4_ = self->priv->parent_c_identifier;
2785 _tmp5_ = comment;
2786 valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp4_, _tmp5_, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
2787 while (TRUE) {
2788 ValaMarkupTokenType _tmp6_;
2789 ValaMarkupReader* _tmp7_;
2790 const gchar* _tmp8_;
2791 const gchar* _tmp9_;
2792 _tmp6_ = self->priv->current_token;
2793 if (!(_tmp6_ == VALA_MARKUP_TOKEN_TYPE_START_ELEMENT)) {
2794 break;
2795 }
2796 _tmp7_ = self->priv->reader;
2797 _tmp8_ = vala_markup_reader_get_name (_tmp7_);
2798 _tmp9_ = _tmp8_;
2799 if (g_strcmp0 (_tmp9_, "field") == 0) {
2800 valadoc_importer_gir_documentation_importer_parse_field (self);
2801 } else {
2802 ValaMarkupReader* _tmp10_;
2803 const gchar* _tmp11_;
2804 const gchar* _tmp12_;
2805 _tmp10_ = self->priv->reader;
2806 _tmp11_ = vala_markup_reader_get_name (_tmp10_);
2807 _tmp12_ = _tmp11_;
2808 if (g_strcmp0 (_tmp12_, "constructor") == 0) {
2809 valadoc_importer_gir_documentation_importer_parse_constructor (self);
2810 } else {
2811 ValaMarkupReader* _tmp13_;
2812 const gchar* _tmp14_;
2813 const gchar* _tmp15_;
2814 _tmp13_ = self->priv->reader;
2815 _tmp14_ = vala_markup_reader_get_name (_tmp13_);
2816 _tmp15_ = _tmp14_;
2817 if (g_strcmp0 (_tmp15_, "method") == 0) {
2818 valadoc_importer_gir_documentation_importer_parse_method (self, "method");
2819 } else {
2820 ValaMarkupReader* _tmp16_;
2821 const gchar* _tmp17_;
2822 const gchar* _tmp18_;
2823 _tmp16_ = self->priv->reader;
2824 _tmp17_ = vala_markup_reader_get_name (_tmp16_);
2825 _tmp18_ = _tmp17_;
2826 if (g_strcmp0 (_tmp18_, "function") == 0) {
2827 valadoc_importer_gir_documentation_importer_skip_element (self);
2828 } else {
2829 ValaMarkupReader* _tmp19_;
2830 const gchar* _tmp20_;
2831 const gchar* _tmp21_;
2832 _tmp19_ = self->priv->reader;
2833 _tmp20_ = vala_markup_reader_get_name (_tmp19_);
2834 _tmp21_ = _tmp20_;
2835 if (g_strcmp0 (_tmp21_, "record") == 0) {
2836 valadoc_importer_gir_documentation_importer_parse_record (self);
2837 } else {
2838 ValaMarkupReader* _tmp22_;
2839 const gchar* _tmp23_;
2840 const gchar* _tmp24_;
2841 gchar* _tmp25_;
2842 gchar* _tmp26_;
2843 _tmp22_ = self->priv->reader;
2844 _tmp23_ = vala_markup_reader_get_name (_tmp22_);
2845 _tmp24_ = _tmp23_;
2846 _tmp25_ = g_strdup_printf ("unknown child element `%s' in `union'", _tmp24_);
2847 _tmp26_ = _tmp25_;
2848 valadoc_importer_gir_documentation_importer_error (self, _tmp26_);
2849 _g_free0 (_tmp26_);
2850 valadoc_importer_gir_documentation_importer_skip_element (self);
2851 }
2852 }
2853 }
2854 }
2855 }
2856 }
2857 _g_free0 (self->priv->parent_c_identifier);
2858 self->priv->parent_c_identifier = NULL;
2859 valadoc_importer_gir_documentation_importer_end_element (self, "union");
2860 _valadoc_api_source_comment_unref0 (comment);
2861 }
2862
2863 static void
valadoc_importer_gir_documentation_importer_parse_constant(ValadocImporterGirDocumentationImporter * self)2864 valadoc_importer_gir_documentation_importer_parse_constant (ValadocImporterGirDocumentationImporter* self)
2865 {
2866 gchar* c_identifier = NULL;
2867 ValaMarkupReader* _tmp0_;
2868 gchar* _tmp1_;
2869 const gchar* _tmp2_;
2870 const gchar* _tmp5_;
2871 ValadocApiGirSourceComment* comment = NULL;
2872 ValadocApiGirSourceComment* _tmp6_;
2873 const gchar* _tmp7_;
2874 ValadocApiGirSourceComment* _tmp8_;
2875 g_return_if_fail (self != NULL);
2876 valadoc_importer_gir_documentation_importer_start_element (self, "constant");
2877 _tmp0_ = self->priv->reader;
2878 _tmp1_ = vala_markup_reader_get_attribute (_tmp0_, "c:identifier");
2879 c_identifier = _tmp1_;
2880 _tmp2_ = c_identifier;
2881 if (_tmp2_ == NULL) {
2882 ValaMarkupReader* _tmp3_;
2883 gchar* _tmp4_;
2884 _tmp3_ = self->priv->reader;
2885 _tmp4_ = vala_markup_reader_get_attribute (_tmp3_, "c:type");
2886 _g_free0 (c_identifier);
2887 c_identifier = _tmp4_;
2888 }
2889 _tmp5_ = c_identifier;
2890 if (_tmp5_ == NULL) {
2891 valadoc_importer_gir_documentation_importer_skip_element (self);
2892 _g_free0 (c_identifier);
2893 return;
2894 }
2895 valadoc_importer_gir_documentation_importer_next (self);
2896 _tmp6_ = valadoc_importer_gir_documentation_importer_parse_symbol_doc (self);
2897 comment = _tmp6_;
2898 _tmp7_ = c_identifier;
2899 _tmp8_ = comment;
2900 valadoc_importer_gir_documentation_importer_attach_comment (self, _tmp7_, _tmp8_, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, NULL, (gint) 0, -1);
2901 valadoc_importer_gir_documentation_importer_parse_type (self, NULL);
2902 valadoc_importer_gir_documentation_importer_end_element (self, "constant");
2903 _valadoc_api_source_comment_unref0 (comment);
2904 _g_free0 (c_identifier);
2905 }
2906
2907 static void
valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init(ValadocImporterGirDocumentationImporterImplicitParameterPos * self,gint parameter,gint position)2908 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_init (ValadocImporterGirDocumentationImporterImplicitParameterPos *self,
2909 gint parameter,
2910 gint position)
2911 {
2912 memset (self, 0, sizeof (ValadocImporterGirDocumentationImporterImplicitParameterPos));
2913 (*self).parameter = parameter;
2914 (*self).position = position;
2915 }
2916
2917 static ValadocImporterGirDocumentationImporterImplicitParameterPos*
valadoc_importer_gir_documentation_importer_implicit_parameter_pos_dup(const ValadocImporterGirDocumentationImporterImplicitParameterPos * self)2918 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_dup (const ValadocImporterGirDocumentationImporterImplicitParameterPos* self)
2919 {
2920 ValadocImporterGirDocumentationImporterImplicitParameterPos* dup;
2921 dup = g_new0 (ValadocImporterGirDocumentationImporterImplicitParameterPos, 1);
2922 memcpy (dup, self, sizeof (ValadocImporterGirDocumentationImporterImplicitParameterPos));
2923 return dup;
2924 }
2925
2926 static void
valadoc_importer_gir_documentation_importer_implicit_parameter_pos_free(ValadocImporterGirDocumentationImporterImplicitParameterPos * self)2927 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_free (ValadocImporterGirDocumentationImporterImplicitParameterPos* self)
2928 {
2929 g_free (self);
2930 }
2931
2932 static GType
valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type_once(void)2933 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type_once (void)
2934 {
2935 GType valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id;
2936 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id = g_boxed_type_register_static ("ValadocImporterGirDocumentationImporterImplicitParameterPos", (GBoxedCopyFunc) valadoc_importer_gir_documentation_importer_implicit_parameter_pos_dup, (GBoxedFreeFunc) valadoc_importer_gir_documentation_importer_implicit_parameter_pos_free);
2937 return valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id;
2938 }
2939
2940 static GType
valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type(void)2941 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type (void)
2942 {
2943 static volatile gsize valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id__volatile = 0;
2944 if (g_once_init_enter (&valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id__volatile)) {
2945 GType valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id;
2946 valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id = valadoc_importer_gir_documentation_importer_implicit_parameter_pos_get_type_once ();
2947 g_once_init_leave (&valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id__volatile, valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id);
2948 }
2949 return valadoc_importer_gir_documentation_importer_implicit_parameter_pos_type_id__volatile;
2950 }
2951
2952 static void
valadoc_importer_gir_documentation_importer_class_init(ValadocImporterGirDocumentationImporterClass * klass,gpointer klass_data)2953 valadoc_importer_gir_documentation_importer_class_init (ValadocImporterGirDocumentationImporterClass * klass,
2954 gpointer klass_data)
2955 {
2956 valadoc_importer_gir_documentation_importer_parent_class = g_type_class_peek_parent (klass);
2957 g_type_class_adjust_private_offset (klass, &ValadocImporterGirDocumentationImporter_private_offset);
2958 ((ValadocImporterDocumentationImporterClass *) klass)->process = (void (*) (ValadocImporterDocumentationImporter*, const gchar*)) valadoc_importer_gir_documentation_importer_real_process;
2959 VALADOC_IMPORTER_DOCUMENTATION_IMPORTER_CLASS (klass)->get_file_extension = valadoc_importer_gir_documentation_importer_real_get_file_extension;
2960 G_OBJECT_CLASS (klass)->get_property = _vala_valadoc_importer_gir_documentation_importer_get_property;
2961 G_OBJECT_CLASS (klass)->finalize = valadoc_importer_gir_documentation_importer_finalize;
2962 g_object_class_install_property (G_OBJECT_CLASS (klass), VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY, valadoc_importer_gir_documentation_importer_properties[VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY] = g_param_spec_string ("file-extension", "file-extension", "file-extension", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
2963 }
2964
2965 static void
valadoc_importer_gir_documentation_importer_instance_init(ValadocImporterGirDocumentationImporter * self,gpointer klass)2966 valadoc_importer_gir_documentation_importer_instance_init (ValadocImporterGirDocumentationImporter * self,
2967 gpointer klass)
2968 {
2969 self->priv = valadoc_importer_gir_documentation_importer_get_instance_private (self);
2970 }
2971
2972 static void
valadoc_importer_gir_documentation_importer_finalize(GObject * obj)2973 valadoc_importer_gir_documentation_importer_finalize (GObject * obj)
2974 {
2975 ValadocImporterGirDocumentationImporter * self;
2976 self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALADOC_IMPORTER_TYPE_GIR_DOCUMENTATION_IMPORTER, ValadocImporterGirDocumentationImporter);
2977 _vala_markup_reader_unref0 (self->priv->reader);
2978 _g_object_unref0 (self->priv->parser);
2979 _g_object_unref0 (self->priv->file);
2980 _g_free0 (self->priv->parent_c_identifier);
2981 G_OBJECT_CLASS (valadoc_importer_gir_documentation_importer_parent_class)->finalize (obj);
2982 }
2983
2984 static GType
valadoc_importer_gir_documentation_importer_get_type_once(void)2985 valadoc_importer_gir_documentation_importer_get_type_once (void)
2986 {
2987 static const GTypeInfo g_define_type_info = { sizeof (ValadocImporterGirDocumentationImporterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) valadoc_importer_gir_documentation_importer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValadocImporterGirDocumentationImporter), 0, (GInstanceInitFunc) valadoc_importer_gir_documentation_importer_instance_init, NULL };
2988 GType valadoc_importer_gir_documentation_importer_type_id;
2989 valadoc_importer_gir_documentation_importer_type_id = g_type_register_static (VALADOC_IMPORTER_TYPE_DOCUMENTATION_IMPORTER, "ValadocImporterGirDocumentationImporter", &g_define_type_info, 0);
2990 ValadocImporterGirDocumentationImporter_private_offset = g_type_add_instance_private (valadoc_importer_gir_documentation_importer_type_id, sizeof (ValadocImporterGirDocumentationImporterPrivate));
2991 return valadoc_importer_gir_documentation_importer_type_id;
2992 }
2993
2994 GType
valadoc_importer_gir_documentation_importer_get_type(void)2995 valadoc_importer_gir_documentation_importer_get_type (void)
2996 {
2997 static volatile gsize valadoc_importer_gir_documentation_importer_type_id__volatile = 0;
2998 if (g_once_init_enter (&valadoc_importer_gir_documentation_importer_type_id__volatile)) {
2999 GType valadoc_importer_gir_documentation_importer_type_id;
3000 valadoc_importer_gir_documentation_importer_type_id = valadoc_importer_gir_documentation_importer_get_type_once ();
3001 g_once_init_leave (&valadoc_importer_gir_documentation_importer_type_id__volatile, valadoc_importer_gir_documentation_importer_type_id);
3002 }
3003 return valadoc_importer_gir_documentation_importer_type_id__volatile;
3004 }
3005
3006 static void
_vala_valadoc_importer_gir_documentation_importer_get_property(GObject * object,guint property_id,GValue * value,GParamSpec * pspec)3007 _vala_valadoc_importer_gir_documentation_importer_get_property (GObject * object,
3008 guint property_id,
3009 GValue * value,
3010 GParamSpec * pspec)
3011 {
3012 ValadocImporterGirDocumentationImporter * self;
3013 self = G_TYPE_CHECK_INSTANCE_CAST (object, VALADOC_IMPORTER_TYPE_GIR_DOCUMENTATION_IMPORTER, ValadocImporterGirDocumentationImporter);
3014 switch (property_id) {
3015 case VALADOC_IMPORTER_GIR_DOCUMENTATION_IMPORTER_FILE_EXTENSION_PROPERTY:
3016 g_value_set_string (value, valadoc_importer_documentation_importer_get_file_extension ((ValadocImporterDocumentationImporter*) self));
3017 break;
3018 default:
3019 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
3020 break;
3021 }
3022 }
3023
3024 static void
_vala_array_destroy(gpointer array,gint array_length,GDestroyNotify destroy_func)3025 _vala_array_destroy (gpointer array,
3026 gint array_length,
3027 GDestroyNotify destroy_func)
3028 {
3029 if ((array != NULL) && (destroy_func != NULL)) {
3030 gint i;
3031 for (i = 0; i < array_length; i = i + 1) {
3032 if (((gpointer*) array)[i] != NULL) {
3033 destroy_func (((gpointer*) array)[i]);
3034 }
3035 }
3036 }
3037 }
3038
3039 static void
_vala_array_free(gpointer array,gint array_length,GDestroyNotify destroy_func)3040 _vala_array_free (gpointer array,
3041 gint array_length,
3042 GDestroyNotify destroy_func)
3043 {
3044 _vala_array_destroy (array, array_length, destroy_func);
3045 g_free (array);
3046 }
3047
3048