diff --git a/gi/_cdefs.v b/gi/_cdefs.v index d2903e5..55cdc8a 100644 --- a/gi/_cdefs.v +++ b/gi/_cdefs.v @@ -24,263 +24,275 @@ struct C.GIRepository struct C.GITypelib struct C.GIAttributeIter + +[typedef] +struct C.GType{} + +[typedef] struct C.GIArgument -struct C.GType struct C.GOptionGroup + +[typedef] struct C.GError{ message charptr } + +[typedef] struct C.gchar + +[typedef] struct C.GSList { data voidptr - next &GSList + next &C.GSList } + +[typedef] struct C.GList { data voidptr - next &GList + next &C.GList } /* TYPELIB */ -fn C.g_typelib_new_from_memory(byteptr, u32, &GError) &GITypelib -fn C.g_typelib_new_from_const_memory(byteptr, u32, &GError) &GITypelib -// fn C.g_typelib_new_from_mapped_file(&GMappedFile, &GError) &GITypelib -fn C.g_typelib_free(&GITypelib) -fn C.g_typelib_symbol(&GITypelib, charptr, voidptr) bool -fn C.g_typelib_get_namespace(&GITypelib) charptr +fn C.g_typelib_new_from_memory(byteptr, u32, &C.GError) &C.GITypelib +fn C.g_typelib_new_from_const_memory(byteptr, u32, &C.GError) &C.GITypelib +// fn C.g_typelib_new_from_mapped_file(&GMappedFile, &C.GError) &C.GITypelib +fn C.g_typelib_free(&C.GITypelib) +fn C.g_typelib_symbol(&C.GITypelib, charptr, voidptr) bool +fn C.g_typelib_get_namespace(&C.GITypelib) charptr /* REPOSITORY */ -fn C.g_irepository_get_default() &GIRepository -fn C.g_irepository_get_dependencies(&GIRepository, charptr) &charptr -fn C.g_irepository_get_immediate_dependencies(&GIRepository, charptr) &charptr -fn C.g_irepository_get_loaded_namespaces(&GIRepository) &charptr -fn C.g_irepository_get_n_infos(&GIRepository, charptr) int -fn C.g_irepository_get_info(&GIRepository, charptr, int) &GIBaseInfo +fn C.g_irepository_get_default() &C.GIRepository +fn C.g_irepository_get_dependencies(&C.GIRepository, charptr) &charptr +fn C.g_irepository_get_immediate_dependencies(&C.GIRepository, charptr) &charptr +fn C.g_irepository_get_loaded_namespaces(&C.GIRepository) &charptr +fn C.g_irepository_get_n_infos(&C.GIRepository, charptr) int +fn C.g_irepository_get_info(&C.GIRepository, charptr, int) &C.GIBaseInfo fn C.g_irepository_get_option_group() &GOptionGroup -fn C.g_irepository_enumerate_versions(&GIRepository, charptr) &GList +fn C.g_irepository_enumerate_versions(&C.GIRepository, charptr) &C.GList fn C.g_irepository_prepend_library_path(charptr) fn C.g_irepository_prepend_search_path(charptr) -fn C.g_irepository_get_search_path() &GSList -fn C.g_irepository_load_typelib(&GIRepository, &GITypelib, int /* GIRepositoryLoadFlags */, &GError) charptr -fn C.g_irepository_get_typelib_path(&GIRepository, charptr) charptr -fn C.g_irepository_is_registered(&GIRepository, charptr, charptr) bool -fn C.g_irepository_require(&GIRepository, charptr, charptr, int /* GIRepositoryLoadFlags */, &GError) &GITypelib -fn C.g_irepository_require_private(&GIRepository, charptr, charptr, charptr, int /* GIRepositoryLoadFlags */, &GError) &GITypelib -fn C.g_irepository_get_c_prefix(&GIRepository, charptr) charptr -fn C.g_irepository_get_shared_library(&GIRepository, charptr) charptr -fn C.g_irepository_get_version(&GIRepository, charptr) charptr -fn C.g_irepository_find_by_gtype(&GIRepository, GType) &GIBaseInfo -fn C.g_irepository_find_by_error_domain(&GIRepository, u32 /* GQuark */) &GIEnumInfo -fn C.g_irepository_find_by_name(&GIRepository, charptr, charptr) &GIBaseInfo -fn C.g_irepository_get_object_gtype_interfaces(&GIRepository, GType, &u32, voidptr) -fn C.g_irepository_dump(charptr, &GError) bool +fn C.g_irepository_get_search_path() &C.GSList +fn C.g_irepository_load_typelib(&C.GIRepository, &C.GITypelib, int /* GIRepositoryLoadFlags */, &C.GError) charptr +fn C.g_irepository_get_typelib_path(&C.GIRepository, charptr) charptr +fn C.g_irepository_is_registered(&C.GIRepository, charptr, charptr) bool +fn C.g_irepository_require(&C.GIRepository, charptr, charptr, int /* GIRepositoryLoadFlags */, &C.GError) &C.GITypelib +fn C.g_irepository_require_private(&C.GIRepository, charptr, charptr, charptr, int /* GIRepositoryLoadFlags */, &C.GError) &C.GITypelib +fn C.g_irepository_get_c_prefix(&C.GIRepository, charptr) charptr +fn C.g_irepository_get_shared_library(&C.GIRepository, charptr) charptr +fn C.g_irepository_get_version(&C.GIRepository, charptr) charptr +fn C.g_irepository_find_by_gtype(&C.GIRepository, C.GType) &C.GIBaseInfo +fn C.g_irepository_find_by_error_domain(&C.GIRepository, u32 /* GQuark */) &C.GIEnumInfo +fn C.g_irepository_find_by_name(&C.GIRepository, charptr, charptr) &C.GIBaseInfo +fn C.g_irepository_get_object_gtype_interfaces(&C.GIRepository, C.GType, &u32, voidptr) +fn C.g_irepository_dump(charptr, &C.GError) bool /* BASE INFO */ -fn C.g_info_new(int /* GIInfoType */, &GIBaseInfo, &GITypelib, u32) &GIBaseInfo -fn C.g_base_info_ref(&GIBaseInfo) &GIBaseInfo -fn C.g_base_info_unref(&GIBaseInfo) -fn C.g_base_info_equal(&GIBaseInfo, &GIBaseInfo) bool -fn C.g_base_info_get_type(&GIBaseInfo) int // GIInfoType -fn C.g_base_info_get_typelib(&GIBaseInfo) &GITypelib -fn C.g_base_info_get_namespace(&GIBaseInfo) charptr -fn C.g_base_info_get_name(&GIBaseInfo) charptr -fn C.g_base_info_get_attribute(&GIBaseInfo, charptr) charptr -fn C.g_base_info_iterate_attributes(&GIBaseInfo, &GIAttributeIter, charptr, charptr) bool -fn C.g_base_info_get_container(&GIBaseInfo) &GIBaseInfo +fn C.g_info_new(int /* GIInfoType */, &C.GIBaseInfo, &C.GITypelib, u32) &C.GIBaseInfo +fn C.g_base_info_ref(&C.GIBaseInfo) &C.GIBaseInfo +fn C.g_base_info_unref(&C.GIBaseInfo) +fn C.g_base_info_equal(&C.GIBaseInfo, &C.GIBaseInfo) bool +fn C.g_base_info_get_type(&C.GIBaseInfo) int // GIInfoType +fn C.g_base_info_get_typelib(&C.GIBaseInfo) &C.GITypelib +fn C.g_base_info_get_namespace(&C.GIBaseInfo) charptr +fn C.g_base_info_get_name(&C.GIBaseInfo) charptr +fn C.g_base_info_get_attribute(&C.GIBaseInfo, charptr) charptr +fn C.g_base_info_iterate_attributes(&C.GIBaseInfo, &C.GIAttributeIter, charptr, charptr) bool +fn C.g_base_info_get_container(&C.GIBaseInfo) &C.GIBaseInfo fn C.g_info_type_to_string(int /* GIInfoType */) charptr -fn C.g_base_info_is_deprecated(&GIBaseInfo) bool +fn C.g_base_info_is_deprecated(&C.GIBaseInfo) bool /* CALLABLE INFO */ fn C.GI_IS_CALLABLE_INFO(voidptr) bool -fn C.g_callable_info_can_throw_gerror(&GICallableInfo) bool -fn C.g_callable_info_get_n_args(&GICallableInfo) int -fn C.g_callable_info_get_arg(&GICallableInfo, int) &GIArgInfo -fn C.g_callable_info_get_caller_owns(&GICallableInfo) int // GITransfer -fn C.g_callable_info_get_instance_ownership_transfer(&GICallableInfo) int // GITransfer -fn C.g_callable_info_get_return_attribute(&GICallableInfo, charptr) charptr -fn C.g_callable_info_get_return_type(&GICallableInfo) &GITypeInfo -fn C.g_callable_info_invoke(&GICallableInfo, voidptr, &GIArgument, int, &GIArgument, int, &GIArgument, bool, bool, &GError) bool -fn C.g_callable_info_is_method(&GICallableInfo) bool -fn C.g_callable_info_iterate_return_attributes(&GICallableInfo, &GIAttributeIter, charptr, charptr) bool -fn C.g_callable_info_load_arg(&GICallableInfo, int, &GIArgInfo) -fn C.g_callable_info_load_return_type(&GICallableInfo, &GITypeInfo) -fn C.g_callable_info_may_return_null(&GICallableInfo) bool -fn C.g_callable_info_skip_return(&GICallableInfo) bool +fn C.g_callable_info_can_throw_gerror(&C.GICallableInfo) bool +fn C.g_callable_info_get_n_args(&C.GICallableInfo) int +fn C.g_callable_info_get_arg(&C.GICallableInfo, int) &C.GIArgInfo +fn C.g_callable_info_get_caller_owns(&C.GICallableInfo) int // GITransfer +fn C.g_callable_info_get_instance_ownership_transfer(&C.GICallableInfo) int // GITransfer +fn C.g_callable_info_get_return_attribute(&C.GICallableInfo, charptr) charptr +fn C.g_callable_info_get_return_type(&C.GICallableInfo) &C.GITypeInfo +fn C.g_callable_info_invoke(&C.GICallableInfo, voidptr, &C.GIArgument, int, &C.GIArgument, int, &C.GIArgument, bool, bool, &C.GError) bool +fn C.g_callable_info_is_method(&C.GICallableInfo) bool +fn C.g_callable_info_iterate_return_attributes(&C.GICallableInfo, &C.GIAttributeIter, charptr, charptr) bool +fn C.g_callable_info_load_arg(&C.GICallableInfo, int, &C.GIArgInfo) +fn C.g_callable_info_load_return_type(&C.GICallableInfo, &C.GITypeInfo) +fn C.g_callable_info_may_return_null(&C.GICallableInfo) bool +fn C.g_callable_info_skip_return(&C.GICallableInfo) bool /* ARG INFO */ -fn C.g_arg_info_get_closure(&GIArgInfo) int -fn C.g_arg_info_get_destroy(&GIArgInfo) int -fn C.g_arg_info_get_direction(&GIArgInfo) int /* GIDirection */ -fn C.g_arg_info_get_ownership_transfer(&GIArgInfo) int /* GITransfer */ -fn C.g_arg_info_get_scope(&GIArgInfo) int /* GIScopeType */ -fn C.g_arg_info_get_type(&GIArgInfo) &GITypeInfo -fn C.g_arg_info_load_type(&GIArgInfo, &GITypeInfo) -fn C.g_arg_info_may_be_null(&GIArgInfo) bool -fn C.g_arg_info_is_caller_allocates(&GIArgInfo) bool -fn C.g_arg_info_is_optional(&GIArgInfo) bool -fn C.g_arg_info_is_return_value(&GIArgInfo) bool -fn C.g_arg_info_is_skip(&GIArgInfo) bool +fn C.g_arg_info_get_closure(&C.GIArgInfo) int +fn C.g_arg_info_get_destroy(&C.GIArgInfo) int +fn C.g_arg_info_get_direction(&C.GIArgInfo) int /* GIDirection */ +fn C.g_arg_info_get_ownership_transfer(&C.GIArgInfo) int /* GITransfer */ +fn C.g_arg_info_get_scope(&C.GIArgInfo) int /* GIScopeType */ +fn C.g_arg_info_get_type(&C.GIArgInfo) &C.GITypeInfo +fn C.g_arg_info_load_type(&C.GIArgInfo, &C.GITypeInfo) +fn C.g_arg_info_may_be_null(&C.GIArgInfo) bool +fn C.g_arg_info_is_caller_allocates(&C.GIArgInfo) bool +fn C.g_arg_info_is_optional(&C.GIArgInfo) bool +fn C.g_arg_info_is_return_value(&C.GIArgInfo) bool +fn C.g_arg_info_is_skip(&C.GIArgInfo) bool /* FUNCTION INFO */ fn C.GI_IS_FUNCTION_INFO(voidptr) bool -fn C.g_function_info_get_flags(&GIFunctionInfo) int /* GIFunctionInfoFlags */ -fn C.g_function_info_get_property(&GIFunctionInfo) &GIPropertyInfo -fn C.g_function_info_get_symbol(&GIFunctionInfo) charptr -fn C.g_function_info_get_vfunc(&GIFunctionInfo) &GIVFuncInfo -fn C.g_function_info_invoke(&GIFunctionInfo, &GIArgument, int, &GIArgument, int, &GIArgument, &GError) bool +fn C.g_function_info_get_flags(&C.GIFunctionInfo) int /* GIFunctionInfoFlags */ +fn C.g_function_info_get_property(&C.GIFunctionInfo) &C.GIPropertyInfo +fn C.g_function_info_get_symbol(&C.GIFunctionInfo) charptr +fn C.g_function_info_get_vfunc(&C.GIFunctionInfo) &C.GIVFuncInfo +fn C.g_function_info_invoke(&C.GIFunctionInfo, &C.GIArgument, int, &C.GIArgument, int, &C.GIArgument, &C.GError) bool /* VFUNC INFO */ -fn C.g_vfunc_info_get_flags(&GIVFuncInfo) int /* GIVFuncInfoFlags */ -fn C.g_vfunc_info_get_offset(&GIVFuncInfo) int -fn C.g_vfunc_info_get_signal(&GIVFuncInfo) &GISignalInfo -fn C.g_vfunc_info_get_invoker(&GIVFuncInfo) &GIFunctionInfo -fn C.g_vfunc_info_get_address(&GIVFuncInfo, GType, &GError) voidptr -fn C.g_vfunc_info_invoke(&GIVFuncInfo, GType, &GIArgument, int, &GIArgument, int, &GIArgument, &GError) bool +fn C.g_vfunc_info_get_flags(&C.GIVFuncInfo) int /* GIVFuncInfoFlags */ +fn C.g_vfunc_info_get_offset(&C.GIVFuncInfo) int +fn C.g_vfunc_info_get_signal(&C.GIVFuncInfo) &C.GISignalInfo +fn C.g_vfunc_info_get_invoker(&C.GIVFuncInfo) &C.GIFunctionInfo +fn C.g_vfunc_info_get_address(&C.GIVFuncInfo, C.GType, &C.GError) voidptr +fn C.g_vfunc_info_invoke(&C.GIVFuncInfo, C.GType, &C.GIArgument, int, &C.GIArgument, int, &C.GIArgument, &C.GError) bool /* PROPERTY INFO */ -fn C.g_property_info_get_flags(&GIPropertyInfo) int /* GParamFlags */ -fn C.g_property_info_get_ownership_transfer(&GIPropertyInfo) int /* GITransfer */ -fn C.g_property_info_get_type(&GIPropertyInfo) &GITypeInfo +fn C.g_property_info_get_flags(&C.GIPropertyInfo) int /* GParamFlags */ +fn C.g_property_info_get_ownership_transfer(&C.GIPropertyInfo) int /* GITransfer */ +fn C.g_property_info_get_type(&C.GIPropertyInfo) &C.GITypeInfo /* TYPE INFO */ -fn C.g_type_info_is_pointer(&GITypeInfo) bool -fn C.g_type_info_get_tag(&GITypeInfo) int /* GITypeTag */ -fn C.g_type_info_get_param_type(&GITypeInfo, int) &GITypeInfo -fn C.g_type_info_get_interface(&GITypeInfo) &GIBaseInfo -fn C.g_type_info_get_array_length(&GITypeInfo) int -fn C.g_type_info_get_array_fixed_size(&GITypeInfo) int -fn C.g_type_info_is_zero_terminated(&GITypeInfo) bool -fn C.g_type_info_get_array_type(&GITypeInfo) int /* GIArrayType */ +fn C.g_type_info_is_pointer(&C.GITypeInfo) bool +fn C.g_type_info_get_tag(&C.GITypeInfo) int /* GITypeTag */ +fn C.g_type_info_get_param_type(&C.GITypeInfo, int) &C.GITypeInfo +fn C.g_type_info_get_interface(&C.GITypeInfo) &C.GIBaseInfo +fn C.g_type_info_get_array_length(&C.GITypeInfo) int +fn C.g_type_info_get_array_fixed_size(&C.GITypeInfo) int +fn C.g_type_info_is_zero_terminated(&C.GITypeInfo) bool +fn C.g_type_info_get_array_type(&C.GITypeInfo) int /* GIArrayType */ /* CONSTANT INFO */ -fn C.g_constant_info_free_value(&GIConstantInfo, &GIArgument) -fn C.g_constant_info_get_type(&GIConstantInfo) &GITypeInfo -fn C.g_constant_info_get_value(&GIConstantInfo, &GIArgument) int +fn C.g_constant_info_free_value(&C.GIConstantInfo, &C.GIArgument) +fn C.g_constant_info_get_type(&C.GIConstantInfo) &C.GITypeInfo +fn C.g_constant_info_get_value(&C.GIConstantInfo, &C.GIArgument) int /* SIGNAL INFO */ -fn C.g_signal_info_get_flags(&GISignalInfo) int /* GSignalFlags */ -fn C.g_signal_info_get_class_closure(&GISignalInfo) &GIVFuncInfo -fn C.g_signal_info_true_stops_emit(&GISignalInfo) bool +fn C.g_signal_info_get_flags(&C.GISignalInfo) int /* GSignalFlags */ +fn C.g_signal_info_get_class_closure(&C.GISignalInfo) &C.GIVFuncInfo +fn C.g_signal_info_true_stops_emit(&C.GISignalInfo) bool /* ENUM INFO */ fn C.GI_IS_VALUE_INFO(voidptr) bool fn C.GI_IS_ENUM_INFO(voidptr) bool -fn C.g_enum_info_get_n_values(&GIEnumInfo) int -fn C.g_enum_info_get_value(&GIEnumInfo, int) &GIValueInfo -fn C.g_enum_info_get_n_methods(&GIEnumInfo) int -fn C.g_enum_info_get_method(&GIEnumInfo, int) &GIFunctionInfo -fn C.g_enum_info_get_storage_type(&GIEnumInfo) int /* GITypeTag */ -fn C.g_enum_info_get_error_domain(&GIEnumInfo) charptr -fn C.g_value_info_get_value(&GIValueInfo) i64 +fn C.g_enum_info_get_n_values(&C.GIEnumInfo) int +fn C.g_enum_info_get_value(&C.GIEnumInfo, int) &C.GIValueInfo +fn C.g_enum_info_get_n_methods(&C.GIEnumInfo) int +fn C.g_enum_info_get_method(&C.GIEnumInfo, int) &C.GIFunctionInfo +fn C.g_enum_info_get_storage_type(&C.GIEnumInfo) int /* GITypeTag */ +fn C.g_enum_info_get_error_domain(&C.GIEnumInfo) charptr +fn C.g_value_info_get_value(&C.GIValueInfo) i64 /* OBJECT INFO */ -fn C.g_object_info_get_abstract(&GIObjectInfo) bool -fn C.g_object_info_get_fundamental(&GIObjectInfo) bool -fn C.g_object_info_get_parent(&GIObjectInfo) &GIObjectInfo -fn C.g_object_info_get_type_name(&GIObjectInfo) charptr -fn C.g_object_info_get_type_init(&GIObjectInfo) charptr -fn C.g_object_info_get_n_constants(&GIObjectInfo) int -fn C.g_object_info_get_constant(&GIObjectInfo, int) &GIConstantInfo -fn C.g_object_info_get_n_fields(&GIObjectInfo) int -fn C.g_object_info_get_field(&GIObjectInfo, int) &GIFieldInfo -fn C.g_object_info_get_n_interfaces(&GIObjectInfo) int -fn C.g_object_info_get_interface(&GIObjectInfo, int) &GIInterfaceInfo -fn C.g_object_info_get_n_methods(&GIObjectInfo) int -fn C.g_object_info_get_method(&GIObjectInfo, int) &GIFunctionInfo -fn C.g_object_info_find_method(&GIObjectInfo, charptr) &GIFunctionInfo -fn C.g_object_info_find_method_using_interfaces(&GIObjectInfo, charptr, &GIObjectInfo) &GIFunctionInfo -fn C.g_object_info_get_n_properties(&GIObjectInfo) int -fn C.g_object_info_get_property(&GIObjectInfo, int) &GIPropertyInfo -fn C.g_object_info_get_n_signals(&GIObjectInfo) int -fn C.g_object_info_get_signal(&GIObjectInfo, int) &GISignalInfo -fn C.g_object_info_find_signal(&GIObjectInfo, charptr) &GISignalInfo -fn C.g_object_info_get_n_vfuncs(&GIObjectInfo) int -fn C.g_object_info_get_vfunc(&GIObjectInfo, int) &GIVFuncInfo -fn C.g_object_info_find_vfunc(&GIObjectInfo, charptr) &GIVFuncInfo -fn C.g_object_info_find_vfunc_using_interfaces(&GIObjectInfo, charptr, &GIObjectInfo) &GIVFuncInfo -fn C.g_object_info_get_class_struct(&GIObjectInfo) &GIStructInfo -fn C.g_object_info_get_ref_function(&GIObjectInfo) charptr -// fn C.g_object_info_get_ref_function_pointer(&GIObjectInfo) voidptr/* GIObjectInfoRefFunction */ -fn C.g_object_info_get_unref_function(&GIObjectInfo) charptr -// fn C.g_object_info_get_unref_function_pointer(&GIObjectInfo) GIObjectInfoUnrefFunction -fn C.g_object_info_get_set_value_function(&GIObjectInfo) -// fn C.g_object_info_get_set_value_function_pointer(&GIObjectInfo) GIObjectInfoSetValueFunction -fn C.g_object_info_get_get_value_function(&GIObjectInfo) -// fn C.g_object_info_get_get_value_function_pointer(&GIObjectInfo) GIObjectInfoGetValueFunction +fn C.g_object_info_get_abstract(&C.GIObjectInfo) bool +fn C.g_object_info_get_fundamental(&C.GIObjectInfo) bool +fn C.g_object_info_get_parent(&C.GIObjectInfo) &C.GIObjectInfo +fn C.g_object_info_get_type_name(&C.GIObjectInfo) charptr +fn C.g_object_info_get_type_init(&C.GIObjectInfo) charptr +fn C.g_object_info_get_n_constants(&C.GIObjectInfo) int +fn C.g_object_info_get_constant(&C.GIObjectInfo, int) &C.GIConstantInfo +fn C.g_object_info_get_n_fields(&C.GIObjectInfo) int +fn C.g_object_info_get_field(&C.GIObjectInfo, int) &C.GIFieldInfo +fn C.g_object_info_get_n_interfaces(&C.GIObjectInfo) int +fn C.g_object_info_get_interface(&C.GIObjectInfo, int) &C.GIInterfaceInfo +fn C.g_object_info_get_n_methods(&C.GIObjectInfo) int +fn C.g_object_info_get_method(&C.GIObjectInfo, int) &C.GIFunctionInfo +fn C.g_object_info_find_method(&C.GIObjectInfo, charptr) &C.GIFunctionInfo +fn C.g_object_info_find_method_using_interfaces(&C.GIObjectInfo, charptr, &C.GIObjectInfo) &C.GIFunctionInfo +fn C.g_object_info_get_n_properties(&C.GIObjectInfo) int +fn C.g_object_info_get_property(&C.GIObjectInfo, int) &C.GIPropertyInfo +fn C.g_object_info_get_n_signals(&C.GIObjectInfo) int +fn C.g_object_info_get_signal(&C.GIObjectInfo, int) &C.GISignalInfo +fn C.g_object_info_find_signal(&C.GIObjectInfo, charptr) &C.GISignalInfo +fn C.g_object_info_get_n_vfuncs(&C.GIObjectInfo) int +fn C.g_object_info_get_vfunc(&C.GIObjectInfo, int) &C.GIVFuncInfo +fn C.g_object_info_find_vfunc(&C.GIObjectInfo, charptr) &C.GIVFuncInfo +fn C.g_object_info_find_vfunc_using_interfaces(&C.GIObjectInfo, charptr, &C.GIObjectInfo) &C.GIVFuncInfo +fn C.g_object_info_get_class_struct(&C.GIObjectInfo) &C.GIStructInfo +fn C.g_object_info_get_ref_function(&C.GIObjectInfo) charptr +// fn C.g_object_info_get_ref_function_pointer(&C.GIObjectInfo) voidptr/* GIObjectInfoRefFunction */ +fn C.g_object_info_get_unref_function(&C.GIObjectInfo) charptr +// fn C.g_object_info_get_unref_function_pointer(&C.GIObjectInfo) GIObjectInfoUnrefFunction +fn C.g_object_info_get_set_value_function(&C.GIObjectInfo) +// fn C.g_object_info_get_set_value_function_pointer(&C.GIObjectInfo) GIObjectInfoSetValueFunction +fn C.g_object_info_get_get_value_function(&C.GIObjectInfo) +// fn C.g_object_info_get_get_value_function_pointer(&C.GIObjectInfo) GIObjectInfoGetValueFunction /* FIELD INFO */ -fn C.g_field_info_get_field(&GIFieldInfo, voidptr, &GIArgument) bool -fn C.g_field_info_set_field(&GIFieldInfo, voidptr, &GIArgument) bool -fn C.g_field_info_get_flags(&GIFieldInfo) int /* GIFieldInfoFlags */ -fn C.g_field_info_get_offset(&GIFieldInfo) int -fn C.g_field_info_get_size(&GIFieldInfo) int -fn C.g_field_info_get_type(&GIFieldInfo) &GITypeInfo +fn C.g_field_info_get_field(&C.GIFieldInfo, voidptr, &C.GIArgument) bool +fn C.g_field_info_set_field(&C.GIFieldInfo, voidptr, &C.GIArgument) bool +fn C.g_field_info_get_flags(&C.GIFieldInfo) int /* GIFieldInfoFlags */ +fn C.g_field_info_get_offset(&C.GIFieldInfo) int +fn C.g_field_info_get_size(&C.GIFieldInfo) int +fn C.g_field_info_get_type(&C.GIFieldInfo) &C.GITypeInfo /* STRUCT INFO */ -fn C.g_struct_info_find_field(&GIStructInfo, charptr) &GIFieldInfo -fn C.g_struct_info_get_alignment(&GIStructInfo) u32 -fn C.g_struct_info_get_size(&GIStructInfo) u32 -fn C.g_struct_info_is_gtype_struct(&GIStructInfo) bool -fn C.g_struct_info_is_foreign(&GIStructInfo) bool -fn C.g_struct_info_get_n_fields(&GIStructInfo) int -fn C.g_struct_info_get_field(&GIStructInfo, int) &GIFieldInfo -fn C.g_struct_info_get_n_methods(&GIStructInfo) int -fn C.g_struct_info_get_method(&GIStructInfo, int) &GIFunctionInfo -fn C.g_struct_info_find_method(&GIStructInfo, charptr) &GIFunctionInfo +fn C.g_struct_info_find_field(&C.GIStructInfo, charptr) &C.GIFieldInfo +fn C.g_struct_info_get_alignment(&C.GIStructInfo) u32 +fn C.g_struct_info_get_size(&C.GIStructInfo) u32 +fn C.g_struct_info_is_gtype_struct(&C.GIStructInfo) bool +fn C.g_struct_info_is_foreign(&C.GIStructInfo) bool +fn C.g_struct_info_get_n_fields(&C.GIStructInfo) int +fn C.g_struct_info_get_field(&C.GIStructInfo, int) &C.GIFieldInfo +fn C.g_struct_info_get_n_methods(&C.GIStructInfo) int +fn C.g_struct_info_get_method(&C.GIStructInfo, int) &C.GIFunctionInfo +fn C.g_struct_info_find_method(&C.GIStructInfo, charptr) &C.GIFunctionInfo /* REGISTERED TYPE INFO */ -fn C.g_registered_type_info_get_type_name(&GIRegisteredTypeInfo) charptr -fn C.g_registered_type_info_get_type_init(&GIRegisteredTypeInfo) charptr -fn C.g_registered_type_info_get_g_type(&GIRegisteredTypeInfo) GType +fn C.g_registered_type_info_get_type_name(&C.GIRegisteredTypeInfo) charptr +fn C.g_registered_type_info_get_type_init(&C.GIRegisteredTypeInfo) charptr +fn C.g_registered_type_info_get_g_type(&C.GIRegisteredTypeInfo) C.GType /* INTERFACE INFO */ -fn C.g_interface_info_get_n_prerequisites(&GIInterfaceInfo) int -fn C.g_interface_info_get_prerequisite(&GIInterfaceInfo, int) &GIBaseInfo -fn C.g_interface_info_get_n_properties(&GIInterfaceInfo) int -fn C.g_interface_info_get_property(&GIInterfaceInfo, int) &GIPropertyInfo -fn C.g_interface_info_get_n_methods(&GIInterfaceInfo) int -fn C.g_interface_info_get_method(&GIInterfaceInfo, int) &GIFunctionInfo -fn C.g_interface_info_find_method(&GIInterfaceInfo, charptr) &GIFunctionInfo -fn C.g_interface_info_get_n_signals(&GIInterfaceInfo) int -fn C.g_interface_info_get_signal(&GIInterfaceInfo, int) &GISignalInfo -fn C.g_interface_info_find_signal(&GIInterfaceInfo, charptr) &GISignalInfo -fn C.g_interface_info_get_n_vfuncs(&GIInterfaceInfo) int -fn C.g_interface_info_get_vfunc(&GIInterfaceInfo, int) &GIVFuncInfo -fn C.g_interface_info_find_vfunc(&GIInterfaceInfo, charptr) &GIVFuncInfo -fn C.g_interface_info_get_n_constants(&GIInterfaceInfo) int -fn C.g_interface_info_get_constant(&GIInterfaceInfo, int) &GIConstantInfo -fn C.g_interface_info_get_iface_struct(&GIInterfaceInfo) &GIStructInfo +fn C.g_interface_info_get_n_prerequisites(&C.GIInterfaceInfo) int +fn C.g_interface_info_get_prerequisite(&C.GIInterfaceInfo, int) &C.GIBaseInfo +fn C.g_interface_info_get_n_properties(&C.GIInterfaceInfo) int +fn C.g_interface_info_get_property(&C.GIInterfaceInfo, int) &C.GIPropertyInfo +fn C.g_interface_info_get_n_methods(&C.GIInterfaceInfo) int +fn C.g_interface_info_get_method(&C.GIInterfaceInfo, int) &C.GIFunctionInfo +fn C.g_interface_info_find_method(&C.GIInterfaceInfo, charptr) &C.GIFunctionInfo +fn C.g_interface_info_get_n_signals(&C.GIInterfaceInfo) int +fn C.g_interface_info_get_signal(&C.GIInterfaceInfo, int) &C.GISignalInfo +fn C.g_interface_info_find_signal(&C.GIInterfaceInfo, charptr) &C.GISignalInfo +fn C.g_interface_info_get_n_vfuncs(&C.GIInterfaceInfo) int +fn C.g_interface_info_get_vfunc(&C.GIInterfaceInfo, int) &C.GIVFuncInfo +fn C.g_interface_info_find_vfunc(&C.GIInterfaceInfo, charptr) &C.GIVFuncInfo +fn C.g_interface_info_get_n_constants(&C.GIInterfaceInfo) int +fn C.g_interface_info_get_constant(&C.GIInterfaceInfo, int) &C.GIConstantInfo +fn C.g_interface_info_get_iface_struct(&C.GIInterfaceInfo) &C.GIStructInfo /* UNION INFO */ -fn C.g_union_info_get_n_fields(&GIUnionInfo) int -fn C.g_union_info_get_field(&GIUnionInfo, int) &GIFieldInfo -fn C.g_union_info_get_n_methods(&GIUnionInfo) int -fn C.g_union_info_get_method(&GIUnionInfo, int) &GIFunctionInfo -fn C.g_union_info_is_discriminated(&GIUnionInfo) bool -fn C.g_union_info_get_discriminator_offset(&GIUnionInfo) int -fn C.g_union_info_get_discriminator_type(&GIUnionInfo) &GITypeInfo -fn C.g_union_info_get_discriminator(&GIUnionInfo, int) &GIConstantInfo -fn C.g_union_info_find_method(&GIUnionInfo, charptr) &GIFunctionInfo -fn C.g_union_info_get_size(&GIUnionInfo) u32 -fn C.g_union_info_get_alignment(&GIUnionInfo) u32 +fn C.g_union_info_get_n_fields(&C.GIUnionInfo) int +fn C.g_union_info_get_field(&C.GIUnionInfo, int) &C.GIFieldInfo +fn C.g_union_info_get_n_methods(&C.GIUnionInfo) int +fn C.g_union_info_get_method(&C.GIUnionInfo, int) &C.GIFunctionInfo +fn C.g_union_info_is_discriminated(&C.GIUnionInfo) bool +fn C.g_union_info_get_discriminator_offset(&C.GIUnionInfo) int +fn C.g_union_info_get_discriminator_type(&C.GIUnionInfo) &C.GITypeInfo +fn C.g_union_info_get_discriminator(&C.GIUnionInfo, int) &C.GIConstantInfo +fn C.g_union_info_find_method(&C.GIUnionInfo, charptr) &C.GIFunctionInfo +fn C.g_union_info_get_size(&C.GIUnionInfo) u32 +fn C.g_union_info_get_alignment(&C.GIUnionInfo) u32 // GTYPE -fn C.G_TYPE_IS_ABSTRACT(GType) bool -fn C.G_TYPE_IS_DERIVED(GType) bool -fn C.G_TYPE_IS_FUNDAMENTAL(GType) bool -fn C.G_TYPE_IS_VALUE_TYPE(GType) bool -fn C.G_TYPE_HAS_VALUE_TABLE(GType) bool -fn C.G_TYPE_IS_CLASSED(GType) bool -fn C.G_TYPE_IS_INSTANTIATABLE(GType) bool -fn C.G_TYPE_IS_DERIVABLE(GType) bool -fn C.G_TYPE_IS_DEEP_DERIVABLE(GType) bool -fn C.G_TYPE_IS_INTERFACE(GType) bool +fn C.G_TYPE_IS_ABSTRACT(&C.GType) bool +fn C.G_TYPE_IS_DERIVED(&C.GType) bool +fn C.G_TYPE_IS_FUNDAMENTAL(&C.GType) bool +fn C.G_TYPE_IS_VALUE_TYPE(&C.GType) bool +fn C.G_TYPE_HAS_VALUE_TABLE(&C.GType) bool +fn C.G_TYPE_IS_CLASSED(&C.GType) bool +fn C.G_TYPE_IS_INSTANTIATABLE(&C.GType) bool +fn C.G_TYPE_IS_DERIVABLE(&C.GType) bool +fn C.G_TYPE_IS_DEEP_DERIVABLE(&C.GType) bool +fn C.G_TYPE_IS_INTERFACE(&C.GType) bool fn C.g_type_tag_to_string(int) charptr // UTILS -fn C.g_slist_length(&GSList) int -fn C.g_slist_free(&GSList) -fn C.g_list_free(&GList) +fn C.g_slist_length(&C.GSList) int +fn C.g_slist_free(&C.GSList) +fn C.g_list_free(&C.GList) fn C.g_free(voidptr) -fn C.g_strfreev(&gchar) +fn C.g_strfreev(&C.gchar) diff --git a/gi/arg_info.v b/gi/arg_info.v index 42a1b83..77fcf7b 100644 --- a/gi/arg_info.v +++ b/gi/arg_info.v @@ -1,81 +1,81 @@ module gi pub struct ArgInfo { - c &GIArgInfo + c &C.GIArgInfo } -pub type Direction int -pub type ScopeType int -pub type Transfer int +pub type Direction = int +pub type ScopeType = int +pub type Transfer = int pub const ( - GI_DIRECTION_IN = Direction(C.GI_DIRECTION_IN) - GI_DIRECTION_OUT = Direction(C.GI_DIRECTION_OUT) - GI_DIRECTION_INOUT = Direction(C.GI_DIRECTION_INOUT) + gi_direction_in = Direction(C.GI_DIRECTION_IN) + gi_direction_out = Direction(C.GI_DIRECTION_OUT) + gi_direction_inout = Direction(C.GI_DIRECTION_INOUT) ) pub const ( - SCOPE_TYPE_INVALID = ScopeType(C.GI_SCOPE_TYPE_INVALID) - SCOPE_TYPE_CALL = ScopeType(C.GI_SCOPE_TYPE_CALL) - SCOPE_TYPE_ASYNC = ScopeType(C.GI_SCOPE_TYPE_ASYNC) - SCOPE_TYPE_NOTIFIED = ScopeType(C.GI_SCOPE_TYPE_NOTIFIED) + scope_type_invalid = ScopeType(C.GI_SCOPE_TYPE_INVALID) + scope_type_call = ScopeType(C.GI_SCOPE_TYPE_CALL) + scope_type_async = ScopeType(C.GI_SCOPE_TYPE_ASYNC) + scope_type_notified = ScopeType(C.GI_SCOPE_TYPE_NOTIFIED) ) pub const ( - TRANSFER_NOTHING = Transfer(C.GI_TRANSFER_NOTHING) - TRANSFER_CONTAINER = Transfer(C.GI_TRANSFER_CONTAINER) - TRANSFER_EVERYTHING = Transfer(C.GI_TRANSFER_EVERYTHING) + transfer_nothing = Transfer(C.GI_TRANSFER_NOTHING) + transfer_container = Transfer(C.GI_TRANSFER_CONTAINER) + transfer_everything = Transfer(C.GI_TRANSFER_EVERYTHING) ) pub fn (ai &ArgInfo) get_closure() int { - return g_arg_info_get_closure(ai.c) + return C.g_arg_info_get_closure(ai.c) } pub fn (ai &ArgInfo) get_destroy() int { - return g_arg_info_get_destroy(ai.c) + return C.g_arg_info_get_destroy(ai.c) } pub fn (ai &ArgInfo) get_direction() Direction { - return g_arg_info_get_direction(ai.c) + return C.g_arg_info_get_direction(ai.c) } pub fn (ai &ArgInfo) get_ownership_transfer() Transfer { - return g_arg_info_get_ownership_transfer(ai.c) + return C.g_arg_info_get_ownership_transfer(ai.c) } pub fn (ai &ArgInfo) get_scope() ScopeType { - return g_arg_info_get_scope(ai.c) + return C.g_arg_info_get_scope(ai.c) } pub fn (ai &ArgInfo) get_type() &TypeInfo { - cptr := &GIBaseInfo(g_arg_info_get_type(ai.c)) + cptr := &C.GIBaseInfo(C.g_arg_info_get_type(ai.c)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &TypeInfo(ptr) } pub fn (ai &ArgInfo) load_type(type_info &TypeInfo) { - g_arg_info_load_type(ai.c, type_info.c) + C.g_arg_info_load_type(ai.c, type_info.c) } pub fn (ai &ArgInfo) may_be_null() bool { - return g_arg_info_may_be_null(ai.c) + return C.g_arg_info_may_be_null(ai.c) } pub fn (ai &ArgInfo) is_caller_allocates() bool { - return g_arg_info_is_caller_allocates(ai.c) + return C.g_arg_info_is_caller_allocates(ai.c) } pub fn (ai &ArgInfo) is_optional() bool { - return g_arg_info_is_optional(ai.c) + return C.g_arg_info_is_optional(ai.c) } pub fn (ai &ArgInfo) is_return_value() bool { - return g_arg_info_is_return_value(ai.c) + return C.g_arg_info_is_return_value(ai.c) } pub fn (ai &ArgInfo) is_skip() bool { - return g_arg_info_is_skip(ai.c) + return C.g_arg_info_is_skip(ai.c) } pub fn (ai &ArgInfo) get_cptr() voidptr { @@ -85,5 +85,5 @@ pub fn (ai &ArgInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (ai &ArgInfo) unref() { - g_base_info_unref(ai.c) + C.g_base_info_unref(ai.c) } diff --git a/gi/base_info.v b/gi/base_info.v index 3e6c485..1e3d911 100644 --- a/gi/base_info.v +++ b/gi/base_info.v @@ -1,95 +1,95 @@ module gi pub struct BaseInfo { - c &GIBaseInfo + c &C.GIBaseInfo } -pub type InfoType int +pub type InfoType = int pub const ( - INFO_TYPE_INVALID = InfoType(C.GI_INFO_TYPE_INVALID) - INFO_TYPE_FUNCTION = InfoType(C.GI_INFO_TYPE_FUNCTION) - INFO_TYPE_CALLBACK = InfoType(C.GI_INFO_TYPE_CALLBACK) - INFO_TYPE_STRUCT = InfoType(C.GI_INFO_TYPE_STRUCT) - INFO_TYPE_BOXED = InfoType(C.GI_INFO_TYPE_BOXED) - INFO_TYPE_ENUM = InfoType(C.GI_INFO_TYPE_ENUM) - INFO_TYPE_FLAGS = InfoType(C.GI_INFO_TYPE_FLAGS) - INFO_TYPE_OBJECT = InfoType(C.GI_INFO_TYPE_OBJECT) - INFO_TYPE_INTERFACE = InfoType(C.GI_INFO_TYPE_INTERFACE) - INFO_TYPE_CONSTANT = InfoType(C.GI_INFO_TYPE_CONSTANT) - INFO_TYPE_INVALID_0 = InfoType(C.GI_INFO_TYPE_INVALID_0) - INFO_TYPE_UNION = InfoType(C.GI_INFO_TYPE_UNION) - INFO_TYPE_VALUE = InfoType(C.GI_INFO_TYPE_VALUE) - INFO_TYPE_SIGNAL = InfoType(C.GI_INFO_TYPE_SIGNAL) - INFO_TYPE_VFUNC = InfoType(C.GI_INFO_TYPE_VFUNC) - INFO_TYPE_PROPERTY = InfoType(C.GI_INFO_TYPE_PROPERTY) - INFO_TYPE_FIELD = InfoType(C.GI_INFO_TYPE_FIELD) - INFO_TYPE_ARG = InfoType(C.GI_INFO_TYPE_ARG) - INFO_TYPE_TYPE = InfoType(C.GI_INFO_TYPE_TYPE) - INFO_TYPE_UNRESOLVED = InfoType(C.GI_INFO_TYPE_UNRESOLVED) + info_type_invalid = InfoType(C.GI_INFO_TYPE_INVALID) + info_type_function = InfoType(C.GI_INFO_TYPE_FUNCTION) + info_type_callback = InfoType(C.GI_INFO_TYPE_CALLBACK) + info_type_struct = InfoType(C.GI_INFO_TYPE_STRUCT) + info_type_boxed = InfoType(C.GI_INFO_TYPE_BOXED) + info_type_enum = InfoType(C.GI_INFO_TYPE_ENUM) + info_type_flags = InfoType(C.GI_INFO_TYPE_FLAGS) + info_type_object = InfoType(C.GI_INFO_TYPE_OBJECT) + info_type_interface = InfoType(C.GI_INFO_TYPE_INTERFACE) + info_type_constant = InfoType(C.GI_INFO_TYPE_CONSTANT) + info_type_invalid_0 = InfoType(C.GI_INFO_TYPE_INVALID_0) + info_type_union = InfoType(C.GI_INFO_TYPE_UNION) + info_type_value = InfoType(C.GI_INFO_TYPE_VALUE) + info_type_signal = InfoType(C.GI_INFO_TYPE_SIGNAL) + info_type_vfunc = InfoType(C.GI_INFO_TYPE_VFUNC) + info_type_property = InfoType(C.GI_INFO_TYPE_PROPERTY) + info_type_field = InfoType(C.GI_INFO_TYPE_FIELD) + info_type_arg = InfoType(C.GI_INFO_TYPE_ARG) + info_type_type = InfoType(C.GI_INFO_TYPE_TYPE) + info_type_unresolved = InfoType(C.GI_INFO_TYPE_UNRESOLVED) ) pub fn new_base_info(type_ InfoType, container &BaseInfo, typelib &Typelib, offset u32) &BaseInfo { - base_info := g_info_new(type_, container.c, typelib.c, offset) + base_info := C.g_info_new(type_, container.c, typelib.c, offset) return &BaseInfo{base_info} } pub fn (bi &BaseInfo) ref() &BaseInfo { - base_info := g_base_info_ref(bi.c) + base_info := C.g_base_info_ref(bi.c) return &BaseInfo{base_info} } pub fn (bi &BaseInfo) unref() { - g_base_info_unref(bi.c) + C.g_base_info_unref(bi.c) } pub fn (bi &BaseInfo) equal(base_info &BaseInfo) bool{ - return g_base_info_equal(bi.c, base_info.c) + return C.g_base_info_equal(bi.c, base_info.c) } pub fn (bi &BaseInfo) get_type() InfoType { - return g_base_info_get_type(bi.c) + return C.g_base_info_get_type(bi.c) } pub fn (bi &BaseInfo) get_typelib() &Typelib { - typelib := g_base_info_get_typelib(bi.c) + typelib := C.g_base_info_get_typelib(bi.c) return &Typelib{typelib} } pub fn (bi &BaseInfo) get_namespace() string { - namespace := g_base_info_get_namespace(bi.c) + namespace := C.g_base_info_get_namespace(bi.c) if isnil(namespace) { return '' } return tos3(namespace) } pub fn (bi &BaseInfo) get_name() string { - name := g_base_info_get_name(bi.c) + name := C.g_base_info_get_name(bi.c) return tos3(name) } pub fn (bi &BaseInfo) get_attribute(name string) string { - attribute := g_base_info_get_attribute(bi.c, name.str) + attribute := C.g_base_info_get_attribute(bi.c, name.str) return tos3(attribute) } -pub fn (bi &BaseInfo) iterate_attributes(cb fn(name, value string)) { - iter := &GIAttributeIter(0) - _name := '' - _value := '' - for g_base_info_iterate_attributes(bi.c, &iter, &_name.str, &_value.str) { - cb(_name, _value) +pub fn (bi &BaseInfo) iterate_attributes(cb fn(name string, value string)) { + iter := &C.GIAttributeIter(0) + name_ := '' + value_ := '' + for C.g_base_info_iterate_attributes(bi.c, &iter, &name_.str, &value_.str) { + cb(name_, value_) } } pub fn (bi &BaseInfo) get_container() &BaseInfo { - container := g_base_info_get_container(bi.c) + container := C.g_base_info_get_container(bi.c) return &BaseInfo{container} } pub fn (bi &BaseInfo) is_deprecated() bool { - return g_base_info_is_deprecated(bi.c) + return C.g_base_info_is_deprecated(bi.c) } pub fn (it InfoType) str() string { - return tos3(g_info_type_to_string(it)) + return tos3(C.g_info_type_to_string(it)) } diff --git a/gi/callable_info.v b/gi/callable_info.v index b9717be..030da34 100644 --- a/gi/callable_info.v +++ b/gi/callable_info.v @@ -1,42 +1,41 @@ module gi pub struct CallableInfo { - c &GICallableInfo + c &C.GICallableInfo } pub fn (ci &CallableInfo) can_throw_gerror() bool { - return g_callable_info_can_throw_gerror(ci.c) + return C.g_callable_info_can_throw_gerror(ci.c) } pub fn (ci &CallableInfo) get_n_args() int { - return g_callable_info_get_n_args(ci.c) + return C.g_callable_info_get_n_args(ci.c) } pub fn (ci &CallableInfo) get_arg(n int) &ArgInfo { - cptr := &GIBaseInfo(g_callable_info_get_arg(ci.c, n)) + cptr := &C.GIBaseInfo(C.g_callable_info_get_arg(ci.c, n)) ptr := &BaseInfo{cptr} return &ArgInfo(ptr) } pub fn (ci &CallableInfo) get_caller_owns() Transfer { - return g_callable_info_get_caller_owns(ci.c) + return C.g_callable_info_get_caller_owns(ci.c) } pub fn (ci &CallableInfo) get_instance_ownership_transfer() Transfer { - return g_callable_info_get_instance_ownership_transfer(ci.c) + return C.g_callable_info_get_instance_ownership_transfer(ci.c) } pub fn (ci &CallableInfo) get_return_attribute(name string) string { - return tos_and_free(g_callable_info_get_return_attribute(ci.c, name.str)) + return tos_and_free(C.g_callable_info_get_return_attribute(ci.c, name.str)) } pub fn (ci &CallableInfo) get_return_type() &TypeInfo { - cptr := &GIBaseInfo(g_callable_info_get_return_type(ci.c)) - ptr := &BaseInfo{cptr} - return &TypeInfo(ptr) + cptr := &C.GIBaseInfo(C.g_callable_info_get_return_type(ci.c)) + return &TypeInfo(cptr) } -// gboolean g_callable_info_invoke(GICallableInfo *info, +// gboolean C.g_callable_info_invoke(GICallableInfo *info, // gpointer function, // const GIArgument *in_args, // int n_in_args, @@ -48,36 +47,36 @@ pub fn (ci &CallableInfo) get_return_type() &TypeInfo { // GError **error) pub fn (ci &CallableInfo) is_method() bool { - return g_callable_info_is_method(ci.c) + return C.g_callable_info_is_method(ci.c) } -pub fn (ci &CallableInfo) iterate_return_attributes(cb fn(name, value string)) { - iter := &GIAttributeIter(0) - _name := '' - _value := '' - for g_callable_info_iterate_return_attributes(ci.c, &iter, &_name.str, &_value.str) { - cb(_name, _value) +pub fn (ci &CallableInfo) iterate_return_attributes(cb fn(name string, value string)) { + iter := &C.GIAttributeIter(0) + name_ := '' + value_ := '' + for C.g_callable_info_iterate_return_attributes(ci.c, &iter, &name_.str, &value_.str) { + cb(name_, value_) } } pub fn (ci &CallableInfo) load_arg(n int, arg &ArgInfo) { - g_callable_info_load_arg(ci.c, n, arg.c) + C.g_callable_info_load_arg(ci.c, n, arg.c) } pub fn (ci &CallableInfo) load_return_type(type_info &TypeInfo) { - g_callable_info_load_return_type(ci.c, type_info.c) + C.g_callable_info_load_return_type(ci.c, type_info.c) } pub fn (ci &CallableInfo) may_return_nil() bool { - return g_callable_info_may_return_null(ci.c) + return C.g_callable_info_may_return_null(ci.c) } pub fn (ci &CallableInfo) skip_return() bool { - return g_callable_info_skip_return(ci.c) + return C.g_callable_info_skip_return(ci.c) } pub fn (ci &CallableInfo) is_valid() bool { - return GI_IS_CALLABLE_INFO(ci.c) + return C.GI_IS_CALLABLE_INFO(ci.c) } pub fn (ci &CallableInfo) get_cptr() voidptr { @@ -87,5 +86,5 @@ pub fn (ci &CallableInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (ci &CallableInfo) unref() { - g_base_info_unref(ci.c) + C.g_base_info_unref(ci.c) } diff --git a/gi/callback_info.v b/gi/callback_info.v index 130cd12..0d1d40c 100644 --- a/gi/callback_info.v +++ b/gi/callback_info.v @@ -1,11 +1,11 @@ module gi pub struct CallbackInfo { - c &GICallbackInfo + c &C.GICallbackInfo } /* Inherits from BaseInfo */ pub fn (ci &CallbackInfo) unref() { - g_base_info_unref(ci.c) + C.g_base_info_unref(ci.c) } diff --git a/gi/constant_info.v b/gi/constant_info.v index d12f7d0..525c995 100644 --- a/gi/constant_info.v +++ b/gi/constant_info.v @@ -1,37 +1,37 @@ module gi -type u8 C.uint8_t -type i32 C.int32_t +// type U8 C.uint8_t +// type I32 C.int32_t pub struct ConstantInfo { - c &GIConstantInfo + c &C.GIConstantInfo } pub fn (ci &ConstantInfo) get_type() &TypeInfo { - cptr := &GIBaseInfo(g_constant_info_get_type(ci.c)) + cptr := &C.GIBaseInfo(C.g_constant_info_get_type(ci.c)) ptr := &BaseInfo{cptr} return &TypeInfo(ptr) } pub fn (ci &ConstantInfo) get_value() voidptr { - arg := GIArgument(0) - g_constant_info_get_value(ci.c, &arg) + arg := C.GIArgument{} + C.g_constant_info_get_value(ci.c, &arg) ti := ci.get_type() tag := ti.get_tag() match tag { - TYPE_TAG_BOOLEAN { return &bool(&arg) } - TYPE_TAG_INT8 { return &i8(&arg) } - TYPE_TAG_UINT8 { return &u8(&arg) } - TYPE_TAG_INT16 { return &i16(&arg) } - TYPE_TAG_UINT16 { return &u16(&arg) } - TYPE_TAG_INT32 { return &i32(&arg) } - TYPE_TAG_UINT32 { return &u32(&arg) } - TYPE_TAG_INT64 { return &i64(&arg) } - TYPE_TAG_UINT64 { return &u64(&arg) } - TYPE_TAG_FLOAT { return &f32(&arg) } - TYPE_TAG_DOUBLE { return &f64(&arg) } - TYPE_TAG_UTF8, TYPE_TAG_FILENAME { + type_tag_boolean { return &bool(&arg) } + type_tag_int8 { return &i8(&arg) } + // TYPE_TAG_UINT8 { return &u8(&arg) } + type_tag_int16 { return &i16(&arg) } + type_tag_uint16 { return &u16(&arg) } + // TYPE_TAG_INT32 { return &i32(&arg) } + type_tag_uint32 { return &u32(&arg) } + type_tag_int64 { return &i64(&arg) } + type_tag_uint64 { return &u64(&arg) } + type_tag_float { return &f32(&arg) } + type_tag_double { return &f64(&arg) } + type_tag_utf8, type_tag_filename { return &charptr(&arg) } else { @@ -49,5 +49,5 @@ pub fn (ci &ConstantInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (ci &ConstantInfo) unref() { - g_base_info_unref(ci.c) + C.g_base_info_unref(ci.c) } diff --git a/gi/enum_info.v b/gi/enum_info.v index cdad0b3..5a4c907 100644 --- a/gi/enum_info.v +++ b/gi/enum_info.v @@ -1,41 +1,41 @@ module gi pub struct EnumInfo { - c &GIEnumInfo + c &C.GIEnumInfo } pub fn (ei &EnumInfo) get_n_values() int { - return g_enum_info_get_n_values(ei.c) + return C.g_enum_info_get_n_values(ei.c) } pub fn (ei &EnumInfo) get_value(n int) &ValueInfo { - cptr := &GIBaseInfo(g_enum_info_get_value(ei.c, n)) + cptr := &C.GIBaseInfo(C.g_enum_info_get_value(ei.c, n)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &ValueInfo(ptr) } pub fn (ei &EnumInfo) get_n_methods() int { - return g_enum_info_get_n_methods(ei.c) + return C.g_enum_info_get_n_methods(ei.c) } pub fn (ei &EnumInfo) get_method(n int) &FunctionInfo { - cptr := &GIBaseInfo(g_enum_info_get_method(ei.c, n)) + cptr := &C.GIBaseInfo(C.g_enum_info_get_method(ei.c, n)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } pub fn (ei &EnumInfo) get_storage_type() int /* GITypeTag */ { - return g_enum_info_get_storage_type(ei.c) + return C.g_enum_info_get_storage_type(ei.c) } pub fn (ei &EnumInfo) get_error_domain() string { - return tos3(g_enum_info_get_error_domain(ei.c)) + return tos3(C.g_enum_info_get_error_domain(ei.c)) } pub fn (ei &EnumInfo) is_valid() bool { - return GI_IS_ENUM_INFO(ei.c) + return C.GI_IS_ENUM_INFO(ei.c) } pub fn (ei &EnumInfo) get_cptr() voidptr { @@ -45,5 +45,5 @@ pub fn (ei &EnumInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (ei &EnumInfo) unref() { - g_base_info_unref(ei.c) + C.g_base_info_unref(ei.c) } diff --git a/gi/field_info.v b/gi/field_info.v index dec98ee..4f62912 100644 --- a/gi/field_info.v +++ b/gi/field_info.v @@ -1,38 +1,38 @@ module gi pub struct FieldInfo { - c &GIFieldInfo + c &C.GIFieldInfo } -pub type FieldInfoFlags int +pub type FieldInfoFlags = int pub const ( - FIELD_IS_READABLE = FieldInfoFlags(C.GI_FIELD_IS_READABLE) - FIELD_IS_WRITABLE = FieldInfoFlags(C.GI_FIELD_IS_WRITABLE) + field_is_readable = FieldInfoFlags(C.GI_FIELD_IS_READABLE) + field_is_writable = FieldInfoFlags(C.GI_FIELD_IS_WRITABLE) ) -pub fn (fi &FieldInfo) get_field(mem voidptr, arg &GIArgument) bool { - return g_field_info_get_field(fi.c, mem, arg) +pub fn (fi &FieldInfo) get_field(mem voidptr, arg &C.GIArgument) bool { + return C.g_field_info_get_field(fi.c, mem, arg) } -pub fn (fi &FieldInfo) set_field(mem voidptr, arg &GIArgument) bool { - return g_field_info_set_field(fi.c, mem, arg) +pub fn (fi &FieldInfo) set_field(mem voidptr, arg &C.GIArgument) bool { + return C.g_field_info_set_field(fi.c, mem, arg) } pub fn (fi &FieldInfo) get_flags() FieldInfoFlags { - return g_field_info_get_flags(fi.c) + return C.g_field_info_get_flags(fi.c) } pub fn (fi &FieldInfo) get_offset() int { - return g_field_info_get_offset(fi.c) + return C.g_field_info_get_offset(fi.c) } pub fn (fi &FieldInfo) get_size() int { - return g_field_info_get_size(fi.c) + return C.g_field_info_get_size(fi.c) } pub fn (fi &FieldInfo) get_type() &TypeInfo { - cptr := &GIBaseInfo(g_field_info_get_type(fi.c)) + cptr := &C.GIBaseInfo(C.g_field_info_get_type(fi.c)) ptr := &BaseInfo{cptr} return &TypeInfo(ptr) } @@ -44,5 +44,5 @@ pub fn (fi &FieldInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (fi &FieldInfo) unref() { - g_base_info_unref(fi.c) + C.g_base_info_unref(fi.c) } diff --git a/gi/function_info.v b/gi/function_info.v index 7110897..9fe6724 100644 --- a/gi/function_info.v +++ b/gi/function_info.v @@ -4,41 +4,41 @@ pub struct FunctionInfo { c &FunctionInfo } -pub type FunctionInfoFlags int +pub type FunctionInfoFlags = int pub const ( - FUNCTION_IS_METHOD = FunctionInfoFlags(C.GI_FUNCTION_IS_METHOD) - FUNCTION_IS_CONSTRUCTOR = FunctionInfoFlags(C.GI_FUNCTION_IS_CONSTRUCTOR) - FUNCTION_IS_GETTER = FunctionInfoFlags(C.GI_FUNCTION_IS_GETTER) - FUNCTION_IS_SETTER = FunctionInfoFlags(C.GI_FUNCTION_IS_SETTER) - FUNCTION_WRAPS_VFUNC = FunctionInfoFlags(C.GI_FUNCTION_WRAPS_VFUNC) - FUNCTION_THROWS = FunctionInfoFlags(C.GI_FUNCTION_THROWS) + function_is_method = FunctionInfoFlags(C.GI_FUNCTION_IS_METHOD) + function_is_constructor = FunctionInfoFlags(C.GI_FUNCTION_IS_CONSTRUCTOR) + function_is_getter = FunctionInfoFlags(C.GI_FUNCTION_IS_GETTER) + function_is_setter = FunctionInfoFlags(C.GI_FUNCTION_IS_SETTER) + function_wraps_vfunc = FunctionInfoFlags(C.GI_FUNCTION_WRAPS_VFUNC) + function_throws = FunctionInfoFlags(C.GI_FUNCTION_THROWS) ) pub fn (fi &FunctionInfo) get_flags() FunctionInfoFlags { - return g_function_info_get_flags(fi.c) + return C.g_function_info_get_flags(fi.c) } pub fn (fi &FunctionInfo) get_property() &PropertyInfo { - cptr := &GIBaseInfo(g_function_info_get_property(fi.c)) + cptr := &C.GIBaseInfo(C.g_function_info_get_property(fi.c)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &PropertyInfo(ptr) } pub fn (fi &FunctionInfo) get_symbol() string { - symbol := g_function_info_get_symbol(fi.c) + symbol := C.g_function_info_get_symbol(fi.c) return tos3(symbol) } pub fn (fi &FunctionInfo) get_vfunc() &VFuncInfo { - cptr := &GIBaseInfo(g_function_info_get_vfunc(fi.c)) + cptr := &C.GIBaseInfo(C.g_function_info_get_vfunc(fi.c)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &VFuncInfo(ptr) } -//gboolean g_function_info_invoke (GIFunctionInfo *info, +//gboolean C.g_function_info_invoke (GIFunctionInfo *info, // const GIArgument *in_args, // int n_in_args, // const GIArgument *out_args, @@ -47,7 +47,7 @@ pub fn (fi &FunctionInfo) get_vfunc() &VFuncInfo { // GError **error) pub fn (fi &FunctionInfo) is_valid() bool { - return GI_IS_FUNCTION_INFO(fi.c) + return C.GI_IS_FUNCTION_INFO(fi.c) } pub fn (fi &FunctionInfo) get_cptr() voidptr { @@ -57,5 +57,5 @@ pub fn (fi &FunctionInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (fi &FunctionInfo) unref() { - g_base_info_unref(fi.c) + C.g_base_info_unref(fi.c) } diff --git a/gi/gi.v b/gi/gi.v index 0179be5..6af71d3 100644 --- a/gi/gi.v +++ b/gi/gi.v @@ -1,6 +1,6 @@ module gi -#flag linux `pkg-config --cflags gobject-introspection-1.0` `pkg-config --libs gobject-introspection-1.0` +#pkgconfig gobject-introspection-1.0 #include diff --git a/gi/gtype.v b/gi/gtype.v index 7854661..1436ed8 100644 --- a/gi/gtype.v +++ b/gi/gtype.v @@ -1,41 +1,41 @@ module gi -pub fn (gt GType) is_abstract() bool { - return G_TYPE_IS_ABSTRACT(gt) +pub fn (gt C.GType) is_abstract() bool { + return C.G_TYPE_IS_ABSTRACT(gt) } -pub fn (gt GType) is_derived() bool { - return G_TYPE_IS_DERIVED(gt) +pub fn (gt C.GType) is_derived() bool { + return C.G_TYPE_IS_DERIVED(gt) } -pub fn (gt GType) is_fundamental() bool { - return G_TYPE_IS_FUNDAMENTAL(gt) +pub fn (gt C.GType) is_fundamental() bool { + return C.G_TYPE_IS_FUNDAMENTAL(gt) } -pub fn (gt GType) is_value_type() bool { - return G_TYPE_IS_VALUE_TYPE(gt) +pub fn (gt C.GType) is_value_type() bool { + return C.G_TYPE_IS_VALUE_TYPE(gt) } -pub fn (gt GType) has_value_table() bool { - return G_TYPE_HAS_VALUE_TABLE(gt) +pub fn (gt C.GType) has_value_table() bool { + return C.G_TYPE_HAS_VALUE_TABLE(gt) } -pub fn (gt GType) is_classed() bool { - return G_TYPE_IS_CLASSED(gt) +pub fn (gt C.GType) is_classed() bool { + return C.G_TYPE_IS_CLASSED(gt) } -pub fn (gt GType) is_instantiatable() bool { - return G_TYPE_IS_INSTANTIATABLE(gt) +pub fn (gt C.GType) is_instantiatable() bool { + return C.G_TYPE_IS_INSTANTIATABLE(gt) } -pub fn (gt GType) is_derivable() bool { - return G_TYPE_IS_DERIVABLE(gt) +pub fn (gt C.GType) is_derivable() bool { + return C.G_TYPE_IS_DERIVABLE(gt) } -pub fn (gt GType) is_deep_derivable() bool { - return G_TYPE_IS_DEEP_DERIVABLE(gt) +pub fn (gt C.GType) is_deep_derivable() bool { + return C.G_TYPE_IS_DEEP_DERIVABLE(gt) } -pub fn (gt GType) is_interface() bool { - return G_TYPE_IS_INTERFACE(gt) +pub fn (gt C.GType) is_interface() bool { + return C.G_TYPE_IS_INTERFACE(gt) } diff --git a/gi/interface_info.v b/gi/interface_info.v index d045fdd..7883935 100644 --- a/gi/interface_info.v +++ b/gi/interface_info.v @@ -1,91 +1,91 @@ module gi pub struct InterfaceInfo { - c &GIInterfaceInfo + c &C.GIInterfaceInfo } pub fn (ii &InterfaceInfo) get_n_prerequisites() int { - return g_interface_info_get_n_prerequisites(ii.c) + return C.g_interface_info_get_n_prerequisites(ii.c) } pub fn (ii &InterfaceInfo) get_prerequisite(n int) &BaseInfo { - cptr := g_interface_info_get_prerequisite(ii.c, n) + cptr := C.g_interface_info_get_prerequisite(ii.c, n) return &BaseInfo{cptr} } pub fn (ii &InterfaceInfo) get_n_properties() int { - return g_interface_info_get_n_properties(ii.c) + return C.g_interface_info_get_n_properties(ii.c) } pub fn (ii &InterfaceInfo) get_property(n int) &PropertyInfo { - cptr := &GIBaseInfo(g_interface_info_get_property(ii.c, n)) + cptr := &C.GIBaseInfo(C.g_interface_info_get_property(ii.c, n)) ptr := &BaseInfo{cptr} return &PropertyInfo(ptr) } pub fn (ii &InterfaceInfo) get_n_methods() int { - return g_interface_info_get_n_methods(ii.c) + return C.g_interface_info_get_n_methods(ii.c) } pub fn (ii &InterfaceInfo) get_method(n int) &FunctionInfo { - cptr := &GIBaseInfo(g_interface_info_get_method(ii.c, n)) + cptr := &C.GIBaseInfo(C.g_interface_info_get_method(ii.c, n)) ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } pub fn (ii &InterfaceInfo) find_method(name string) &FunctionInfo { - cptr := &GIBaseInfo(g_interface_info_find_method(ii.c, name.str)) + cptr := &C.GIBaseInfo(C.g_interface_info_find_method(ii.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } pub fn (ii &InterfaceInfo) get_n_signals() int { - return g_interface_info_get_n_signals(ii.c) + return C.g_interface_info_get_n_signals(ii.c) } pub fn (ii &InterfaceInfo) get_signal(n int) &SignalInfo { - cptr := &GIBaseInfo(g_interface_info_get_signal(ii.c, n)) + cptr := &C.GIBaseInfo(C.g_interface_info_get_signal(ii.c, n)) ptr := &BaseInfo{cptr} return &SignalInfo(ptr) } pub fn (ii &InterfaceInfo) find_signal(name string) &SignalInfo { - cptr := &GIBaseInfo(g_interface_info_find_signal(ii.c, name.str)) + cptr := &C.GIBaseInfo(C.g_interface_info_find_signal(ii.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &SignalInfo(ptr) } pub fn (ii &InterfaceInfo) get_n_vfuncs() int { - return g_interface_info_get_n_vfuncs(ii.c) + return C.g_interface_info_get_n_vfuncs(ii.c) } pub fn (ii &InterfaceInfo) get_vfunc(n int) &VFuncInfo { - cptr := &GIBaseInfo(g_interface_info_get_vfunc(ii.c, n)) + cptr := &C.GIBaseInfo(C.g_interface_info_get_vfunc(ii.c, n)) ptr := &BaseInfo{cptr} return &VFuncInfo(ptr) } pub fn (ii &InterfaceInfo) find_vfunc(name string) &VFuncInfo { - cptr := &GIBaseInfo(g_interface_info_find_vfunc(ii.c, name.str)) + cptr := &C.GIBaseInfo(C.g_interface_info_find_vfunc(ii.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &VFuncInfo(ptr) } pub fn (ii &InterfaceInfo) get_n_constants() int { - return g_interface_info_get_n_constants(ii.c) + return C.g_interface_info_get_n_constants(ii.c) } pub fn (ii &InterfaceInfo) get_constant(n int) &ConstantInfo { - cptr := &GIBaseInfo(g_interface_info_get_constant(ii.c, n)) + cptr := &C.GIBaseInfo(C.g_interface_info_get_constant(ii.c, n)) ptr := &BaseInfo{cptr} return &ConstantInfo(ptr) } pub fn (ii &InterfaceInfo) get_iface_struct() &StructInfo { - cptr := &GIBaseInfo(g_interface_info_get_iface_struct(ii.c)) + cptr := &C.GIBaseInfo(C.g_interface_info_get_iface_struct(ii.c)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &StructInfo(ptr) @@ -98,5 +98,5 @@ pub fn (ii &InterfaceInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (ii &InterfaceInfo) unref() { - g_base_info_unref(ii.c) + C.g_base_info_unref(ii.c) } diff --git a/gi/object_info.v b/gi/object_info.v index ed36677..dd3c2ae 100644 --- a/gi/object_info.v +++ b/gi/object_info.v @@ -1,76 +1,76 @@ module gi pub struct ObjectInfo { - c &GIObjectInfo + c &C.GIObjectInfo } pub fn (oi &ObjectInfo) get_abstract() bool { - return g_object_info_get_abstract(oi.c) + return C.g_object_info_get_abstract(oi.c) } pub fn (oi &ObjectInfo) get_fundamental() bool { - return g_object_info_get_fundamental(oi.c) + return C.g_object_info_get_fundamental(oi.c) } pub fn (oi &ObjectInfo) get_parent() &ObjectInfo { - cptr := &GIBaseInfo(g_object_info_get_parent(oi.c)) + cptr := &C.GIBaseInfo(C.g_object_info_get_parent(oi.c)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &ObjectInfo(ptr) } pub fn (oi &ObjectInfo) get_type_name() string { - type_name := g_object_info_get_type_name(oi.c) + type_name := C.g_object_info_get_type_name(oi.c) if type_name == 0 { return '' } return tos3(type_name) } pub fn (oi &ObjectInfo) get_type_init() string { - return tos3(g_object_info_get_type_init(oi.c)) + return tos3(C.g_object_info_get_type_init(oi.c)) } pub fn (oi &ObjectInfo) get_n_constants() int { - return g_object_info_get_n_constants(oi.c) + return C.g_object_info_get_n_constants(oi.c) } pub fn (oi &ObjectInfo) get_constant(n int) &ConstantInfo { - cptr := &GIBaseInfo(g_object_info_get_constant(oi.c, n)) + cptr := &C.GIBaseInfo(C.g_object_info_get_constant(oi.c, n)) ptr := &BaseInfo{cptr} return &ConstantInfo(ptr) } pub fn (oi &ObjectInfo) get_n_fields() int { - return g_object_info_get_n_fields(oi.c) + return C.g_object_info_get_n_fields(oi.c) } pub fn (oi &ObjectInfo) get_field(n int) &FieldInfo { - cptr := &GIBaseInfo(g_object_info_get_field(oi.c, n)) + cptr := &C.GIBaseInfo(C.g_object_info_get_field(oi.c, n)) ptr := &BaseInfo{cptr} return &FieldInfo(ptr) } pub fn (oi &ObjectInfo) get_n_interfaces() int { - return g_object_info_get_n_interfaces(oi.c) + return C.g_object_info_get_n_interfaces(oi.c) } pub fn (oi &ObjectInfo) get_interface(n int) &InterfaceInfo { - cptr := &GIBaseInfo(g_object_info_get_interface(oi.c, n)) + cptr := &C.GIBaseInfo(C.g_object_info_get_interface(oi.c, n)) ptr := &BaseInfo{cptr} return &InterfaceInfo(ptr) } pub fn (oi &ObjectInfo) get_n_methods() int { - return g_object_info_get_n_methods(oi.c) + return C.g_object_info_get_n_methods(oi.c) } pub fn (oi &ObjectInfo) get_method(n int) &FunctionInfo { - cptr := &GIBaseInfo(g_object_info_get_method(oi.c, n)) + cptr := &C.GIBaseInfo(C.g_object_info_get_method(oi.c, n)) ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } pub fn (oi &ObjectInfo) find_method(name string) &FunctionInfo { - cptr := &GIBaseInfo(g_object_info_find_method(oi.c, name.str)) + cptr := &C.GIBaseInfo(C.g_object_info_find_method(oi.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) @@ -78,77 +78,77 @@ pub fn (oi &ObjectInfo) find_method(name string) &FunctionInfo { pub fn (oi &ObjectInfo) find_method_using_interfaces(name string, implementor &ObjectInfo) &FunctionInfo { - cptr := &GIBaseInfo(g_object_info_find_method_using_interfaces(oi.c, name.str, implementor)) + cptr := &C.GIBaseInfo(C.g_object_info_find_method_using_interfaces(oi.c, name.str, implementor)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } pub fn (oi &ObjectInfo) get_n_properties() int { - return g_object_info_get_n_properties(oi.c) + return C.g_object_info_get_n_properties(oi.c) } pub fn (oi &ObjectInfo) get_property(n int) &PropertyInfo { - cptr := &GIBaseInfo(g_object_info_get_property(oi.c, n)) + cptr := &C.GIBaseInfo(C.g_object_info_get_property(oi.c, n)) ptr := &BaseInfo{cptr} return &PropertyInfo(ptr) } pub fn (oi &ObjectInfo) get_n_signals() int { - return g_object_info_get_n_signals(oi.c) + return C.g_object_info_get_n_signals(oi.c) } pub fn (oi &ObjectInfo) get_signal(n int) &SignalInfo { - cptr := &GIBaseInfo(g_object_info_get_signal(oi.c, n)) + cptr := &C.GIBaseInfo(C.g_object_info_get_signal(oi.c, n)) ptr := &BaseInfo{cptr} return &SignalInfo(ptr) } pub fn (oi &ObjectInfo) find_signal(name string) &SignalInfo { - cptr := &GIBaseInfo(g_object_info_find_signal(oi.c, name.str)) + cptr := &C.GIBaseInfo(C.g_object_info_find_signal(oi.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &SignalInfo(ptr) } pub fn (oi &ObjectInfo) get_n_vfuncs() int { - return g_object_info_get_n_vfuncs(oi.c) + return C.g_object_info_get_n_vfuncs(oi.c) } pub fn (oi &ObjectInfo) get_vfunc(n int) &VFuncInfo { - cptr := &GIBaseInfo(g_object_info_get_vfunc(oi.c, n)) + cptr := &C.GIBaseInfo(C.g_object_info_get_vfunc(oi.c, n)) ptr := &BaseInfo{cptr} return &VFuncInfo(ptr) } pub fn (oi &ObjectInfo) find_vfunc(name string) &VFuncInfo { - cptr := &GIBaseInfo(g_object_info_find_vfunc(oi.c, name.str)) + cptr := &C.GIBaseInfo(C.g_object_info_find_vfunc(oi.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &VFuncInfo(ptr) } pub fn (oi &ObjectInfo) find_vfunc_using_interfaces(name string, implementor &ObjectInfo) &VFuncInfo { - cptr := &GIBaseInfo(g_object_info_find_vfunc_using_interfaces(oi.c, name.str, implementor)) + cptr := &C.GIBaseInfo(C.g_object_info_find_vfunc_using_interfaces(oi.c, name.str, implementor)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &VFuncInfo(ptr) } pub fn (oi &ObjectInfo) get_class_struct() &StructInfo { - cptr := &GIBaseInfo(g_object_info_get_class_struct(oi.c)) + cptr := &C.GIBaseInfo(C.g_object_info_get_class_struct(oi.c)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &StructInfo(ptr) } pub fn (oi &ObjectInfo) get_ref_function() string { - ref_function := g_object_info_get_ref_function(oi.c) + ref_function := C.g_object_info_get_ref_function(oi.c) return tos3(ref_function) } pub fn (oi &ObjectInfo) get_unref_function() string { - unref_function := g_object_info_get_unref_function(oi.c) + unref_function := C.g_object_info_get_unref_function(oi.c) return tos3(unref_function) } pub fn (oi &ObjectInfo) get_cptr() voidptr { @@ -166,5 +166,5 @@ pub fn (oi &ObjectInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (oi &ObjectInfo) unref() { - g_base_info_unref(oi.c) + C.g_base_info_unref(oi.c) } diff --git a/gi/property_info.v b/gi/property_info.v index d5358ea..603be6a 100644 --- a/gi/property_info.v +++ b/gi/property_info.v @@ -1,35 +1,35 @@ module gi pub struct PropertyInfo { - c &GIPropertyInfo + c &C.GIPropertyInfo } -pub type ParamFlags int +pub type ParamFlags = int const ( - PARAM_READABLE = ParamFlags(C.G_PARAM_READABLE) - PARAM_WRITABLE = ParamFlags(C.G_PARAM_WRITABLE) - PARAM_READWRITE = ParamFlags(C.G_PARAM_READWRITE) - PARAM_CONSTRUCT = ParamFlags(C.G_PARAM_CONSTRUCT) - PARAM_CONSTRUCT_ONLY = ParamFlags(C.G_PARAM_CONSTRUCT_ONLY) - PARAM_LAX_VALIDATION = ParamFlags(C.G_PARAM_LAX_VALIDATION) - PARAM_STATIC_NAME = ParamFlags(C.G_PARAM_STATIC_NAME) - PARAM_STATIC_NICK = ParamFlags(C.G_PARAM_STATIC_NICK) - PARAM_STATIC_BLURB = ParamFlags(C.G_PARAM_STATIC_BLURB) - PARAM_EXPLICIT_NOTIFY = ParamFlags(C.G_PARAM_EXPLICIT_NOTIFY) - PARAM_DEPRECATED = ParamFlags(C.G_PARAM_DEPRECATED) + param_readable = ParamFlags(C.G_PARAM_READABLE) + param_writable = ParamFlags(C.G_PARAM_WRITABLE) + param_readwrite = ParamFlags(C.G_PARAM_READWRITE) + param_construct = ParamFlags(C.G_PARAM_CONSTRUCT) + param_construct_only = ParamFlags(C.G_PARAM_CONSTRUCT_ONLY) + param_lax_validation = ParamFlags(C.G_PARAM_LAX_VALIDATION) + param_static_name = ParamFlags(C.G_PARAM_STATIC_NAME) + // PARAM_STATIC_NICK = ParamFlags(C.G_PARAM_STATIC_NICK) + // PARAM_STATIC_BLURB = ParamFlags(C.G_PARAM_STATIC_BLURB) + // PARAM_EXPLICIT_NOTIFY = ParamFlags(C.G_PARAM_EXPLICIT_NOTIFY) + // PARAM_DEPRECATED = ParamFlags(C.G_PARAM_DEPRECATED) ) pub fn (pi &PropertyInfo) get_flags() ParamFlags { - return g_property_info_get_flags(pi.c) + return C.g_property_info_get_flags(pi.c) } pub fn (pi &PropertyInfo) get_ownership_transfer() Transfer { - return g_property_info_get_ownership_transfer(pi.c) + return C.g_property_info_get_ownership_transfer(pi.c) } pub fn (pi &PropertyInfo) get_type() &TypeInfo { - cptr := &GIBaseInfo(g_property_info_get_type(pi.c)) + cptr := &C.GIBaseInfo(C.g_property_info_get_type(pi.c)) ptr := &BaseInfo{cptr} return &TypeInfo(ptr) } @@ -41,5 +41,5 @@ pub fn (pi &PropertyInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (pi &PropertyInfo) unref() { - g_base_info_unref(pi.c) + C.g_base_info_unref(pi.c) } diff --git a/gi/registered_type_info.v b/gi/registered_type_info.v index 3295cae..3c30dcb 100644 --- a/gi/registered_type_info.v +++ b/gi/registered_type_info.v @@ -1,21 +1,21 @@ module gi pub struct RegisteredTypeInfo { - c &GIRegisteredTypeInfo + c &C.GIRegisteredTypeInfo } pub fn (rti &RegisteredTypeInfo) get_type_name() string { - type_name := g_registered_type_info_get_type_name(rti.c) + type_name := C.g_registered_type_info_get_type_name(rti.c) return tos3(type_name) } pub fn (rti &RegisteredTypeInfo) get_type_init() string { - type_init := g_registered_type_info_get_type_init(rti.c) + type_init := C.g_registered_type_info_get_type_init(rti.c) return tos3(type_init) } -pub fn (rti &RegisteredTypeInfo) get_g_type() GType { - return g_registered_type_info_get_g_type(rti.c) +pub fn (rti &RegisteredTypeInfo) get_g_type() C.GType { + return C.g_registered_type_info_get_g_type(rti.c) } pub fn (rti &RegisteredTypeInfo) get_cptr() voidptr { @@ -25,5 +25,5 @@ pub fn (rti &RegisteredTypeInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (rti &RegisteredTypeInfo) unref() { - g_base_info_unref(rti.c) + C.g_base_info_unref(rti.c) } diff --git a/gi/repository.v b/gi/repository.v index c969be8..387bacb 100644 --- a/gi/repository.v +++ b/gi/repository.v @@ -1,68 +1,68 @@ module gi pub struct Repository { - c &GIRepository + c &C.GIRepository } const ( - REPOSITORY_LOAD_FLAG_LAZY = C.G_IREPOSITORY_LOAD_FLAG_LAZY + repository_load_flag_lazy = C.G_IREPOSITORY_LOAD_FLAG_LAZY ) pub fn get_default_repository() &Repository { - repository := g_irepository_get_default() + repository := C.g_irepository_get_default() if isnil(repository) { return 0 } return &Repository{repository} } -// GOptionGroup *g_irepository_get_option_group (void) +// GOptionGroup *C.g_irepository_get_option_group (void) pub fn prepend_repository_search_path(path string) { - g_irepository_prepend_search_path(path.str) + C.g_irepository_prepend_search_path(path.str) } pub fn prepend_repository_library_path(path string) { - g_irepository_prepend_library_path(path.str) + C.g_irepository_prepend_library_path(path.str) } pub fn get_repository_search_path() []string { - paths := g_irepository_get_search_path() + paths := C.g_irepository_get_search_path() return gslist_gstring_to_array_string(paths) } /* METHODS */ pub fn (r &Repository) get_dependencies(namespace string) []string { - deps := g_irepository_get_dependencies(r.c, namespace.str) + deps := C.g_irepository_get_dependencies(r.c, namespace.str) return carray_string_to_array_string(deps) } pub fn (r &Repository) get_immediate_dependencies(namespace string) []string { - deps := g_irepository_get_immediate_dependencies(r.c, namespace.str) + deps := C.g_irepository_get_immediate_dependencies(r.c, namespace.str) return carray_string_to_array_string(deps) } pub fn (r &Repository) get_loaded_namespaces() []string { - namespaces := g_irepository_get_loaded_namespaces(r.c) + namespaces := C.g_irepository_get_loaded_namespaces(r.c) return carray_string_to_array_string(namespaces) } pub fn (r &Repository) get_n_infos(namespace string) int { - return g_irepository_get_n_infos(r.c, namespace.str) + return C.g_irepository_get_n_infos(r.c, namespace.str) } pub fn (r &Repository) get_info(namespace string, index int) &BaseInfo { - info := g_irepository_get_info(r.c, namespace.str, index) + info := C.g_irepository_get_info(r.c, namespace.str, index) return &BaseInfo{info} } pub fn (r &Repository) enumerate_versions(namespace string) []string { - versions := g_irepository_enumerate_versions(r.c, namespace.str) + versions := C.g_irepository_enumerate_versions(r.c, namespace.str) return glist_gstring_to_array_string(versions) } pub fn (r &Repository) load_typelib(typelib Typelib) ?string { - err := &GError(0) - typelib_ := g_irepository_load_typelib(r.c, typelib.c, 0, &err) + err := &C.GError(0) + typelib_ := C.g_irepository_load_typelib(r.c, typelib.c, 0, &err) if err != 0 { return error(tos3(err.message)) } @@ -70,23 +70,23 @@ pub fn (r &Repository) load_typelib(typelib Typelib) ?string { } pub fn (r &Repository) get_typelib_path(namespace string) string { - path := g_irepository_get_typelib_path(r.c, namespace.str) + path := C.g_irepository_get_typelib_path(r.c, namespace.str) return tos_and_free(path) } -pub fn (r &Repository) is_registered(namespace, version string) bool { +pub fn (r &Repository) is_registered(namespace string, version string) bool { if version == '' { - return g_irepository_is_registered(r.c, namespace.str, 0) + return C.g_irepository_is_registered(r.c, namespace.str, 0) } - return g_irepository_is_registered(r.c, namespace.str, version.str) + return C.g_irepository_is_registered(r.c, namespace.str, version.str) } -pub fn (r &Repository) require(namespace, version string/* , flags int */) ?&Typelib { - err := &GError(0) +pub fn (r &Repository) require(namespace string, version string/* , flags int */) ?&Typelib { + err := &C.GError(0) typelib := if version != '' { - g_irepository_require(r.c, namespace.str, version.str, 1, &err) + C.g_irepository_require(r.c, namespace.str, version.str, 1, &err) } else { - g_irepository_require(r.c, namespace.str, 0, 1, &err) + C.g_irepository_require(r.c, namespace.str, 0, 1, &err) } if err != 0 { return error(tos3(err.message)) @@ -100,38 +100,38 @@ pub fn (r &Repository) require(namespace, version string/* , flags int */) ?&Typ // } pub fn (r &Repository) get_c_prefix(namespace string) string { - c_prefix := g_irepository_get_c_prefix(r.c, namespace.str) + c_prefix := C.g_irepository_get_c_prefix(r.c, namespace.str) return tos_and_free(c_prefix) } pub fn (r &Repository) get_shared_library(namespace string) string { - shlib := g_irepository_get_shared_library(r.c, namespace.str) + shlib := C.g_irepository_get_shared_library(r.c, namespace.str) return tos_and_free(shlib) } pub fn (r &Repository) get_version(namespace string) string { - version := g_irepository_get_version(r.c, namespace.str) + version := C.g_irepository_get_version(r.c, namespace.str) return tos_and_free(version) } pub fn (r &Repository) find_by_gtype(gtype int) &BaseInfo { - base_info := g_irepository_find_by_gtype(r.c, gtype) + base_info := C.g_irepository_find_by_gtype(r.c, gtype) return &BaseInfo{base_info} } -// GIEnumInfo * g_irepository_find_by_error_domain (GIRepository *repository, +// GIEnumInfo * C.g_irepository_find_by_error_domain (GIRepository *repository, // GQuark domain) -pub fn (r &Repository) find_by_name(namespace, name string) &BaseInfo { - base_info := g_irepository_find_by_name(r.c, namespace.str, name.str) +pub fn (r &Repository) find_by_name(namespace string, name string) &BaseInfo { + base_info := C.g_irepository_find_by_name(r.c, namespace.str, name.str) return &BaseInfo{base_info} } -// void g_irepository_get_object_gtype_interfaces (GIRepository *repository, +// void C.g_irepository_get_object_gtype_interfaces (GIRepository *repository, // GType gtype, // guint *n_interfaces_out, // GIInterfaceInfo **interfaces_out) pub fn (r &Repository) dump(arg string) bool { - return g_irepository_dump(r.c, arg.str) + return C.g_irepository_dump(r.c, arg.str) } diff --git a/gi/signal_info.v b/gi/signal_info.v index 8b8ec3c..750f31c 100644 --- a/gi/signal_info.v +++ b/gi/signal_info.v @@ -1,37 +1,37 @@ module gi -pub type SignalFlags int +pub type SignalFlags = int const ( - SIGNAL_RUN_FIRST = SignalFlags(C.G_SIGNAL_RUN_FIRST) - SIGNAL_RUN_LAST = SignalFlags(C.G_SIGNAL_RUN_LAST) - SIGNAL_RUN_CLEANUP = SignalFlags(C.G_SIGNAL_RUN_CLEANUP) - SIGNAL_NO_RECURSE = SignalFlags(C.G_SIGNAL_NO_RECURSE) - SIGNAL_DETAILED = SignalFlags(C.G_SIGNAL_DETAILED) - SIGNAL_ACTION = SignalFlags(C.G_SIGNAL_ACTION) - SIGNAL_NO_HOOKS = SignalFlags(C.G_SIGNAL_NO_HOOKS) - SIGNAL_MUST_COLLECT = SignalFlags(C.G_SIGNAL_MUST_COLLECT) - SIGNAL_DEPRECATED = SignalFlags(C.G_SIGNAL_DEPRECATED) + signal_run_first = SignalFlags(C.G_SIGNAL_RUN_FIRST) + signal_run_last = SignalFlags(C.G_SIGNAL_RUN_LAST) + signal_run_cleanup = SignalFlags(C.G_SIGNAL_RUN_CLEANUP) + signal_no_recurse = SignalFlags(C.G_SIGNAL_NO_RECURSE) + signal_detailed = SignalFlags(C.G_SIGNAL_DETAILED) + signal_action = SignalFlags(C.G_SIGNAL_ACTION) + signal_no_hooks = SignalFlags(C.G_SIGNAL_NO_HOOKS) + signal_must_collect = SignalFlags(C.G_SIGNAL_MUST_COLLECT) + signal_deprecated = SignalFlags(C.G_SIGNAL_DEPRECATED) ) pub struct SignalInfo { - c &GISignalInfo + c &C.GISignalInfo } pub fn (si &SignalInfo) get_flags() SignalFlags { - return g_signal_info_get_flags(si.c) + return C.g_signal_info_get_flags(si.c) } pub fn (si &SignalInfo) get_class_closure() &VFuncInfo { - clls := g_signal_info_get_class_closure(si.c) + clls := C.g_signal_info_get_class_closure(si.c) if clls == 0 { return 0 } - cptr := &GIBaseInfo(clls) + cptr := &C.GIBaseInfo(clls) ptr := &BaseInfo{cptr} return &VFuncInfo(ptr) } pub fn (si &SignalInfo) true_stops_emit() bool { - return g_signal_info_true_stops_emit(si.c) + return C.g_signal_info_true_stops_emit(si.c) } pub fn (si &SignalInfo) get_cptr() voidptr { @@ -41,5 +41,5 @@ pub fn (si &SignalInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (si &SignalInfo) unref() { - g_base_info_unref(si.c) + C.g_base_info_unref(si.c) } diff --git a/gi/struct_info.v b/gi/struct_info.v index a5d1732..4a9220b 100644 --- a/gi/struct_info.v +++ b/gi/struct_info.v @@ -1,54 +1,54 @@ module gi pub struct StructInfo { - c &GIStructInfo + c &C.GIStructInfo } pub fn (si &StructInfo) find_field(name string) &FieldInfo { - cptr := &GIBaseInfo(g_struct_info_find_field(si.c, name.str)) + cptr := &C.GIBaseInfo(C.g_struct_info_find_field(si.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &FieldInfo(ptr) } pub fn (si &StructInfo) get_alignment() u32 { - return g_struct_info_get_alignment(si.c) + return C.g_struct_info_get_alignment(si.c) } pub fn (si &StructInfo) get_size() u32 { - return g_struct_info_get_size(si.c) + return C.g_struct_info_get_size(si.c) } pub fn (si &StructInfo) is_gtype_struct() bool { - return g_struct_info_is_gtype_struct(si.c) + return C.g_struct_info_is_gtype_struct(si.c) } pub fn (si &StructInfo) is_foreign() bool { - return g_struct_info_is_foreign(si.c) + return C.g_struct_info_is_foreign(si.c) } pub fn (si &StructInfo) get_n_fields() int { - return g_struct_info_get_n_fields(si.c) + return C.g_struct_info_get_n_fields(si.c) } pub fn (si &StructInfo) get_field(n int) &FieldInfo { - cptr := &GIBaseInfo(g_struct_info_get_field(si.c, n)) + cptr := &C.GIBaseInfo(C.g_struct_info_get_field(si.c, n)) ptr := &BaseInfo{cptr} return &FieldInfo(ptr) } pub fn (si &StructInfo) get_n_methods() int { - return g_struct_info_get_n_methods(si.c) + return C.g_struct_info_get_n_methods(si.c) } pub fn (si &StructInfo) get_method(n int) &FunctionInfo { - cptr := &GIBaseInfo(g_struct_info_get_method(si.c, n)) + cptr := &C.GIBaseInfo(C.g_struct_info_get_method(si.c, n)) ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } pub fn (si &StructInfo) find_method(name string) &FunctionInfo { - cptr := &GIBaseInfo(g_struct_info_find_method(si.c, name.str)) + cptr := &C.GIBaseInfo(C.g_struct_info_find_method(si.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) @@ -61,5 +61,5 @@ pub fn (si &StructInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (si &StructInfo) unref() { - g_base_info_unref(si.c) + C.g_base_info_unref(si.c) } diff --git a/gi/type_info.v b/gi/type_info.v index b3e7abf..92ecf88 100644 --- a/gi/type_info.v +++ b/gi/type_info.v @@ -1,77 +1,77 @@ module gi pub struct TypeInfo { - c &GITypeInfo + c &C.GITypeInfo } -pub type ArrayType int -pub type TypeTag int +pub type ArrayType = int +pub type TypeTag = int const ( - ARRAY_TYPE_C = ArrayType(C.GI_ARRAY_TYPE_C) - ARRAY_TYPE_ARRAY = ArrayType(C.GI_ARRAY_TYPE_ARRAY) - ARRAY_TYPE_PTR_ARRAY = ArrayType(C.GI_ARRAY_TYPE_PTR_ARRAY) - ARRAY_TYPE_BYTE_ARRAY = ArrayType(C.GI_ARRAY_TYPE_BYTE_ARRAY) + array_type_c = ArrayType(C.GI_ARRAY_TYPE_C) + array_type_array = ArrayType(C.GI_ARRAY_TYPE_ARRAY) + array_type_ptr_array = ArrayType(C.GI_ARRAY_TYPE_PTR_ARRAY) + array_type_byte_array = ArrayType(C.GI_ARRAY_TYPE_BYTE_ARRAY) ) pub const ( - TYPE_TAG_VOID = TypeTag(C.GI_TYPE_TAG_VOID) - TYPE_TAG_BOOLEAN = TypeTag(C.GI_TYPE_TAG_BOOLEAN) - TYPE_TAG_INT8 = TypeTag(C.GI_TYPE_TAG_INT8) - TYPE_TAG_UINT8 = TypeTag(C.GI_TYPE_TAG_UINT8) - TYPE_TAG_INT16 = TypeTag(C.GI_TYPE_TAG_INT16) - TYPE_TAG_UINT16 = TypeTag(C.GI_TYPE_TAG_UINT16) - TYPE_TAG_INT32 = TypeTag(C.GI_TYPE_TAG_INT32) - TYPE_TAG_UINT32 = TypeTag(C.GI_TYPE_TAG_UINT32) - TYPE_TAG_INT64 = TypeTag(C.GI_TYPE_TAG_INT64) - TYPE_TAG_UINT64 = TypeTag(C.GI_TYPE_TAG_UINT64) - TYPE_TAG_FLOAT = TypeTag(C.GI_TYPE_TAG_FLOAT) - TYPE_TAG_DOUBLE = TypeTag(C.GI_TYPE_TAG_DOUBLE) - TYPE_TAG_GTYPE = TypeTag(C.GI_TYPE_TAG_GTYPE) - TYPE_TAG_UTF8 = TypeTag(C.GI_TYPE_TAG_UTF8) - TYPE_TAG_FILENAME = TypeTag(C.GI_TYPE_TAG_FILENAME) - TYPE_TAG_ARRAY = TypeTag(C.GI_TYPE_TAG_ARRAY) - TYPE_TAG_INTERFACE = TypeTag(C.GI_TYPE_TAG_INTERFACE) - TYPE_TAG_GLIST = TypeTag(C.GI_TYPE_TAG_GLIST) - TYPE_TAG_GSLIST = TypeTag(C.GI_TYPE_TAG_GSLIST) - TYPE_TAG_GHASH = TypeTag(C.GI_TYPE_TAG_GHASH) - TYPE_TAG_ERROR = TypeTag(C.GI_TYPE_TAG_ERROR) - TYPE_TAG_UNICHAR = TypeTag(C.GI_TYPE_TAG_UNICHAR) + type_tag_void = TypeTag(C.GI_TYPE_TAG_VOID) + type_tag_boolean = TypeTag(C.GI_TYPE_TAG_BOOLEAN) + type_tag_int8 = TypeTag(C.GI_TYPE_TAG_INT8) + type_tag_uint8 = TypeTag(C.GI_TYPE_TAG_UINT8) + type_tag_int16 = TypeTag(C.GI_TYPE_TAG_INT16) + type_tag_uint16 = TypeTag(C.GI_TYPE_TAG_UINT16) + type_tag_int32 = TypeTag(C.GI_TYPE_TAG_INT32) + type_tag_uint32 = TypeTag(C.GI_TYPE_TAG_UINT32) + type_tag_int64 = TypeTag(C.GI_TYPE_TAG_INT64) + type_tag_uint64 = TypeTag(C.GI_TYPE_TAG_UINT64) + type_tag_float = TypeTag(C.GI_TYPE_TAG_FLOAT) + type_tag_double = TypeTag(C.GI_TYPE_TAG_DOUBLE) + type_tag_gtype = TypeTag(C.GI_TYPE_TAG_GTYPE) + type_tag_utf8 = TypeTag(C.GI_TYPE_TAG_UTF8) + type_tag_filename = TypeTag(C.GI_TYPE_TAG_FILENAME) + type_tag_array = TypeTag(C.GI_TYPE_TAG_ARRAY) + type_tag_interface = TypeTag(C.GI_TYPE_TAG_INTERFACE) + type_tag_glist = TypeTag(C.GI_TYPE_TAG_GLIST) + type_tag_gslist = TypeTag(C.GI_TYPE_TAG_GSLIST) + type_tag_ghash = TypeTag(C.GI_TYPE_TAG_GHASH) + type_tag_error = TypeTag(C.GI_TYPE_TAG_ERROR) + type_tag_unichar = TypeTag(C.GI_TYPE_TAG_UNICHAR) ) pub fn (ti &TypeInfo) is_pointer() bool { - return g_type_info_is_pointer(ti.c) + return C.g_type_info_is_pointer(ti.c) } pub fn (ti &TypeInfo) get_tag() TypeTag{ - return g_type_info_get_tag(ti.c) + return C.g_type_info_get_tag(ti.c) } pub fn (ti &TypeInfo) get_param_type(n int) &TypeInfo { - cptr := &GIBaseInfo(g_type_info_get_param_type(ti.c, n)) + cptr := &C.GIBaseInfo(C.g_type_info_get_param_type(ti.c, n)) ptr := &BaseInfo{cptr} return &TypeInfo(ptr) } pub fn (ti &TypeInfo) get_interface() &BaseInfo { - cptr := g_type_info_get_interface(ti.c) + cptr := C.g_type_info_get_interface(ti.c) return &BaseInfo{cptr} } pub fn (ti &TypeInfo) get_array_length() int { - return g_type_info_get_array_length(ti.c) + return C.g_type_info_get_array_length(ti.c) } pub fn (ti &TypeInfo) get_array_fixed_size() int { - return g_type_info_get_array_fixed_size(ti.c) + return C.g_type_info_get_array_fixed_size(ti.c) } pub fn (ti &TypeInfo) is_zero_terminated() bool { - return g_type_info_is_zero_terminated(ti.c) + return C.g_type_info_is_zero_terminated(ti.c) } pub fn (ti &TypeInfo) get_array_type() ArrayType { - return g_type_info_get_array_type(ti.c) + return C.g_type_info_get_array_type(ti.c) } pub fn (ti &TypeInfo) get_cptr() voidptr { @@ -79,11 +79,11 @@ pub fn (ti &TypeInfo) get_cptr() voidptr { } pub fn (tt TypeTag) str() string { - return tos3(g_type_tag_to_string(tt)) + return tos3(C.g_type_tag_to_string(tt)) } /* Inherits from BaseInfo */ pub fn (tt &TypeInfo) unref() { - g_base_info_unref(tt.c) + C.g_base_info_unref(tt.c) } diff --git a/gi/typelib.v b/gi/typelib.v index a01da89..b5862d4 100644 --- a/gi/typelib.v +++ b/gi/typelib.v @@ -1,12 +1,12 @@ module gi pub struct Typelib { - c &GITypelib + c &C.GITypelib } pub fn new_typelib_from_memory(mem byteptr, size u32) ?&Typelib { - error := &GError(0) - typelib := g_typelib_new_from_memory(&mem, size, &error) + error := &C.GError(0) + typelib := C.g_typelib_new_from_memory(&mem, size, &error) if typelib == 0 { panic(tos3(error.message)) } @@ -14,36 +14,36 @@ pub fn new_typelib_from_memory(mem byteptr, size u32) ?&Typelib { } // pub fn new_typelib_from_const_memory(mem byteptr, size u32) ?&Typelib { -// error := &GError(0) -// typelib := g_typelib_new_from_const_memory(&mem, size, &error) +// error := &C.GError(0) +// typelib := C.g_typelib_new_from_const_memory(&mem, size, &error) // if isnil(typelib) { // panic(tos3(error.message)) // } // return &Typelib{typelib} // } -// GITypelib * g_typelib_new_from_mapped_file (GMappedFile *mfile, +// GITypelib * C.g_typelib_new_from_mapped_file (GMappedFile *mfile, // GError **error) pub fn (tl &Typelib) free() { - g_typelib_free(tl.c) + C.g_typelib_free(tl.c) } pub fn (tl &Typelib) get_symbol(symbol_name string) string { - _symbol := voidptr(0) - loaded := g_typelib_symbol(tl.c, symbol_name.str, &_symbol) + c_symbol := voidptr(0) + loaded := C.g_typelib_symbol(tl.c, symbol_name.str, &c_symbol) if !loaded { return '' } - symbol := charptr(_symbol) + symbol := charptr(c_symbol) return tos3(symbol) } pub fn (tl &Typelib) get_namespace() string { - namespace := g_typelib_get_namespace(tl) + namespace := C.g_typelib_get_namespace(tl) return tos3(namespace) } /* Inherits from BaseInfo */ pub fn (tl &Typelib) unref() { - g_base_info_unref(tl.c) + C.g_base_info_unref(tl.c) } diff --git a/gi/union_info.v b/gi/union_info.v index 7eb8534..5208a9f 100644 --- a/gi/union_info.v +++ b/gi/union_info.v @@ -1,62 +1,62 @@ module gi pub struct UnionInfo { - c &GIUnionInfo + c &C.GIUnionInfo } pub fn (ui &UnionInfo) get_n_fields() int { - return g_union_info_get_n_fields(ui.c) + return C.g_union_info_get_n_fields(ui.c) } pub fn (ui &UnionInfo) get_field(n int) &FieldInfo { - cptr := &GIBaseInfo(g_union_info_get_field(ui.c, n)) + cptr := &C.GIBaseInfo(C.g_union_info_get_field(ui.c, n)) ptr := &BaseInfo{cptr} return &FieldInfo(ptr) } pub fn (ui &UnionInfo) get_n_methods() int { - return g_union_info_get_n_methods(ui.c) + return C.g_union_info_get_n_methods(ui.c) } pub fn (ui &UnionInfo) get_method(n int) &FunctionInfo { - cptr := &GIBaseInfo(g_union_info_get_method(ui.c, n)) + cptr := &C.GIBaseInfo(C.g_union_info_get_method(ui.c, n)) ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } pub fn (ui &UnionInfo) is_discriminated() bool { - return g_union_info_is_discriminated(ui.c) + return C.g_union_info_is_discriminated(ui.c) } pub fn (ui &UnionInfo) discriminator_offset() int { - return g_union_info_get_discriminator_offset(ui.c) + return C.g_union_info_get_discriminator_offset(ui.c) } pub fn (ui &UnionInfo) discriminator_type() &TypeInfo { - cptr := &GIBaseInfo(g_union_info_get_discriminator_type(ui.c)) + cptr := &C.GIBaseInfo(C.g_union_info_get_discriminator_type(ui.c)) ptr := &BaseInfo{cptr} return &TypeInfo(ptr) } pub fn (ui &UnionInfo) get_discriminator(n int) &ConstantInfo { - cptr := &GIBaseInfo(g_union_info_get_discriminator(ui.c, n)) + cptr := &C.GIBaseInfo(C.g_union_info_get_discriminator(ui.c, n)) ptr := &BaseInfo{cptr} return &ConstantInfo(ptr) } pub fn (ui &UnionInfo) find_method(name string) &FunctionInfo { - cptr := &GIBaseInfo(g_union_info_find_method(ui.c, name.str)) + cptr := &C.GIBaseInfo(C.g_union_info_find_method(ui.c, name.str)) if cptr == 0 { return 0 } ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } pub fn (ui &UnionInfo) get_size() u32 { - return g_union_info_get_size(ui.c) + return C.g_union_info_get_size(ui.c) } pub fn (ui &UnionInfo) get_alignment() u32 { - return g_union_info_get_alignment(ui.c) + return C.g_union_info_get_alignment(ui.c) } pub fn (ui &UnionInfo) get_cptr() voidptr { @@ -66,5 +66,5 @@ pub fn (ui &UnionInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (ui &UnionInfo) unref() { - g_base_info_unref(ui.c) + C.g_base_info_unref(ui.c) } diff --git a/gi/utils.v b/gi/utils.v index f8751d1..19ff1eb 100644 --- a/gi/utils.v +++ b/gi/utils.v @@ -1,51 +1,55 @@ module gi -fn gslist_gstring_to_array_string(_list &GSList) []string { - mut ret := []string +fn gslist_gstring_to_array_string(_list &C.GSList) []string { + mut ret := []string{} mut list := _list for !isnil(list) { str := tos_clone(list.data) ret << str list = list.next } - g_slist_free(_list) + C.g_slist_free(_list) return ret } fn glist_gstring_to_array_string(_list &C.GList) []string { - mut ret := []string + mut ret := []string{} mut list := _list for !isnil(list) { str := tos_clone(list.data) ret << str list = list.next } - g_list_free(_list) + C.g_list_free(_list) return ret } fn carray_string_to_array_string(arr &charptr) []string { - mut arr_str := []string + mut arr_str := []string{} if isnil(arr) { return arr_str } mut i := 0 for { - elem := byteptr(arr[i]) - if elem == 0 { break } - arr_str << tos_clone(elem) - i++ + unsafe { + elem := byteptr(arr[i]) + if elem == 0 { break } + arr_str << tos_clone(elem) + i++ + } } - g_strfreev(arr) + C.g_strfreev(arr) return arr_str } fn next_charptr(_s &charptr) &charptr { - mut s := _s - return s++ + unsafe { + mut s := _s + return s++ + } } fn tos_and_free(ptr charptr) string { - _ptr := byteptr(ptr) - ret := tos_clone(_ptr) - g_free(ptr) + c_ptr := byteptr(ptr) + ret := tos_clone(c_ptr) + C.g_free(ptr) return ret } diff --git a/gi/value_info.v b/gi/value_info.v index 12b16b4..f1f5020 100644 --- a/gi/value_info.v +++ b/gi/value_info.v @@ -1,15 +1,15 @@ module gi pub struct ValueInfo { - c &GIValueInfo + c &C.GIValueInfo } pub fn (vi &ValueInfo) get_value() i64 { - return g_value_info_get_value(vi.c) + return C.g_value_info_get_value(vi.c) } pub fn (vi &ValueInfo) is_valid() bool { - return GI_IS_ENUM_INFO(vi.c) + return C.GI_IS_ENUM_INFO(vi.c) } pub fn (vi &ValueInfo) get_cptr() voidptr { @@ -19,5 +19,5 @@ pub fn (vi &ValueInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (vi &ValueInfo) unref() { - g_base_info_unref(vi.c) + C.g_base_info_unref(vi.c) } diff --git a/gi/vfunc_info.v b/gi/vfunc_info.v index fdde555..57530e8 100644 --- a/gi/vfunc_info.v +++ b/gi/vfunc_info.v @@ -1,45 +1,45 @@ module gi pub struct VFuncInfo { - c &GIVFuncInfo + c &C.GIVFuncInfo } -pub type VFuncInfoFlags int +pub type VFuncInfoFlags = int const ( - VFUNC_MUST_CHAIN_UP = VFuncInfoFlags(C.GI_VFUNC_MUST_CHAIN_UP) - VFUNC_MUST_OVERRIDE = VFuncInfoFlags(C.GI_VFUNC_MUST_OVERRIDE) - VFUNC_MUST_NOT_OVERRIDE = VFuncInfoFlags(C.GI_VFUNC_MUST_NOT_OVERRIDE) + vfunc_must_chain_up = VFuncInfoFlags(C.GI_VFUNC_MUST_CHAIN_UP) + vfunc_must_override = VFuncInfoFlags(C.GI_VFUNC_MUST_OVERRIDE) + vfunc_must_not_override = VFuncInfoFlags(C.GI_VFUNC_MUST_NOT_OVERRIDE) ) pub fn (vfi &VFuncInfo) get_flags() int { - return g_vfunc_info_get_flags(vfi.c) + return C.g_vfunc_info_get_flags(vfi.c) } pub fn (vfi &VFuncInfo) get_offset() int { - return g_vfunc_info_get_offset(vfi.c) + return C.g_vfunc_info_get_offset(vfi.c) } pub fn (vfi &VFuncInfo) get_signal() &SignalInfo { - cptr := &GIBaseInfo(g_vfunc_info_get_signal(vfi.c)) + cptr := &C.GIBaseInfo(C.g_vfunc_info_get_signal(vfi.c)) if isnil(cptr) { return 0 } ptr := &BaseInfo{cptr} return &SignalInfo(ptr) } pub fn (vfi &VFuncInfo) get_invoker() &FunctionInfo { - cptr := &GIBaseInfo(g_vfunc_info_get_invoker(vfi.c)) + cptr := &C.GIBaseInfo(C.g_vfunc_info_get_invoker(vfi.c)) if isnil(cptr) { return 0 } ptr := &BaseInfo{cptr} return &FunctionInfo(ptr) } -// gpointer g_vfunc_info_get_address (GIVFuncInfo *info, +// gpointer C.g_vfunc_info_get_address (GIVFuncInfo *info, // GType implementor_gtype, // GError **error) -// gboolean g_vfunc_info_invoke (GIVFuncInfo *info, +// gboolean C.g_vfunc_info_invoke (GIVFuncInfo *info, // GType implementor, // const GIArgument *in_args, // int n_in_args, @@ -55,5 +55,5 @@ pub fn (vfi &VFuncInfo) get_cptr() voidptr { /* Inherits from BaseInfo */ pub fn (vfi &VFuncInfo) unref() { - g_base_info_unref(vfi.c) + C.g_base_info_unref(vfi.c) }