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 2012/11/14 03:22:12 UTC
[lucy-commits] [6/7] git commit: refs/heads/master - Generate callback wrappers for
more methods.
Generate callback wrappers for more methods.
Generate a callback wrapper for every novel, non-final method.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/10262d39
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/10262d39
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/10262d39
Branch: refs/heads/master
Commit: 10262d39704a5d73f68fa9346012c06fa01aeb46
Parents: 17b608b
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Fri Nov 9 17:45:00 2012 -0800
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Tue Nov 13 17:49:42 2012 -0800
----------------------------------------------------------------------
clownfish/compiler/src/CFCBindClass.c | 3 +--
clownfish/compiler/src/CFCBindMethod.c | 10 ++++++++--
clownfish/compiler/src/CFCPerl.c | 3 +--
3 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/10262d39/clownfish/compiler/src/CFCBindClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindClass.c b/clownfish/compiler/src/CFCBindClass.c
index 1eb2560..2bebdc3 100644
--- a/clownfish/compiler/src/CFCBindClass.c
+++ b/clownfish/compiler/src/CFCBindClass.c
@@ -321,8 +321,7 @@ CFCBindClass_to_c_data(CFCBindClass *self) {
}
// Declare (but don't define) callback.
- if ((CFCMethod_public(method) || CFCMethod_abstract(method))
- && CFCMethod_novel(method)) {
+ if (CFCMethod_novel(method) && !CFCMethod_final(method)) {
char *cb_dec = CFCBindMeth_callback_dec(method);
cb_funcs = CFCUtil_cat(cb_funcs, cb_dec, "\n", NULL);
FREEMEM(cb_dec);
http://git-wip-us.apache.org/repos/asf/lucy/blob/10262d39/clownfish/compiler/src/CFCBindMethod.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindMethod.c b/clownfish/compiler/src/CFCBindMethod.c
index 68ba38a..4e17be1 100644
--- a/clownfish/compiler/src/CFCBindMethod.c
+++ b/clownfish/compiler/src/CFCBindMethod.c
@@ -233,7 +233,7 @@ CFCBindMeth_spec_def(CFCMethod *method) {
int is_novel = CFCMethod_novel(method);
const char *full_override_sym = "NULL";
- if ((CFCMethod_public(method) || CFCMethod_abstract(method)) && is_novel) {
+ if (is_novel && !CFCMethod_final(method)) {
full_override_sym = CFCMethod_full_override_sym(method);
}
@@ -375,9 +375,15 @@ CFCBindMeth_callback_def(CFCMethod *method) {
else if (CFCType_is_object(return_type)) {
callback_def = S_obj_callback_def(method, params, refcount_mods);
}
- else {
+ else if (CFCType_is_integer(return_type)
+ || CFCType_is_floating(return_type)
+ ) {
callback_def = S_primitive_callback_def(method, params, refcount_mods);
}
+ else {
+ // Can't map return type.
+ callback_def = S_invalid_callback_def(method);
+ }
FREEMEM(params);
FREEMEM(refcount_mods);
http://git-wip-us.apache.org/repos/asf/lucy/blob/10262d39/clownfish/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.c b/clownfish/compiler/src/CFCPerl.c
index 5c28f07..ca30ad2 100644
--- a/clownfish/compiler/src/CFCPerl.c
+++ b/clownfish/compiler/src/CFCPerl.c
@@ -535,8 +535,7 @@ CFCPerl_write_callbacks(CFCPerl *self) {
CFCMethod *method = fresh_methods[meth_num];
// Define callback.
- if ((CFCMethod_public(method) || CFCMethod_abstract(method))
- && CFCMethod_novel(method)) {
+ if (CFCMethod_novel(method) && !CFCMethod_final(method)) {
char *cb_def = CFCBindMeth_callback_def(method);
content = CFCUtil_cat(content, cb_def, "\n", NULL);
FREEMEM(cb_def);