Repository: lucy-clownfish Updated Branches: refs/heads/master 39d63859c -> fe8d05af7
Change Go signature for Hash.Keys(). Return a slice of strings instead of a slice of empty-interface. Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/f6d4cfbd Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/f6d4cfbd Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/f6d4cfbd Branch: refs/heads/master Commit: f6d4cfbda4b5ca306d0b6d3416cb680ce7b14601 Parents: 6f71120 Author: Marvin Humphrey <[email protected]> Authored: Tue Aug 4 14:56:00 2015 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Thu Aug 6 19:51:31 2015 -0700 ---------------------------------------------------------------------- runtime/go/build.go | 1 + runtime/go/clownfish/clownfish.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f6d4cfbd/runtime/go/build.go ---------------------------------------------------------------------- diff --git a/runtime/go/build.go b/runtime/go/build.go index 71c668a..dd6b1f3 100644 --- a/runtime/go/build.go +++ b/runtime/go/build.go @@ -155,6 +155,7 @@ func specMethods(parcel *cfc.Parcel) { vecBinding.Register() hashBinding := cfc.NewGoClass(parcel, "Clownfish::Hash") + hashBinding.SpecMethod("Keys", "Keys() []string") hashBinding.SetSuppressCtor(true) hashBinding.Register() } http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f6d4cfbd/runtime/go/clownfish/clownfish.go ---------------------------------------------------------------------- diff --git a/runtime/go/clownfish/clownfish.go b/runtime/go/clownfish/clownfish.go index 35cb470..4da8c82 100644 --- a/runtime/go/clownfish/clownfish.go +++ b/runtime/go/clownfish/clownfish.go @@ -146,6 +146,18 @@ func NewHash(size int) Hash { return WRAPHash(unsafe.Pointer(cfObj)) } +func (h *HashIMP) Keys() []string { + self := (*C.cfish_Hash)(unsafe.Pointer(h.TOPTR())) + keysCF := C.CFISH_Hash_Keys(self) + numKeys := C.CFISH_Vec_Get_Size(keysCF) + keys := make([]string, 0, int(numKeys)) + for i := C.size_t(0); i < numKeys; i++ { + keys = append(keys, CFStringToGo(unsafe.Pointer(C.CFISH_Vec_Fetch(keysCF, i)))) + } + C.cfish_decref(unsafe.Pointer(keysCF)) + return keys +} + func (o *ObjIMP) INITOBJ(ptr unsafe.Pointer) { o.ref = uintptr(ptr) runtime.SetFinalizer(o, ClearRef)
