summaryrefslogtreecommitdiff
path: root/benchmark/mergesort.c
diff options
context:
space:
mode:
Diffstat (limited to 'benchmark/mergesort.c')
-rw-r--r--benchmark/mergesort.c705
1 files changed, 0 insertions, 705 deletions
diff --git a/benchmark/mergesort.c b/benchmark/mergesort.c
deleted file mode 100644
index 1a2a841..0000000
--- a/benchmark/mergesort.c
+++ /dev/null
@@ -1,705 +0,0 @@
-/* mergesort.c generated by valac 0.16.1, the Vala compiler
- * generated from mergesort.vala, do not modify */
-
-/* mergesort.vala
- *
- * Copyright (C) 2009 Didier Villevalois
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
-
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
-
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- *
- * Author:
- * Will <tcosprojects@gmail.com>
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gee-internals.h>
-#include <gobject/gvaluecollector.h>
-
-
-#define GEE_TYPE_MERGE_SORT (gee_merge_sort_get_type ())
-#define GEE_MERGE_SORT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GEE_TYPE_MERGE_SORT, GeeMergeSort))
-#define GEE_MERGE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GEE_TYPE_MERGE_SORT, GeeMergeSortClass))
-#define GEE_IS_MERGE_SORT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GEE_TYPE_MERGE_SORT))
-#define GEE_IS_MERGE_SORT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GEE_TYPE_MERGE_SORT))
-#define GEE_MERGE_SORT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GEE_TYPE_MERGE_SORT, GeeMergeSortClass))
-
-typedef struct _GeeMergeSort GeeMergeSort;
-typedef struct _GeeMergeSortClass GeeMergeSortClass;
-typedef struct _GeeMergeSortPrivate GeeMergeSortPrivate;
-#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-#define _g_destroy_func0(var) (((var == NULL) || (g_destroy_func == NULL)) ? NULL : (var = (g_destroy_func (var), NULL)))
-#define _gee_merge_sort_unref0(var) ((var == NULL) ? NULL : (var = (gee_merge_sort_unref (var), NULL)))
-typedef struct _GeeParamSpecMergeSort GeeParamSpecMergeSort;
-
-struct _GeeMergeSort {
- GTypeInstance parent_instance;
- volatile int ref_count;
- GeeMergeSortPrivate * priv;
-};
-
-struct _GeeMergeSortClass {
- GTypeClass parent_class;
- void (*finalize) (GeeMergeSort *self);
-};
-
-struct _GeeMergeSortPrivate {
- GType g_type;
- GBoxedCopyFunc g_dup_func;
- GDestroyNotify g_destroy_func;
- GeeList* list_collection;
- gpointer* array;
- gint array_length1;
- gint _array_size_;
- gpointer* list;
- gint list_length1;
- gint _list_size_;
- gint index;
- gint size;
- GCompareFunc compare;
-};
-
-struct _GeeParamSpecMergeSort {
- GParamSpec parent_instance;
-};
-
-
-static gpointer gee_merge_sort_parent_class = NULL;
-
-gpointer gee_merge_sort_ref (gpointer instance);
-void gee_merge_sort_unref (gpointer instance);
-GParamSpec* gee_param_spec_merge_sort (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void gee_value_set_merge_sort (GValue* value, gpointer v_object);
-void gee_value_take_merge_sort (GValue* value, gpointer v_object);
-gpointer gee_value_get_merge_sort (const GValue* value);
-GType gee_merge_sort_get_type (void) G_GNUC_CONST;
-#define GEE_MERGE_SORT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GEE_TYPE_MERGE_SORT, GeeMergeSortPrivate))
-enum {
- GEE_MERGE_SORT_DUMMY_PROPERTY
-};
-void gee_merge_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare);
-void gee_merge_sort_sort_arraylist (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list, GCompareFunc compare);
-void gee_merge_sort_sort_list (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare);
-GeeMergeSort* gee_merge_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
-GeeMergeSort* gee_merge_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func);
-static void gee_merge_sort_do_sort (GeeMergeSort* self);
-static void gee_merge_sort_merge_sort_aux (GeeMergeSort* self, gint left, gint right, gpointer* work_area, int work_area_length1);
-static void gee_merge_sort_finalize (GeeMergeSort* obj);
-static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
-static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
-
-
-void gee_merge_sort_sort (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare) {
- GeeList* _tmp0_;
- g_return_if_fail (list != NULL);
- _tmp0_ = list;
- if (GEE_IS_ARRAY_LIST (_tmp0_)) {
- GeeList* _tmp1_;
- GCompareFunc _tmp2_;
- _tmp1_ = list;
- _tmp2_ = compare;
- gee_merge_sort_sort_arraylist (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, GEE_ARRAY_LIST (_tmp1_), _tmp2_);
- } else {
- GeeList* _tmp3_;
- GCompareFunc _tmp4_;
- _tmp3_ = list;
- _tmp4_ = compare;
- gee_merge_sort_sort_list (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func, _tmp3_, _tmp4_);
- }
-}
-
-
-static gpointer _g_object_ref0 (gpointer self) {
- return self ? g_object_ref (self) : NULL;
-}
-
-
-void gee_merge_sort_sort_list (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeList* list, GCompareFunc compare) {
- GeeMergeSort* _tmp0_;
- GeeMergeSort* helper;
- GeeMergeSort* _tmp1_;
- GeeList* _tmp2_;
- GeeList* _tmp3_;
- GeeMergeSort* _tmp4_;
- GeeList* _tmp5_;
- gint _tmp6_ = 0;
- gpointer* _tmp7_ = NULL;
- GeeMergeSort* _tmp8_;
- GeeMergeSort* _tmp9_;
- gpointer* _tmp10_;
- gint _tmp10__length1;
- GeeMergeSort* _tmp11_;
- GeeMergeSort* _tmp12_;
- GeeList* _tmp13_;
- gint _tmp14_;
- gint _tmp15_;
- GeeMergeSort* _tmp16_;
- GCompareFunc _tmp17_;
- GeeMergeSort* _tmp18_;
- GeeList* _tmp19_;
- GeeMergeSort* _tmp20_;
- gpointer* _tmp21_;
- gint _tmp21__length1;
- g_return_if_fail (list != NULL);
- _tmp0_ = gee_merge_sort_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func);
- helper = _tmp0_;
- _tmp1_ = helper;
- _tmp2_ = list;
- _tmp3_ = _g_object_ref0 (_tmp2_);
- _g_object_unref0 (_tmp1_->priv->list_collection);
- _tmp1_->priv->list_collection = _tmp3_;
- _tmp4_ = helper;
- _tmp5_ = list;
- _tmp7_ = gee_collection_to_array ((GeeCollection*) _tmp5_, &_tmp6_);
- _tmp4_->priv->array = (_vala_array_free (_tmp4_->priv->array, _tmp4_->priv->array_length1, (GDestroyNotify) g_destroy_func), NULL);
- _tmp4_->priv->array = _tmp7_;
- _tmp4_->priv->array_length1 = _tmp6_;
- _tmp4_->priv->_array_size_ = _tmp4_->priv->array_length1;
- _tmp8_ = helper;
- _tmp9_ = helper;
- _tmp10_ = _tmp9_->priv->array;
- _tmp10__length1 = _tmp9_->priv->array_length1;
- _tmp8_->priv->list = _tmp10_;
- _tmp8_->priv->list_length1 = _tmp10__length1;
- _tmp8_->priv->_list_size_ = _tmp8_->priv->list_length1;
- _tmp11_ = helper;
- _tmp11_->priv->index = 0;
- _tmp12_ = helper;
- _tmp13_ = list;
- _tmp14_ = gee_collection_get_size ((GeeCollection*) _tmp13_);
- _tmp15_ = _tmp14_;
- _tmp12_->priv->size = _tmp15_;
- _tmp16_ = helper;
- _tmp17_ = compare;
- _tmp16_->priv->compare = _tmp17_;
- _tmp18_ = helper;
- gee_merge_sort_do_sort (_tmp18_);
- _tmp19_ = list;
- gee_collection_clear ((GeeCollection*) _tmp19_);
- _tmp20_ = helper;
- _tmp21_ = _tmp20_->priv->array;
- _tmp21__length1 = _tmp20_->priv->array_length1;
- {
- gpointer* item_collection = NULL;
- gint item_collection_length1 = 0;
- gint _item_collection_size_ = 0;
- gint item_it = 0;
- item_collection = _tmp21_;
- item_collection_length1 = _tmp21__length1;
- for (item_it = 0; item_it < _tmp21__length1; item_it = item_it + 1) {
- gpointer _tmp22_;
- gpointer item = NULL;
- _tmp22_ = ((item_collection[item_it] != NULL) && (g_dup_func != NULL)) ? g_dup_func ((gpointer) item_collection[item_it]) : ((gpointer) item_collection[item_it]);
- item = _tmp22_;
- {
- GeeList* _tmp23_;
- gconstpointer _tmp24_;
- _tmp23_ = list;
- _tmp24_ = item;
- gee_collection_add ((GeeCollection*) _tmp23_, _tmp24_);
- _g_destroy_func0 (item);
- }
- }
- }
- _gee_merge_sort_unref0 (helper);
-}
-
-
-void gee_merge_sort_sort_arraylist (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func, GeeArrayList* list, GCompareFunc compare) {
- GeeMergeSort* _tmp0_;
- GeeMergeSort* helper;
- GeeArrayList* _tmp1_;
- GeeList* _tmp2_;
- GeeArrayList* _tmp3_;
- gpointer* _tmp4_;
- gint _tmp4__length1;
- GeeArrayList* _tmp5_;
- gint _tmp6_;
- GCompareFunc _tmp7_;
- g_return_if_fail (list != NULL);
- _tmp0_ = gee_merge_sort_new (g_type, (GBoxedCopyFunc) g_dup_func, g_destroy_func);
- helper = _tmp0_;
- _tmp1_ = list;
- _tmp2_ = _g_object_ref0 ((GeeList*) _tmp1_);
- _g_object_unref0 (helper->priv->list_collection);
- helper->priv->list_collection = _tmp2_;
- _tmp3_ = list;
- _tmp4_ = _tmp3_->_items;
- _tmp4__length1 = _tmp3_->_items_length1;
- helper->priv->list = _tmp4_;
- helper->priv->list_length1 = _tmp4__length1;
- helper->priv->_list_size_ = helper->priv->list_length1;
- helper->priv->index = 0;
- _tmp5_ = list;
- _tmp6_ = _tmp5_->_size;
- helper->priv->size = _tmp6_;
- _tmp7_ = compare;
- helper->priv->compare = _tmp7_;
- gee_merge_sort_do_sort (helper);
- _gee_merge_sort_unref0 (helper);
-}
-
-
-static void gee_merge_sort_do_sort (GeeMergeSort* self) {
- gint _tmp0_;
- gint _tmp1_;
- gpointer* _tmp2_ = NULL;
- gpointer* work_area;
- gint work_area_length1;
- gint _work_area_size_;
- gint _tmp3_;
- gint _tmp4_;
- gpointer* _tmp5_;
- gint _tmp5__length1;
- g_return_if_fail (self != NULL);
- _tmp0_ = self->priv->size;
- if (_tmp0_ <= 1) {
- return;
- }
- _tmp1_ = self->priv->size;
- _tmp2_ = g_new0 (gpointer, _tmp1_);
- work_area = _tmp2_;
- work_area_length1 = _tmp1_;
- _work_area_size_ = work_area_length1;
- _tmp3_ = self->priv->index;
- _tmp4_ = self->priv->size;
- _tmp5_ = work_area;
- _tmp5__length1 = work_area_length1;
- gee_merge_sort_merge_sort_aux (self, _tmp3_, _tmp4_, _tmp5_, _tmp5__length1);
- work_area = (_vala_array_free (work_area, work_area_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL);
-}
-
-
-static void gee_merge_sort_merge_sort_aux (GeeMergeSort* self, gint left, gint right, gpointer* work_area, int work_area_length1) {
- gint _tmp0_;
- gint _tmp1_;
- g_return_if_fail (self != NULL);
- _tmp0_ = right;
- _tmp1_ = left;
- if (_tmp0_ == (_tmp1_ + 1)) {
- return;
- } else {
- gint _tmp2_;
- gint _tmp3_;
- gint size;
- gint _tmp4_;
- gint middle;
- gint _tmp5_;
- gint lbegin;
- gint _tmp6_;
- gint _tmp7_;
- gint rbegin;
- gint _tmp8_;
- gint _tmp9_;
- gint _tmp10_;
- gpointer* _tmp11_;
- gint _tmp11__length1;
- gint _tmp12_;
- gint _tmp13_;
- gint _tmp14_;
- gpointer* _tmp15_;
- gint _tmp15__length1;
- _tmp2_ = right;
- _tmp3_ = left;
- size = _tmp2_ - _tmp3_;
- _tmp4_ = size;
- middle = _tmp4_ / 2;
- _tmp5_ = left;
- lbegin = _tmp5_;
- _tmp6_ = left;
- _tmp7_ = middle;
- rbegin = _tmp6_ + _tmp7_;
- _tmp8_ = left;
- _tmp9_ = left;
- _tmp10_ = middle;
- _tmp11_ = work_area;
- _tmp11__length1 = work_area_length1;
- gee_merge_sort_merge_sort_aux (self, _tmp8_, _tmp9_ + _tmp10_, _tmp11_, _tmp11__length1);
- _tmp12_ = left;
- _tmp13_ = middle;
- _tmp14_ = right;
- _tmp15_ = work_area;
- _tmp15__length1 = work_area_length1;
- gee_merge_sort_merge_sort_aux (self, _tmp12_ + _tmp13_, _tmp14_, _tmp15_, _tmp15__length1);
- {
- gint i;
- i = 0;
- {
- gboolean _tmp16_;
- _tmp16_ = TRUE;
- while (TRUE) {
- gboolean _tmp17_;
- gint _tmp19_;
- gint _tmp20_;
- gboolean _tmp21_ = FALSE;
- gint _tmp22_;
- gint _tmp23_;
- gint _tmp24_;
- gboolean _tmp37_;
- _tmp17_ = _tmp16_;
- if (!_tmp17_) {
- gint _tmp18_;
- _tmp18_ = i;
- i = _tmp18_ + 1;
- }
- _tmp16_ = FALSE;
- _tmp19_ = i;
- _tmp20_ = size;
- if (!(_tmp19_ < _tmp20_)) {
- break;
- }
- _tmp22_ = lbegin;
- _tmp23_ = left;
- _tmp24_ = middle;
- if (_tmp22_ < (_tmp23_ + _tmp24_)) {
- gboolean _tmp25_ = FALSE;
- gint _tmp26_;
- gint _tmp27_;
- gboolean _tmp36_;
- _tmp26_ = rbegin;
- _tmp27_ = right;
- if (_tmp26_ == _tmp27_) {
- _tmp25_ = TRUE;
- } else {
- GCompareFunc _tmp28_;
- gpointer* _tmp29_;
- gint _tmp29__length1;
- gint _tmp30_;
- gconstpointer _tmp31_;
- gpointer* _tmp32_;
- gint _tmp32__length1;
- gint _tmp33_;
- gconstpointer _tmp34_;
- gint _tmp35_ = 0;
- _tmp28_ = self->priv->compare;
- _tmp29_ = self->priv->list;
- _tmp29__length1 = self->priv->list_length1;
- _tmp30_ = lbegin;
- _tmp31_ = _tmp29_[_tmp30_];
- _tmp32_ = self->priv->list;
- _tmp32__length1 = self->priv->list_length1;
- _tmp33_ = rbegin;
- _tmp34_ = _tmp32_[_tmp33_];
- _tmp35_ = _tmp28_ (_tmp31_, _tmp34_);
- _tmp25_ = _tmp35_ <= 0;
- }
- _tmp36_ = _tmp25_;
- _tmp21_ = _tmp36_;
- } else {
- _tmp21_ = FALSE;
- }
- _tmp37_ = _tmp21_;
- if (_tmp37_) {
- gpointer* _tmp38_;
- gint _tmp38__length1;
- gint _tmp39_;
- gpointer* _tmp40_;
- gint _tmp40__length1;
- gint _tmp41_;
- gconstpointer _tmp42_;
- gpointer _tmp43_;
- gpointer _tmp44_;
- gint _tmp45_;
- _tmp38_ = work_area;
- _tmp38__length1 = work_area_length1;
- _tmp39_ = i;
- _tmp40_ = self->priv->list;
- _tmp40__length1 = self->priv->list_length1;
- _tmp41_ = lbegin;
- _tmp42_ = _tmp40_[_tmp41_];
- _tmp43_ = ((_tmp42_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp42_) : ((gpointer) _tmp42_);
- ((_tmp38_[_tmp39_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp38_[_tmp39_] = (self->priv->g_destroy_func (_tmp38_[_tmp39_]), NULL));
- _tmp38_[_tmp39_] = _tmp43_;
- _tmp44_ = _tmp38_[_tmp39_];
- _tmp45_ = lbegin;
- lbegin = _tmp45_ + 1;
- } else {
- gpointer* _tmp46_;
- gint _tmp46__length1;
- gint _tmp47_;
- gpointer* _tmp48_;
- gint _tmp48__length1;
- gint _tmp49_;
- gconstpointer _tmp50_;
- gpointer _tmp51_;
- gpointer _tmp52_;
- gint _tmp53_;
- _tmp46_ = work_area;
- _tmp46__length1 = work_area_length1;
- _tmp47_ = i;
- _tmp48_ = self->priv->list;
- _tmp48__length1 = self->priv->list_length1;
- _tmp49_ = rbegin;
- _tmp50_ = _tmp48_[_tmp49_];
- _tmp51_ = ((_tmp50_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp50_) : ((gpointer) _tmp50_);
- ((_tmp46_[_tmp47_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp46_[_tmp47_] = (self->priv->g_destroy_func (_tmp46_[_tmp47_]), NULL));
- _tmp46_[_tmp47_] = _tmp51_;
- _tmp52_ = _tmp46_[_tmp47_];
- _tmp53_ = rbegin;
- rbegin = _tmp53_ + 1;
- }
- }
- }
- }
- {
- gint _tmp54_;
- gint i;
- _tmp54_ = left;
- i = _tmp54_;
- {
- gboolean _tmp55_;
- _tmp55_ = TRUE;
- while (TRUE) {
- gboolean _tmp56_;
- gint _tmp58_;
- gint _tmp59_;
- gpointer* _tmp60_;
- gint _tmp60__length1;
- gint _tmp61_;
- gpointer* _tmp62_;
- gint _tmp62__length1;
- gint _tmp63_;
- gint _tmp64_;
- gconstpointer _tmp65_;
- gpointer _tmp66_;
- gpointer _tmp67_;
- _tmp56_ = _tmp55_;
- if (!_tmp56_) {
- gint _tmp57_;
- _tmp57_ = i;
- i = _tmp57_ + 1;
- }
- _tmp55_ = FALSE;
- _tmp58_ = i;
- _tmp59_ = right;
- if (!(_tmp58_ < _tmp59_)) {
- break;
- }
- _tmp60_ = self->priv->list;
- _tmp60__length1 = self->priv->list_length1;
- _tmp61_ = i;
- _tmp62_ = work_area;
- _tmp62__length1 = work_area_length1;
- _tmp63_ = i;
- _tmp64_ = left;
- _tmp65_ = _tmp62_[_tmp63_ - _tmp64_];
- _tmp66_ = ((_tmp65_ != NULL) && (self->priv->g_dup_func != NULL)) ? self->priv->g_dup_func ((gpointer) _tmp65_) : ((gpointer) _tmp65_);
- ((_tmp60_[_tmp61_] == NULL) || (self->priv->g_destroy_func == NULL)) ? NULL : (_tmp60_[_tmp61_] = (self->priv->g_destroy_func (_tmp60_[_tmp61_]), NULL));
- _tmp60_[_tmp61_] = _tmp66_;
- _tmp67_ = _tmp60_[_tmp61_];
- }
- }
- }
- }
-}
-
-
-GeeMergeSort* gee_merge_sort_construct (GType object_type, GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
- GeeMergeSort* self = NULL;
- self = (GeeMergeSort*) g_type_create_instance (object_type);
- self->priv->g_type = g_type;
- self->priv->g_dup_func = g_dup_func;
- self->priv->g_destroy_func = g_destroy_func;
- return self;
-}
-
-
-GeeMergeSort* gee_merge_sort_new (GType g_type, GBoxedCopyFunc g_dup_func, GDestroyNotify g_destroy_func) {
- return gee_merge_sort_construct (GEE_TYPE_MERGE_SORT, g_type, g_dup_func, g_destroy_func);
-}
-
-
-static void gee_value_merge_sort_init (GValue* value) {
- value->data[0].v_pointer = NULL;
-}
-
-
-static void gee_value_merge_sort_free_value (GValue* value) {
- if (value->data[0].v_pointer) {
- gee_merge_sort_unref (value->data[0].v_pointer);
- }
-}
-
-
-static void gee_value_merge_sort_copy_value (const GValue* src_value, GValue* dest_value) {
- if (src_value->data[0].v_pointer) {
- dest_value->data[0].v_pointer = gee_merge_sort_ref (src_value->data[0].v_pointer);
- } else {
- dest_value->data[0].v_pointer = NULL;
- }
-}
-
-
-static gpointer gee_value_merge_sort_peek_pointer (const GValue* value) {
- return value->data[0].v_pointer;
-}
-
-
-static gchar* gee_value_merge_sort_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
- if (collect_values[0].v_pointer) {
- GeeMergeSort* object;
- object = collect_values[0].v_pointer;
- if (object->parent_instance.g_class == NULL) {
- return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
- } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
- return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
- }
- value->data[0].v_pointer = gee_merge_sort_ref (object);
- } else {
- value->data[0].v_pointer = NULL;
- }
- return NULL;
-}
-
-
-static gchar* gee_value_merge_sort_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
- GeeMergeSort** object_p;
- object_p = collect_values[0].v_pointer;
- if (!object_p) {
- return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
- }
- if (!value->data[0].v_pointer) {
- *object_p = NULL;
- } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
- *object_p = value->data[0].v_pointer;
- } else {
- *object_p = gee_merge_sort_ref (value->data[0].v_pointer);
- }
- return NULL;
-}
-
-
-GParamSpec* gee_param_spec_merge_sort (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
- GeeParamSpecMergeSort* spec;
- g_return_val_if_fail (g_type_is_a (object_type, GEE_TYPE_MERGE_SORT), NULL);
- spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
- G_PARAM_SPEC (spec)->value_type = object_type;
- return G_PARAM_SPEC (spec);
-}
-
-
-gpointer gee_value_get_merge_sort (const GValue* value) {
- g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TYPE_MERGE_SORT), NULL);
- return value->data[0].v_pointer;
-}
-
-
-void gee_value_set_merge_sort (GValue* value, gpointer v_object) {
- GeeMergeSort* old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TYPE_MERGE_SORT));
- old = value->data[0].v_pointer;
- if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TYPE_MERGE_SORT));
- g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
- value->data[0].v_pointer = v_object;
- gee_merge_sort_ref (value->data[0].v_pointer);
- } else {
- value->data[0].v_pointer = NULL;
- }
- if (old) {
- gee_merge_sort_unref (old);
- }
-}
-
-
-void gee_value_take_merge_sort (GValue* value, gpointer v_object) {
- GeeMergeSort* old;
- g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, GEE_TYPE_MERGE_SORT));
- old = value->data[0].v_pointer;
- if (v_object) {
- g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, GEE_TYPE_MERGE_SORT));
- g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
- value->data[0].v_pointer = v_object;
- } else {
- value->data[0].v_pointer = NULL;
- }
- if (old) {
- gee_merge_sort_unref (old);
- }
-}
-
-
-static void gee_merge_sort_class_init (GeeMergeSortClass * klass) {
- gee_merge_sort_parent_class = g_type_class_peek_parent (klass);
- GEE_MERGE_SORT_CLASS (klass)->finalize = gee_merge_sort_finalize;
- g_type_class_add_private (klass, sizeof (GeeMergeSortPrivate));
-}
-
-
-static void gee_merge_sort_instance_init (GeeMergeSort * self) {
- self->priv = GEE_MERGE_SORT_GET_PRIVATE (self);
- self->ref_count = 1;
-}
-
-
-static void gee_merge_sort_finalize (GeeMergeSort* obj) {
- GeeMergeSort * self;
- self = GEE_MERGE_SORT (obj);
- _g_object_unref0 (self->priv->list_collection);
- self->priv->array = (_vala_array_free (self->priv->array, self->priv->array_length1, (GDestroyNotify) self->priv->g_destroy_func), NULL);
-}
-
-
-GType gee_merge_sort_get_type (void) {
- static volatile gsize gee_merge_sort_type_id__volatile = 0;
- if (g_once_init_enter (&gee_merge_sort_type_id__volatile)) {
- static const GTypeValueTable g_define_type_value_table = { gee_value_merge_sort_init, gee_value_merge_sort_free_value, gee_value_merge_sort_copy_value, gee_value_merge_sort_peek_pointer, "p", gee_value_merge_sort_collect_value, "p", gee_value_merge_sort_lcopy_value };
- static const GTypeInfo g_define_type_info = { sizeof (GeeMergeSortClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gee_merge_sort_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GeeMergeSort), 0, (GInstanceInitFunc) gee_merge_sort_instance_init, &g_define_type_value_table };
- 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) };
- GType gee_merge_sort_type_id;
- gee_merge_sort_type_id = g_type_register_fundamental (g_type_fundamental_next (), "GeeMergeSort", &g_define_type_info, &g_define_type_fundamental_info, 0);
- g_once_init_leave (&gee_merge_sort_type_id__volatile, gee_merge_sort_type_id);
- }
- return gee_merge_sort_type_id__volatile;
-}
-
-
-gpointer gee_merge_sort_ref (gpointer instance) {
- GeeMergeSort* self;
- self = instance;
- g_atomic_int_inc (&self->ref_count);
- return instance;
-}
-
-
-void gee_merge_sort_unref (gpointer instance) {
- GeeMergeSort* self;
- self = instance;
- if (g_atomic_int_dec_and_test (&self->ref_count)) {
- GEE_MERGE_SORT_GET_CLASS (self)->finalize (self);
- g_type_free_instance ((GTypeInstance *) self);
- }
-}
-
-
-static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
- if ((array != NULL) && (destroy_func != NULL)) {
- int i;
- for (i = 0; i < array_length; i = i + 1) {
- if (((gpointer*) array)[i] != NULL) {
- destroy_func (((gpointer*) array)[i]);
- }
- }
- }
-}
-
-
-static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
- _vala_array_destroy (array, array_length, destroy_func);
- g_free (array);
-}
-
-
-