You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2015/08/14 20:06:12 UTC

[05/14] lucy-clownfish git commit: Custom Go binding for StrIter_new.

Custom Go binding for StrIter_new.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/647ef88b
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/647ef88b
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/647ef88b

Branch: refs/heads/master
Commit: 647ef88ba585aa0b3802b4bf6952e26fa7008e68
Parents: 7073bd0
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Sat Aug 8 17:31:44 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Sun Aug 9 19:00:35 2015 -0700

----------------------------------------------------------------------
 runtime/go/build.go               | 4 ++++
 runtime/go/clownfish/clownfish.go | 6 ++++++
 2 files changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/647ef88b/runtime/go/build.go
----------------------------------------------------------------------
diff --git a/runtime/go/build.go b/runtime/go/build.go
index e509dba..3807d87 100644
--- a/runtime/go/build.go
+++ b/runtime/go/build.go
@@ -154,6 +154,10 @@ func specMethods(parcel *cfc.Parcel) {
 	stringBinding.SpecMethod("Swap_Chars", "SwapChars(rune, rune) string")
 	stringBinding.Register()
 
+	stringIterBinding := cfc.NewGoClass(parcel, "Clownfish::StringIterator")
+	stringIterBinding.SetSuppressCtor(true)
+	stringIterBinding.Register()
+
 	blobBinding := cfc.NewGoClass(parcel, "Clownfish::Blob")
 	blobBinding.SpecMethod("", "GetBuf() uintptr")
 	blobBinding.Register()

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/647ef88b/runtime/go/clownfish/clownfish.go
----------------------------------------------------------------------
diff --git a/runtime/go/clownfish/clownfish.go b/runtime/go/clownfish/clownfish.go
index be96655..065c9d0 100644
--- a/runtime/go/clownfish/clownfish.go
+++ b/runtime/go/clownfish/clownfish.go
@@ -157,6 +157,12 @@ func NewString(goString string) String {
 	return WRAPString(unsafe.Pointer(cfObj))
 }
 
+func NewStringIterator(str String, offset uintptr) StringIterator {
+	strCF := (*C.cfish_String)(unsafe.Pointer(str.TOPTR()))
+	iter := C.cfish_StrIter_new(strCF, C.size_t(offset))
+	return WRAPStringIterator(unsafe.Pointer(iter))
+}
+
 func NewVector(size int) Vector {
 	if (size < 0 || uint64(size) > ^uint64(0)) {
 		panic(NewErr(fmt.Sprintf("Param 'size' out of range: %d", size)))