Skip to content

Instantly share code, notes, and snippets.

@anthgur
Last active December 28, 2015 22:29
Show Gist options
  • Save anthgur/7571725 to your computer and use it in GitHub Desktop.
Save anthgur/7571725 to your computer and use it in GitHub Desktop.
A quick test I created to interact with libgit2.
type GitAtomic
val::Clong
function GitAtomic()
new(zero(Clong))
end
end
type GitRefcount
refcount_val::Clong
owner::Ptr{Void}
function GitRefcount()
new(zero(Clong), C_NULL)
end
end
type GitVectorCmp
a::Ptr{Void}
b::Ptr{Void}
function GitVectorCmp()
new(C_NULL, C_NULL)
end
end
type GitVector
_alloc_size::Csize_t
_cmp_a::Ptr{Void}
_cmp_b::Ptr{Void}
contents::Ptr{Ptr{Void}}
length::Csize_t
sorted::Cint
function GitVector()
new(zero(Csize_t), C_NULL, C_NULL, C_NULL, zero(Csize_t), zero(Cint))
end
end
type GitConfig
rc_recfcount_val::Clong
rc_owned::Ptr{Void}
files_alloc_size::Csize_t
files_cmp_a::Ptr{Void}
files_cmp_b::Ptr{Void}
files_contents::Ptr{Ptr{Void}}
files_length::Csize_t
files_sorted::Cint
function GitConfig()
new(zero(Clong), C_NULL, zero(Csize_t), C_NULL, C_NULL, C_NULL, zero(Csize_t), zero(Cint))
end
end
julia> include("git2types.jl")
julia> config = GitConfig()
GitConfig(0,Ptr{Void} @0x0000000000000000,0x0000000000000000,Ptr{Void} @0x0000000000000000,Ptr{Void} @0x0000000000000000,Ptr{Ptr{None}} @0x0000000000000000,0x0000000000000000,0)
julia> err = ccall((:git_config_new, :libgit2), Cint, (Ptr{GitConfig},), &config)
0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment