~ubuntu-branches/ubuntu/precise/gnome-games/precise-proposed

« back to all changes in this revision

Viewing changes to glchess/src/ai-profile.c

  • Committer: Package Import Robot
  • Author(s): Rodrigo Moya
  • Date: 2011-05-30 13:32:04 UTC
  • mfrom: (1.3.4)
  • mto: (163.1.3 precise)
  • mto: This revision was merged to the branch mainline in revision 143.
  • Revision ID: package-import@ubuntu.com-20110530133204-celaq1v1dsxc48q1
Tags: upstream-3.0.2
ImportĀ upstreamĀ versionĀ 3.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ai-profile.c generated by valac 0.12.0, the Vala compiler
 
2
 * generated from ai-profile.vala, do not modify */
 
3
 
 
4
 
 
5
#include <glib.h>
 
6
#include <glib-object.h>
 
7
#include <stdlib.h>
 
8
#include <string.h>
 
9
#include <gobject/gvaluecollector.h>
 
10
 
 
11
 
 
12
#define TYPE_AI_PROFILE (ai_profile_get_type ())
 
13
#define AI_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_AI_PROFILE, AIProfile))
 
14
#define AI_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_AI_PROFILE, AIProfileClass))
 
15
#define IS_AI_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_AI_PROFILE))
 
16
#define IS_AI_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_AI_PROFILE))
 
17
#define AI_PROFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_AI_PROFILE, AIProfileClass))
 
18
 
 
19
typedef struct _AIProfile AIProfile;
 
20
typedef struct _AIProfileClass AIProfileClass;
 
21
typedef struct _AIProfilePrivate AIProfilePrivate;
 
22
#define _g_free0(var) (var = (g_free (var), NULL))
 
23
typedef struct _ParamSpecAIProfile ParamSpecAIProfile;
 
24
#define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL)))
 
25
#define __g_list_free__ai_profile_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__ai_profile_unref0_ (var), NULL)))
 
26
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
 
27
#define _ai_profile_unref0(var) ((var == NULL) ? NULL : (var = (ai_profile_unref (var), NULL)))
 
28
 
 
29
struct _AIProfile {
 
30
        GTypeInstance parent_instance;
 
31
        volatile int ref_count;
 
32
        AIProfilePrivate * priv;
 
33
        gchar* name;
 
34
        gchar* protocol;
 
35
        gchar* binary;
 
36
        gchar* path;
 
37
        gchar* args;
 
38
        gchar** easy_options;
 
39
        gint easy_options_length1;
 
40
        gchar** normal_options;
 
41
        gint normal_options_length1;
 
42
        gchar** hard_options;
 
43
        gint hard_options_length1;
 
44
};
 
45
 
 
46
struct _AIProfileClass {
 
47
        GTypeClass parent_class;
 
48
        void (*finalize) (AIProfile *self);
 
49
};
 
50
 
 
51
struct _ParamSpecAIProfile {
 
52
        GParamSpec parent_instance;
 
53
};
 
54
 
 
55
 
 
56
static gpointer ai_profile_parent_class = NULL;
 
57
 
 
58
gpointer ai_profile_ref (gpointer instance);
 
59
void ai_profile_unref (gpointer instance);
 
60
GParamSpec* param_spec_ai_profile (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
 
61
void value_set_ai_profile (GValue* value, gpointer v_object);
 
62
void value_take_ai_profile (GValue* value, gpointer v_object);
 
63
gpointer value_get_ai_profile (const GValue* value);
 
64
GType ai_profile_get_type (void) G_GNUC_CONST;
 
65
enum  {
 
66
        AI_PROFILE_DUMMY_PROPERTY
 
67
};
 
68
AIProfile* ai_profile_new (void);
 
69
AIProfile* ai_profile_construct (GType object_type);
 
70
static void ai_profile_finalize (AIProfile* obj);
 
71
GList* load_ai_profiles (const gchar* filename);
 
72
static void _ai_profile_unref0_ (gpointer var);
 
73
static void _g_list_free__ai_profile_unref0_ (GList* self);
 
74
gchar** load_options (GKeyFile* file, const gchar* name, const gchar* difficulty, int* result_length1, GError** error);
 
75
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
76
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
77
 
 
78
 
 
79
AIProfile* ai_profile_construct (GType object_type) {
 
80
        AIProfile* self = NULL;
 
81
        self = (AIProfile*) g_type_create_instance (object_type);
 
82
        return self;
 
83
}
 
84
 
 
85
 
 
86
AIProfile* ai_profile_new (void) {
 
87
        return ai_profile_construct (TYPE_AI_PROFILE);
 
88
}
 
89
 
 
90
 
 
91
static void value_ai_profile_init (GValue* value) {
 
92
        value->data[0].v_pointer = NULL;
 
93
}
 
94
 
 
95
 
 
96
static void value_ai_profile_free_value (GValue* value) {
 
97
        if (value->data[0].v_pointer) {
 
98
                ai_profile_unref (value->data[0].v_pointer);
 
99
        }
 
100
}
 
101
 
 
102
 
 
103
static void value_ai_profile_copy_value (const GValue* src_value, GValue* dest_value) {
 
104
        if (src_value->data[0].v_pointer) {
 
105
                dest_value->data[0].v_pointer = ai_profile_ref (src_value->data[0].v_pointer);
 
106
        } else {
 
107
                dest_value->data[0].v_pointer = NULL;
 
108
        }
 
109
}
 
110
 
 
111
 
 
112
static gpointer value_ai_profile_peek_pointer (const GValue* value) {
 
113
        return value->data[0].v_pointer;
 
114
}
 
115
 
 
116
 
 
117
static gchar* value_ai_profile_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
 
118
        if (collect_values[0].v_pointer) {
 
119
                AIProfile* object;
 
120
                object = collect_values[0].v_pointer;
 
121
                if (object->parent_instance.g_class == NULL) {
 
122
                        return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
 
123
                } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
 
124
                        return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
 
125
                }
 
126
                value->data[0].v_pointer = ai_profile_ref (object);
 
127
        } else {
 
128
                value->data[0].v_pointer = NULL;
 
129
        }
 
130
        return NULL;
 
131
}
 
132
 
 
133
 
 
134
static gchar* value_ai_profile_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
 
135
        AIProfile** object_p;
 
136
        object_p = collect_values[0].v_pointer;
 
137
        if (!object_p) {
 
138
                return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
 
139
        }
 
140
        if (!value->data[0].v_pointer) {
 
141
                *object_p = NULL;
 
142
        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
 
143
                *object_p = value->data[0].v_pointer;
 
144
        } else {
 
145
                *object_p = ai_profile_ref (value->data[0].v_pointer);
 
146
        }
 
147
        return NULL;
 
148
}
 
149
 
 
150
 
 
151
GParamSpec* param_spec_ai_profile (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
 
152
        ParamSpecAIProfile* spec;
 
153
        g_return_val_if_fail (g_type_is_a (object_type, TYPE_AI_PROFILE), NULL);
 
154
        spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
 
155
        G_PARAM_SPEC (spec)->value_type = object_type;
 
156
        return G_PARAM_SPEC (spec);
 
157
}
 
158
 
 
159
 
 
160
gpointer value_get_ai_profile (const GValue* value) {
 
161
        g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AI_PROFILE), NULL);
 
162
        return value->data[0].v_pointer;
 
163
}
 
164
 
 
165
 
 
166
void value_set_ai_profile (GValue* value, gpointer v_object) {
 
167
        AIProfile* old;
 
168
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AI_PROFILE));
 
169
        old = value->data[0].v_pointer;
 
170
        if (v_object) {
 
171
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_AI_PROFILE));
 
172
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
 
173
                value->data[0].v_pointer = v_object;
 
174
                ai_profile_ref (value->data[0].v_pointer);
 
175
        } else {
 
176
                value->data[0].v_pointer = NULL;
 
177
        }
 
178
        if (old) {
 
179
                ai_profile_unref (old);
 
180
        }
 
181
}
 
182
 
 
183
 
 
184
void value_take_ai_profile (GValue* value, gpointer v_object) {
 
185
        AIProfile* old;
 
186
        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_AI_PROFILE));
 
187
        old = value->data[0].v_pointer;
 
188
        if (v_object) {
 
189
                g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_AI_PROFILE));
 
190
                g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
 
191
                value->data[0].v_pointer = v_object;
 
192
        } else {
 
193
                value->data[0].v_pointer = NULL;
 
194
        }
 
195
        if (old) {
 
196
                ai_profile_unref (old);
 
197
        }
 
198
}
 
199
 
 
200
 
 
201
static void ai_profile_class_init (AIProfileClass * klass) {
 
202
        ai_profile_parent_class = g_type_class_peek_parent (klass);
 
203
        AI_PROFILE_CLASS (klass)->finalize = ai_profile_finalize;
 
204
}
 
205
 
 
206
 
 
207
static void ai_profile_instance_init (AIProfile * self) {
 
208
        gchar* _tmp0_;
 
209
        _tmp0_ = g_strdup ("");
 
210
        self->args = _tmp0_;
 
211
        self->ref_count = 1;
 
212
}
 
213
 
 
214
 
 
215
static void ai_profile_finalize (AIProfile* obj) {
 
216
        AIProfile * self;
 
217
        self = AI_PROFILE (obj);
 
218
        _g_free0 (self->name);
 
219
        _g_free0 (self->protocol);
 
220
        _g_free0 (self->binary);
 
221
        _g_free0 (self->path);
 
222
        _g_free0 (self->args);
 
223
        self->easy_options = (_vala_array_free (self->easy_options, self->easy_options_length1, (GDestroyNotify) g_free), NULL);
 
224
        self->normal_options = (_vala_array_free (self->normal_options, self->normal_options_length1, (GDestroyNotify) g_free), NULL);
 
225
        self->hard_options = (_vala_array_free (self->hard_options, self->hard_options_length1, (GDestroyNotify) g_free), NULL);
 
226
}
 
227
 
 
228
 
 
229
GType ai_profile_get_type (void) {
 
230
        static volatile gsize ai_profile_type_id__volatile = 0;
 
231
        if (g_once_init_enter (&ai_profile_type_id__volatile)) {
 
232
                static const GTypeValueTable g_define_type_value_table = { value_ai_profile_init, value_ai_profile_free_value, value_ai_profile_copy_value, value_ai_profile_peek_pointer, "p", value_ai_profile_collect_value, "p", value_ai_profile_lcopy_value };
 
233
                static const GTypeInfo g_define_type_info = { sizeof (AIProfileClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ai_profile_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (AIProfile), 0, (GInstanceInitFunc) ai_profile_instance_init, &g_define_type_value_table };
 
234
                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) };
 
235
                GType ai_profile_type_id;
 
236
                ai_profile_type_id = g_type_register_fundamental (g_type_fundamental_next (), "AIProfile", &g_define_type_info, &g_define_type_fundamental_info, 0);
 
237
                g_once_init_leave (&ai_profile_type_id__volatile, ai_profile_type_id);
 
238
        }
 
239
        return ai_profile_type_id__volatile;
 
240
}
 
241
 
 
242
 
 
243
gpointer ai_profile_ref (gpointer instance) {
 
244
        AIProfile* self;
 
245
        self = instance;
 
246
        g_atomic_int_inc (&self->ref_count);
 
247
        return instance;
 
248
}
 
249
 
 
250
 
 
251
void ai_profile_unref (gpointer instance) {
 
252
        AIProfile* self;
 
253
        self = instance;
 
254
        if (g_atomic_int_dec_and_test (&self->ref_count)) {
 
255
                AI_PROFILE_GET_CLASS (self)->finalize (self);
 
256
                g_type_free_instance ((GTypeInstance *) self);
 
257
        }
 
258
}
 
259
 
 
260
 
 
261
static void _ai_profile_unref0_ (gpointer var) {
 
262
        (var == NULL) ? NULL : (var = (ai_profile_unref (var), NULL));
 
263
}
 
264
 
 
265
 
 
266
static void _g_list_free__ai_profile_unref0_ (GList* self) {
 
267
        g_list_foreach (self, (GFunc) _ai_profile_unref0_, NULL);
 
268
        g_list_free (self);
 
269
}
 
270
 
 
271
 
 
272
static gpointer _ai_profile_ref0 (gpointer self) {
 
273
        return self ? ai_profile_ref (self) : NULL;
 
274
}
 
275
 
 
276
 
 
277
GList* load_ai_profiles (const gchar* filename) {
 
278
        GList* result = NULL;
 
279
        GList* profiles;
 
280
        GKeyFile* _tmp0_ = NULL;
 
281
        GKeyFile* file;
 
282
        gsize _tmp1_;
 
283
        gchar** _tmp2_ = NULL;
 
284
        GError * _inner_error_ = NULL;
 
285
        g_return_val_if_fail (filename != NULL, NULL);
 
286
        profiles = NULL;
 
287
        _tmp0_ = g_key_file_new ();
 
288
        file = _tmp0_;
 
289
        g_key_file_load_from_file (file, filename, G_KEY_FILE_NONE, &_inner_error_);
 
290
        if (_inner_error_ != NULL) {
 
291
                if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
292
                        goto __catch7_g_key_file_error;
 
293
                }
 
294
                if (_inner_error_->domain == G_FILE_ERROR) {
 
295
                        goto __catch7_g_file_error;
 
296
                }
 
297
                _g_key_file_free0 (file);
 
298
                __g_list_free__ai_profile_unref0_0 (profiles);
 
299
                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
300
                g_clear_error (&_inner_error_);
 
301
                return NULL;
 
302
        }
 
303
        goto __finally7;
 
304
        __catch7_g_key_file_error:
 
305
        {
 
306
                GError * e;
 
307
                e = _inner_error_;
 
308
                _inner_error_ = NULL;
 
309
                g_warning ("ai-profile.vala:24: Failed to load AI profiles: %s", e->message);
 
310
                result = profiles;
 
311
                _g_error_free0 (e);
 
312
                _g_key_file_free0 (file);
 
313
                return result;
 
314
        }
 
315
        goto __finally7;
 
316
        __catch7_g_file_error:
 
317
        {
 
318
                GError * e;
 
319
                e = _inner_error_;
 
320
                _inner_error_ = NULL;
 
321
                g_warning ("ai-profile.vala:29: Failed to load AI profiles: %s", e->message);
 
322
                result = profiles;
 
323
                _g_error_free0 (e);
 
324
                _g_key_file_free0 (file);
 
325
                return result;
 
326
        }
 
327
        __finally7:
 
328
        if (_inner_error_ != NULL) {
 
329
                _g_key_file_free0 (file);
 
330
                __g_list_free__ai_profile_unref0_0 (profiles);
 
331
                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
332
                g_clear_error (&_inner_error_);
 
333
                return NULL;
 
334
        }
 
335
        _tmp2_ = g_key_file_get_groups (file, &_tmp1_);
 
336
        {
 
337
                gchar** name_collection;
 
338
                int name_collection_length1;
 
339
                int name_it;
 
340
                name_collection = _tmp2_;
 
341
                name_collection_length1 = _tmp1_;
 
342
                for (name_it = 0; name_it < _tmp1_; name_it = name_it + 1) {
 
343
                        gchar* _tmp3_;
 
344
                        gchar* name;
 
345
                        _tmp3_ = g_strdup (name_collection[name_it]);
 
346
                        name = _tmp3_;
 
347
                        {
 
348
                                AIProfile* _tmp4_ = NULL;
 
349
                                AIProfile* profile;
 
350
                                gchar* _tmp5_;
 
351
                                gchar* _tmp6_ = NULL;
 
352
                                gchar* _tmp7_;
 
353
                                gchar* _tmp8_ = NULL;
 
354
                                gchar* _tmp9_;
 
355
                                gboolean _tmp10_;
 
356
                                gboolean _tmp11_;
 
357
                                gint _tmp14_;
 
358
                                gchar** _tmp15_ = NULL;
 
359
                                gchar** _tmp16_;
 
360
                                gint _tmp16__length1;
 
361
                                gint __tmp16__size_;
 
362
                                gint _tmp17_;
 
363
                                gchar** _tmp18_ = NULL;
 
364
                                gchar** _tmp19_;
 
365
                                gint _tmp19__length1;
 
366
                                gint __tmp19__size_;
 
367
                                gint _tmp20_;
 
368
                                gchar** _tmp21_ = NULL;
 
369
                                gchar** _tmp22_;
 
370
                                gint _tmp22__length1;
 
371
                                gint __tmp22__size_;
 
372
                                gchar* _tmp23_ = NULL;
 
373
                                gchar* path;
 
374
                                g_debug ("ai-profile.vala:35: Loading AI profile %s", name);
 
375
                                _tmp4_ = ai_profile_new ();
 
376
                                profile = _tmp4_;
 
377
                                _tmp5_ = g_strdup (name);
 
378
                                _g_free0 (profile->name);
 
379
                                profile->name = _tmp5_;
 
380
                                _tmp6_ = g_key_file_get_value (file, name, "protocol", &_inner_error_);
 
381
                                _tmp7_ = _tmp6_;
 
382
                                if (_inner_error_ != NULL) {
 
383
                                        if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
384
                                                goto __catch8_g_key_file_error;
 
385
                                        }
 
386
                                        _ai_profile_unref0 (profile);
 
387
                                        _g_free0 (name);
 
388
                                        name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
389
                                        _g_key_file_free0 (file);
 
390
                                        __g_list_free__ai_profile_unref0_0 (profiles);
 
391
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
392
                                        g_clear_error (&_inner_error_);
 
393
                                        return NULL;
 
394
                                }
 
395
                                _g_free0 (profile->protocol);
 
396
                                profile->protocol = _tmp7_;
 
397
                                _tmp8_ = g_key_file_get_value (file, name, "binary", &_inner_error_);
 
398
                                _tmp9_ = _tmp8_;
 
399
                                if (_inner_error_ != NULL) {
 
400
                                        if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
401
                                                goto __catch8_g_key_file_error;
 
402
                                        }
 
403
                                        _ai_profile_unref0 (profile);
 
404
                                        _g_free0 (name);
 
405
                                        name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
406
                                        _g_key_file_free0 (file);
 
407
                                        __g_list_free__ai_profile_unref0_0 (profiles);
 
408
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
409
                                        g_clear_error (&_inner_error_);
 
410
                                        return NULL;
 
411
                                }
 
412
                                _g_free0 (profile->binary);
 
413
                                profile->binary = _tmp9_;
 
414
                                _tmp10_ = g_key_file_has_key (file, name, "args", &_inner_error_);
 
415
                                _tmp11_ = _tmp10_;
 
416
                                if (_inner_error_ != NULL) {
 
417
                                        if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
418
                                                goto __catch8_g_key_file_error;
 
419
                                        }
 
420
                                        _ai_profile_unref0 (profile);
 
421
                                        _g_free0 (name);
 
422
                                        name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
423
                                        _g_key_file_free0 (file);
 
424
                                        __g_list_free__ai_profile_unref0_0 (profiles);
 
425
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
426
                                        g_clear_error (&_inner_error_);
 
427
                                        return NULL;
 
428
                                }
 
429
                                if (_tmp11_) {
 
430
                                        gchar* _tmp12_ = NULL;
 
431
                                        gchar* _tmp13_;
 
432
                                        _tmp12_ = g_key_file_get_value (file, name, "args", &_inner_error_);
 
433
                                        _tmp13_ = _tmp12_;
 
434
                                        if (_inner_error_ != NULL) {
 
435
                                                if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
436
                                                        goto __catch8_g_key_file_error;
 
437
                                                }
 
438
                                                _ai_profile_unref0 (profile);
 
439
                                                _g_free0 (name);
 
440
                                                name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
441
                                                _g_key_file_free0 (file);
 
442
                                                __g_list_free__ai_profile_unref0_0 (profiles);
 
443
                                                g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
444
                                                g_clear_error (&_inner_error_);
 
445
                                                return NULL;
 
446
                                        }
 
447
                                        _g_free0 (profile->args);
 
448
                                        profile->args = _tmp13_;
 
449
                                }
 
450
                                _tmp15_ = load_options (file, name, "easy", &_tmp14_, &_inner_error_);
 
451
                                _tmp16_ = _tmp15_;
 
452
                                _tmp16__length1 = _tmp14_;
 
453
                                __tmp16__size_ = _tmp14_;
 
454
                                if (_inner_error_ != NULL) {
 
455
                                        if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
456
                                                goto __catch8_g_key_file_error;
 
457
                                        }
 
458
                                        _ai_profile_unref0 (profile);
 
459
                                        _g_free0 (name);
 
460
                                        name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
461
                                        _g_key_file_free0 (file);
 
462
                                        __g_list_free__ai_profile_unref0_0 (profiles);
 
463
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
464
                                        g_clear_error (&_inner_error_);
 
465
                                        return NULL;
 
466
                                }
 
467
                                profile->easy_options = (_vala_array_free (profile->easy_options, profile->easy_options_length1, (GDestroyNotify) g_free), NULL);
 
468
                                profile->easy_options = _tmp16_;
 
469
                                profile->easy_options_length1 = _tmp16__length1;
 
470
                                _tmp18_ = load_options (file, name, "normal", &_tmp17_, &_inner_error_);
 
471
                                _tmp19_ = _tmp18_;
 
472
                                _tmp19__length1 = _tmp17_;
 
473
                                __tmp19__size_ = _tmp17_;
 
474
                                if (_inner_error_ != NULL) {
 
475
                                        if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
476
                                                goto __catch8_g_key_file_error;
 
477
                                        }
 
478
                                        _ai_profile_unref0 (profile);
 
479
                                        _g_free0 (name);
 
480
                                        name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
481
                                        _g_key_file_free0 (file);
 
482
                                        __g_list_free__ai_profile_unref0_0 (profiles);
 
483
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
484
                                        g_clear_error (&_inner_error_);
 
485
                                        return NULL;
 
486
                                }
 
487
                                profile->normal_options = (_vala_array_free (profile->normal_options, profile->normal_options_length1, (GDestroyNotify) g_free), NULL);
 
488
                                profile->normal_options = _tmp19_;
 
489
                                profile->normal_options_length1 = _tmp19__length1;
 
490
                                _tmp21_ = load_options (file, name, "hard", &_tmp20_, &_inner_error_);
 
491
                                _tmp22_ = _tmp21_;
 
492
                                _tmp22__length1 = _tmp20_;
 
493
                                __tmp22__size_ = _tmp20_;
 
494
                                if (_inner_error_ != NULL) {
 
495
                                        if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
496
                                                goto __catch8_g_key_file_error;
 
497
                                        }
 
498
                                        _ai_profile_unref0 (profile);
 
499
                                        _g_free0 (name);
 
500
                                        name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
501
                                        _g_key_file_free0 (file);
 
502
                                        __g_list_free__ai_profile_unref0_0 (profiles);
 
503
                                        g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
504
                                        g_clear_error (&_inner_error_);
 
505
                                        return NULL;
 
506
                                }
 
507
                                profile->hard_options = (_vala_array_free (profile->hard_options, profile->hard_options_length1, (GDestroyNotify) g_free), NULL);
 
508
                                profile->hard_options = _tmp22_;
 
509
                                profile->hard_options_length1 = _tmp22__length1;
 
510
                                goto __finally8;
 
511
                                __catch8_g_key_file_error:
 
512
                                {
 
513
                                        GError * e;
 
514
                                        e = _inner_error_;
 
515
                                        _inner_error_ = NULL;
 
516
                                        _g_error_free0 (e);
 
517
                                        _ai_profile_unref0 (profile);
 
518
                                        _g_free0 (name);
 
519
                                        continue;
 
520
                                }
 
521
                                __finally8:
 
522
                                if (_inner_error_ != NULL) {
 
523
                                        _ai_profile_unref0 (profile);
 
524
                                        _g_free0 (name);
 
525
                                        name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
526
                                        _g_key_file_free0 (file);
 
527
                                        __g_list_free__ai_profile_unref0_0 (profiles);
 
528
                                        g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
529
                                        g_clear_error (&_inner_error_);
 
530
                                        return NULL;
 
531
                                }
 
532
                                _tmp23_ = g_find_program_in_path (profile->binary);
 
533
                                path = _tmp23_;
 
534
                                if (path != NULL) {
 
535
                                        gchar* _tmp24_;
 
536
                                        AIProfile* _tmp25_;
 
537
                                        _tmp24_ = g_strdup (path);
 
538
                                        _g_free0 (profile->path);
 
539
                                        profile->path = _tmp24_;
 
540
                                        _tmp25_ = _ai_profile_ref0 (profile);
 
541
                                        profiles = g_list_append (profiles, _tmp25_);
 
542
                                }
 
543
                                _g_free0 (path);
 
544
                                _ai_profile_unref0 (profile);
 
545
                                _g_free0 (name);
 
546
                        }
 
547
                }
 
548
                name_collection = (_vala_array_free (name_collection, name_collection_length1, (GDestroyNotify) g_free), NULL);
 
549
        }
 
550
        result = profiles;
 
551
        _g_key_file_free0 (file);
 
552
        return result;
 
553
}
 
554
 
 
555
 
 
556
gchar** load_options (GKeyFile* file, const gchar* name, const gchar* difficulty, int* result_length1, GError** error) {
 
557
        gchar** result = NULL;
 
558
        gint count;
 
559
        gchar** _tmp5_ = NULL;
 
560
        gchar** options;
 
561
        gint options_length1;
 
562
        gint _options_size_;
 
563
        gchar** _tmp13_;
 
564
        GError * _inner_error_ = NULL;
 
565
        g_return_val_if_fail (file != NULL, NULL);
 
566
        g_return_val_if_fail (name != NULL, NULL);
 
567
        g_return_val_if_fail (difficulty != NULL, NULL);
 
568
        count = 0;
 
569
        while (TRUE) {
 
570
                gchar* _tmp0_ = NULL;
 
571
                gchar* _tmp1_;
 
572
                gboolean _tmp2_;
 
573
                gboolean _tmp3_;
 
574
                gboolean _tmp4_;
 
575
                _tmp0_ = g_strdup_printf ("option-%s-%d", difficulty, count);
 
576
                _tmp1_ = _tmp0_;
 
577
                _tmp2_ = g_key_file_has_key (file, name, _tmp1_, &_inner_error_);
 
578
                _tmp3_ = _tmp2_;
 
579
                _g_free0 (_tmp1_);
 
580
                _tmp4_ = _tmp3_;
 
581
                if (_inner_error_ != NULL) {
 
582
                        if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
583
                                g_propagate_error (error, _inner_error_);
 
584
                                return NULL;
 
585
                        } else {
 
586
                                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
587
                                g_clear_error (&_inner_error_);
 
588
                                return NULL;
 
589
                        }
 
590
                }
 
591
                if (!_tmp4_) {
 
592
                        break;
 
593
                }
 
594
                count++;
 
595
        }
 
596
        _tmp5_ = g_new0 (gchar*, count + 1);
 
597
        options = _tmp5_;
 
598
        options_length1 = count;
 
599
        _options_size_ = count;
 
600
        {
 
601
                gint i;
 
602
                i = 0;
 
603
                {
 
604
                        gboolean _tmp6_;
 
605
                        _tmp6_ = TRUE;
 
606
                        while (TRUE) {
 
607
                                gchar* _tmp7_ = NULL;
 
608
                                gchar* _tmp8_;
 
609
                                gchar* _tmp9_ = NULL;
 
610
                                gchar* _tmp10_;
 
611
                                gchar* _tmp11_;
 
612
                                gchar* _tmp12_;
 
613
                                if (!_tmp6_) {
 
614
                                        i++;
 
615
                                }
 
616
                                _tmp6_ = FALSE;
 
617
                                if (!(i < count)) {
 
618
                                        break;
 
619
                                }
 
620
                                _tmp7_ = g_strdup_printf ("option-%s-%d", difficulty, i);
 
621
                                _tmp8_ = _tmp7_;
 
622
                                _tmp9_ = g_key_file_get_value (file, name, _tmp8_, &_inner_error_);
 
623
                                _tmp10_ = _tmp9_;
 
624
                                _g_free0 (_tmp8_);
 
625
                                _tmp11_ = _tmp10_;
 
626
                                if (_inner_error_ != NULL) {
 
627
                                        if (_inner_error_->domain == G_KEY_FILE_ERROR) {
 
628
                                                g_propagate_error (error, _inner_error_);
 
629
                                                options = (_vala_array_free (options, options_length1, (GDestroyNotify) g_free), NULL);
 
630
                                                return NULL;
 
631
                                        } else {
 
632
                                                options = (_vala_array_free (options, options_length1, (GDestroyNotify) g_free), NULL);
 
633
                                                g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 
634
                                                g_clear_error (&_inner_error_);
 
635
                                                return NULL;
 
636
                                        }
 
637
                                }
 
638
                                _tmp12_ = _tmp11_;
 
639
                                _g_free0 (options[i]);
 
640
                                options[i] = _tmp12_;
 
641
                        }
 
642
                }
 
643
        }
 
644
        _tmp13_ = options;
 
645
        *result_length1 = options_length1;
 
646
        result = _tmp13_;
 
647
        return result;
 
648
}
 
649
 
 
650
 
 
651
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
652
        if ((array != NULL) && (destroy_func != NULL)) {
 
653
                int i;
 
654
                for (i = 0; i < array_length; i = i + 1) {
 
655
                        if (((gpointer*) array)[i] != NULL) {
 
656
                                destroy_func (((gpointer*) array)[i]);
 
657
                        }
 
658
                }
 
659
        }
 
660
}
 
661
 
 
662
 
 
663
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
 
664
        _vala_array_destroy (array, array_length, destroy_func);
 
665
        g_free (array);
 
666
}
 
667
 
 
668
 
 
669