345
345
void (*generate_marshaller) (ValaCCodeBaseModule* self, ValaList* params, ValaDataType* return_type, gboolean dbus);
346
346
char* (*get_marshaller_function) (ValaCCodeBaseModule* self, ValaList* params, ValaDataType* return_type, const char* prefix, gboolean dbus);
347
347
char* (*get_array_length_cname) (ValaCCodeBaseModule* self, const char* array_cname, gint dim);
348
char* (*get_parameter_array_length_cname) (ValaCCodeBaseModule* self, ValaFormalParameter* param, gint dim);
348
349
ValaCCodeExpression* (*get_array_length_cexpression) (ValaCCodeBaseModule* self, ValaExpression* array_expr, gint dim);
349
350
char* (*get_array_size_cname) (ValaCCodeBaseModule* self, const char* array_cname);
350
351
ValaCCodeExpression* (*get_array_size_cexpression) (ValaCCodeBaseModule* self, ValaExpression* array_expr);
519
520
static ValaCCodeStruct* vala_gasync_module_generate_data_struct (ValaGAsyncModule* self, ValaMethod* m);
520
521
char* vala_ccode_base_module_get_variable_cname (ValaCCodeBaseModule* self, const char* name);
521
char* vala_ccode_base_module_get_array_length_cname (ValaCCodeBaseModule* self, const char* array_cname, gint dim);
522
char* vala_ccode_base_module_get_parameter_array_length_cname (ValaCCodeBaseModule* self, ValaFormalParameter* param, gint dim);
522
523
char* vala_ccode_base_module_get_delegate_target_cname (ValaCCodeBaseModule* self, const char* delegate_cname);
523
524
char* vala_ccode_base_module_get_delegate_target_destroy_notify_cname (ValaCCodeBaseModule* self, const char* delegate_cname);
525
char* vala_ccode_base_module_get_array_length_cname (ValaCCodeBaseModule* self, const char* array_cname, gint dim);
524
526
static ValaCCodeFunction* vala_gasync_module_generate_free_function (ValaGAsyncModule* self, ValaMethod* m);
525
527
void vala_ccode_base_module_push_context (ValaCCodeBaseModule* self, ValaCCodeBaseModuleEmitContext* emit_context);
526
528
ValaCCodeBaseModuleEmitContext* vala_ccode_base_module_emit_context_new (ValaSymbol* symbol);
643
644
if (!(dim <= vala_array_type_get_rank (array_type))) {
646
vala_ccode_struct_add_field (data, "gint", _tmp13_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, _tmp12_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param)), dim), NULL);
647
vala_ccode_struct_add_field (data, "gint", _tmp12_ = vala_ccode_base_module_get_parameter_array_length_cname ((ValaCCodeBaseModule*) self, param, dim), NULL);
648
648
_g_free0 (_tmp12_);
656
656
ValaDelegateType* deleg_type;
657
657
deleg_type = _vala_code_node_ref0 (VALA_DELEGATE_TYPE (vala_variable_get_variable_type ((ValaVariable*) param)));
658
658
if (vala_delegate_get_has_target (vala_delegate_type_get_delegate_symbol (deleg_type))) {
663
vala_ccode_struct_add_field (data, "gpointer", _tmp15_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, _tmp14_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))), NULL);
663
vala_ccode_struct_add_field (data, "gpointer", _tmp14_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, _tmp13_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))), NULL);
665
664
_g_free0 (_tmp14_);
666
vala_ccode_struct_add_field (data, "GDestroyNotify", _tmp17_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, _tmp16_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))), NULL);
666
vala_ccode_struct_add_field (data, "GDestroyNotify", _tmp16_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, _tmp15_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))), NULL);
668
667
_g_free0 (_tmp16_);
670
670
_vala_code_node_unref0 (deleg_type);
676
676
_vala_collection_object_unref0 (_param_it);
678
678
if (!VALA_IS_VOID_TYPE (vala_method_get_return_type (m))) {
680
vala_ccode_struct_add_field (data, _tmp18_ = vala_data_type_get_cname (vala_method_get_return_type (m)), "result", NULL);
680
vala_ccode_struct_add_field (data, _tmp17_ = vala_data_type_get_cname (vala_method_get_return_type (m)), "result", NULL);
682
682
if (VALA_IS_ARRAY_TYPE (vala_method_get_return_type (m))) {
683
683
ValaArrayType* array_type;
684
684
array_type = _vala_code_node_ref0 (VALA_ARRAY_TYPE (vala_method_get_return_type (m)));
710
710
ValaDelegateType* deleg_type;
711
711
deleg_type = _vala_code_node_ref0 (VALA_DELEGATE_TYPE (vala_method_get_return_type (m)));
712
712
if (vala_delegate_get_has_target (vala_delegate_type_get_delegate_symbol (deleg_type))) {
715
vala_ccode_struct_add_field (data, "gpointer", _tmp21_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result"), NULL);
715
vala_ccode_struct_add_field (data, "gpointer", _tmp20_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, "result"), NULL);
717
vala_ccode_struct_add_field (data, "GDestroyNotify", _tmp21_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result"), NULL);
716
718
_g_free0 (_tmp21_);
717
vala_ccode_struct_add_field (data, "GDestroyNotify", _tmp22_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, "result"), NULL);
720
720
_vala_code_node_unref0 (deleg_type);
924
924
ValaCCodeIdentifier* _tmp51_;
925
925
ValaCCodeExpressionStatement* _tmp52_;
926
926
ValaCCodeFragment* cfrag;
929
ValaCCodeIdentifier* _tmp97_;
930
ValaCCodeFunctionCall* _tmp98_;
929
ValaCCodeIdentifier* _tmp95_;
930
ValaCCodeFunctionCall* _tmp96_;
931
931
ValaCCodeFunctionCall* ccall;
932
ValaCCodeExpressionStatement* _tmp99_;
933
ValaCCodeFormalParameter* _tmp100_;
934
ValaCCodeFormalParameter* _tmp101_;
935
gboolean _tmp102_ = FALSE;
932
ValaCCodeExpressionStatement* _tmp97_;
933
ValaCCodeFormalParameter* _tmp98_;
934
ValaCCodeFormalParameter* _tmp99_;
935
gboolean _tmp100_ = FALSE;
936
936
g_return_val_if_fail (self != NULL, NULL);
937
937
g_return_val_if_fail (m != NULL, NULL);
938
938
asyncblock = vala_ccode_block_new ();
1172
1170
if (!(dim <= vala_array_type_get_rank (array_type))) {
1175
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) (_tmp78_ = vala_ccode_expression_statement_new ((ValaCCodeExpression*) (_tmp77_ = vala_ccode_assignment_new ((ValaCCodeExpression*) (_tmp73_ = vala_ccode_member_access_new_pointer ((ValaCCodeExpression*) data_var, _tmp72_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, _tmp71_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param)), dim))), (ValaCCodeExpression*) (_tmp76_ = vala_ccode_identifier_new (_tmp75_ = vala_ccode_base_module_get_array_length_cname ((ValaCCodeBaseModule*) self, _tmp74_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param)), dim))), VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE)))));
1176
_vala_ccode_node_unref0 (_tmp78_);
1177
_vala_ccode_node_unref0 (_tmp77_);
1173
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) (_tmp76_ = vala_ccode_expression_statement_new ((ValaCCodeExpression*) (_tmp75_ = vala_ccode_assignment_new ((ValaCCodeExpression*) (_tmp72_ = vala_ccode_member_access_new_pointer ((ValaCCodeExpression*) data_var, _tmp71_ = vala_ccode_base_module_get_parameter_array_length_cname ((ValaCCodeBaseModule*) self, param, dim))), (ValaCCodeExpression*) (_tmp74_ = vala_ccode_identifier_new (_tmp73_ = vala_ccode_base_module_get_parameter_array_length_cname ((ValaCCodeBaseModule*) self, param, dim))), VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE)))));
1178
1174
_vala_ccode_node_unref0 (_tmp76_);
1181
_vala_ccode_node_unref0 (_tmp73_);
1175
_vala_ccode_node_unref0 (_tmp75_);
1176
_vala_ccode_node_unref0 (_tmp74_);
1178
_vala_ccode_node_unref0 (_tmp72_);
1183
1179
_g_free0 (_tmp71_);
1191
1187
ValaDelegateType* deleg_type;
1192
1188
deleg_type = _vala_code_node_ref0 (VALA_DELEGATE_TYPE (vala_variable_get_variable_type ((ValaVariable*) param)));
1193
1189
if (vala_delegate_get_has_target (vala_delegate_type_get_delegate_symbol (deleg_type))) {
1192
ValaCCodeMemberAccess* _tmp79_;
1196
ValaCCodeMemberAccess* _tmp81_;
1199
ValaCCodeIdentifier* _tmp84_;
1200
ValaCCodeAssignment* _tmp85_;
1201
ValaCCodeExpressionStatement* _tmp86_;
1202
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) (_tmp86_ = vala_ccode_expression_statement_new ((ValaCCodeExpression*) (_tmp85_ = vala_ccode_assignment_new ((ValaCCodeExpression*) (_tmp81_ = vala_ccode_member_access_new_pointer ((ValaCCodeExpression*) data_var, _tmp80_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, _tmp79_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))))), (ValaCCodeExpression*) (_tmp84_ = vala_ccode_identifier_new (_tmp83_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, _tmp82_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))))), VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE)))));
1203
_vala_ccode_node_unref0 (_tmp86_);
1204
_vala_ccode_node_unref0 (_tmp85_);
1195
ValaCCodeIdentifier* _tmp82_;
1196
ValaCCodeAssignment* _tmp83_;
1197
ValaCCodeExpressionStatement* _tmp84_;
1198
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) (_tmp84_ = vala_ccode_expression_statement_new ((ValaCCodeExpression*) (_tmp83_ = vala_ccode_assignment_new ((ValaCCodeExpression*) (_tmp79_ = vala_ccode_member_access_new_pointer ((ValaCCodeExpression*) data_var, _tmp78_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, _tmp77_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))))), (ValaCCodeExpression*) (_tmp82_ = vala_ccode_identifier_new (_tmp81_ = vala_ccode_base_module_get_delegate_target_cname ((ValaCCodeBaseModule*) self, _tmp80_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))))), VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE)))));
1205
1199
_vala_ccode_node_unref0 (_tmp84_);
1208
_vala_ccode_node_unref0 (_tmp81_);
1200
_vala_ccode_node_unref0 (_tmp83_);
1201
_vala_ccode_node_unref0 (_tmp82_);
1209
1203
_g_free0 (_tmp80_);
1204
_vala_ccode_node_unref0 (_tmp79_);
1211
1207
if (vala_data_type_get_value_owned ((ValaDataType*) deleg_type)) {
1210
ValaCCodeMemberAccess* _tmp87_;
1214
ValaCCodeMemberAccess* _tmp89_;
1217
ValaCCodeIdentifier* _tmp92_;
1218
ValaCCodeAssignment* _tmp93_;
1219
ValaCCodeExpressionStatement* _tmp94_;
1220
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) (_tmp94_ = vala_ccode_expression_statement_new ((ValaCCodeExpression*) (_tmp93_ = vala_ccode_assignment_new ((ValaCCodeExpression*) (_tmp89_ = vala_ccode_member_access_new_pointer ((ValaCCodeExpression*) data_var, _tmp88_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, _tmp87_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))))), (ValaCCodeExpression*) (_tmp92_ = vala_ccode_identifier_new (_tmp91_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, _tmp90_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))))), VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE)))));
1221
_vala_ccode_node_unref0 (_tmp94_);
1222
_vala_ccode_node_unref0 (_tmp93_);
1213
ValaCCodeIdentifier* _tmp90_;
1214
ValaCCodeAssignment* _tmp91_;
1215
ValaCCodeExpressionStatement* _tmp92_;
1216
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) (_tmp92_ = vala_ccode_expression_statement_new ((ValaCCodeExpression*) (_tmp91_ = vala_ccode_assignment_new ((ValaCCodeExpression*) (_tmp87_ = vala_ccode_member_access_new_pointer ((ValaCCodeExpression*) data_var, _tmp86_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, _tmp85_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))))), (ValaCCodeExpression*) (_tmp90_ = vala_ccode_identifier_new (_tmp89_ = vala_ccode_base_module_get_delegate_target_destroy_notify_cname ((ValaCCodeBaseModule*) self, _tmp88_ = vala_ccode_base_module_get_variable_cname ((ValaCCodeBaseModule*) self, vala_symbol_get_name ((ValaSymbol*) param))))), VALA_CCODE_ASSIGNMENT_OPERATOR_SIMPLE)))));
1223
1217
_vala_ccode_node_unref0 (_tmp92_);
1226
_vala_ccode_node_unref0 (_tmp89_);
1218
_vala_ccode_node_unref0 (_tmp91_);
1219
_vala_ccode_node_unref0 (_tmp90_);
1227
1221
_g_free0 (_tmp88_);
1222
_vala_ccode_node_unref0 (_tmp87_);
1231
1227
_vala_code_node_unref0 (deleg_type);
1242
1238
vala_ccode_base_module_append_temp_decl ((ValaCCodeBaseModule*) self, cfrag, (ValaList*) vala_ccode_base_module_get_temp_vars ((ValaCCodeBaseModule*) self));
1243
1239
vala_collection_clear ((ValaCollection*) vala_ccode_base_module_get_temp_vars ((ValaCCodeBaseModule*) self));
1244
1240
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) cfrag);
1245
ccall = (_tmp98_ = vala_ccode_function_call_new ((ValaCCodeExpression*) (_tmp97_ = vala_ccode_identifier_new (_tmp96_ = g_strconcat (_tmp95_ = vala_method_get_real_cname (m), "_co", NULL)))), _vala_ccode_node_unref0 (_tmp97_), _g_free0 (_tmp96_), _g_free0 (_tmp95_), _tmp98_);
1241
ccall = (_tmp96_ = vala_ccode_function_call_new ((ValaCCodeExpression*) (_tmp95_ = vala_ccode_identifier_new (_tmp94_ = g_strconcat (_tmp93_ = vala_method_get_real_cname (m), "_co", NULL)))), _vala_ccode_node_unref0 (_tmp95_), _g_free0 (_tmp94_), _g_free0 (_tmp93_), _tmp96_);
1246
1242
vala_ccode_function_call_add_argument (ccall, (ValaCCodeExpression*) data_var);
1247
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) (_tmp99_ = vala_ccode_expression_statement_new ((ValaCCodeExpression*) ccall)));
1243
vala_ccode_block_add_statement (asyncblock, (ValaCCodeNode*) (_tmp97_ = vala_ccode_expression_statement_new ((ValaCCodeExpression*) ccall)));
1244
_vala_ccode_node_unref0 (_tmp97_);
1245
vala_map_set ((ValaMap*) cparam_map, GINT_TO_POINTER (vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (double) (-1), FALSE)), _tmp98_ = vala_ccode_formal_parameter_new ("_callback_", "GAsyncReadyCallback"));
1246
_vala_ccode_node_unref0 (_tmp98_);
1247
vala_map_set ((ValaMap*) cparam_map, GINT_TO_POINTER (vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, -0.9, FALSE)), _tmp99_ = vala_ccode_formal_parameter_new ("_user_data_", "gpointer"));
1248
1248
_vala_ccode_node_unref0 (_tmp99_);
1249
vala_map_set ((ValaMap*) cparam_map, GINT_TO_POINTER (vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, (double) (-1), FALSE)), _tmp100_ = vala_ccode_formal_parameter_new ("_callback_", "GAsyncReadyCallback"));
1250
_vala_ccode_node_unref0 (_tmp100_);
1251
vala_map_set ((ValaMap*) cparam_map, GINT_TO_POINTER (vala_ccode_base_module_get_param_pos ((ValaCCodeBaseModule*) self, -0.9, FALSE)), _tmp101_ = vala_ccode_formal_parameter_new ("_user_data_", "gpointer"));
1252
_vala_ccode_node_unref0 (_tmp101_);
1253
1249
vala_ccode_base_module_generate_cparameters ((ValaCCodeBaseModule*) self, m, ((ValaCCodeBaseModule*) self)->source_declarations, (ValaMap*) cparam_map, asyncfunc, NULL, NULL, NULL, 1);
1254
1250
if (vala_method_get_base_method (m) != NULL) {
1257
_tmp102_ = vala_method_get_base_interface_method (m) != NULL;
1253
_tmp100_ = vala_method_get_base_interface_method (m) != NULL;
1260
ValaCCodeFunction* _tmp103_;
1256
ValaCCodeFunction* _tmp101_;
1261
1257
vala_ccode_function_set_modifiers (asyncfunc, vala_ccode_function_get_modifiers (asyncfunc) | VALA_CCODE_MODIFIERS_STATIC);
1262
vala_ccode_declaration_space_add_type_member_declaration (((ValaCCodeBaseModule*) self)->source_declarations, (ValaCCodeNode*) (_tmp103_ = vala_ccode_function_copy (asyncfunc)));
1263
_vala_ccode_node_unref0 (_tmp103_);
1258
vala_ccode_declaration_space_add_type_member_declaration (((ValaCCodeBaseModule*) self)->source_declarations, (ValaCCodeNode*) (_tmp101_ = vala_ccode_function_copy (asyncfunc)));
1259
_vala_ccode_node_unref0 (_tmp101_);
1265
1261
if (vala_symbol_is_private_symbol ((ValaSymbol*) m)) {
1266
1262
vala_ccode_function_set_modifiers (asyncfunc, vala_ccode_function_get_modifiers (asyncfunc) | VALA_CCODE_MODIFIERS_STATIC);