You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/03/19 18:27:14 UTC
[04/14] lucy-clownfish git commit: Add extra parameter to Obj_To_Host
Add extra parameter to Obj_To_Host
This parameter will be used to pass the conversion cache around.
Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/f3eea9b2
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/f3eea9b2
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/f3eea9b2
Branch: refs/heads/master
Commit: f3eea9b22fef28df418cc4f71f861d9c7f2ab3d8
Parents: 3e0546f
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Mar 8 11:54:47 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Mar 10 14:47:23 2016 +0100
----------------------------------------------------------------------
compiler/src/CFCPerlMethod.c | 2 +-
compiler/src/CFCPerlTypeMap.c | 2 +-
runtime/c/src/clownfish.c | 35 +++++++--------
runtime/core/Clownfish/Blob.cfh | 2 +-
runtime/core/Clownfish/Boolean.cfh | 2 +-
runtime/core/Clownfish/ByteBuf.cfh | 2 +-
runtime/core/Clownfish/Hash.cfh | 2 +-
runtime/core/Clownfish/Num.cfh | 4 +-
runtime/core/Clownfish/Obj.cfh | 2 +-
runtime/core/Clownfish/String.cfh | 2 +-
runtime/core/Clownfish/Vector.cfh | 2 +-
runtime/example-lang/src/Clownfish/Obj.c | 2 +-
runtime/go/ext/clownfish.c | 38 +++++++++--------
.../perl/buildlib/Clownfish/Build/Binding.pm | 11 +++--
runtime/perl/xs/XSBind.c | 45 ++++++++++++--------
runtime/perl/xs/XSBind.h | 2 +-
runtime/python/cfext/CFBind.c | 27 ++++++++----
runtime/python/cfext/CFBind.h | 4 +-
18 files changed, 103 insertions(+), 83 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/compiler/src/CFCPerlMethod.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlMethod.c b/compiler/src/CFCPerlMethod.c
index 911d51d..08d32e2 100644
--- a/compiler/src/CFCPerlMethod.c
+++ b/compiler/src/CFCPerlMethod.c
@@ -456,7 +456,7 @@ S_callback_start(CFCMethod *method) {
" ENTER;\n"
" SAVETMPS;\n"
" PUSHMARK(SP);\n"
- " mPUSHs((SV*)CFISH_Obj_To_Host((cfish_Obj*)self));\n";
+ " mPUSHs((SV*)CFISH_Obj_To_Host((cfish_Obj*)self, NULL));\n";
int num_args = (int)CFCParamList_num_vars(param_list) - 1;
int num_to_extend = num_args == 0 ? 1
: num_args == 1 ? 2
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/compiler/src/CFCPerlTypeMap.c
----------------------------------------------------------------------
diff --git a/compiler/src/CFCPerlTypeMap.c b/compiler/src/CFCPerlTypeMap.c
index c975c4f..d416284 100644
--- a/compiler/src/CFCPerlTypeMap.c
+++ b/compiler/src/CFCPerlTypeMap.c
@@ -278,7 +278,7 @@ CFCPerlTypeMap_write_xs_typemap(CFCHierarchy *hierarchy) {
class_var, ", ", allocation, ");\n\n", NULL);
output = CFCUtil_cat(output, class_var, "_\n"
- " $arg = (SV*)CFISH_Obj_To_Host((cfish_Obj*)$var);\n"
+ " $arg = (SV*)CFISH_Obj_To_Host((cfish_Obj*)$var, NULL);\n"
" CFISH_DECREF($var);\n"
"\n", NULL);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/c/src/clownfish.c
----------------------------------------------------------------------
diff --git a/runtime/c/src/clownfish.c b/runtime/c/src/clownfish.c
index 3566cf9..239a796 100644
--- a/runtime/c/src/clownfish.c
+++ b/runtime/c/src/clownfish.c
@@ -120,8 +120,9 @@ cfish_dec_refcount(void *vself) {
}
void*
-Obj_To_Host_IMP(Obj *self) {
+Obj_To_Host_IMP(Obj *self, void *vcache) {
UNUSED_VAR(self);
+ UNUSED_VAR(vcache);
THROW(ERR, "Obj_To_Host not supported in C bindings");
UNREACHABLE_RETURN(void*);
}
@@ -264,58 +265,58 @@ cfish_TestUtils_destroy_host_runtime(void *runtime) {
/**** To_Host methods ******************************************************/
void*
-Str_To_Host_IMP(String *self) {
+Str_To_Host_IMP(String *self, void *vcache) {
Str_To_Host_t super_to_host
= SUPER_METHOD_PTR(STRING, CFISH_Str_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Blob_To_Host_IMP(Blob *self) {
+Blob_To_Host_IMP(Blob *self, void *vcache) {
Blob_To_Host_t super_to_host
= SUPER_METHOD_PTR(BLOB, CFISH_Blob_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-BB_To_Host_IMP(ByteBuf *self) {
+BB_To_Host_IMP(ByteBuf *self, void *vcache) {
BB_To_Host_t super_to_host
= SUPER_METHOD_PTR(BYTEBUF, CFISH_BB_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Vec_To_Host_IMP(Vector *self) {
+Vec_To_Host_IMP(Vector *self, void *vcache) {
Vec_To_Host_t super_to_host
= SUPER_METHOD_PTR(VECTOR, CFISH_Vec_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Hash_To_Host_IMP(Hash *self) {
+Hash_To_Host_IMP(Hash *self, void *vcache) {
Hash_To_Host_t super_to_host
= SUPER_METHOD_PTR(HASH, CFISH_Hash_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Float_To_Host_IMP(Float *self) {
+Float_To_Host_IMP(Float *self, void *vcache) {
Float_To_Host_t super_to_host
= SUPER_METHOD_PTR(FLOAT, CFISH_Float_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Int_To_Host_IMP(Integer *self) {
+Int_To_Host_IMP(Integer *self, void *vcache) {
Int_To_Host_t super_to_host
= SUPER_METHOD_PTR(INTEGER, CFISH_Int_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Bool_To_Host_IMP(Boolean *self) {
+Bool_To_Host_IMP(Boolean *self, void *vcache) {
Bool_To_Host_t super_to_host
= SUPER_METHOD_PTR(BOOLEAN, CFISH_Bool_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/core/Clownfish/Blob.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Blob.cfh b/runtime/core/Clownfish/Blob.cfh
index 9d21a31..505d4a4 100644
--- a/runtime/core/Clownfish/Blob.cfh
+++ b/runtime/core/Clownfish/Blob.cfh
@@ -77,7 +77,7 @@ public final class Clownfish::Blob inherits Clownfish::Obj {
init_wrap(Blob *self, const void *bytes, size_t size);
void*
- To_Host(Blob *self);
+ To_Host(Blob *self, void *vcache);
/** Return the number of bytes held by the Blob.
*/
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/core/Clownfish/Boolean.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Boolean.cfh b/runtime/core/Clownfish/Boolean.cfh
index 36a7d28..318e56d 100644
--- a/runtime/core/Clownfish/Boolean.cfh
+++ b/runtime/core/Clownfish/Boolean.cfh
@@ -39,7 +39,7 @@ public final class Clownfish::Boolean nickname Bool {
singleton(bool value);
void*
- To_Host(Boolean *self);
+ To_Host(Boolean *self, void *vcache);
/** Return the value of the Boolean.
*/
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/core/Clownfish/ByteBuf.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/ByteBuf.cfh b/runtime/core/Clownfish/ByteBuf.cfh
index 5e60ed3..9934520 100644
--- a/runtime/core/Clownfish/ByteBuf.cfh
+++ b/runtime/core/Clownfish/ByteBuf.cfh
@@ -76,7 +76,7 @@ public final class Clownfish::ByteBuf nickname BB inherits Clownfish::Obj {
size_t capacity);
void*
- To_Host(ByteBuf *self);
+ To_Host(ByteBuf *self, void *vcache);
/** Resize the ByteBuf to `size`. If greater than the object's capacity,
* throws an error.
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/core/Clownfish/Hash.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Hash.cfh b/runtime/core/Clownfish/Hash.cfh
index 590d3c9..d8b695c 100644
--- a/runtime/core/Clownfish/Hash.cfh
+++ b/runtime/core/Clownfish/Hash.cfh
@@ -51,7 +51,7 @@ public final class Clownfish::Hash inherits Clownfish::Obj {
get_tombstone();
void*
- To_Host(Hash *self);
+ To_Host(Hash *self, void *vcache);
/** Empty the hash of all key-value pairs.
*/
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/core/Clownfish/Num.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Num.cfh b/runtime/core/Clownfish/Num.cfh
index 07befa4..778bb6a 100644
--- a/runtime/core/Clownfish/Num.cfh
+++ b/runtime/core/Clownfish/Num.cfh
@@ -37,7 +37,7 @@ public final class Clownfish::Float {
init(Float* self, double value);
void*
- To_Host(Float *self);
+ To_Host(Float *self, void *vcache);
/** Return the value of the Float.
*/
@@ -101,7 +101,7 @@ public final class Clownfish::Integer nickname Int {
init(Integer* self, int64_t value);
void*
- To_Host(Integer *self);
+ To_Host(Integer *self, void *vcache);
/** Return the value of the Integer.
*/
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/core/Clownfish/Obj.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Obj.cfh b/runtime/core/Clownfish/Obj.cfh
index 30b14e0..5241a16 100644
--- a/runtime/core/Clownfish/Obj.cfh
+++ b/runtime/core/Clownfish/Obj.cfh
@@ -31,7 +31,7 @@ public abstract class Clownfish::Obj {
/** Return a host-language object wrapper for this object.
*/
void*
- To_Host(Obj *self);
+ To_Host(Obj *self, void *vcache);
/** Return a clone of the object.
*/
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/core/Clownfish/String.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/String.cfh b/runtime/core/Clownfish/String.cfh
index c279e75..72f60a1 100644
--- a/runtime/core/Clownfish/String.cfh
+++ b/runtime/core/Clownfish/String.cfh
@@ -142,7 +142,7 @@ public final class Clownfish::String nickname Str
newf(const char *pattern, ...);
void*
- To_Host(String *self);
+ To_Host(String *self, void *vcache);
/** Return the concatenation of the String and `other`.
*/
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/core/Clownfish/Vector.cfh
----------------------------------------------------------------------
diff --git a/runtime/core/Clownfish/Vector.cfh b/runtime/core/Clownfish/Vector.cfh
index cacf475..5cfa0da 100644
--- a/runtime/core/Clownfish/Vector.cfh
+++ b/runtime/core/Clownfish/Vector.cfh
@@ -41,7 +41,7 @@ public final class Clownfish::Vector nickname Vec inherits Clownfish::Obj {
init(Vector *self, size_t capacity = 0);
void*
- To_Host(Vector *self);
+ To_Host(Vector *self, void *vcache);
/** Push an item onto the end of a Vector.
*/
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/example-lang/src/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/runtime/example-lang/src/Clownfish/Obj.c b/runtime/example-lang/src/Clownfish/Obj.c
index c4a5dce..a0d1055 100644
--- a/runtime/example-lang/src/Clownfish/Obj.c
+++ b/runtime/example-lang/src/Clownfish/Obj.c
@@ -37,7 +37,7 @@ cfish_dec_refcount(void *vself) {
}
void*
-CFISH_Obj_To_Host_IMP(cfish_Obj *self) {
+CFISH_Obj_To_Host_IMP(cfish_Obj *self, void *vcache) {
THROW(CFISH_ERR, "TODO");
UNREACHABLE_RETURN(void*);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/go/ext/clownfish.c
----------------------------------------------------------------------
diff --git a/runtime/go/ext/clownfish.c b/runtime/go/ext/clownfish.c
index 884fe0e..28f95b5 100644
--- a/runtime/go/ext/clownfish.c
+++ b/runtime/go/ext/clownfish.c
@@ -124,8 +124,9 @@ cfish_dec_refcount(void *vself) {
}
void*
-Obj_To_Host_IMP(Obj *self) {
+Obj_To_Host_IMP(Obj *self, void *vcache) {
UNUSED_VAR(self);
+ UNUSED_VAR(vcache);
THROW(ERR, "Unimplemented for Go");
UNREACHABLE_RETURN(void*);
}
@@ -169,8 +170,9 @@ Class_find_parent_class(String *class_name) {
}
void*
-Class_To_Host_IMP(Class *self) {
+Class_To_Host_IMP(Class *self, void *vcache) {
UNUSED_VAR(self);
+ UNUSED_VAR(vcache);
THROW(ERR, "Unimplemented for Go");
UNREACHABLE_RETURN(void*);
}
@@ -251,59 +253,59 @@ Err_trap(Err_Attempt_t routine, void *context) {
/***************************** To_Host methods *****************************/
void*
-Str_To_Host_IMP(String *self) {
+Str_To_Host_IMP(String *self, void *vcache) {
Str_To_Host_t super_to_host
= SUPER_METHOD_PTR(STRING, CFISH_Str_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Blob_To_Host_IMP(Blob *self) {
+Blob_To_Host_IMP(Blob *self, void *vcache) {
Blob_To_Host_t super_to_host
= SUPER_METHOD_PTR(BLOB, CFISH_Blob_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-BB_To_Host_IMP(ByteBuf *self) {
+BB_To_Host_IMP(ByteBuf *self, void *vcache) {
BB_To_Host_t super_to_host
= SUPER_METHOD_PTR(BYTEBUF, CFISH_BB_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Vec_To_Host_IMP(Vector *self) {
+Vec_To_Host_IMP(Vector *self, void *vcache) {
Vec_To_Host_t super_to_host
= SUPER_METHOD_PTR(VECTOR, CFISH_Vec_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Hash_To_Host_IMP(Hash *self) {
+Hash_To_Host_IMP(Hash *self, void *vcache) {
Hash_To_Host_t super_to_host
= SUPER_METHOD_PTR(HASH, CFISH_Hash_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Float_To_Host_IMP(Float *self) {
+Float_To_Host_IMP(Float *self, void *vcache) {
Float_To_Host_t super_to_host
= SUPER_METHOD_PTR(FLOAT, CFISH_Float_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Int_To_Host_IMP(Integer *self) {
+Int_To_Host_IMP(Integer *self, void *vcache) {
Int_To_Host_t super_to_host
= SUPER_METHOD_PTR(INTEGER, CFISH_Int_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
void*
-Bool_To_Host_IMP(Boolean *self) {
+Bool_To_Host_IMP(Boolean *self, void *vcache) {
Bool_To_Host_t super_to_host
= SUPER_METHOD_PTR(BOOLEAN, CFISH_Bool_To_Host);
- return super_to_host(self);
+ return super_to_host(self, vcache);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/perl/buildlib/Clownfish/Build/Binding.pm
----------------------------------------------------------------------
diff --git a/runtime/perl/buildlib/Clownfish/Build/Binding.pm b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
index 6d9e87e..ec8ac12 100644
--- a/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -750,7 +750,6 @@ END_POD
$pod_spec->set_synopsis($synopsis);
$pod_spec->set_description($description);
$pod_spec->add_method(
- method => 'To_Host',
alias => 'to_perl',
pod => $to_perl_pod,
);
@@ -768,7 +767,7 @@ get_class(self)
cfish_Obj *self
CODE:
cfish_Class *klass = cfish_Obj_get_class(self);
- RETVAL = (SV*)CFISH_Class_To_Host(klass);
+ RETVAL = (SV*)CFISH_Class_To_Host(klass, NULL);
OUTPUT: RETVAL
SV*
@@ -776,7 +775,7 @@ get_class_name(self)
cfish_Obj *self
CODE:
cfish_String *class_name = cfish_Obj_get_class_name(self);
- RETVAL = (SV*)CFISH_Str_To_Host(class_name);
+ RETVAL = (SV*)CFISH_Str_To_Host(class_name, NULL);
OUTPUT: RETVAL
bool
@@ -801,7 +800,7 @@ SV*
to_perl(self)
cfish_Obj *self;
CODE:
- RETVAL = (SV*)CFISH_Obj_To_Host(self);
+ RETVAL = (SV*)CFISH_Obj_To_Host(self, NULL);
OUTPUT: RETVAL
END_XS_CODE
@@ -921,7 +920,7 @@ CODE:
{
cfish_Class *klass = cfish_Class_fetch_class(class_name);
CFISH_UNUSED_VAR(unused_sv);
- RETVAL = klass ? (SV*)CFISH_Class_To_Host(klass) : &PL_sv_undef;
+ RETVAL = klass ? (SV*)CFISH_Class_To_Host(klass, NULL) : &PL_sv_undef;
}
OUTPUT: RETVAL
@@ -948,7 +947,7 @@ CODE:
aTHX_ ST(locations[1]), "parent", CFISH_CLASS, NULL);
}
singleton = cfish_Class_singleton(class_name, parent);
- RETVAL = (SV*)CFISH_Class_To_Host(singleton);
+ RETVAL = (SV*)CFISH_Class_To_Host(singleton, NULL);
}
OUTPUT: RETVAL
END_XS_CODE
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/perl/xs/XSBind.c
----------------------------------------------------------------------
diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c
index a4f9046..793d5eb 100644
--- a/runtime/perl/xs/XSBind.c
+++ b/runtime/perl/xs/XSBind.c
@@ -719,7 +719,8 @@ XSBind_cfish_obj_to_sv_noinc(pTHX_ cfish_Obj *obj) {
}
void*
-CFISH_Obj_To_Host_IMP(cfish_Obj *self) {
+CFISH_Obj_To_Host_IMP(cfish_Obj *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
dTHX;
return XSBind_cfish_obj_to_sv_inc(aTHX_ self);
}
@@ -752,8 +753,8 @@ cfish_Class_register_with_host(cfish_Class *singleton, cfish_Class *parent) {
SAVETMPS;
EXTEND(SP, 2);
PUSHMARK(SP);
- mPUSHs((SV*)CFISH_Class_To_Host(singleton));
- mPUSHs((SV*)CFISH_Class_To_Host(parent));
+ mPUSHs((SV*)CFISH_Class_To_Host(singleton, NULL));
+ mPUSHs((SV*)CFISH_Class_To_Host(parent, NULL));
PUTBACK;
call_pv("Clownfish::Class::_register", G_VOID | G_DISCARD);
FREETMPS;
@@ -768,7 +769,7 @@ cfish_Class_fresh_host_methods(cfish_String *class_name) {
SAVETMPS;
EXTEND(SP, 1);
PUSHMARK(SP);
- mPUSHs((SV*)CFISH_Str_To_Host(class_name));
+ mPUSHs((SV*)CFISH_Str_To_Host(class_name, NULL));
PUTBACK;
call_pv("Clownfish::Class::_fresh_host_methods", G_SCALAR);
SPAGAIN;
@@ -788,7 +789,7 @@ cfish_Class_find_parent_class(cfish_String *class_name) {
SAVETMPS;
EXTEND(SP, 1);
PUSHMARK(SP);
- mPUSHs((SV*)CFISH_Str_To_Host(class_name));
+ mPUSHs((SV*)CFISH_Str_To_Host(class_name, NULL));
PUTBACK;
call_pv("Clownfish::Class::_find_parent_class", G_SCALAR);
SPAGAIN;
@@ -863,7 +864,7 @@ cfish_Err_set_error(cfish_Err *error) {
PUSHMARK(SP);
PUSHmortal;
if (error) {
- mPUSHs((SV*)CFISH_Err_To_Host(error));
+ mPUSHs((SV*)CFISH_Err_To_Host(error, NULL));
}
else {
PUSHmortal;
@@ -878,7 +879,7 @@ void
cfish_Err_do_throw(cfish_Err *err) {
dTHX;
dSP;
- SV *error_sv = (SV*)CFISH_Err_To_Host(err);
+ SV *error_sv = (SV*)CFISH_Err_To_Host(err, NULL);
CFISH_DECREF(err);
ENTER;
SAVETMPS;
@@ -900,7 +901,7 @@ cfish_Err_throw_mess(cfish_Class *klass, cfish_String *message) {
void
cfish_Err_warn_mess(cfish_String *message) {
dTHX;
- SV *error_sv = (SV*)CFISH_Str_To_Host(message);
+ SV *error_sv = (SV*)CFISH_Str_To_Host(message, NULL);
CFISH_DECREF(message);
warn("%s", SvPV_nolen(error_sv));
SvREFCNT_dec(error_sv);
@@ -955,7 +956,8 @@ cfish_Err_trap(CFISH_Err_Attempt_t routine, void *context) {
/**************************** Clownfish::String *****************************/
void*
-CFISH_Str_To_Host_IMP(cfish_String *self) {
+CFISH_Str_To_Host_IMP(cfish_String *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
dTHX;
SV *sv = newSVpvn(CFISH_Str_Get_Ptr8(self), CFISH_Str_Get_Size(self));
SvUTF8_on(sv);
@@ -965,7 +967,8 @@ CFISH_Str_To_Host_IMP(cfish_String *self) {
/***************************** Clownfish::Blob ******************************/
void*
-CFISH_Blob_To_Host_IMP(cfish_Blob *self) {
+CFISH_Blob_To_Host_IMP(cfish_Blob *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
dTHX;
return newSVpvn(CFISH_Blob_Get_Buf(self), CFISH_Blob_Get_Size(self));
}
@@ -973,7 +976,8 @@ CFISH_Blob_To_Host_IMP(cfish_Blob *self) {
/**************************** Clownfish::ByteBuf ****************************/
void*
-CFISH_BB_To_Host_IMP(cfish_ByteBuf *self) {
+CFISH_BB_To_Host_IMP(cfish_ByteBuf *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
dTHX;
return newSVpvn(CFISH_BB_Get_Buf(self), CFISH_BB_Get_Size(self));
}
@@ -981,7 +985,7 @@ CFISH_BB_To_Host_IMP(cfish_ByteBuf *self) {
/**************************** Clownfish::Vector *****************************/
void*
-CFISH_Vec_To_Host_IMP(cfish_Vector *self) {
+CFISH_Vec_To_Host_IMP(cfish_Vector *self, void *vcache) {
dTHX;
AV *perl_array = newAV();
uint32_t num_elems = CFISH_Vec_Get_Size(self);
@@ -996,7 +1000,7 @@ CFISH_Vec_To_Host_IMP(cfish_Vector *self) {
}
else {
// Recurse for each value.
- SV *const val_sv = (SV*)CFISH_Obj_To_Host(val);
+ SV *const val_sv = (SV*)CFISH_Obj_To_Host(val, vcache);
av_store(perl_array, i, val_sv);
}
}
@@ -1008,7 +1012,7 @@ CFISH_Vec_To_Host_IMP(cfish_Vector *self) {
/***************************** Clownfish::Hash ******************************/
void*
-CFISH_Hash_To_Host_IMP(cfish_Hash *self) {
+CFISH_Hash_To_Host_IMP(cfish_Hash *self, void *vcache) {
dTHX;
HV *perl_hash = newHV();
cfish_HashIterator *iter = cfish_HashIter_new(self);
@@ -1021,7 +1025,9 @@ CFISH_Hash_To_Host_IMP(cfish_Hash *self) {
// Recurse for each value.
cfish_Obj *val = CFISH_HashIter_Get_Value(iter);
- SV *val_sv = XSBind_cfish_to_perl(aTHX_ val);
+ SV *val_sv = val
+ ? (SV*)CFISH_Obj_To_Host(val, vcache)
+ : newSV(0);
// Using a negative `klen` argument to signal UTF-8 is undocumented
// in older Perl versions but works since 5.8.0.
@@ -1035,13 +1041,15 @@ CFISH_Hash_To_Host_IMP(cfish_Hash *self) {
/****************************** Clownfish::Num ******************************/
void*
-CFISH_Float_To_Host_IMP(cfish_Float *self) {
+CFISH_Float_To_Host_IMP(cfish_Float *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
dTHX;
return newSVnv(self->value);
}
void*
-CFISH_Int_To_Host_IMP(cfish_Integer *self) {
+CFISH_Int_To_Host_IMP(cfish_Integer *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
dTHX;
SV *sv = NULL;
@@ -1056,7 +1064,8 @@ CFISH_Int_To_Host_IMP(cfish_Integer *self) {
}
void*
-CFISH_Bool_To_Host_IMP(cfish_Boolean *self) {
+CFISH_Bool_To_Host_IMP(cfish_Boolean *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
dTHX;
return newSViv((IV)self->value);
}
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/perl/xs/XSBind.h
----------------------------------------------------------------------
diff --git a/runtime/perl/xs/XSBind.h b/runtime/perl/xs/XSBind.h
index 98e48c7..03ee676 100644
--- a/runtime/perl/xs/XSBind.h
+++ b/runtime/perl/xs/XSBind.h
@@ -104,7 +104,7 @@ cfish_XSBind_cfish_obj_to_sv_noinc(pTHX_ cfish_Obj *obj);
*/
static CFISH_INLINE SV*
cfish_XSBind_cfish_to_perl(pTHX_ cfish_Obj *obj) {
- return obj ? (SV*)CFISH_Obj_To_Host(obj) : newSV(0);
+ return obj ? (SV*)CFISH_Obj_To_Host(obj, NULL) : newSV(0);
}
/** Convert a Perl SV to a Clownfish object of class `klass`.
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/python/cfext/CFBind.c
----------------------------------------------------------------------
diff --git a/runtime/python/cfext/CFBind.c b/runtime/python/cfext/CFBind.c
index cd77078..4c5780e 100644
--- a/runtime/python/cfext/CFBind.c
+++ b/runtime/python/cfext/CFBind.c
@@ -852,7 +852,8 @@ cfish_dec_refcount(void *vself) {
/**** Obj ******************************************************************/
void*
-CFISH_Obj_To_Host_IMP(cfish_Obj *self) {
+CFISH_Obj_To_Host_IMP(cfish_Obj *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
return CFISH_INCREF(self);
}
@@ -1103,28 +1104,32 @@ cfish_TestUtils_destroy_host_runtime(void *runtime) {
/**** To_Host methods ******************************************************/
void*
-CFISH_Str_To_Host_IMP(cfish_String *self) {
+CFISH_Str_To_Host_IMP(cfish_String *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
const char *ptr = CFISH_Str_Get_Ptr8(self);
size_t size = CFISH_Str_Get_Size(self);
return PyUnicode_FromStringAndSize(ptr, size);
}
void*
-CFISH_Blob_To_Host_IMP(cfish_Blob *self) {
+CFISH_Blob_To_Host_IMP(cfish_Blob *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
const char *buf = CFISH_Blob_Get_Buf(self);
size_t size = CFISH_Blob_Get_Size(self);
return PyBytes_FromStringAndSize(buf, size);
}
void*
-CFISH_BB_To_Host_IMP(cfish_ByteBuf *self) {
+CFISH_BB_To_Host_IMP(cfish_ByteBuf *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
CFISH_BB_To_Host_t super_to_host
= CFISH_SUPER_METHOD_PTR(CFISH_BYTEBUF, CFISH_BB_To_Host);
return super_to_host(self);
}
void*
-CFISH_Vec_To_Host_IMP(cfish_Vector *self) {
+CFISH_Vec_To_Host_IMP(cfish_Vector *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
uint32_t num_elems = CFISH_Vec_Get_Size(self);
PyObject *list = PyList_New(num_elems);
@@ -1139,7 +1144,8 @@ CFISH_Vec_To_Host_IMP(cfish_Vector *self) {
}
void*
-CFISH_Hash_To_Host_IMP(cfish_Hash *self) {
+CFISH_Hash_To_Host_IMP(cfish_Hash *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
PyObject *dict = PyDict_New();
// Iterate over key-value pairs.
@@ -1164,18 +1170,21 @@ CFISH_Hash_To_Host_IMP(cfish_Hash *self) {
}
void*
-CFISH_Float_To_Host_IMP(cfish_Float *self) {
+CFISH_Float_To_Host_IMP(cfish_Float *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
return PyFloat_FromDouble(CFISH_Float_Get_Value(self));
}
void*
-CFISH_Int_To_Host_IMP(cfish_Integer *self) {
+CFISH_Int_To_Host_IMP(cfish_Integer *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
int64_t num = CFISH_Int_Get_Value(self);
return PyLong_FromLongLong(num);
}
void*
-CFISH_Bool_To_Host_IMP(cfish_Boolean *self) {
+CFISH_Bool_To_Host_IMP(cfish_Boolean *self, void *vcache) {
+ CFISH_UNUSED_VAR(vcache);
if (self == CFISH_TRUE) {
Py_INCREF(Py_True);
return Py_True;
http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f3eea9b2/runtime/python/cfext/CFBind.h
----------------------------------------------------------------------
diff --git a/runtime/python/cfext/CFBind.h b/runtime/python/cfext/CFBind.h
index 9c8d53f..5d385fb 100644
--- a/runtime/python/cfext/CFBind.h
+++ b/runtime/python/cfext/CFBind.h
@@ -55,7 +55,7 @@ CFBind_migrate_cferr(void);
static CFISH_INLINE PyObject*
CFBind_cfish_to_py(struct cfish_Obj *obj) {
if (obj != NULL) {
- return (PyObject*)CFISH_Obj_To_Host(obj);
+ return (PyObject*)CFISH_Obj_To_Host(obj, NULL);
}
else {
Py_RETURN_NONE;
@@ -69,7 +69,7 @@ CFBind_cfish_to_py(struct cfish_Obj *obj) {
static CFISH_INLINE PyObject*
CFBind_cfish_to_py_zeroref(struct cfish_Obj *obj) {
if (obj != NULL) {
- PyObject *result = (PyObject*)CFISH_Obj_To_Host(obj);
+ PyObject *result = (PyObject*)CFISH_Obj_To_Host(obj, NULL);
CFISH_DECREF(obj);
return result;
}