1 /* gcomment.c generated by valac, the Vala compiler
2  * generated from gcomment.vala, do not modify */
3 
4 /* gcomment.vala
5  *
6  * Copyright (C) 2010 Luca Bruno
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
21  *
22  * Author:
23  * 	Luca Bruno <lethalman88@gmail.com>
24  */
25 
26 #include <glib-object.h>
27 #include <stdlib.h>
28 #include <string.h>
29 #include <glib.h>
30 #include <float.h>
31 #include <math.h>
32 #include <gobject/gvaluecollector.h>
33 #include <valagee.h>
34 #include <valadoc.h>
35 
36 #define GTKDOC_TYPE_HEADER (gtkdoc_header_get_type ())
37 #define GTKDOC_HEADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTKDOC_TYPE_HEADER, GtkdocHeader))
38 #define GTKDOC_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTKDOC_TYPE_HEADER, GtkdocHeaderClass))
39 #define GTKDOC_IS_HEADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTKDOC_TYPE_HEADER))
40 #define GTKDOC_IS_HEADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTKDOC_TYPE_HEADER))
41 #define GTKDOC_HEADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTKDOC_TYPE_HEADER, GtkdocHeaderClass))
42 
43 typedef struct _GtkdocHeader GtkdocHeader;
44 typedef struct _GtkdocHeaderClass GtkdocHeaderClass;
45 typedef struct _GtkdocHeaderPrivate GtkdocHeaderPrivate;
46 #define _g_free0(var) (var = (g_free (var), NULL))
47 typedef struct _GtkdocParamSpecHeader GtkdocParamSpecHeader;
48 
49 #define GTKDOC_TYPE_GCOMMENT (gtkdoc_gcomment_get_type ())
50 #define GTKDOC_GCOMMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTKDOC_TYPE_GCOMMENT, GtkdocGComment))
51 #define GTKDOC_GCOMMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTKDOC_TYPE_GCOMMENT, GtkdocGCommentClass))
52 #define GTKDOC_IS_GCOMMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTKDOC_TYPE_GCOMMENT))
53 #define GTKDOC_IS_GCOMMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTKDOC_TYPE_GCOMMENT))
54 #define GTKDOC_GCOMMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTKDOC_TYPE_GCOMMENT, GtkdocGCommentClass))
55 
56 typedef struct _GtkdocGComment GtkdocGComment;
57 typedef struct _GtkdocGCommentClass GtkdocGCommentClass;
58 typedef struct _GtkdocGCommentPrivate GtkdocGCommentPrivate;
59 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
60 #define _gtkdoc_header_unref0(var) ((var == NULL) ? NULL : (var = (gtkdoc_header_unref (var), NULL)))
61 #define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
62 typedef struct _GtkdocParamSpecGComment GtkdocParamSpecGComment;
63 
64 struct _GtkdocHeader {
65 	GTypeInstance parent_instance;
66 	volatile int ref_count;
67 	gchar* name;
68 	gchar** annotations;
69 	gint annotations_length1;
70 	gchar* value;
71 	gdouble pos;
72 	gboolean block;
73 	GtkdocHeaderPrivate * priv;
74 };
75 
76 struct _GtkdocHeaderClass {
77 	GTypeClass parent_class;
78 	void (*finalize) (GtkdocHeader *self);
79 };
80 
81 struct _GtkdocParamSpecHeader {
82 	GParamSpec parent_instance;
83 };
84 
85 struct _GtkdocGComment {
86 	GTypeInstance parent_instance;
87 	volatile int ref_count;
88 	gchar* symbol;
89 	gchar** symbol_annotations;
90 	gint symbol_annotations_length1;
91 	ValaList* headers;
92 	gboolean short_description;
93 	gchar* brief_comment;
94 	gchar* long_comment;
95 	gchar* returns;
96 	gchar** returns_annotations;
97 	gint returns_annotations_length1;
98 	ValaList* versioning;
99 	gchar** see_also;
100 	gint see_also_length1;
101 	gboolean is_section;
102 	GtkdocGCommentPrivate * priv;
103 };
104 
105 struct _GtkdocGCommentClass {
106 	GTypeClass parent_class;
107 	void (*finalize) (GtkdocGComment *self);
108 };
109 
110 struct _GtkdocParamSpecGComment {
111 	GParamSpec parent_instance;
112 };
113 
114 static gpointer gtkdoc_header_parent_class = NULL;
115 static gpointer gtkdoc_gcomment_parent_class = NULL;
116 
117 gpointer gtkdoc_header_ref (gpointer instance);
118 void gtkdoc_header_unref (gpointer instance);
119 GParamSpec* gtkdoc_param_spec_header (const gchar* name,
120                                       const gchar* nick,
121                                       const gchar* blurb,
122                                       GType object_type,
123                                       GParamFlags flags);
124 void gtkdoc_value_set_header (GValue* value,
125                               gpointer v_object);
126 void gtkdoc_value_take_header (GValue* value,
127                                gpointer v_object);
128 gpointer gtkdoc_value_get_header (const GValue* value);
129 GType gtkdoc_header_get_type (void) G_GNUC_CONST;
130 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkdocHeader, gtkdoc_header_unref)
131 GtkdocHeader* gtkdoc_header_new (const gchar* name,
132                                  const gchar* value,
133                                  gdouble pos,
134                                  gboolean block);
135 GtkdocHeader* gtkdoc_header_construct (GType object_type,
136                                        const gchar* name,
137                                        const gchar* value,
138                                        gdouble pos,
139                                        gboolean block);
140 gint gtkdoc_header_cmp (GtkdocHeader* self,
141                         GtkdocHeader* header);
142 static void gtkdoc_header_finalize (GtkdocHeader * obj);
143 static GType gtkdoc_header_get_type_once (void);
144 gpointer gtkdoc_gcomment_ref (gpointer instance);
145 void gtkdoc_gcomment_unref (gpointer instance);
146 GParamSpec* gtkdoc_param_spec_gcomment (const gchar* name,
147                                         const gchar* nick,
148                                         const gchar* blurb,
149                                         GType object_type,
150                                         GParamFlags flags);
151 void gtkdoc_value_set_gcomment (GValue* value,
152                                 gpointer v_object);
153 void gtkdoc_value_take_gcomment (GValue* value,
154                                  gpointer v_object);
155 gpointer gtkdoc_value_get_gcomment (const GValue* value);
156 GType gtkdoc_gcomment_get_type (void) G_GNUC_CONST;
157 G_DEFINE_AUTOPTR_CLEANUP_FUNC (GtkdocGComment, gtkdoc_gcomment_unref)
158 gchar* gtkdoc_gcomment_to_string (GtkdocGComment* self);
159 gchar* gtkdoc_commentize (const gchar* comment);
160 gchar* gtkdoc_gcomment_to_docbook (GtkdocGComment* self,
161                                    ValadocErrorReporter* reporter);
162 GtkdocGComment* gtkdoc_gcomment_new (void);
163 GtkdocGComment* gtkdoc_gcomment_construct (GType object_type);
164 static void gtkdoc_gcomment_finalize (GtkdocGComment * obj);
165 static GType gtkdoc_gcomment_get_type_once (void);
166 static void _vala_array_destroy (gpointer array,
167                           gint array_length,
168                           GDestroyNotify destroy_func);
169 static void _vala_array_free (gpointer array,
170                        gint array_length,
171                        GDestroyNotify destroy_func);
172 
173 GtkdocHeader*
gtkdoc_header_construct(GType object_type,const gchar * name,const gchar * value,gdouble pos,gboolean block)174 gtkdoc_header_construct (GType object_type,
175                          const gchar* name,
176                          const gchar* value,
177                          gdouble pos,
178                          gboolean block)
179 {
180 	GtkdocHeader* self = NULL;
181 	gchar* _tmp0_;
182 	gchar* _tmp1_;
183 	g_return_val_if_fail (name != NULL, NULL);
184 	self = (GtkdocHeader*) g_type_create_instance (object_type);
185 	_tmp0_ = g_strdup (name);
186 	_g_free0 (self->name);
187 	self->name = _tmp0_;
188 	_tmp1_ = g_strdup (value);
189 	_g_free0 (self->value);
190 	self->value = _tmp1_;
191 	self->pos = pos;
192 	self->block = block;
193 	return self;
194 }
195 
196 GtkdocHeader*
gtkdoc_header_new(const gchar * name,const gchar * value,gdouble pos,gboolean block)197 gtkdoc_header_new (const gchar* name,
198                    const gchar* value,
199                    gdouble pos,
200                    gboolean block)
201 {
202 	return gtkdoc_header_construct (GTKDOC_TYPE_HEADER, name, value, pos, block);
203 }
204 
205 gint
gtkdoc_header_cmp(GtkdocHeader * self,GtkdocHeader * header)206 gtkdoc_header_cmp (GtkdocHeader* self,
207                    GtkdocHeader* header)
208 {
209 	gint result = 0;
210 	g_return_val_if_fail (self != NULL, 0);
211 	g_return_val_if_fail (header != NULL, 0);
212 	if (self->pos > header->pos) {
213 		result = 1;
214 		return result;
215 	} else {
216 		if (self->pos < header->pos) {
217 			result = -1;
218 			return result;
219 		}
220 	}
221 	result = 0;
222 	return result;
223 }
224 
225 static void
gtkdoc_value_header_init(GValue * value)226 gtkdoc_value_header_init (GValue* value)
227 {
228 	value->data[0].v_pointer = NULL;
229 }
230 
231 static void
gtkdoc_value_header_free_value(GValue * value)232 gtkdoc_value_header_free_value (GValue* value)
233 {
234 	if (value->data[0].v_pointer) {
235 		gtkdoc_header_unref (value->data[0].v_pointer);
236 	}
237 }
238 
239 static void
gtkdoc_value_header_copy_value(const GValue * src_value,GValue * dest_value)240 gtkdoc_value_header_copy_value (const GValue* src_value,
241                                 GValue* dest_value)
242 {
243 	if (src_value->data[0].v_pointer) {
244 		dest_value->data[0].v_pointer = gtkdoc_header_ref (src_value->data[0].v_pointer);
245 	} else {
246 		dest_value->data[0].v_pointer = NULL;
247 	}
248 }
249 
250 static gpointer
gtkdoc_value_header_peek_pointer(const GValue * value)251 gtkdoc_value_header_peek_pointer (const GValue* value)
252 {
253 	return value->data[0].v_pointer;
254 }
255 
256 static gchar*
gtkdoc_value_header_collect_value(GValue * value,guint n_collect_values,GTypeCValue * collect_values,guint collect_flags)257 gtkdoc_value_header_collect_value (GValue* value,
258                                    guint n_collect_values,
259                                    GTypeCValue* collect_values,
260                                    guint collect_flags)
261 {
262 	if (collect_values[0].v_pointer) {
263 		GtkdocHeader * object;
264 		object = collect_values[0].v_pointer;
265 		if (object->parent_instance.g_class == NULL) {
266 			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
267 		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
268 			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
269 		}
270 		value->data[0].v_pointer = gtkdoc_header_ref (object);
271 	} else {
272 		value->data[0].v_pointer = NULL;
273 	}
274 	return NULL;
275 }
276 
277 static gchar*
gtkdoc_value_header_lcopy_value(const GValue * value,guint n_collect_values,GTypeCValue * collect_values,guint collect_flags)278 gtkdoc_value_header_lcopy_value (const GValue* value,
279                                  guint n_collect_values,
280                                  GTypeCValue* collect_values,
281                                  guint collect_flags)
282 {
283 	GtkdocHeader ** object_p;
284 	object_p = collect_values[0].v_pointer;
285 	if (!object_p) {
286 		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
287 	}
288 	if (!value->data[0].v_pointer) {
289 		*object_p = NULL;
290 	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
291 		*object_p = value->data[0].v_pointer;
292 	} else {
293 		*object_p = gtkdoc_header_ref (value->data[0].v_pointer);
294 	}
295 	return NULL;
296 }
297 
298 GParamSpec*
gtkdoc_param_spec_header(const gchar * name,const gchar * nick,const gchar * blurb,GType object_type,GParamFlags flags)299 gtkdoc_param_spec_header (const gchar* name,
300                           const gchar* nick,
301                           const gchar* blurb,
302                           GType object_type,
303                           GParamFlags flags)
304 {
305 	GtkdocParamSpecHeader* spec;
306 	g_return_val_if_fail (g_type_is_a (object_type, GTKDOC_TYPE_HEADER), NULL);
307 	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
308 	G_PARAM_SPEC (spec)->value_type = object_type;
309 	return G_PARAM_SPEC (spec);
310 }
311 
312 gpointer
gtkdoc_value_get_header(const GValue * value)313 gtkdoc_value_get_header (const GValue* value)
314 {
315 	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GTKDOC_TYPE_HEADER), NULL);
316 	return value->data[0].v_pointer;
317 }
318 
319 void
gtkdoc_value_set_header(GValue * value,gpointer v_object)320 gtkdoc_value_set_header (GValue* value,
321                          gpointer v_object)
322 {
323 	GtkdocHeader * old;
324 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GTKDOC_TYPE_HEADER));
325 	old = value->data[0].v_pointer;
326 	if (v_object) {
327 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GTKDOC_TYPE_HEADER));
328 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
329 		value->data[0].v_pointer = v_object;
330 		gtkdoc_header_ref (value->data[0].v_pointer);
331 	} else {
332 		value->data[0].v_pointer = NULL;
333 	}
334 	if (old) {
335 		gtkdoc_header_unref (old);
336 	}
337 }
338 
339 void
gtkdoc_value_take_header(GValue * value,gpointer v_object)340 gtkdoc_value_take_header (GValue* value,
341                           gpointer v_object)
342 {
343 	GtkdocHeader * old;
344 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GTKDOC_TYPE_HEADER));
345 	old = value->data[0].v_pointer;
346 	if (v_object) {
347 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GTKDOC_TYPE_HEADER));
348 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
349 		value->data[0].v_pointer = v_object;
350 	} else {
351 		value->data[0].v_pointer = NULL;
352 	}
353 	if (old) {
354 		gtkdoc_header_unref (old);
355 	}
356 }
357 
358 static void
gtkdoc_header_class_init(GtkdocHeaderClass * klass,gpointer klass_data)359 gtkdoc_header_class_init (GtkdocHeaderClass * klass,
360                           gpointer klass_data)
361 {
362 	gtkdoc_header_parent_class = g_type_class_peek_parent (klass);
363 	((GtkdocHeaderClass *) klass)->finalize = gtkdoc_header_finalize;
364 }
365 
366 static void
gtkdoc_header_instance_init(GtkdocHeader * self,gpointer klass)367 gtkdoc_header_instance_init (GtkdocHeader * self,
368                              gpointer klass)
369 {
370 	self->ref_count = 1;
371 }
372 
373 static void
gtkdoc_header_finalize(GtkdocHeader * obj)374 gtkdoc_header_finalize (GtkdocHeader * obj)
375 {
376 	GtkdocHeader * self;
377 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GTKDOC_TYPE_HEADER, GtkdocHeader);
378 	g_signal_handlers_destroy (self);
379 	_g_free0 (self->name);
380 	self->annotations = (_vala_array_free (self->annotations, self->annotations_length1, (GDestroyNotify) g_free), NULL);
381 	_g_free0 (self->value);
382 }
383 
384 static GType
gtkdoc_header_get_type_once(void)385 gtkdoc_header_get_type_once (void)
386 {
387 	static const GTypeValueTable g_define_type_value_table = { gtkdoc_value_header_init, gtkdoc_value_header_free_value, gtkdoc_value_header_copy_value, gtkdoc_value_header_peek_pointer, "p", gtkdoc_value_header_collect_value, "p", gtkdoc_value_header_lcopy_value };
388 	static const GTypeInfo g_define_type_info = { sizeof (GtkdocHeaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gtkdoc_header_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GtkdocHeader), 0, (GInstanceInitFunc) gtkdoc_header_instance_init, &g_define_type_value_table };
389 	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
390 	GType gtkdoc_header_type_id;
391 	gtkdoc_header_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GtkdocHeader", &g_define_type_info, &g_define_type_fundamental_info, 0);
392 	return gtkdoc_header_type_id;
393 }
394 
395 GType
gtkdoc_header_get_type(void)396 gtkdoc_header_get_type (void)
397 {
398 	static volatile gsize gtkdoc_header_type_id__volatile = 0;
399 	if (g_once_init_enter (&gtkdoc_header_type_id__volatile)) {
400 		GType gtkdoc_header_type_id;
401 		gtkdoc_header_type_id = gtkdoc_header_get_type_once ();
402 		g_once_init_leave (&gtkdoc_header_type_id__volatile, gtkdoc_header_type_id);
403 	}
404 	return gtkdoc_header_type_id__volatile;
405 }
406 
407 gpointer
gtkdoc_header_ref(gpointer instance)408 gtkdoc_header_ref (gpointer instance)
409 {
410 	GtkdocHeader * self;
411 	self = instance;
412 	g_atomic_int_inc (&self->ref_count);
413 	return instance;
414 }
415 
416 void
gtkdoc_header_unref(gpointer instance)417 gtkdoc_header_unref (gpointer instance)
418 {
419 	GtkdocHeader * self;
420 	self = instance;
421 	if (g_atomic_int_dec_and_test (&self->ref_count)) {
422 		GTKDOC_HEADER_GET_CLASS (self)->finalize (self);
423 		g_type_free_instance ((GTypeInstance *) self);
424 	}
425 }
426 
427 static gpointer
_vala_iterable_ref0(gpointer self)428 _vala_iterable_ref0 (gpointer self)
429 {
430 	return self ? vala_iterable_ref (self) : NULL;
431 }
432 
433 static gchar*
_vala_g_strjoinv(const gchar * separator,gchar ** str_array,gint str_array_length1)434 _vala_g_strjoinv (const gchar* separator,
435                   gchar** str_array,
436                   gint str_array_length1)
437 {
438 	gboolean _tmp0_ = FALSE;
439 	gchar* result = NULL;
440 	if (separator == NULL) {
441 		separator = "";
442 	}
443 	if (str_array != NULL) {
444 		gboolean _tmp1_ = FALSE;
445 		if (str_array_length1 > 0) {
446 			_tmp1_ = TRUE;
447 		} else {
448 			gboolean _tmp2_ = FALSE;
449 			if (str_array_length1 == -1) {
450 				const gchar* _tmp3_;
451 				_tmp3_ = str_array[0];
452 				_tmp2_ = _tmp3_ != NULL;
453 			} else {
454 				_tmp2_ = FALSE;
455 			}
456 			_tmp1_ = _tmp2_;
457 		}
458 		_tmp0_ = _tmp1_;
459 	} else {
460 		_tmp0_ = FALSE;
461 	}
462 	if (_tmp0_) {
463 		gint i = 0;
464 		gsize len = 0UL;
465 		gint _tmp16_;
466 		gint _tmp17_;
467 		const gchar* res = NULL;
468 		void* _tmp18_;
469 		void* ptr = NULL;
470 		const gchar* _tmp19_;
471 		const gchar* _tmp20_;
472 		void* _tmp21_;
473 		const gchar* _tmp31_;
474 		len = (gsize) 1;
475 		{
476 			gboolean _tmp4_ = FALSE;
477 			i = 0;
478 			_tmp4_ = TRUE;
479 			while (TRUE) {
480 				gboolean _tmp6_ = FALSE;
481 				gboolean _tmp7_ = FALSE;
482 				gint _tmp10_ = 0;
483 				const gchar* _tmp11_;
484 				if (!_tmp4_) {
485 					gint _tmp5_;
486 					_tmp5_ = i;
487 					i = _tmp5_ + 1;
488 				}
489 				_tmp4_ = FALSE;
490 				if (str_array_length1 != -1) {
491 					_tmp7_ = i < str_array_length1;
492 				} else {
493 					_tmp7_ = FALSE;
494 				}
495 				if (_tmp7_) {
496 					_tmp6_ = TRUE;
497 				} else {
498 					gboolean _tmp8_ = FALSE;
499 					if (str_array_length1 == -1) {
500 						const gchar* _tmp9_;
501 						_tmp9_ = str_array[i];
502 						_tmp8_ = _tmp9_ != NULL;
503 					} else {
504 						_tmp8_ = FALSE;
505 					}
506 					_tmp6_ = _tmp8_;
507 				}
508 				if (!_tmp6_) {
509 					break;
510 				}
511 				_tmp11_ = str_array[i];
512 				if (_tmp11_ != NULL) {
513 					const gchar* _tmp12_;
514 					gint _tmp13_;
515 					gint _tmp14_;
516 					_tmp12_ = str_array[i];
517 					_tmp13_ = strlen ((const gchar*) _tmp12_);
518 					_tmp14_ = _tmp13_;
519 					_tmp10_ = _tmp14_;
520 				} else {
521 					_tmp10_ = 0;
522 				}
523 				len += (gsize) _tmp10_;
524 			}
525 		}
526 		if (i == 0) {
527 			gchar* _tmp15_;
528 			_tmp15_ = g_strdup ("");
529 			result = _tmp15_;
530 			return result;
531 		}
532 		str_array_length1 = i;
533 		_tmp16_ = strlen ((const gchar*) separator);
534 		_tmp17_ = _tmp16_;
535 		len += (gsize) (_tmp17_ * (i - 1));
536 		_tmp18_ = g_malloc (len);
537 		res = _tmp18_;
538 		_tmp19_ = res;
539 		_tmp20_ = str_array[0];
540 		_tmp21_ = g_stpcpy ((void*) _tmp19_, (const gchar*) _tmp20_);
541 		ptr = _tmp21_;
542 		{
543 			gboolean _tmp22_ = FALSE;
544 			i = 1;
545 			_tmp22_ = TRUE;
546 			while (TRUE) {
547 				void* _tmp24_;
548 				void* _tmp25_;
549 				const gchar* _tmp26_ = NULL;
550 				const gchar* _tmp27_;
551 				void* _tmp29_;
552 				void* _tmp30_;
553 				if (!_tmp22_) {
554 					gint _tmp23_;
555 					_tmp23_ = i;
556 					i = _tmp23_ + 1;
557 				}
558 				_tmp22_ = FALSE;
559 				if (!(i < str_array_length1)) {
560 					break;
561 				}
562 				_tmp24_ = ptr;
563 				_tmp25_ = g_stpcpy (_tmp24_, (const gchar*) separator);
564 				ptr = _tmp25_;
565 				_tmp27_ = str_array[i];
566 				if (_tmp27_ != NULL) {
567 					const gchar* _tmp28_;
568 					_tmp28_ = str_array[i];
569 					_tmp26_ = (const gchar*) _tmp28_;
570 				} else {
571 					_tmp26_ = "";
572 				}
573 				_tmp29_ = ptr;
574 				_tmp30_ = g_stpcpy (_tmp29_, _tmp26_);
575 				ptr = _tmp30_;
576 			}
577 		}
578 		_tmp31_ = res;
579 		res = NULL;
580 		result = (gchar*) _tmp31_;
581 		return result;
582 	} else {
583 		gchar* _tmp32_;
584 		_tmp32_ = g_strdup ("");
585 		result = _tmp32_;
586 		return result;
587 	}
588 }
589 
590 gchar*
gtkdoc_gcomment_to_string(GtkdocGComment * self)591 gtkdoc_gcomment_to_string (GtkdocGComment* self)
592 {
593 	GString* builder = NULL;
594 	GString* _tmp0_;
595 	const gchar* _tmp1_ = NULL;
596 	GString* _tmp2_;
597 	const gchar* _tmp3_;
598 	gchar* _tmp4_;
599 	gchar* _tmp5_;
600 	gboolean _tmp6_ = FALSE;
601 	gchar** _tmp7_;
602 	gint _tmp7__length1;
603 	gboolean _tmp13_ = FALSE;
604 	ValaList* _tmp19_;
605 	gboolean _tmp51_ = FALSE;
606 	const gchar* _tmp57_;
607 	gchar** _tmp62_;
608 	gint _tmp62__length1;
609 	gboolean _tmp67_ = FALSE;
610 	const gchar* _tmp68_;
611 	ValaList* _tmp84_;
612 	gint _tmp85_;
613 	gint _tmp86_;
614 	GString* _tmp107_;
615 	GString* _tmp108_;
616 	const gchar* _tmp109_;
617 	gchar* _tmp110_;
618 	gchar* result = NULL;
619 	g_return_val_if_fail (self != NULL, NULL);
620 	_tmp0_ = g_string_new ("");
621 	builder = _tmp0_;
622 	if (self->is_section) {
623 		_tmp1_ = "SECTION:%s";
624 	} else {
625 		_tmp1_ = "%s:";
626 	}
627 	_tmp2_ = builder;
628 	_tmp3_ = self->symbol;
629 	_tmp4_ = g_strdup_printf (_tmp1_, _tmp3_);
630 	_tmp5_ = _tmp4_;
631 	g_string_append_printf (_tmp2_, "/**\n * %s", _tmp5_);
632 	_g_free0 (_tmp5_);
633 	_tmp7_ = self->symbol_annotations;
634 	_tmp7__length1 = self->symbol_annotations_length1;
635 	if (_tmp7_ != NULL) {
636 		gchar** _tmp8_;
637 		gint _tmp8__length1;
638 		_tmp8_ = self->symbol_annotations;
639 		_tmp8__length1 = self->symbol_annotations_length1;
640 		_tmp6_ = _tmp8__length1 > 0;
641 	} else {
642 		_tmp6_ = FALSE;
643 	}
644 	if (_tmp6_) {
645 		gchar** _tmp9_;
646 		gint _tmp9__length1;
647 		_tmp9_ = self->symbol_annotations;
648 		_tmp9__length1 = self->symbol_annotations_length1;
649 		{
650 			gchar** annotation_collection = NULL;
651 			gint annotation_collection_length1 = 0;
652 			gint _annotation_collection_size_ = 0;
653 			gint annotation_it = 0;
654 			annotation_collection = _tmp9_;
655 			annotation_collection_length1 = _tmp9__length1;
656 			for (annotation_it = 0; annotation_it < annotation_collection_length1; annotation_it = annotation_it + 1) {
657 				gchar* _tmp10_;
658 				gchar* annotation = NULL;
659 				_tmp10_ = g_strdup (annotation_collection[annotation_it]);
660 				annotation = _tmp10_;
661 				{
662 					GString* _tmp11_;
663 					const gchar* _tmp12_;
664 					_tmp11_ = builder;
665 					_tmp12_ = annotation;
666 					g_string_append_printf (_tmp11_, " (%s)", _tmp12_);
667 					_g_free0 (annotation);
668 				}
669 			}
670 		}
671 	}
672 	if (self->short_description) {
673 		const gchar* _tmp14_;
674 		_tmp14_ = self->brief_comment;
675 		_tmp13_ = _tmp14_ != NULL;
676 	} else {
677 		_tmp13_ = FALSE;
678 	}
679 	if (_tmp13_) {
680 		GString* _tmp15_;
681 		const gchar* _tmp16_;
682 		gchar* _tmp17_;
683 		gchar* _tmp18_;
684 		_tmp15_ = builder;
685 		_tmp16_ = self->brief_comment;
686 		_tmp17_ = gtkdoc_commentize (_tmp16_);
687 		_tmp18_ = _tmp17_;
688 		g_string_append_printf (_tmp15_, "\n * @short_description: %s", _tmp18_);
689 		_g_free0 (_tmp18_);
690 	}
691 	_tmp19_ = self->headers;
692 	vala_list_sort (_tmp19_, (GCompareDataFunc) gtkdoc_header_cmp, NULL, NULL);
693 	{
694 		ValaList* _header_list = NULL;
695 		ValaList* _tmp20_;
696 		ValaList* _tmp21_;
697 		gint _header_size = 0;
698 		ValaList* _tmp22_;
699 		gint _tmp23_;
700 		gint _tmp24_;
701 		gint _header_index = 0;
702 		_tmp20_ = self->headers;
703 		_tmp21_ = _vala_iterable_ref0 (_tmp20_);
704 		_header_list = _tmp21_;
705 		_tmp22_ = _header_list;
706 		_tmp23_ = vala_collection_get_size ((ValaCollection*) _tmp22_);
707 		_tmp24_ = _tmp23_;
708 		_header_size = _tmp24_;
709 		_header_index = -1;
710 		while (TRUE) {
711 			gint _tmp25_;
712 			gint _tmp26_;
713 			GtkdocHeader* header = NULL;
714 			ValaList* _tmp27_;
715 			gpointer _tmp28_;
716 			GString* _tmp29_;
717 			GtkdocHeader* _tmp30_;
718 			const gchar* _tmp31_;
719 			gboolean _tmp32_ = FALSE;
720 			GtkdocHeader* _tmp33_;
721 			gchar** _tmp34_;
722 			gint _tmp34__length1;
723 			GtkdocHeader* _tmp43_;
724 			const gchar* _tmp44_;
725 			_header_index = _header_index + 1;
726 			_tmp25_ = _header_index;
727 			_tmp26_ = _header_size;
728 			if (!(_tmp25_ < _tmp26_)) {
729 				break;
730 			}
731 			_tmp27_ = _header_list;
732 			_tmp28_ = vala_list_get (_tmp27_, _header_index);
733 			header = (GtkdocHeader*) _tmp28_;
734 			_tmp29_ = builder;
735 			_tmp30_ = header;
736 			_tmp31_ = _tmp30_->name;
737 			g_string_append_printf (_tmp29_, "\n * @%s:", _tmp31_);
738 			_tmp33_ = header;
739 			_tmp34_ = _tmp33_->annotations;
740 			_tmp34__length1 = _tmp33_->annotations_length1;
741 			if (_tmp34_ != NULL) {
742 				GtkdocHeader* _tmp35_;
743 				gchar** _tmp36_;
744 				gint _tmp36__length1;
745 				_tmp35_ = header;
746 				_tmp36_ = _tmp35_->annotations;
747 				_tmp36__length1 = _tmp35_->annotations_length1;
748 				_tmp32_ = _tmp36__length1 > 0;
749 			} else {
750 				_tmp32_ = FALSE;
751 			}
752 			if (_tmp32_) {
753 				GtkdocHeader* _tmp37_;
754 				gchar** _tmp38_;
755 				gint _tmp38__length1;
756 				GString* _tmp42_;
757 				_tmp37_ = header;
758 				_tmp38_ = _tmp37_->annotations;
759 				_tmp38__length1 = _tmp37_->annotations_length1;
760 				{
761 					gchar** annotation_collection = NULL;
762 					gint annotation_collection_length1 = 0;
763 					gint _annotation_collection_size_ = 0;
764 					gint annotation_it = 0;
765 					annotation_collection = _tmp38_;
766 					annotation_collection_length1 = _tmp38__length1;
767 					for (annotation_it = 0; annotation_it < annotation_collection_length1; annotation_it = annotation_it + 1) {
768 						gchar* _tmp39_;
769 						gchar* annotation = NULL;
770 						_tmp39_ = g_strdup (annotation_collection[annotation_it]);
771 						annotation = _tmp39_;
772 						{
773 							GString* _tmp40_;
774 							const gchar* _tmp41_;
775 							_tmp40_ = builder;
776 							_tmp41_ = annotation;
777 							g_string_append_printf (_tmp40_, " (%s)", _tmp41_);
778 							_g_free0 (annotation);
779 						}
780 					}
781 				}
782 				_tmp42_ = builder;
783 				g_string_append_c (_tmp42_, ':');
784 			}
785 			_tmp43_ = header;
786 			_tmp44_ = _tmp43_->value;
787 			if (_tmp44_ != NULL) {
788 				GString* _tmp45_;
789 				GString* _tmp46_;
790 				GtkdocHeader* _tmp47_;
791 				const gchar* _tmp48_;
792 				gchar* _tmp49_;
793 				gchar* _tmp50_;
794 				_tmp45_ = builder;
795 				g_string_append_c (_tmp45_, ' ');
796 				_tmp46_ = builder;
797 				_tmp47_ = header;
798 				_tmp48_ = _tmp47_->value;
799 				_tmp49_ = gtkdoc_commentize (_tmp48_);
800 				_tmp50_ = _tmp49_;
801 				g_string_append (_tmp46_, _tmp50_);
802 				_g_free0 (_tmp50_);
803 			}
804 			_gtkdoc_header_unref0 (header);
805 		}
806 		_vala_iterable_unref0 (_header_list);
807 	}
808 	if (!self->short_description) {
809 		const gchar* _tmp52_;
810 		_tmp52_ = self->brief_comment;
811 		_tmp51_ = _tmp52_ != NULL;
812 	} else {
813 		_tmp51_ = FALSE;
814 	}
815 	if (_tmp51_) {
816 		GString* _tmp53_;
817 		const gchar* _tmp54_;
818 		gchar* _tmp55_;
819 		gchar* _tmp56_;
820 		_tmp53_ = builder;
821 		_tmp54_ = self->brief_comment;
822 		_tmp55_ = gtkdoc_commentize (_tmp54_);
823 		_tmp56_ = _tmp55_;
824 		g_string_append_printf (_tmp53_, "\n * \n * %s", _tmp56_);
825 		_g_free0 (_tmp56_);
826 	}
827 	_tmp57_ = self->long_comment;
828 	if (_tmp57_ != NULL) {
829 		GString* _tmp58_;
830 		const gchar* _tmp59_;
831 		gchar* _tmp60_;
832 		gchar* _tmp61_;
833 		_tmp58_ = builder;
834 		_tmp59_ = self->long_comment;
835 		_tmp60_ = gtkdoc_commentize (_tmp59_);
836 		_tmp61_ = _tmp60_;
837 		g_string_append_printf (_tmp58_, "\n * \n * %s", _tmp61_);
838 		_g_free0 (_tmp61_);
839 	}
840 	_tmp62_ = self->see_also;
841 	_tmp62__length1 = self->see_also_length1;
842 	if (_tmp62__length1 > 0) {
843 		GString* _tmp63_;
844 		gchar** _tmp64_;
845 		gint _tmp64__length1;
846 		gchar* _tmp65_;
847 		gchar* _tmp66_;
848 		_tmp63_ = builder;
849 		_tmp64_ = self->see_also;
850 		_tmp64__length1 = self->see_also_length1;
851 		_tmp65_ = _vala_g_strjoinv (", ", _tmp64_, (gint) _tmp64__length1);
852 		_tmp66_ = _tmp65_;
853 		g_string_append_printf (_tmp63_, "\n * \n * <emphasis>See also</emphasis>: %s", _tmp66_);
854 		_g_free0 (_tmp66_);
855 	}
856 	_tmp68_ = self->returns;
857 	if (_tmp68_ != NULL) {
858 		_tmp67_ = TRUE;
859 	} else {
860 		gchar** _tmp69_;
861 		gint _tmp69__length1;
862 		_tmp69_ = self->returns_annotations;
863 		_tmp69__length1 = self->returns_annotations_length1;
864 		_tmp67_ = _tmp69__length1 > 0;
865 	}
866 	if (_tmp67_) {
867 		GString* _tmp70_;
868 		gchar** _tmp71_;
869 		gint _tmp71__length1;
870 		GString* _tmp78_;
871 		const gchar* _tmp79_;
872 		_tmp70_ = builder;
873 		g_string_append (_tmp70_, "\n * \n * Returns:");
874 		_tmp71_ = self->returns_annotations;
875 		_tmp71__length1 = self->returns_annotations_length1;
876 		if (_tmp71_ != NULL) {
877 			gchar** _tmp72_;
878 			gint _tmp72__length1;
879 			gchar** _tmp76_;
880 			gint _tmp76__length1;
881 			_tmp72_ = self->returns_annotations;
882 			_tmp72__length1 = self->returns_annotations_length1;
883 			{
884 				gchar** annotation_collection = NULL;
885 				gint annotation_collection_length1 = 0;
886 				gint _annotation_collection_size_ = 0;
887 				gint annotation_it = 0;
888 				annotation_collection = _tmp72_;
889 				annotation_collection_length1 = _tmp72__length1;
890 				for (annotation_it = 0; annotation_it < annotation_collection_length1; annotation_it = annotation_it + 1) {
891 					gchar* _tmp73_;
892 					gchar* annotation = NULL;
893 					_tmp73_ = g_strdup (annotation_collection[annotation_it]);
894 					annotation = _tmp73_;
895 					{
896 						GString* _tmp74_;
897 						const gchar* _tmp75_;
898 						_tmp74_ = builder;
899 						_tmp75_ = annotation;
900 						g_string_append_printf (_tmp74_, " (%s)", _tmp75_);
901 						_g_free0 (annotation);
902 					}
903 				}
904 			}
905 			_tmp76_ = self->returns_annotations;
906 			_tmp76__length1 = self->returns_annotations_length1;
907 			if (_tmp76__length1 > 0) {
908 				GString* _tmp77_;
909 				_tmp77_ = builder;
910 				g_string_append_c (_tmp77_, ':');
911 			}
912 		}
913 		_tmp78_ = builder;
914 		g_string_append_c (_tmp78_, ' ');
915 		_tmp79_ = self->returns;
916 		if (_tmp79_ != NULL) {
917 			GString* _tmp80_;
918 			const gchar* _tmp81_;
919 			gchar* _tmp82_;
920 			gchar* _tmp83_;
921 			_tmp80_ = builder;
922 			_tmp81_ = self->returns;
923 			_tmp82_ = gtkdoc_commentize (_tmp81_);
924 			_tmp83_ = _tmp82_;
925 			g_string_append (_tmp80_, _tmp83_);
926 			_g_free0 (_tmp83_);
927 		}
928 	}
929 	_tmp84_ = self->versioning;
930 	_tmp85_ = vala_collection_get_size ((ValaCollection*) _tmp84_);
931 	_tmp86_ = _tmp85_;
932 	if (_tmp86_ > 0) {
933 		GString* _tmp87_;
934 		_tmp87_ = builder;
935 		g_string_append (_tmp87_, "\n *");
936 		{
937 			ValaList* _version_list = NULL;
938 			ValaList* _tmp88_;
939 			ValaList* _tmp89_;
940 			gint _version_size = 0;
941 			ValaList* _tmp90_;
942 			gint _tmp91_;
943 			gint _tmp92_;
944 			gint _version_index = 0;
945 			_tmp88_ = self->versioning;
946 			_tmp89_ = _vala_iterable_ref0 (_tmp88_);
947 			_version_list = _tmp89_;
948 			_tmp90_ = _version_list;
949 			_tmp91_ = vala_collection_get_size ((ValaCollection*) _tmp90_);
950 			_tmp92_ = _tmp91_;
951 			_version_size = _tmp92_;
952 			_version_index = -1;
953 			while (TRUE) {
954 				gint _tmp93_;
955 				gint _tmp94_;
956 				GtkdocHeader* version = NULL;
957 				ValaList* _tmp95_;
958 				gpointer _tmp96_;
959 				GString* _tmp97_;
960 				GtkdocHeader* _tmp98_;
961 				const gchar* _tmp99_;
962 				GtkdocHeader* _tmp100_;
963 				const gchar* _tmp101_;
964 				_version_index = _version_index + 1;
965 				_tmp93_ = _version_index;
966 				_tmp94_ = _version_size;
967 				if (!(_tmp93_ < _tmp94_)) {
968 					break;
969 				}
970 				_tmp95_ = _version_list;
971 				_tmp96_ = vala_list_get (_tmp95_, _version_index);
972 				version = (GtkdocHeader*) _tmp96_;
973 				_tmp97_ = builder;
974 				_tmp98_ = version;
975 				_tmp99_ = _tmp98_->name;
976 				g_string_append_printf (_tmp97_, "\n * %s:", _tmp99_);
977 				_tmp100_ = version;
978 				_tmp101_ = _tmp100_->value;
979 				if (_tmp101_ != NULL) {
980 					GString* _tmp102_;
981 					GtkdocHeader* _tmp103_;
982 					const gchar* _tmp104_;
983 					gchar* _tmp105_;
984 					gchar* _tmp106_;
985 					_tmp102_ = builder;
986 					_tmp103_ = version;
987 					_tmp104_ = _tmp103_->value;
988 					_tmp105_ = gtkdoc_commentize (_tmp104_);
989 					_tmp106_ = _tmp105_;
990 					g_string_append_printf (_tmp102_, " %s", _tmp106_);
991 					_g_free0 (_tmp106_);
992 				}
993 				_gtkdoc_header_unref0 (version);
994 			}
995 			_vala_iterable_unref0 (_version_list);
996 		}
997 	}
998 	_tmp107_ = builder;
999 	g_string_append (_tmp107_, "\n */");
1000 	_tmp108_ = builder;
1001 	_tmp109_ = _tmp108_->str;
1002 	_tmp110_ = g_strdup (_tmp109_);
1003 	result = _tmp110_;
1004 	_g_string_free0 (builder);
1005 	return result;
1006 }
1007 
1008 gchar*
gtkdoc_gcomment_to_docbook(GtkdocGComment * self,ValadocErrorReporter * reporter)1009 gtkdoc_gcomment_to_docbook (GtkdocGComment* self,
1010                             ValadocErrorReporter* reporter)
1011 {
1012 	gchar* deprecated = NULL;
1013 	gchar* since = NULL;
1014 	GString* builder = NULL;
1015 	GString* _tmp21_;
1016 	const gchar* _tmp22_;
1017 	const gchar* _tmp26_;
1018 	const gchar* _tmp29_;
1019 	ValaList* _tmp32_;
1020 	gboolean _tmp33_ = FALSE;
1021 	ValaList* _tmp34_;
1022 	gint _tmp35_;
1023 	gint _tmp36_;
1024 	const gchar* _tmp57_;
1025 	GString* _tmp60_;
1026 	const gchar* _tmp61_;
1027 	gchar* _tmp62_;
1028 	gchar* result = NULL;
1029 	g_return_val_if_fail (self != NULL, NULL);
1030 	g_return_val_if_fail (reporter != NULL, NULL);
1031 	deprecated = NULL;
1032 	since = NULL;
1033 	{
1034 		ValaList* _header_list = NULL;
1035 		ValaList* _tmp0_;
1036 		ValaList* _tmp1_;
1037 		gint _header_size = 0;
1038 		ValaList* _tmp2_;
1039 		gint _tmp3_;
1040 		gint _tmp4_;
1041 		gint _header_index = 0;
1042 		_tmp0_ = self->versioning;
1043 		_tmp1_ = _vala_iterable_ref0 (_tmp0_);
1044 		_header_list = _tmp1_;
1045 		_tmp2_ = _header_list;
1046 		_tmp3_ = vala_collection_get_size ((ValaCollection*) _tmp2_);
1047 		_tmp4_ = _tmp3_;
1048 		_header_size = _tmp4_;
1049 		_header_index = -1;
1050 		while (TRUE) {
1051 			gint _tmp5_;
1052 			gint _tmp6_;
1053 			GtkdocHeader* header = NULL;
1054 			ValaList* _tmp7_;
1055 			gpointer _tmp8_;
1056 			GtkdocHeader* _tmp9_;
1057 			const gchar* _tmp10_;
1058 			_header_index = _header_index + 1;
1059 			_tmp5_ = _header_index;
1060 			_tmp6_ = _header_size;
1061 			if (!(_tmp5_ < _tmp6_)) {
1062 				break;
1063 			}
1064 			_tmp7_ = _header_list;
1065 			_tmp8_ = vala_list_get (_tmp7_, _header_index);
1066 			header = (GtkdocHeader*) _tmp8_;
1067 			_tmp9_ = header;
1068 			_tmp10_ = _tmp9_->name;
1069 			if (g_strcmp0 (_tmp10_, "Deprecated") == 0) {
1070 				GtkdocHeader* _tmp11_;
1071 				const gchar* _tmp12_;
1072 				gchar* _tmp13_;
1073 				_tmp11_ = header;
1074 				_tmp12_ = _tmp11_->value;
1075 				_tmp13_ = g_strdup (_tmp12_);
1076 				_g_free0 (deprecated);
1077 				deprecated = _tmp13_;
1078 			} else {
1079 				GtkdocHeader* _tmp14_;
1080 				const gchar* _tmp15_;
1081 				_tmp14_ = header;
1082 				_tmp15_ = _tmp14_->name;
1083 				if (g_strcmp0 (_tmp15_, "Since") == 0) {
1084 					GtkdocHeader* _tmp16_;
1085 					const gchar* _tmp17_;
1086 					gchar* _tmp18_;
1087 					_tmp16_ = header;
1088 					_tmp17_ = _tmp16_->value;
1089 					_tmp18_ = g_strdup (_tmp17_);
1090 					_g_free0 (since);
1091 					since = _tmp18_;
1092 				} else {
1093 					GtkdocHeader* _tmp19_;
1094 					const gchar* _tmp20_;
1095 					_tmp19_ = header;
1096 					_tmp20_ = _tmp19_->name;
1097 					valadoc_error_reporter_simple_warning (reporter, "GtkDoc", "Unknown versioning tag '%s'", _tmp20_);
1098 				}
1099 			}
1100 			_gtkdoc_header_unref0 (header);
1101 		}
1102 		_vala_iterable_unref0 (_header_list);
1103 	}
1104 	_tmp21_ = g_string_new ("");
1105 	builder = _tmp21_;
1106 	_tmp22_ = deprecated;
1107 	if (_tmp22_ != NULL) {
1108 		GString* _tmp23_;
1109 		const gchar* _tmp24_;
1110 		const gchar* _tmp25_;
1111 		_tmp23_ = builder;
1112 		_tmp24_ = self->symbol;
1113 		_tmp25_ = deprecated;
1114 		g_string_append_printf (_tmp23_, "<warning><para><literal>%s</literal> is deprecated and should not be u" \
1115 "sed in newly-written code. %s</para></warning>", _tmp24_, _tmp25_);
1116 	}
1117 	_tmp26_ = self->brief_comment;
1118 	if (_tmp26_ != NULL) {
1119 		GString* _tmp27_;
1120 		const gchar* _tmp28_;
1121 		_tmp27_ = builder;
1122 		_tmp28_ = self->brief_comment;
1123 		g_string_append_printf (_tmp27_, "<para>%s</para>", _tmp28_);
1124 	}
1125 	_tmp29_ = self->long_comment;
1126 	if (_tmp29_ != NULL) {
1127 		GString* _tmp30_;
1128 		const gchar* _tmp31_;
1129 		_tmp30_ = builder;
1130 		_tmp31_ = self->long_comment;
1131 		g_string_append (_tmp30_, _tmp31_);
1132 	}
1133 	_tmp32_ = self->headers;
1134 	vala_list_sort (_tmp32_, (GCompareDataFunc) gtkdoc_header_cmp, NULL, NULL);
1135 	_tmp34_ = self->headers;
1136 	_tmp35_ = vala_collection_get_size ((ValaCollection*) _tmp34_);
1137 	_tmp36_ = _tmp35_;
1138 	if (_tmp36_ > 0) {
1139 		_tmp33_ = TRUE;
1140 	} else {
1141 		const gchar* _tmp37_;
1142 		_tmp37_ = self->returns;
1143 		_tmp33_ = _tmp37_ != NULL;
1144 	}
1145 	if (_tmp33_) {
1146 		GString* _tmp38_;
1147 		const gchar* _tmp53_;
1148 		GString* _tmp56_;
1149 		_tmp38_ = builder;
1150 		g_string_append (_tmp38_, "<variablelist role=\"params\">");
1151 		{
1152 			ValaList* _header_list = NULL;
1153 			ValaList* _tmp39_;
1154 			ValaList* _tmp40_;
1155 			gint _header_size = 0;
1156 			ValaList* _tmp41_;
1157 			gint _tmp42_;
1158 			gint _tmp43_;
1159 			gint _header_index = 0;
1160 			_tmp39_ = self->headers;
1161 			_tmp40_ = _vala_iterable_ref0 (_tmp39_);
1162 			_header_list = _tmp40_;
1163 			_tmp41_ = _header_list;
1164 			_tmp42_ = vala_collection_get_size ((ValaCollection*) _tmp41_);
1165 			_tmp43_ = _tmp42_;
1166 			_header_size = _tmp43_;
1167 			_header_index = -1;
1168 			while (TRUE) {
1169 				gint _tmp44_;
1170 				gint _tmp45_;
1171 				GtkdocHeader* header = NULL;
1172 				ValaList* _tmp46_;
1173 				gpointer _tmp47_;
1174 				GString* _tmp48_;
1175 				GtkdocHeader* _tmp49_;
1176 				const gchar* _tmp50_;
1177 				GtkdocHeader* _tmp51_;
1178 				const gchar* _tmp52_;
1179 				_header_index = _header_index + 1;
1180 				_tmp44_ = _header_index;
1181 				_tmp45_ = _header_size;
1182 				if (!(_tmp44_ < _tmp45_)) {
1183 					break;
1184 				}
1185 				_tmp46_ = _header_list;
1186 				_tmp47_ = vala_list_get (_tmp46_, _header_index);
1187 				header = (GtkdocHeader*) _tmp47_;
1188 				_tmp48_ = builder;
1189 				_tmp49_ = header;
1190 				_tmp50_ = _tmp49_->name;
1191 				_tmp51_ = header;
1192 				_tmp52_ = _tmp51_->value;
1193 				g_string_append_printf (_tmp48_, "<varlistentry><term><parameter>%s</parameter>&#160;:</term>\n" \
1194 "<listitem><simpara> %s </simpara></listitem></varlistentry>", _tmp50_, _tmp52_);
1195 				_gtkdoc_header_unref0 (header);
1196 			}
1197 			_vala_iterable_unref0 (_header_list);
1198 		}
1199 		_tmp53_ = self->returns;
1200 		if (_tmp53_ != NULL) {
1201 			GString* _tmp54_;
1202 			const gchar* _tmp55_;
1203 			_tmp54_ = builder;
1204 			_tmp55_ = self->returns;
1205 			g_string_append_printf (_tmp54_, "<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term>\n" \
1206 "<listitem><simpara> %s </simpara></listitem></varlistentry>", _tmp55_);
1207 		}
1208 		_tmp56_ = builder;
1209 		g_string_append (_tmp56_, "</variablelist>");
1210 	}
1211 	_tmp57_ = since;
1212 	if (_tmp57_ != NULL) {
1213 		GString* _tmp58_;
1214 		const gchar* _tmp59_;
1215 		_tmp58_ = builder;
1216 		_tmp59_ = since;
1217 		g_string_append_printf (_tmp58_, "<para role=\"since\">Since %s</para>", _tmp59_);
1218 	}
1219 	_tmp60_ = builder;
1220 	_tmp61_ = _tmp60_->str;
1221 	_tmp62_ = g_strdup (_tmp61_);
1222 	result = _tmp62_;
1223 	_g_string_free0 (builder);
1224 	_g_free0 (since);
1225 	_g_free0 (deprecated);
1226 	return result;
1227 }
1228 
1229 GtkdocGComment*
gtkdoc_gcomment_construct(GType object_type)1230 gtkdoc_gcomment_construct (GType object_type)
1231 {
1232 	GtkdocGComment* self = NULL;
1233 	self = (GtkdocGComment*) g_type_create_instance (object_type);
1234 	return self;
1235 }
1236 
1237 GtkdocGComment*
gtkdoc_gcomment_new(void)1238 gtkdoc_gcomment_new (void)
1239 {
1240 	return gtkdoc_gcomment_construct (GTKDOC_TYPE_GCOMMENT);
1241 }
1242 
1243 static void
gtkdoc_value_gcomment_init(GValue * value)1244 gtkdoc_value_gcomment_init (GValue* value)
1245 {
1246 	value->data[0].v_pointer = NULL;
1247 }
1248 
1249 static void
gtkdoc_value_gcomment_free_value(GValue * value)1250 gtkdoc_value_gcomment_free_value (GValue* value)
1251 {
1252 	if (value->data[0].v_pointer) {
1253 		gtkdoc_gcomment_unref (value->data[0].v_pointer);
1254 	}
1255 }
1256 
1257 static void
gtkdoc_value_gcomment_copy_value(const GValue * src_value,GValue * dest_value)1258 gtkdoc_value_gcomment_copy_value (const GValue* src_value,
1259                                   GValue* dest_value)
1260 {
1261 	if (src_value->data[0].v_pointer) {
1262 		dest_value->data[0].v_pointer = gtkdoc_gcomment_ref (src_value->data[0].v_pointer);
1263 	} else {
1264 		dest_value->data[0].v_pointer = NULL;
1265 	}
1266 }
1267 
1268 static gpointer
gtkdoc_value_gcomment_peek_pointer(const GValue * value)1269 gtkdoc_value_gcomment_peek_pointer (const GValue* value)
1270 {
1271 	return value->data[0].v_pointer;
1272 }
1273 
1274 static gchar*
gtkdoc_value_gcomment_collect_value(GValue * value,guint n_collect_values,GTypeCValue * collect_values,guint collect_flags)1275 gtkdoc_value_gcomment_collect_value (GValue* value,
1276                                      guint n_collect_values,
1277                                      GTypeCValue* collect_values,
1278                                      guint collect_flags)
1279 {
1280 	if (collect_values[0].v_pointer) {
1281 		GtkdocGComment * object;
1282 		object = collect_values[0].v_pointer;
1283 		if (object->parent_instance.g_class == NULL) {
1284 			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
1285 		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
1286 			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
1287 		}
1288 		value->data[0].v_pointer = gtkdoc_gcomment_ref (object);
1289 	} else {
1290 		value->data[0].v_pointer = NULL;
1291 	}
1292 	return NULL;
1293 }
1294 
1295 static gchar*
gtkdoc_value_gcomment_lcopy_value(const GValue * value,guint n_collect_values,GTypeCValue * collect_values,guint collect_flags)1296 gtkdoc_value_gcomment_lcopy_value (const GValue* value,
1297                                    guint n_collect_values,
1298                                    GTypeCValue* collect_values,
1299                                    guint collect_flags)
1300 {
1301 	GtkdocGComment ** object_p;
1302 	object_p = collect_values[0].v_pointer;
1303 	if (!object_p) {
1304 		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
1305 	}
1306 	if (!value->data[0].v_pointer) {
1307 		*object_p = NULL;
1308 	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
1309 		*object_p = value->data[0].v_pointer;
1310 	} else {
1311 		*object_p = gtkdoc_gcomment_ref (value->data[0].v_pointer);
1312 	}
1313 	return NULL;
1314 }
1315 
1316 GParamSpec*
gtkdoc_param_spec_gcomment(const gchar * name,const gchar * nick,const gchar * blurb,GType object_type,GParamFlags flags)1317 gtkdoc_param_spec_gcomment (const gchar* name,
1318                             const gchar* nick,
1319                             const gchar* blurb,
1320                             GType object_type,
1321                             GParamFlags flags)
1322 {
1323 	GtkdocParamSpecGComment* spec;
1324 	g_return_val_if_fail (g_type_is_a (object_type, GTKDOC_TYPE_GCOMMENT), NULL);
1325 	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
1326 	G_PARAM_SPEC (spec)->value_type = object_type;
1327 	return G_PARAM_SPEC (spec);
1328 }
1329 
1330 gpointer
gtkdoc_value_get_gcomment(const GValue * value)1331 gtkdoc_value_get_gcomment (const GValue* value)
1332 {
1333 	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GTKDOC_TYPE_GCOMMENT), NULL);
1334 	return value->data[0].v_pointer;
1335 }
1336 
1337 void
gtkdoc_value_set_gcomment(GValue * value,gpointer v_object)1338 gtkdoc_value_set_gcomment (GValue* value,
1339                            gpointer v_object)
1340 {
1341 	GtkdocGComment * old;
1342 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GTKDOC_TYPE_GCOMMENT));
1343 	old = value->data[0].v_pointer;
1344 	if (v_object) {
1345 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GTKDOC_TYPE_GCOMMENT));
1346 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
1347 		value->data[0].v_pointer = v_object;
1348 		gtkdoc_gcomment_ref (value->data[0].v_pointer);
1349 	} else {
1350 		value->data[0].v_pointer = NULL;
1351 	}
1352 	if (old) {
1353 		gtkdoc_gcomment_unref (old);
1354 	}
1355 }
1356 
1357 void
gtkdoc_value_take_gcomment(GValue * value,gpointer v_object)1358 gtkdoc_value_take_gcomment (GValue* value,
1359                             gpointer v_object)
1360 {
1361 	GtkdocGComment * old;
1362 	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GTKDOC_TYPE_GCOMMENT));
1363 	old = value->data[0].v_pointer;
1364 	if (v_object) {
1365 		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GTKDOC_TYPE_GCOMMENT));
1366 		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
1367 		value->data[0].v_pointer = v_object;
1368 	} else {
1369 		value->data[0].v_pointer = NULL;
1370 	}
1371 	if (old) {
1372 		gtkdoc_gcomment_unref (old);
1373 	}
1374 }
1375 
1376 static void
gtkdoc_gcomment_class_init(GtkdocGCommentClass * klass,gpointer klass_data)1377 gtkdoc_gcomment_class_init (GtkdocGCommentClass * klass,
1378                             gpointer klass_data)
1379 {
1380 	gtkdoc_gcomment_parent_class = g_type_class_peek_parent (klass);
1381 	((GtkdocGCommentClass *) klass)->finalize = gtkdoc_gcomment_finalize;
1382 }
1383 
1384 static void
gtkdoc_gcomment_instance_init(GtkdocGComment * self,gpointer klass)1385 gtkdoc_gcomment_instance_init (GtkdocGComment * self,
1386                                gpointer klass)
1387 {
1388 	GEqualFunc _tmp0_;
1389 	ValaArrayList* _tmp1_;
1390 	GEqualFunc _tmp2_;
1391 	ValaArrayList* _tmp3_;
1392 	_tmp0_ = g_direct_equal;
1393 	_tmp1_ = vala_array_list_new (GTKDOC_TYPE_HEADER, (GBoxedCopyFunc) gtkdoc_header_ref, (GDestroyNotify) gtkdoc_header_unref, _tmp0_);
1394 	self->headers = (ValaList*) _tmp1_;
1395 	_tmp2_ = g_direct_equal;
1396 	_tmp3_ = vala_array_list_new (GTKDOC_TYPE_HEADER, (GBoxedCopyFunc) gtkdoc_header_ref, (GDestroyNotify) gtkdoc_header_unref, _tmp2_);
1397 	self->versioning = (ValaList*) _tmp3_;
1398 	self->ref_count = 1;
1399 }
1400 
1401 static void
gtkdoc_gcomment_finalize(GtkdocGComment * obj)1402 gtkdoc_gcomment_finalize (GtkdocGComment * obj)
1403 {
1404 	GtkdocGComment * self;
1405 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, GTKDOC_TYPE_GCOMMENT, GtkdocGComment);
1406 	g_signal_handlers_destroy (self);
1407 	_g_free0 (self->symbol);
1408 	self->symbol_annotations = (_vala_array_free (self->symbol_annotations, self->symbol_annotations_length1, (GDestroyNotify) g_free), NULL);
1409 	_vala_iterable_unref0 (self->headers);
1410 	_g_free0 (self->brief_comment);
1411 	_g_free0 (self->long_comment);
1412 	_g_free0 (self->returns);
1413 	self->returns_annotations = (_vala_array_free (self->returns_annotations, self->returns_annotations_length1, (GDestroyNotify) g_free), NULL);
1414 	_vala_iterable_unref0 (self->versioning);
1415 	self->see_also = (_vala_array_free (self->see_also, self->see_also_length1, (GDestroyNotify) g_free), NULL);
1416 }
1417 
1418 static GType
gtkdoc_gcomment_get_type_once(void)1419 gtkdoc_gcomment_get_type_once (void)
1420 {
1421 	static const GTypeValueTable g_define_type_value_table = { gtkdoc_value_gcomment_init, gtkdoc_value_gcomment_free_value, gtkdoc_value_gcomment_copy_value, gtkdoc_value_gcomment_peek_pointer, "p", gtkdoc_value_gcomment_collect_value, "p", gtkdoc_value_gcomment_lcopy_value };
1422 	static const GTypeInfo g_define_type_info = { sizeof (GtkdocGCommentClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gtkdoc_gcomment_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GtkdocGComment), 0, (GInstanceInitFunc) gtkdoc_gcomment_instance_init, &g_define_type_value_table };
1423 	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
1424 	GType gtkdoc_gcomment_type_id;
1425 	gtkdoc_gcomment_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GtkdocGComment", &g_define_type_info, &g_define_type_fundamental_info, 0);
1426 	return gtkdoc_gcomment_type_id;
1427 }
1428 
1429 GType
gtkdoc_gcomment_get_type(void)1430 gtkdoc_gcomment_get_type (void)
1431 {
1432 	static volatile gsize gtkdoc_gcomment_type_id__volatile = 0;
1433 	if (g_once_init_enter (&gtkdoc_gcomment_type_id__volatile)) {
1434 		GType gtkdoc_gcomment_type_id;
1435 		gtkdoc_gcomment_type_id = gtkdoc_gcomment_get_type_once ();
1436 		g_once_init_leave (&gtkdoc_gcomment_type_id__volatile, gtkdoc_gcomment_type_id);
1437 	}
1438 	return gtkdoc_gcomment_type_id__volatile;
1439 }
1440 
1441 gpointer
gtkdoc_gcomment_ref(gpointer instance)1442 gtkdoc_gcomment_ref (gpointer instance)
1443 {
1444 	GtkdocGComment * self;
1445 	self = instance;
1446 	g_atomic_int_inc (&self->ref_count);
1447 	return instance;
1448 }
1449 
1450 void
gtkdoc_gcomment_unref(gpointer instance)1451 gtkdoc_gcomment_unref (gpointer instance)
1452 {
1453 	GtkdocGComment * self;
1454 	self = instance;
1455 	if (g_atomic_int_dec_and_test (&self->ref_count)) {
1456 		GTKDOC_GCOMMENT_GET_CLASS (self)->finalize (self);
1457 		g_type_free_instance ((GTypeInstance *) self);
1458 	}
1459 }
1460 
1461 static void
_vala_array_destroy(gpointer array,gint array_length,GDestroyNotify destroy_func)1462 _vala_array_destroy (gpointer array,
1463                      gint array_length,
1464                      GDestroyNotify destroy_func)
1465 {
1466 	if ((array != NULL) && (destroy_func != NULL)) {
1467 		gint i;
1468 		for (i = 0; i < array_length; i = i + 1) {
1469 			if (((gpointer*) array)[i] != NULL) {
1470 				destroy_func (((gpointer*) array)[i]);
1471 			}
1472 		}
1473 	}
1474 }
1475 
1476 static void
_vala_array_free(gpointer array,gint array_length,GDestroyNotify destroy_func)1477 _vala_array_free (gpointer array,
1478                   gint array_length,
1479                   GDestroyNotify destroy_func)
1480 {
1481 	_vala_array_destroy (array, array_length, destroy_func);
1482 	g_free (array);
1483 }
1484 
1485