summaryrefslogtreecommitdiff
path: root/src/main.c
blob: f14d6485e9d127bbc49615174d839a57a7243d2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/* main.c generated by valac, the Vala compiler
 * generated from main.vala, do not modify */

/*
 * Copyright 2010 Joakim Sindholt <opensource@zhasha.com>
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * on the rights to use, copy, modify, merge, publish, distribute, sub
 * license, and/or sell copies of the Software, and to permit persons to whom
 * the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice (including the next
 * paragraph) shall be included in all copies or substantial portions of the
 * Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
 * USE OR OTHER DEALINGS IN THE SOFTWARE. */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>


#define EMULATION_TYPE_SPEC_ENTRY (emulation_spec_entry_get_type ())

#define EMULATION_TYPE_SPEC (emulation_spec_get_type ())
#define EMULATION_SPEC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EMULATION_TYPE_SPEC, EmulationSpec))
#define EMULATION_SPEC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EMULATION_TYPE_SPEC, EmulationSpecClass))
#define EMULATION_IS_SPEC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EMULATION_TYPE_SPEC))
#define EMULATION_IS_SPEC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EMULATION_TYPE_SPEC))
#define EMULATION_SPEC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EMULATION_TYPE_SPEC, EmulationSpecClass))

typedef struct _EmulationSpec EmulationSpec;
typedef struct _EmulationSpecClass EmulationSpecClass;
typedef struct _EmulationSpecEntry EmulationSpecEntry;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define PROJECT_TYPE_WINDOW (project_window_get_type ())
#define PROJECT_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PROJECT_TYPE_WINDOW, ProjectWindow))
#define PROJECT_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PROJECT_TYPE_WINDOW, ProjectWindowClass))
#define PROJECT_IS_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PROJECT_TYPE_WINDOW))
#define PROJECT_IS_WINDOW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PROJECT_TYPE_WINDOW))
#define PROJECT_WINDOW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PROJECT_TYPE_WINDOW, ProjectWindowClass))

typedef struct _ProjectWindow ProjectWindow;
typedef struct _ProjectWindowClass ProjectWindowClass;

struct _EmulationSpecEntry {
	EmulationSpec* spec;
	char* name;
};


extern EmulationSpecEntry* emulation_specs;
extern gint emulation_specs_length1;
EmulationSpecEntry* emulation_specs = NULL;
gint emulation_specs_length1 = 0;
extern guint emulation_spec_default;
guint emulation_spec_default = (guint) 1;

GType emulation_spec_entry_get_type (void);
GType emulation_spec_get_type (void);
EmulationSpecEntry* emulation_spec_entry_dup (const EmulationSpecEntry* self);
void emulation_spec_entry_free (EmulationSpecEntry* self);
void emulation_spec_entry_copy (const EmulationSpecEntry* self, EmulationSpecEntry* dest);
void emulation_spec_entry_destroy (EmulationSpecEntry* self);
static void _vala_EmulationSpecEntry_array_free (EmulationSpecEntry* array, gint array_length);
EmulationSpec* emulation_spec_new (const char* filename, const char* variant);
EmulationSpec* emulation_spec_construct (GType object_type, const char* filename, const char* variant);
ProjectWindow* project_window_new (void);
ProjectWindow* project_window_construct (GType object_type);
GType project_window_get_type (void);
gint _main (char** args, int args_length1);



static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


void emulation_spec_entry_copy (const EmulationSpecEntry* self, EmulationSpecEntry* dest) {
	dest->spec = _g_object_ref0 (self->spec);
	dest->name = g_strdup (self->name);
}


void emulation_spec_entry_destroy (EmulationSpecEntry* self) {
	_g_object_unref0 (self->spec);
	_g_free0 (self->name);
}


EmulationSpecEntry* emulation_spec_entry_dup (const EmulationSpecEntry* self) {
	EmulationSpecEntry* dup;
	dup = g_new0 (EmulationSpecEntry, 1);
	emulation_spec_entry_copy (self, dup);
	return dup;
}


void emulation_spec_entry_free (EmulationSpecEntry* self) {
	emulation_spec_entry_destroy (self);
	g_free (self);
}


GType emulation_spec_entry_get_type (void) {
	static GType emulation_spec_entry_type_id = 0;
	if (emulation_spec_entry_type_id == 0) {
		emulation_spec_entry_type_id = g_boxed_type_register_static ("EmulationSpecEntry", (GBoxedCopyFunc) emulation_spec_entry_dup, (GBoxedFreeFunc) emulation_spec_entry_free);
	}
	return emulation_spec_entry_type_id;
}


static void _vala_EmulationSpecEntry_array_free (EmulationSpecEntry* array, gint array_length) {
	if (array != NULL) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			emulation_spec_entry_destroy (&array[i]);
		}
	}
	g_free (array);
}


gint _main (char** args, int args_length1) {
	gint result;
	EmulationSpecEntry* _tmp0_;
	EmulationSpec* _tmp1_;
	char* _tmp2_;
	EmulationSpec* _tmp3_;
	char* _tmp4_;
	ProjectWindow* main;
	gtk_init (&args_length1, &args);
	emulation_specs = (_tmp0_ = g_new0 (EmulationSpecEntry, 2), emulation_specs = (_vala_EmulationSpecEntry_array_free (emulation_specs, emulation_specs_length1), NULL), emulation_specs_length1 = 2, _tmp0_);
	emulation_specs[0].spec = (_tmp1_ = emulation_spec_new ("/usr/share/rsim/r300reg.xml", "r300"), _g_object_unref0 (emulation_specs[0].spec), _tmp1_);
	emulation_specs[0].name = (_tmp2_ = g_strdup ("r300"), _g_free0 (emulation_specs[0].name), _tmp2_);
	emulation_specs[1].spec = (_tmp3_ = emulation_spec_new ("/usr/share/rsim/r300reg.xml", "r500"), _g_object_unref0 (emulation_specs[1].spec), _tmp3_);
	emulation_specs[1].name = (_tmp4_ = g_strdup ("r500"), _g_free0 (emulation_specs[1].name), _tmp4_);
	main = g_object_ref_sink (project_window_new ());
	gtk_widget_show_all ((GtkWidget*) main);
	gtk_main ();
	{
		guint i;
		i = (guint) 0;
		{
			gboolean _tmp5_;
			_tmp5_ = TRUE;
			while (TRUE) {
				if (!_tmp5_) {
					i++;
				}
				_tmp5_ = FALSE;
				if (!(i < emulation_specs_length1)) {
					break;
				}
				g_object_unref ((GObject*) emulation_specs[i].spec);
			}
		}
	}
	result = 0;
	_g_object_unref0 (main);
	return result;
}


int main (int argc, char ** argv) {
	g_type_init ();
	return _main (argv, argc);
}