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/03 23:47:44 UTC
[5/7] lucy-clownfish git commit: Map Blob to Go `[]byte`.
Map Blob to Go `[]byte`.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/df024469
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/df024469
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/df024469
Branch: refs/heads/master
Commit: df0244695968125e31b2c2825cfb72ebf0c5951c
Parents: 04a5731
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 30 18:10:35 2015 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Fri Jul 31 11:06:32 2015 -0700
----------------------------------------------------------------------
compiler/src/CFCGoFunc.c | 7 +++++++
compiler/src/CFCGoTypeMap.c | 3 +++
2 files changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/df024469/compiler/src/CFCGoFunc.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoFunc.c b/compiler/src/CFCGoFunc.c
index 64f2255..80a6e8d 100644
--- a/compiler/src/CFCGoFunc.c
+++ b/compiler/src/CFCGoFunc.c
@@ -90,6 +90,7 @@ S_prep_start(CFCParcel *parcel, const char *name, CFCClass *invoker,
char *convertible = NULL;
if (CFCType_cfish_string(type)) { convertible = "String"; }
else if (CFCType_cfish_vector(type)) { convertible = "Vector"; }
+ else if (CFCType_cfish_blob(type)) { convertible = "Blob"; }
else { continue; }
char pattern[] =
"\t%sCF := (*C.cfish_%s)(%sGoTo%s(%s))\n";
@@ -172,6 +173,7 @@ S_prep_cfargs(CFCParcel *parcel, CFCClass *invoker,
"(", go_name, ")", NULL);
}
else if ((CFCType_is_string_type(type)
+ || CFCType_cfish_blob(type)
|| CFCType_cfish_vector(type))
// Don't convert an invocant.
&& (targ != IS_METHOD || i != 0)
@@ -234,6 +236,11 @@ CFCGoFunc_return_statement(CFCParcel *parcel, CFCType *return_type,
"%s\treturn %sCFStringToGo(unsafe.Pointer(retvalCF))\n";
statement = CFCUtil_sprintf(pattern, maybe_decref, clownfish_dot);
}
+ else if (CFCType_cfish_blob(return_type)) {
+ char pattern[] =
+ "%s\treturn %sBlobToGo(unsafe.Pointer(retvalCF))\n";
+ statement = CFCUtil_sprintf(pattern, maybe_decref, clownfish_dot);
+ }
else if (CFCType_cfish_vector(return_type)) {
char pattern[] =
"%s\treturn %sVectorToGo(unsafe.Pointer(retvalCF))\n";
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/df024469/compiler/src/CFCGoTypeMap.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoTypeMap.c b/compiler/src/CFCGoTypeMap.c
index 15e42a7..afd5345 100644
--- a/compiler/src/CFCGoTypeMap.c
+++ b/compiler/src/CFCGoTypeMap.c
@@ -96,6 +96,9 @@ CFCGoTypeMap_go_type_name(CFCType *type, CFCParcel *current_parcel) {
if (CFCType_is_string_type(type)) {
return CFCUtil_strdup("string");
}
+ else if (CFCType_cfish_blob(type)) {
+ return CFCUtil_strdup("[]byte");
+ }
else if (CFCType_cfish_vector(type)) {
return CFCUtil_strdup("[]interface{}");
}