1 /* valasourcelocation.c generated by valac, the Vala compiler
2  * generated from valasourcelocation.vala, do not modify */
3 
4 /* valasourcelocation.vala
5  *
6  * Copyright (C) 2008  Jürg Billeter
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  * 	Jürg Billeter <j@bitron.ch>
24  */
25 
26 #include "vala.h"
27 #include <glib.h>
28 #include <string.h>
29 #include <stdlib.h>
30 
31 void
vala_source_location_init(ValaSourceLocation * self,gchar * _pos,gint _line,gint _column)32 vala_source_location_init (ValaSourceLocation *self,
33                            gchar* _pos,
34                            gint _line,
35                            gint _column)
36 {
37 	memset (self, 0, sizeof (ValaSourceLocation));
38 	(*self).pos = _pos;
39 	(*self).line = _line;
40 	(*self).column = _column;
41 }
42 
43 /**
44  * Returns a string representation of this source location.
45  *
46  * @return human-readable string
47  */
48 gchar*
vala_source_location_to_string(ValaSourceLocation * self)49 vala_source_location_to_string (ValaSourceLocation *self)
50 {
51 	gchar* _tmp0_;
52 	gchar* result = NULL;
53 	_tmp0_ = g_strdup_printf ("%d.%d", (*self).line, (*self).column);
54 	result = _tmp0_;
55 	return result;
56 }
57 
58 ValaSourceLocation*
vala_source_location_dup(const ValaSourceLocation * self)59 vala_source_location_dup (const ValaSourceLocation* self)
60 {
61 	ValaSourceLocation* dup;
62 	dup = g_new0 (ValaSourceLocation, 1);
63 	memcpy (dup, self, sizeof (ValaSourceLocation));
64 	return dup;
65 }
66 
67 void
vala_source_location_free(ValaSourceLocation * self)68 vala_source_location_free (ValaSourceLocation* self)
69 {
70 	g_free (self);
71 }
72 
73 static GType
vala_source_location_get_type_once(void)74 vala_source_location_get_type_once (void)
75 {
76 	GType vala_source_location_type_id;
77 	vala_source_location_type_id = g_boxed_type_register_static ("ValaSourceLocation", (GBoxedCopyFunc) vala_source_location_dup, (GBoxedFreeFunc) vala_source_location_free);
78 	return vala_source_location_type_id;
79 }
80 
81 GType
vala_source_location_get_type(void)82 vala_source_location_get_type (void)
83 {
84 	static volatile gsize vala_source_location_type_id__volatile = 0;
85 	if (g_once_init_enter (&vala_source_location_type_id__volatile)) {
86 		GType vala_source_location_type_id;
87 		vala_source_location_type_id = vala_source_location_get_type_once ();
88 		g_once_init_leave (&vala_source_location_type_id__volatile, vala_source_location_type_id);
89 	}
90 	return vala_source_location_type_id__volatile;
91 }
92 
93