Repository: lucy-clownfish Updated Branches: refs/heads/master 6f4f79e20 -> 957772687
Don't export certain conversion helpers. Export `GoToClownfish`, but not `goToString`, `goToHash`, etc. Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/029d9786 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/029d9786 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/029d9786 Branch: refs/heads/master Commit: 029d9786233e56d9f3c75d70b7b8bf5cb8e67096 Parents: 6f4f79e Author: Marvin Humphrey <[email protected]> Authored: Wed Aug 19 18:50:41 2015 -0700 Committer: Marvin Humphrey <[email protected]> Committed: Fri Sep 4 14:26:57 2015 -0700 ---------------------------------------------------------------------- runtime/go/clownfish/clownfish.go | 54 ++++++++++++++--------------- runtime/go/clownfish/clownfish_test.go | 14 ++++---- 2 files changed, 34 insertions(+), 34 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/029d9786/runtime/go/clownfish/clownfish.go ---------------------------------------------------------------------- diff --git a/runtime/go/clownfish/clownfish.go b/runtime/go/clownfish/clownfish.go index bae8b3d..5fd7c64 100644 --- a/runtime/go/clownfish/clownfish.go +++ b/runtime/go/clownfish/clownfish.go @@ -130,7 +130,7 @@ func GetClass(o Obj) Class { } func FetchClass(className string) Class { - nameCF := (*C.cfish_String)(GoToString(className)) + nameCF := (*C.cfish_String)(goToString(className)) defer C.cfish_decref(unsafe.Pointer(nameCF)) class := C.cfish_Class_fetch_class(nameCF) return WRAPClass(unsafe.Pointer(class)) @@ -155,7 +155,7 @@ func (c *ClassIMP) MakeObj() Obj { } func NewMethod(name string, callbackFunc unsafe.Pointer, offset uint32) Method { - nameCF := (*C.cfish_String)(GoToString(name)) + nameCF := (*C.cfish_String)(goToString(name)) defer C.cfish_decref(unsafe.Pointer(nameCF)) methCF := C.cfish_Method_new(nameCF, C.cfish_method_t(callbackFunc), C.uint32_t(offset)); @@ -268,75 +268,75 @@ func GoToClownfish(value interface{}, class unsafe.Pointer, nullable bool) unsaf switch v := value.(type) { case string: if klass == C.CFISH_STRING || klass == C.CFISH_OBJ { - converted = GoToString(value) + converted = goToString(value) } case []byte: if klass == C.CFISH_BLOB || klass == C.CFISH_OBJ { - converted = GoToBlob(value) + converted = goToBlob(value) } case int: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case uint: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case uintptr: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case int64: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case int32: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case int16: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case int8: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case uint64: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case uint32: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case uint16: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case uint8: if klass == C.CFISH_INTEGER || klass == C.CFISH_OBJ { - converted = GoToInteger(value) + converted = goToInteger(value) } case float32: if klass == C.CFISH_FLOAT || klass == C.CFISH_OBJ { - converted = GoToFloat(value) + converted = goToFloat(value) } case float64: if klass == C.CFISH_FLOAT || klass == C.CFISH_OBJ { - converted = GoToFloat(value) + converted = goToFloat(value) } case bool: if klass == C.CFISH_BOOLEAN || klass == C.CFISH_OBJ { - converted = GoToBoolean(value) + converted = goToBoolean(value) } case []interface{}: if klass == C.CFISH_VECTOR || klass == C.CFISH_OBJ { - converted = GoToVector(value) + converted = goToVector(value) } case map[string]interface{}: if klass == C.CFISH_HASH || klass == C.CFISH_OBJ { - converted = GoToHash(value) + converted = goToHash(value) } case Obj: converted = unsafe.Pointer(C.cfish_incref(unsafe.Pointer(v.TOPTR()))) @@ -365,7 +365,7 @@ func UnwrapClownfish(value Obj, name string, nullable bool) unsafe.Pointer { return unsafe.Pointer(value.TOPTR()) } -func GoToString(value interface{}) unsafe.Pointer { +func goToString(value interface{}) unsafe.Pointer { switch v := value.(type) { case string: size := len(v) @@ -380,7 +380,7 @@ func GoToString(value interface{}) unsafe.Pointer { } } -func GoToBlob(value interface{}) unsafe.Pointer { +func goToBlob(value interface{}) unsafe.Pointer { switch v := value.(type) { case []byte: size := C.size_t(len(v)) @@ -398,7 +398,7 @@ func GoToBlob(value interface{}) unsafe.Pointer { } } -func GoToInteger(value interface{}) unsafe.Pointer { +func goToInteger(value interface{}) unsafe.Pointer { switch v := value.(type) { case int: return unsafe.Pointer(C.cfish_Int_new(C.int64_t(v))) @@ -443,7 +443,7 @@ func GoToInteger(value interface{}) unsafe.Pointer { } } -func GoToFloat(value interface{}) unsafe.Pointer { +func goToFloat(value interface{}) unsafe.Pointer { switch v := value.(type) { case float32: return unsafe.Pointer(C.cfish_Float_new(C.double(v))) @@ -458,7 +458,7 @@ func GoToFloat(value interface{}) unsafe.Pointer { } } -func GoToBoolean(value interface{}) unsafe.Pointer { +func goToBoolean(value interface{}) unsafe.Pointer { switch v := value.(type) { case bool: if v { @@ -475,7 +475,7 @@ func GoToBoolean(value interface{}) unsafe.Pointer { } } -func GoToVector(value interface{}) unsafe.Pointer { +func goToVector(value interface{}) unsafe.Pointer { switch v := value.(type) { case []interface{}: size := len(v) @@ -494,7 +494,7 @@ func GoToVector(value interface{}) unsafe.Pointer { } } -func GoToHash(value interface{}) unsafe.Pointer { +func goToHash(value interface{}) unsafe.Pointer { switch v := value.(type) { case map[string]interface{}: size := len(v) http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/029d9786/runtime/go/clownfish/clownfish_test.go ---------------------------------------------------------------------- diff --git a/runtime/go/clownfish/clownfish_test.go b/runtime/go/clownfish/clownfish_test.go index 6b31527..69e9660 100644 --- a/runtime/go/clownfish/clownfish_test.go +++ b/runtime/go/clownfish/clownfish_test.go @@ -136,7 +136,7 @@ func TestGoToNilNotNullable(t *testing.T) { func TestGoToString(t *testing.T) { strings := []string{"foo", "", "z\u0000z"} for _, val := range strings { - got := WRAPAny(GoToString(val)) + got := WRAPAny(goToString(val)) if _, ok := got.(String); !ok { t.Errorf("Not a String, but a %T", got) } @@ -150,7 +150,7 @@ func TestGoToBlob(t *testing.T) { strings := []string{"foo", "", "z\u0000z"} for _, str := range strings { val := []byte(str) - got := WRAPAny(GoToBlob(val)) + got := WRAPAny(goToBlob(val)) if _, ok := got.(Blob); !ok { t.Errorf("Not a Blob, but a %T", got) } @@ -193,7 +193,7 @@ func TestGoToFloat(t *testing.T) { values := []float64{math.MaxFloat64, math.SmallestNonzeroFloat64, 0.0, -0.0, 0.5, -0.5, math.Inf(1), math.Inf(-1)} for _, val := range values { - got := WRAPAny(GoToFloat(val)) + got := WRAPAny(goToFloat(val)) if _, ok := got.(Float); !ok { t.Errorf("Not a Float, but a %T", got) } @@ -203,7 +203,7 @@ func TestGoToFloat(t *testing.T) { } // NaN - got = WRAPAny(GoToFloat(math.NaN())) + got = WRAPAny(goToFloat(math.NaN())) if !math.IsNaN(ToGo(unsafe.Pointer(got.TOPTR())).(float64)) { t.Error("Didn't convert NaN cleanly") } @@ -217,7 +217,7 @@ func TestGoToFloat(t *testing.T) { func TestGoToBoolean(t *testing.T) { values := []bool{true, false} for _, val := range values { - got := WRAPAny(GoToBoolean(val)) + got := WRAPAny(goToBoolean(val)) if _, ok := got.(Boolean); !ok { t.Errorf("Not a Boolean, but a %T", got) } @@ -232,7 +232,7 @@ func TestGoToHash(t *testing.T) { "foo": int64(1), "bar": []interface{}{}, } - got := WRAPAny(GoToHash(expected)) + got := WRAPAny(goToHash(expected)) if _, ok := got.(Hash); !ok { t.Errorf("Not a Hash, but a %T", got) } @@ -246,7 +246,7 @@ func TestGoToVector(t *testing.T) { []interface{}{}, int64(-1), } - got := WRAPAny(GoToVector(expected)) + got := WRAPAny(goToVector(expected)) if _, ok := got.(Vector); !ok { t.Errorf("Not a Vector, but a %T", got) }
