aboutsummaryrefslogtreecommitdiffstats
path: root/cshared/blame_cshared.go
diff options
context:
space:
mode:
authorVadim Markovtsev <vadim@sourced.tech>2016-06-21 17:14:53 +0300
committerVadim Markovtsev <vadim@sourced.tech>2016-06-21 17:14:53 +0300
commitda07dca4523ebd25c634152a62cae4a72eb5783f (patch)
tree028122b562ce464ae4410525b5b3d3dfcea4846c /cshared/blame_cshared.go
parentbea415417e87fbb403095e8cd3fb8512a1a97af8 (diff)
downloadgo-git-da07dca4523ebd25c634152a62cae4a72eb5783f.tar.gz
Wrap more objects with CGo
Diffstat (limited to 'cshared/blame_cshared.go')
-rw-r--r--cshared/blame_cshared.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/cshared/blame_cshared.go b/cshared/blame_cshared.go
new file mode 100644
index 0000000..2da2e42
--- /dev/null
+++ b/cshared/blame_cshared.go
@@ -0,0 +1,51 @@
+// +build ignore
+package main
+
+import (
+ "C"
+
+ "gopkg.in/src-d/go-git.v3"
+)
+
+//export c_Blame_get_Path
+func c_Blame_get_Path(b uint64) *C.char {
+ obj, ok := GetObject(Handle(b))
+ if !ok {
+ return nil
+ }
+ blame := obj.(*git.Blame)
+ return C.CString(blame.Path)
+}
+
+//export c_Blame_get_Rev
+func c_Blame_get_Rev(b uint64) *C.char {
+ obj, ok := GetObject(Handle(b))
+ if !ok {
+ return nil
+ }
+ blame := obj.(*git.Blame)
+ return CBytes(blame.Rev[:])
+}
+
+
+//export c_Blame_get_Lines_len
+func c_Blame_get_Lines_len(b uint64) int {
+ obj, ok := GetObject(Handle(b))
+ if !ok {
+ return 0
+ }
+ blame := obj.(*git.Blame)
+ return len(blame.Lines)
+}
+
+//export c_Blame_get_Lines_item
+func c_Blame_get_Lines_item(b uint64, i int) {
+ obj, ok := GetObject(Handle(b))
+ if !ok {
+ return
+ }
+ blame := obj.(*git.Blame)
+ line := blame.Lines[i]
+ _ = line
+}
+