Add conversions to CGO type names.

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

Branch: refs/heads/py_exp1
Commit: 0f3b369a31d05e3893d1d855bfd77019b707df3e
Parents: 26ef33c
Author: Marvin Humphrey <[email protected]>
Authored: Thu Dec 11 20:28:53 2014 -0800
Committer: Marvin Humphrey <[email protected]>
Committed: Thu Dec 11 20:29:32 2014 -0800

----------------------------------------------------------------------
 compiler/src/CFCGoTypeMap.c | 14 ++++++++++++++
 compiler/src/CFCGoTypeMap.h |  3 +++
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f3b369a/compiler/src/CFCGoTypeMap.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoTypeMap.c b/compiler/src/CFCGoTypeMap.c
index 62f04ab..3913ecf 100644
--- a/compiler/src/CFCGoTypeMap.c
+++ b/compiler/src/CFCGoTypeMap.c
@@ -125,6 +125,20 @@ CFCGoTypeMap_go_type_name(CFCType *type, CFCParcel 
*current_parcel) {
 }
 
 char*
+CFCGoTypeMap_cgo_type_name(CFCType *type) {
+    if (CFCType_is_object(type)) {
+        const char *specifier  = CFCType_get_specifier(type);
+        return CFCUtil_sprintf("*C.%s", specifier);
+    }
+    else if (CFCType_is_primitive(type)) {
+        const char *specifier = CFCType_get_specifier(type);
+        return CFCUtil_sprintf("C.%s", specifier);
+    }
+
+    return NULL;
+}
+
+char*
 CFCGoTypeMap_go_var_to_c(CFCType *type, const char *go_var) {
     char *result = NULL;
 

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/0f3b369a/compiler/src/CFCGoTypeMap.h
----------------------------------------------------------------------
diff --git a/compiler/src/CFCGoTypeMap.h b/compiler/src/CFCGoTypeMap.h
index d99dc41..9d1d419 100644
--- a/compiler/src/CFCGoTypeMap.h
+++ b/compiler/src/CFCGoTypeMap.h
@@ -29,6 +29,9 @@ CFCGoTypeMap_go_type_name(struct CFCType *type,
                           struct CFCParcel *current_parcel);
 
 char*
+CFCGoTypeMap_cgo_type_name(struct CFCType *type);
+
+char*
 CFCGoTypeMap_go_var_to_c(struct CFCType *type, const char *go_var);
 
 char*

Reply via email to