Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix all erros and warnings #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
404 changes: 208 additions & 196 deletions gi/_cdefs.v

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions gi/arg_info.v
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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)
}
80 changes: 40 additions & 40 deletions gi/base_info.v
Original file line number Diff line number Diff line change
@@ -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))
}
47 changes: 23 additions & 24 deletions gi/callable_info.v
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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 {
Expand All @@ -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)
}
4 changes: 2 additions & 2 deletions gi/callback_info.v
Original file line number Diff line number Diff line change
@@ -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)
}
Loading