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/10 03:59:04 UTC

[03/17] lucy-clownfish git commit: Don't convert return value of Clone().

Don't convert return value of Clone().

Have Clone return an Obj rather than an interface{}, and override the
default binding which would convert some Clownfish types to Go types.


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

Branch: refs/heads/master
Commit: db2fcaeef7deaf725bd72e9ee5f57c5359ee465b
Parents: b1a2632
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Aug 4 11:55:17 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Aug 6 19:51:31 2015 -0700

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


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/db2fcaee/runtime/go/build.go
----------------------------------------------------------------------
diff --git a/runtime/go/build.go b/runtime/go/build.go
index 71a8c6b..71c668a 100644
--- a/runtime/go/build.go
+++ b/runtime/go/build.go
@@ -137,6 +137,7 @@ func runCFC() {
 func specMethods(parcel *cfc.Parcel) {
 	objBinding := cfc.NewGoClass(parcel, "Clownfish::Obj")
 	objBinding.SpecMethod("", "TOPTR() uintptr")
+	objBinding.SpecMethod("Clone", "Clone() Obj")
 	objBinding.Register()
 
 	errBinding := cfc.NewGoClass(parcel, "Clownfish::Err")

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/db2fcaee/runtime/go/clownfish/clownfish.go
----------------------------------------------------------------------
diff --git a/runtime/go/clownfish/clownfish.go b/runtime/go/clownfish/clownfish.go
index d5e3190..35cb470 100644
--- a/runtime/go/clownfish/clownfish.go
+++ b/runtime/go/clownfish/clownfish.go
@@ -160,6 +160,12 @@ func (o *ObjIMP) TOPTR() uintptr {
 	return o.ref
 }
 
+func (o *ObjIMP)Clone() Obj {
+	self := (*C.cfish_Obj)(unsafe.Pointer(o.TOPTR()))
+	dupe := C.CFISH_Obj_Clone(self)
+	return WRAPAny(unsafe.Pointer(dupe)).(Obj)
+}
+
 func certifyCF(value interface{}, class *C.cfish_Class) {
 	cfObj, ok := value.(Obj)
 	if ok {