diff options
author | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-05-23 17:50:12 +0200 |
---|---|---|
committer | Rico Tzschichholz <ricotz@ubuntu.com> | 2021-07-16 16:59:57 +0200 |
commit | 366590a71672106d8f8a820e79431df7f0c39337 (patch) | |
tree | af530265b03db60f5a9d5f39e7d9f4d098aa12f3 /tests/asynchronous/bug654337.c-expected | |
parent | 7c4a957606f5a5b2afc8078228f228c8f87ccce5 (diff) | |
download | vala-366590a71672106d8f8a820e79431df7f0c39337.tar.gz |
tests: Add expected generated C sources
Diffstat (limited to 'tests/asynchronous/bug654337.c-expected')
-rw-r--r-- | tests/asynchronous/bug654337.c-expected | 181 |
1 files changed, 181 insertions, 0 deletions
diff --git a/tests/asynchronous/bug654337.c-expected b/tests/asynchronous/bug654337.c-expected new file mode 100644 index 000000000..925cba654 --- /dev/null +++ b/tests/asynchronous/bug654337.c-expected @@ -0,0 +1,181 @@ +/* asynchronous_bug654337.c generated by valac, the Vala compiler + * generated from asynchronous_bug654337.vala, do not modify */ + +#include <gio/gio.h> +#include <glib-object.h> +#include <glib.h> + +#if !defined(VALA_EXTERN) +#if defined(_MSC_VER) +#define VALA_EXTERN __declspec(dllexport) extern +#elif __GNUC__ >= 4 +#define VALA_EXTERN __attribute__((visibility("default"))) extern +#else +#define VALA_EXTERN extern +#endif +#endif + +typedef struct _Block1Data Block1Data; +typedef struct _FooData FooData; + +struct _Block1Data { + int _ref_count_; + GType t_type; + GBoxedCopyFunc t_dup_func; + GDestroyNotify t_destroy_func; + gpointer _async_data_; +}; + +struct _FooData { + int _state_; + GObject* _source_object_; + GAsyncResult* _res_; + GTask* _async_result; + GType t_type; + GBoxedCopyFunc t_dup_func; + GDestroyNotify t_destroy_func; + Block1Data* _data1_; + GSourceFunc c; + gpointer c_target; + GDestroyNotify c_target_destroy_notify; +}; + +static void foo_data_free (gpointer _data); +VALA_EXTERN void foo (GType t_type, + GBoxedCopyFunc t_dup_func, + GDestroyNotify t_destroy_func, + GAsyncReadyCallback _callback_, + gpointer _user_data_); +VALA_EXTERN void foo_finish (GAsyncResult* _res_); +static gboolean foo_co (FooData* _data_); +static Block1Data* block1_data_ref (Block1Data* _data1_); +static void block1_data_unref (void * _userdata_); +static gboolean __lambda4_ (Block1Data* _data1_); +static gboolean ___lambda4__gsource_func (gpointer self); +static void _vala_main (void); + +static void +foo_data_free (gpointer _data) +{ + FooData* _data_; + _data_ = _data; + g_slice_free (FooData, _data_); +} + +void +foo (GType t_type, + GBoxedCopyFunc t_dup_func, + GDestroyNotify t_destroy_func, + GAsyncReadyCallback _callback_, + gpointer _user_data_) +{ + FooData* _data_; + _data_ = g_slice_new0 (FooData); + _data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_); + g_task_set_task_data (_data_->_async_result, _data_, foo_data_free); + _data_->t_type = t_type; + _data_->t_dup_func = t_dup_func; + _data_->t_destroy_func = t_destroy_func; + foo_co (_data_); +} + +void +foo_finish (GAsyncResult* _res_) +{ + FooData* _data_; + _data_ = g_task_propagate_pointer (G_TASK (_res_), NULL); +} + +static Block1Data* +block1_data_ref (Block1Data* _data1_) +{ + g_atomic_int_inc (&_data1_->_ref_count_); + return _data1_; +} + +static void +block1_data_unref (void * _userdata_) +{ + Block1Data* _data1_; + _data1_ = (Block1Data*) _userdata_; + if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) { + GType t_type; + GBoxedCopyFunc t_dup_func; + GDestroyNotify t_destroy_func; + t_type = _data1_->t_type; + t_dup_func = _data1_->t_dup_func; + t_destroy_func = _data1_->t_destroy_func; + g_slice_free (Block1Data, _data1_); + } +} + +static gboolean +__lambda4_ (Block1Data* _data1_) +{ + GType t_type; + GBoxedCopyFunc t_dup_func; + GDestroyNotify t_destroy_func; + gboolean result = FALSE; + t_type = _data1_->t_type; + t_dup_func = _data1_->t_dup_func; + t_destroy_func = _data1_->t_destroy_func; + result = foo_co (_data1_->_async_data_); + return result; +} + +static gboolean +___lambda4__gsource_func (gpointer self) +{ + gboolean result; + result = __lambda4_ (self); + return result; +} + +static gboolean +foo_co (FooData* _data_) +{ + switch (_data_->_state_) { + case 0: + goto _state_0; + default: + g_assert_not_reached (); + } + _state_0: + _data_->_data1_ = g_slice_new0 (Block1Data); + _data_->_data1_->_ref_count_ = 1; + _data_->_data1_->t_type = _data_->t_type; + _data_->_data1_->t_dup_func = _data_->t_dup_func; + _data_->_data1_->t_destroy_func = _data_->t_destroy_func; + _data_->_data1_->_async_data_ = _data_; + _data_->c = ___lambda4__gsource_func; + _data_->c_target = block1_data_ref (_data_->_data1_); + _data_->c_target_destroy_notify = block1_data_unref; + (_data_->c_target_destroy_notify == NULL) ? NULL : (_data_->c_target_destroy_notify (_data_->c_target), NULL); + _data_->c = NULL; + _data_->c_target = NULL; + _data_->c_target_destroy_notify = NULL; + block1_data_unref (_data_->_data1_); + _data_->_data1_ = NULL; + g_task_return_pointer (_data_->_async_result, _data_, NULL); + if (_data_->_state_ != 0) { + while (!g_task_get_completed (_data_->_async_result)) { + g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE); + } + } + g_object_unref (_data_->_async_result); + return FALSE; +} + +static void +_vala_main (void) +{ +} + +int +main (int argc, + char ** argv) +{ + _vala_main (); + return 0; +} + |