1 /* valaccodeggnucsection.c generated by valac, the Vala compiler
2  * generated from valaccodeggnucsection.vala, do not modify */
3 
4 /* valaccodeggnucsection.vala
5  *
6  * Copyright (C) 2016  Rico Tzschichholz
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  * 	Rico Tzschichholz <ricotz@ubuntu.com>
24  */
25 
26 #include "valaccode.h"
27 #include <glib.h>
28 #include <valagee.h>
29 #include <glib-object.h>
30 #include <stdlib.h>
31 #include <string.h>
32 
33 #define _vala_ccode_node_unref0(var) ((var == NULL) ? NULL : (var = (vala_ccode_node_unref (var), NULL)))
34 #define _vala_iterable_unref0(var) ((var == NULL) ? NULL : (var = (vala_iterable_unref (var), NULL)))
35 
36 struct _ValaCCodeGGnucSectionPrivate {
37 	ValaGGnucSectionType _section_type;
38 };
39 
40 static gint ValaCCodeGGnucSection_private_offset;
41 static gpointer vala_ccode_ggnuc_section_parent_class = NULL;
42 
43 static void vala_ccode_ggnuc_section_real_write (ValaCCodeNode* base,
44                                           ValaCCodeWriter* writer);
45 static void vala_ccode_ggnuc_section_real_write_declaration (ValaCCodeNode* base,
46                                                       ValaCCodeWriter* writer);
47 static void vala_ccode_ggnuc_section_finalize (ValaCCodeNode * obj);
48 static GType vala_ccode_ggnuc_section_get_type_once (void);
49 
50 static inline gpointer
vala_ccode_ggnuc_section_get_instance_private(ValaCCodeGGnucSection * self)51 vala_ccode_ggnuc_section_get_instance_private (ValaCCodeGGnucSection* self)
52 {
53 	return G_STRUCT_MEMBER_P (self, ValaCCodeGGnucSection_private_offset);
54 }
55 
56 ValaGGnucSectionType
vala_ccode_ggnuc_section_get_section_type(ValaCCodeGGnucSection * self)57 vala_ccode_ggnuc_section_get_section_type (ValaCCodeGGnucSection* self)
58 {
59 	ValaGGnucSectionType result;
60 	ValaGGnucSectionType _tmp0_;
61 	g_return_val_if_fail (self != NULL, 0);
62 	_tmp0_ = self->priv->_section_type;
63 	result = _tmp0_;
64 	return result;
65 }
66 
67 void
vala_ccode_ggnuc_section_set_section_type(ValaCCodeGGnucSection * self,ValaGGnucSectionType value)68 vala_ccode_ggnuc_section_set_section_type (ValaCCodeGGnucSection* self,
69                                            ValaGGnucSectionType value)
70 {
71 	g_return_if_fail (self != NULL);
72 	self->priv->_section_type = value;
73 }
74 
75 ValaCCodeGGnucSection*
vala_ccode_ggnuc_section_construct(GType object_type,ValaGGnucSectionType t)76 vala_ccode_ggnuc_section_construct (GType object_type,
77                                     ValaGGnucSectionType t)
78 {
79 	ValaCCodeGGnucSection* self = NULL;
80 	self = (ValaCCodeGGnucSection*) vala_ccode_fragment_construct (object_type);
81 	vala_ccode_ggnuc_section_set_section_type (self, t);
82 	return self;
83 }
84 
85 ValaCCodeGGnucSection*
vala_ccode_ggnuc_section_new(ValaGGnucSectionType t)86 vala_ccode_ggnuc_section_new (ValaGGnucSectionType t)
87 {
88 	return vala_ccode_ggnuc_section_construct (VALA_TYPE_CCODE_GGNUC_SECTION, t);
89 }
90 
91 static void
vala_ccode_ggnuc_section_real_write(ValaCCodeNode * base,ValaCCodeWriter * writer)92 vala_ccode_ggnuc_section_real_write (ValaCCodeNode* base,
93                                      ValaCCodeWriter* writer)
94 {
95 	ValaCCodeGGnucSection * self;
96 	ValaGGnucSectionType _tmp0_;
97 	const gchar* _tmp1_;
98 	ValaGGnucSectionType _tmp11_;
99 	const gchar* _tmp12_;
100 	self = (ValaCCodeGGnucSection*) base;
101 	g_return_if_fail (writer != NULL);
102 	vala_ccode_writer_write_string (writer, "G_GNUC_BEGIN_");
103 	_tmp0_ = self->priv->_section_type;
104 	_tmp1_ = vala_ggnuc_section_type_to_string (_tmp0_);
105 	vala_ccode_writer_write_string (writer, _tmp1_);
106 	vala_ccode_writer_write_newline (writer);
107 	{
108 		ValaList* _node_list = NULL;
109 		ValaList* _tmp2_;
110 		gint _node_size = 0;
111 		ValaList* _tmp3_;
112 		gint _tmp4_;
113 		gint _tmp5_;
114 		gint _node_index = 0;
115 		_tmp2_ = vala_ccode_fragment_get_children ((ValaCCodeFragment*) self);
116 		_node_list = _tmp2_;
117 		_tmp3_ = _node_list;
118 		_tmp4_ = vala_collection_get_size ((ValaCollection*) _tmp3_);
119 		_tmp5_ = _tmp4_;
120 		_node_size = _tmp5_;
121 		_node_index = -1;
122 		while (TRUE) {
123 			gint _tmp6_;
124 			gint _tmp7_;
125 			ValaCCodeNode* node = NULL;
126 			ValaList* _tmp8_;
127 			gpointer _tmp9_;
128 			ValaCCodeNode* _tmp10_;
129 			_node_index = _node_index + 1;
130 			_tmp6_ = _node_index;
131 			_tmp7_ = _node_size;
132 			if (!(_tmp6_ < _tmp7_)) {
133 				break;
134 			}
135 			_tmp8_ = _node_list;
136 			_tmp9_ = vala_list_get (_tmp8_, _node_index);
137 			node = (ValaCCodeNode*) _tmp9_;
138 			_tmp10_ = node;
139 			vala_ccode_node_write_combined (_tmp10_, writer);
140 			_vala_ccode_node_unref0 (node);
141 		}
142 		_vala_iterable_unref0 (_node_list);
143 	}
144 	vala_ccode_writer_write_string (writer, "G_GNUC_END_");
145 	_tmp11_ = self->priv->_section_type;
146 	_tmp12_ = vala_ggnuc_section_type_to_string (_tmp11_);
147 	vala_ccode_writer_write_string (writer, _tmp12_);
148 	vala_ccode_writer_write_newline (writer);
149 }
150 
151 static void
vala_ccode_ggnuc_section_real_write_declaration(ValaCCodeNode * base,ValaCCodeWriter * writer)152 vala_ccode_ggnuc_section_real_write_declaration (ValaCCodeNode* base,
153                                                  ValaCCodeWriter* writer)
154 {
155 	ValaCCodeGGnucSection * self;
156 	self = (ValaCCodeGGnucSection*) base;
157 	g_return_if_fail (writer != NULL);
158 }
159 
160 static void
vala_ccode_ggnuc_section_class_init(ValaCCodeGGnucSectionClass * klass,gpointer klass_data)161 vala_ccode_ggnuc_section_class_init (ValaCCodeGGnucSectionClass * klass,
162                                      gpointer klass_data)
163 {
164 	vala_ccode_ggnuc_section_parent_class = g_type_class_peek_parent (klass);
165 	((ValaCCodeNodeClass *) klass)->finalize = vala_ccode_ggnuc_section_finalize;
166 	g_type_class_adjust_private_offset (klass, &ValaCCodeGGnucSection_private_offset);
167 	((ValaCCodeNodeClass *) klass)->write = (void (*) (ValaCCodeNode*, ValaCCodeWriter*)) vala_ccode_ggnuc_section_real_write;
168 	((ValaCCodeNodeClass *) klass)->write_declaration = (void (*) (ValaCCodeNode*, ValaCCodeWriter*)) vala_ccode_ggnuc_section_real_write_declaration;
169 }
170 
171 static void
vala_ccode_ggnuc_section_instance_init(ValaCCodeGGnucSection * self,gpointer klass)172 vala_ccode_ggnuc_section_instance_init (ValaCCodeGGnucSection * self,
173                                         gpointer klass)
174 {
175 	self->priv = vala_ccode_ggnuc_section_get_instance_private (self);
176 }
177 
178 static void
vala_ccode_ggnuc_section_finalize(ValaCCodeNode * obj)179 vala_ccode_ggnuc_section_finalize (ValaCCodeNode * obj)
180 {
181 	ValaCCodeGGnucSection * self;
182 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, VALA_TYPE_CCODE_GGNUC_SECTION, ValaCCodeGGnucSection);
183 	VALA_CCODE_NODE_CLASS (vala_ccode_ggnuc_section_parent_class)->finalize (obj);
184 }
185 
186 /**
187  * Represents a section that should be processed on condition.
188  */
189 static GType
vala_ccode_ggnuc_section_get_type_once(void)190 vala_ccode_ggnuc_section_get_type_once (void)
191 {
192 	static const GTypeInfo g_define_type_info = { sizeof (ValaCCodeGGnucSectionClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) vala_ccode_ggnuc_section_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (ValaCCodeGGnucSection), 0, (GInstanceInitFunc) vala_ccode_ggnuc_section_instance_init, NULL };
193 	GType vala_ccode_ggnuc_section_type_id;
194 	vala_ccode_ggnuc_section_type_id = g_type_register_static (VALA_TYPE_CCODE_FRAGMENT, "ValaCCodeGGnucSection", &g_define_type_info, 0);
195 	ValaCCodeGGnucSection_private_offset = g_type_add_instance_private (vala_ccode_ggnuc_section_type_id, sizeof (ValaCCodeGGnucSectionPrivate));
196 	return vala_ccode_ggnuc_section_type_id;
197 }
198 
199 GType
vala_ccode_ggnuc_section_get_type(void)200 vala_ccode_ggnuc_section_get_type (void)
201 {
202 	static volatile gsize vala_ccode_ggnuc_section_type_id__volatile = 0;
203 	if (g_once_init_enter (&vala_ccode_ggnuc_section_type_id__volatile)) {
204 		GType vala_ccode_ggnuc_section_type_id;
205 		vala_ccode_ggnuc_section_type_id = vala_ccode_ggnuc_section_get_type_once ();
206 		g_once_init_leave (&vala_ccode_ggnuc_section_type_id__volatile, vala_ccode_ggnuc_section_type_id);
207 	}
208 	return vala_ccode_ggnuc_section_type_id__volatile;
209 }
210 
211 const gchar*
vala_ggnuc_section_type_to_string(ValaGGnucSectionType self)212 vala_ggnuc_section_type_to_string (ValaGGnucSectionType self)
213 {
214 	const gchar* result = NULL;
215 	switch (self) {
216 		case VALA_GGNUC_SECTION_TYPE_IGNORE_DEPRECATIONS:
217 		{
218 			result = "IGNORE_DEPRECATIONS";
219 			return result;
220 		}
221 		default:
222 		{
223 			g_assert_not_reached ();
224 		}
225 	}
226 }
227 
228 static GType
vala_ggnuc_section_type_get_type_once(void)229 vala_ggnuc_section_type_get_type_once (void)
230 {
231 	static const GEnumValue values[] = {{VALA_GGNUC_SECTION_TYPE_IGNORE_DEPRECATIONS, "VALA_GGNUC_SECTION_TYPE_IGNORE_DEPRECATIONS", "ignore-deprecations"}, {0, NULL, NULL}};
232 	GType vala_ggnuc_section_type_type_id;
233 	vala_ggnuc_section_type_type_id = g_enum_register_static ("ValaGGnucSectionType", values);
234 	return vala_ggnuc_section_type_type_id;
235 }
236 
237 GType
vala_ggnuc_section_type_get_type(void)238 vala_ggnuc_section_type_get_type (void)
239 {
240 	static volatile gsize vala_ggnuc_section_type_type_id__volatile = 0;
241 	if (g_once_init_enter (&vala_ggnuc_section_type_type_id__volatile)) {
242 		GType vala_ggnuc_section_type_type_id;
243 		vala_ggnuc_section_type_type_id = vala_ggnuc_section_type_get_type_once ();
244 		g_once_init_leave (&vala_ggnuc_section_type_type_id__volatile, vala_ggnuc_section_type_type_id);
245 	}
246 	return vala_ggnuc_section_type_type_id__volatile;
247 }
248 
249