Repository: lucy-clownfish Updated Branches: refs/heads/master a94a2ec57 -> decdc56a0
Remove Class#Foster_Obj Export this functionality as XSBind_foster_obj. Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/48587241 Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/48587241 Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/48587241 Branch: refs/heads/master Commit: 48587241de652ca4a10bacf18538e1265be0fe71 Parents: cd536bb Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Sat Sep 26 17:58:30 2015 +0200 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Sat Sep 26 17:58:30 2015 +0200 ---------------------------------------------------------------------- runtime/c/src/clownfish.c | 8 -------- runtime/core/Clownfish/Class.cfh | 5 ----- runtime/example-lang/src/Clownfish/Class.c | 6 ------ runtime/go/ext/clownfish.c | 8 -------- runtime/perl/xs/XSBind.c | 23 +++++++++++------------ runtime/perl/xs/XSBind.h | 6 ++++++ 6 files changed, 17 insertions(+), 39 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/48587241/runtime/c/src/clownfish.c ---------------------------------------------------------------------- diff --git a/runtime/c/src/clownfish.c b/runtime/c/src/clownfish.c index d40f571..3566cf9 100644 --- a/runtime/c/src/clownfish.c +++ b/runtime/c/src/clownfish.c @@ -145,14 +145,6 @@ Class_Init_Obj_IMP(Class *self, void *allocation) { return obj; } -Obj* -Class_Foster_Obj_IMP(Class *self, void *host_obj) { - UNUSED_VAR(self); - UNUSED_VAR(host_obj); - THROW(ERR, "Class_Foster_Obj not supported in C bindings"); - UNREACHABLE_RETURN(Obj*); -} - void Class_register_with_host(Class *singleton, Class *parent) { UNUSED_VAR(singleton); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/48587241/runtime/core/Clownfish/Class.cfh ---------------------------------------------------------------------- diff --git a/runtime/core/Clownfish/Class.cfh b/runtime/core/Clownfish/Class.cfh index ab08415..f826598 100644 --- a/runtime/core/Clownfish/Class.cfh +++ b/runtime/core/Clownfish/Class.cfh @@ -112,11 +112,6 @@ final class Clownfish::Class inherits Clownfish::Obj { incremented Obj* Init_Obj(Class *self, void *allocation); - /** Create a new object to go with the supplied host object. - */ - Obj* - Foster_Obj(Class *self, void *host_obj); - void Add_Host_Method_Alias(Class *self, const char *alias, const char *meth_name); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/48587241/runtime/example-lang/src/Clownfish/Class.c ---------------------------------------------------------------------- diff --git a/runtime/example-lang/src/Clownfish/Class.c b/runtime/example-lang/src/Clownfish/Class.c index 48ad548..31bcc99 100644 --- a/runtime/example-lang/src/Clownfish/Class.c +++ b/runtime/example-lang/src/Clownfish/Class.c @@ -31,12 +31,6 @@ CFISH_Class_Init_Obj_IMP(cfish_Class *self, void *allocation) { UNREACHABLE_RETURN(cfish_Obj*); } -cfish_Obj* -CFISH_Class_Foster_Obj_IMP(cfish_Class *self, void *host_obj) { - THROW(CFISH_ERR, "TODO"); - UNREACHABLE_RETURN(cfish_Obj*); -} - void cfish_Class_register_with_host(cfish_Class *singleton, cfish_Class *parent) { THROW(CFISH_ERR, "TODO"); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/48587241/runtime/go/ext/clownfish.c ---------------------------------------------------------------------- diff --git a/runtime/go/ext/clownfish.c b/runtime/go/ext/clownfish.c index 56682d4..5d8c01f 100644 --- a/runtime/go/ext/clownfish.c +++ b/runtime/go/ext/clownfish.c @@ -149,14 +149,6 @@ Class_Init_Obj_IMP(Class *self, void *allocation) { return obj; } -Obj* -Class_Foster_Obj_IMP(Class *self, void *host_obj) { - UNUSED_VAR(self); - UNUSED_VAR(host_obj); - THROW(ERR, "Unimplemented for Go"); - UNREACHABLE_RETURN(Obj*); -} - void Class_register_with_host(Class *singleton, Class *parent) { UNUSED_VAR(singleton); http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/48587241/runtime/perl/xs/XSBind.c ---------------------------------------------------------------------- diff --git a/runtime/perl/xs/XSBind.c b/runtime/perl/xs/XSBind.c index a4ec829..39f4c5a 100644 --- a/runtime/perl/xs/XSBind.c +++ b/runtime/perl/xs/XSBind.c @@ -78,6 +78,17 @@ XSBind_new_blank_obj(pTHX_ SV *either_sv) { } cfish_Obj* +XSBind_foster_obj(pTHX_ SV *sv, cfish_Class *klass) { + cfish_Obj *obj + = (cfish_Obj*)cfish_Memory_wrapped_calloc(klass->obj_alloc_size, 1); + SV *inner_obj = SvRV((SV*)sv); + obj->klass = klass; + sv_setiv(inner_obj, PTR2IV(obj)); + obj->ref.host_obj = inner_obj; + return obj; +} + +cfish_Obj* XSBind_perl_to_cfish(pTHX_ SV *sv, cfish_Class *klass) { cfish_Obj *retval = NULL; if (!S_maybe_perl_to_cfish(aTHX_ sv, klass, true, NULL, &retval)) { @@ -701,18 +712,6 @@ CFISH_Class_Init_Obj_IMP(cfish_Class *self, void *allocation) { return obj; } -cfish_Obj* -CFISH_Class_Foster_Obj_IMP(cfish_Class *self, void *host_obj) { - dTHX; - cfish_Obj *obj - = (cfish_Obj*)cfish_Memory_wrapped_calloc(self->obj_alloc_size, 1); - SV *inner_obj = SvRV((SV*)host_obj); - obj->klass = self; - sv_setiv(inner_obj, PTR2IV(obj)); - obj->ref.host_obj = inner_obj; - return obj; -} - void cfish_Class_register_with_host(cfish_Class *singleton, cfish_Class *parent) { dTHX; http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/48587241/runtime/perl/xs/XSBind.h ---------------------------------------------------------------------- diff --git a/runtime/perl/xs/XSBind.h b/runtime/perl/xs/XSBind.h index 609c5bb..096fbc0 100644 --- a/runtime/perl/xs/XSBind.h +++ b/runtime/perl/xs/XSBind.h @@ -50,6 +50,11 @@ extern "C" { CFISH_VISIBLE cfish_Obj* cfish_XSBind_new_blank_obj(pTHX_ SV *either_sv); +/** Create a new object to go with the supplied host object. + */ +CFISH_VISIBLE cfish_Obj* +cfish_XSBind_foster_obj(pTHX_ SV *sv, cfish_Class *klass); + /** Test whether an SV is defined. Handles "get" magic, unlike SvOK on its * own. */ @@ -307,6 +312,7 @@ cfish_XSBind_allot_params(pTHX_ SV** stack, int32_t start, * named "XSBind_sv_defined".) */ #define XSBind_new_blank_obj cfish_XSBind_new_blank_obj +#define XSBind_foster_obj cfish_XSBind_foster_obj #define XSBind_sv_defined cfish_XSBind_sv_defined #define XSBind_cfish_obj_to_sv cfish_XSBind_cfish_obj_to_sv #define XSBind_cfish_obj_to_sv_noinc cfish_XSBind_cfish_obj_to_sv_noinc