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/01/13 22:30:00 UTC
[lucy-commits] svn commit: r1231312 - in /incubator/lucy/trunk: c/src/Lucy/Object/
clownfish/perl/lib/Clownfish/
clownfish/perl/lib/Clownfish/CFC/Binding/Perl/ clownfish/perl/t/
clownfish/src/ core/Lucy/Object/ example-lang/src/Lucy/Object/ perl/lib/
perl/t/ perl/xs/...
Author: marvin
Date: Fri Jan 13 21:29:59 2012
New Revision: 1231312
URL: http://svn.apache.org/viewvc?rev=1231312&view=rev
Log:
Differentiate between "novel" and "fresh" methods.
A method is "novel" if it has never been defined before within the inheritance
chain. A "novel" method does not override any other method.
A class's "fresh" methods are all the methods which it implements itself
rather than inheriting.
All "novel" methods are "fresh" for some class, but not all "fresh" methods
are "novel".
Modified:
incubator/lucy/trunk/c/src/Lucy/Object/VTable.c
incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC.xs
incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Binding/Perl/Class.pm
incubator/lucy/trunk/clownfish/perl/t/202-overridden_method.t
incubator/lucy/trunk/clownfish/perl/t/400-class.t
incubator/lucy/trunk/clownfish/src/CFCBindClass.c
incubator/lucy/trunk/clownfish/src/CFCClass.c
incubator/lucy/trunk/clownfish/src/CFCClass.h
incubator/lucy/trunk/clownfish/src/CFCDumpable.c
incubator/lucy/trunk/clownfish/src/CFCMethod.c
incubator/lucy/trunk/clownfish/src/CFCMethod.h
incubator/lucy/trunk/core/Lucy/Object/VTable.c
incubator/lucy/trunk/core/Lucy/Object/VTable.cfh
incubator/lucy/trunk/example-lang/src/Lucy/Object/VTable.c
incubator/lucy/trunk/perl/lib/Lucy.pm
incubator/lucy/trunk/perl/t/021-vtable.t
incubator/lucy/trunk/perl/xs/Lucy/Object/VTable.c
Modified: incubator/lucy/trunk/c/src/Lucy/Object/VTable.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/c/src/Lucy/Object/VTable.c?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/c/src/Lucy/Object/VTable.c (original)
+++ incubator/lucy/trunk/c/src/Lucy/Object/VTable.c Fri Jan 13 21:29:59 2012
@@ -31,7 +31,7 @@ lucy_VTable_register_with_host(lucy_VTab
}
lucy_VArray*
-lucy_VTable_novel_host_methods(const lucy_CharBuf *class_name) {
+lucy_VTable_fresh_host_methods(const lucy_CharBuf *class_name) {
THROW(LUCY_ERR, "TODO");
UNREACHABLE_RETURN(lucy_VArray*);
}
Modified: incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC.xs
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC.xs?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC.xs (original)
+++ incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC.xs Fri Jan 13 21:29:59 2012
@@ -253,11 +253,11 @@ CODE:
OUTPUT: RETVAL
SV*
-novel_method(self, sym)
+fresh_method(self, sym)
CFCClass *self;
const char *sym;
CODE:
- CFCMethod *method = CFCClass_novel_method(self, sym);
+ CFCMethod *method = CFCClass_fresh_method(self, sym);
RETVAL = S_cfcbase_to_perlref(method);
OUTPUT: RETVAL
@@ -286,8 +286,8 @@ ALIAS:
member_vars = 38
inert_vars = 40
tree_to_ladder = 42
- novel_methods = 44
- novel_member_vars = 46
+ fresh_methods = 44
+ fresh_member_vars = 46
privacy_symbol = 48
PPCODE:
{
@@ -392,15 +392,15 @@ PPCODE:
break;
}
case 44: {
- CFCMethod **novel = CFCClass_novel_methods(self);
- retval = S_array_of_cfcbase_to_av((CFCBase**)novel);
- FREEMEM(novel);
+ CFCMethod **fresh = CFCClass_fresh_methods(self);
+ retval = S_array_of_cfcbase_to_av((CFCBase**)fresh);
+ FREEMEM(fresh);
break;
}
case 46: {
- CFCVariable **novel = CFCClass_novel_member_vars(self);
- retval = S_array_of_cfcbase_to_av((CFCBase**)novel);
- FREEMEM(novel);
+ CFCVariable **fresh = CFCClass_fresh_member_vars(self);
+ retval = S_array_of_cfcbase_to_av((CFCBase**)fresh);
+ FREEMEM(fresh);
break;
}
case 48: {
Modified: incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Binding/Perl/Class.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Binding/Perl/Class.pm?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Binding/Perl/Class.pm (original)
+++ incubator/lucy/trunk/clownfish/perl/lib/Clownfish/CFC/Binding/Perl/Class.pm Fri Jan 13 21:29:59 2012
@@ -122,7 +122,7 @@ sub method_bindings {
# the object using VTable method dispatch. Doing things this way
# allows SUPER:: invocations from Perl-space to work properly.
for my $descendant ( @{ $client->tree_to_ladder } ) { # includes self
- my $real_method = $descendant->novel_method( lc($meth_name) );
+ my $real_method = $descendant->fresh_method( lc($meth_name) );
next unless $real_method;
# Create the binding, add it to the array.
Modified: incubator/lucy/trunk/clownfish/perl/t/202-overridden_method.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/t/202-overridden_method.t?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/t/202-overridden_method.t (original)
+++ incubator/lucy/trunk/clownfish/perl/t/202-overridden_method.t Fri Jan 13 21:29:59 2012
@@ -42,5 +42,5 @@ my $overrider = Clownfish::CFC::Method->
class_cnick => 'FooJr'
);
$overrider->override($orig);
-ok( !$overrider->novel );
+ok( !$overrider->novel, "A Method which overrides another is not 'novel'" );
Modified: incubator/lucy/trunk/clownfish/perl/t/400-class.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/perl/t/400-class.t?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/perl/t/400-class.t (original)
+++ incubator/lucy/trunk/clownfish/perl/t/400-class.t Fri Jan 13 21:29:59 2012
@@ -118,21 +118,21 @@ like( $@, qr/grow_tree/, "Forbid add_met
is( ${ $foo_jr->get_parent }, $$foo, "grow_tree, one level" );
is( ${ $final_foo->get_parent }, $$foo_jr, "grow_tree, two levels" );
-is( ${ $foo->novel_method("Do_Stuff") }, $$do_stuff, 'novel_method' );
+is( ${ $foo->fresh_method("Do_Stuff") }, $$do_stuff, 'fresh_method' );
is( ${ $foo_jr->method("Do_Stuff") }, $$do_stuff, "inherited method" );
-ok( !$foo_jr->novel_method("Do_Stuff"), 'inherited method not novel' );
+ok( !$foo_jr->fresh_method("Do_Stuff"), 'inherited method not "fresh"' );
ok( $final_foo->method("Do_Stuff")->final, "Finalize inherited method" );
ok( !$foo_jr->method("Do_Stuff")->final, "Don't finalize method in parent" );
is_deeply( $foo->inert_vars, [$widget], "inert vars" );
is_deeply( $foo->functions, [$tread_water], "inert funcs" );
is_deeply( $foo->methods, [$do_stuff], "methods" );
-is_deeply( $foo->novel_methods, [$do_stuff], "novel_methods" );
-is_deeply( $foo->novel_member_vars, [$thing], "novel_member_vars" );
+is_deeply( $foo->fresh_methods, [$do_stuff], "fresh_methods" );
+is_deeply( $foo->fresh_member_vars, [$thing], "fresh_member_vars" );
is_deeply( $foo_jr->member_vars, [$thing], "inherit member vars" );
is_deeply( $foo_jr->functions, [], "don't inherit inert funcs" );
-is_deeply( $foo_jr->novel_member_vars, [], "novel_member_vars" );
+is_deeply( $foo_jr->fresh_member_vars, [], "fresh_member_vars" );
is_deeply( $foo_jr->inert_vars, [], "don't inherit inert vars" );
-is_deeply( $final_foo->novel_methods, [], "novel_methods" );
+is_deeply( $final_foo->fresh_methods, [], "fresh_methods" );
like( $foo_jr->get_autocode, qr/load/i, "autogenerate Dump/Load" );
is_deeply( $foo->tree_to_ladder, [ $foo, $foo_jr, $final_foo ],
Modified: incubator/lucy/trunk/clownfish/src/CFCBindClass.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCBindClass.c?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCBindClass.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCBindClass.c Fri Jan 13 21:29:59 2012
@@ -64,7 +64,7 @@ S_vtable_definition(CFCBindClass *self);
static char*
S_callback_declarations(CFCBindClass *self);
-// Declare typedefs for novel methods, to ease casting.
+// Declare typedefs for fresh methods, to ease casting.
static char*
S_method_typedefs(CFCBindClass *self);
@@ -131,9 +131,9 @@ CFCBindClass_destroy(CFCBindClass *self)
}
static int
-S_method_is_novel(CFCMethod *method, CFCMethod **novel_methods) {
- for (int i = 0; novel_methods[i] != NULL; i++) {
- if (method == novel_methods[i]) { return 1; }
+S_method_is_fresh(CFCMethod *method, CFCMethod **fresh_methods) {
+ for (int i = 0; fresh_methods[i] != NULL; i++) {
+ if (method == fresh_methods[i]) { return 1; }
}
return 0;
}
@@ -305,7 +305,7 @@ CFCBindClass_to_c(CFCBindClass *self) {
char *vtable_def = S_vtable_definition(self);
CFCMethod **methods = CFCClass_methods(client);
- CFCMethod **novel_methods = CFCClass_novel_methods(client);
+ CFCMethod **fresh_methods = CFCClass_fresh_methods(client);
char *offsets = CFCUtil_strdup("");
char *cb_funcs = CFCUtil_strdup("");
@@ -321,7 +321,7 @@ CFCBindClass_to_c(CFCBindClass *self) {
for (int meth_num = 0; methods[meth_num] != NULL; meth_num++) {
CFCMethod *method = methods[meth_num];
- int method_is_novel = S_method_is_novel(method, novel_methods);
+ int method_is_fresh = S_method_is_fresh(method, fresh_methods);
size_t off_sym_size
= CFCMethod_full_offset_sym(method, cnick, NULL, 0);
char *full_offset_sym = (char*)MALLOCATE(off_sym_size);
@@ -340,7 +340,7 @@ CFCBindClass_to_c(CFCBindClass *self) {
FREEMEM(full_offset_sym);
// Create a default implementation for abstract methods.
- if (method_is_novel && CFCMethod_abstract(method)) {
+ if (method_is_fresh && CFCMethod_abstract(method)) {
char *method_def = CFCBindMeth_abstract_method_def(method);
cb_funcs = CFCUtil_cat(cb_funcs, method_def, "\n", NULL);
FREEMEM(method_def);
@@ -350,7 +350,7 @@ CFCBindClass_to_c(CFCBindClass *self) {
// host.
if (CFCMethod_public(method) || CFCMethod_abstract(method)) {
const char *full_cb_sym = CFCMethod_full_callback_sym(method);
- if (method_is_novel) {
+ if (method_is_fresh) {
char *cb_def = CFCBindMeth_callback_def(method);
char *cb_obj_def
= CFCBindMeth_callback_obj_def(method, offset_str);
@@ -424,7 +424,7 @@ CFCBindClass_to_c(CFCBindClass *self) {
sprintf(code, pattern, include_h, offsets, cb_funcs, cb_objects, cb_var,
class_name_def, vtable_def, autocode);
- FREEMEM(novel_methods);
+ FREEMEM(fresh_methods);
FREEMEM(offsets);
FREEMEM(cb_funcs);
FREEMEM(cb_objects);
@@ -556,32 +556,32 @@ S_vtable_definition(CFCBindClass *self)
// Declare cfish_Callback objects.
static char*
S_callback_declarations(CFCBindClass *self) {
- CFCMethod** novel_methods = CFCClass_novel_methods(self->client);
+ CFCMethod** fresh_methods = CFCClass_fresh_methods(self->client);
char *declarations = CFCUtil_strdup("");
- for (int i = 0; novel_methods[i] != NULL; i++) {
- CFCMethod *method = novel_methods[i];
+ for (int i = 0; fresh_methods[i] != NULL; i++) {
+ CFCMethod *method = fresh_methods[i];
if (CFCMethod_public(method) || CFCMethod_abstract(method)) {
char *callback = CFCBindMeth_callback_dec(method);
declarations = CFCUtil_cat(declarations, callback, NULL);
FREEMEM(callback);
}
}
- FREEMEM(novel_methods);
+ FREEMEM(fresh_methods);
return declarations;
}
-// Declare typedefs for novel methods, to ease casting.
+// Declare typedefs for every fresh method implementation, to ease casting.
static char*
S_method_typedefs(CFCBindClass *self) {
- CFCMethod** novel_methods = CFCClass_novel_methods(self->client);
+ CFCMethod** fresh_methods = CFCClass_fresh_methods(self->client);
char *typedefs = CFCUtil_strdup("");
- for (int i = 0; novel_methods[i] != NULL; i++) {
- CFCMethod *method = novel_methods[i];
+ for (int i = 0; fresh_methods[i] != NULL; i++) {
+ CFCMethod *method = fresh_methods[i];
char *typedef_str = CFCBindMeth_typdef_dec(method);
typedefs = CFCUtil_cat(typedefs, typedef_str, "\n", NULL);
FREEMEM(typedef_str);
}
- FREEMEM(novel_methods);
+ FREEMEM(fresh_methods);
return typedefs;
}
@@ -601,7 +601,7 @@ S_parent_include(CFCBindClass *self) {
static char*
S_sub_declarations(CFCBindClass *self) {
CFCFunction **functions = CFCClass_functions(self->client);
- CFCMethod** novel_methods = CFCClass_novel_methods(self->client);
+ CFCMethod** fresh_methods = CFCClass_fresh_methods(self->client);
char *declarations = CFCUtil_strdup("");
for (int i = 0; functions[i] != NULL; i++) {
CFCFunction *func = functions[i];
@@ -609,13 +609,13 @@ S_sub_declarations(CFCBindClass *self) {
declarations = CFCUtil_cat(declarations, dec, "\n\n", NULL);
FREEMEM(dec);
}
- for (int i = 0; novel_methods[i] != NULL; i++) {
- CFCMethod *method = novel_methods[i];
+ for (int i = 0; fresh_methods[i] != NULL; i++) {
+ CFCMethod *method = fresh_methods[i];
char *dec = CFCBindFunc_func_declaration((CFCFunction*)method);
declarations = CFCUtil_cat(declarations, dec, "\n\n", NULL);
FREEMEM(dec);
}
- FREEMEM(novel_methods);
+ FREEMEM(fresh_methods);
return declarations;
}
@@ -725,9 +725,9 @@ S_short_names(CFCBindClass *self) {
}
if (!CFCClass_inert(client)) {
- CFCMethod **novel_methods = CFCClass_novel_methods(client);
- for (int i = 0; novel_methods[i] != NULL; i++) {
- CFCMethod *meth = novel_methods[i];
+ CFCMethod **fresh_methods = CFCClass_fresh_methods(client);
+ for (int i = 0; fresh_methods[i] != NULL; i++) {
+ CFCMethod *meth = fresh_methods[i];
const char *short_typedef = CFCMethod_short_typedef(meth);
const char *full_typedef = CFCMethod_full_typedef(meth);
short_names = CFCUtil_cat(short_names, " #define ",
@@ -738,7 +738,7 @@ S_short_names(CFCBindClass *self) {
short_names = CFCUtil_cat(short_names, " #define ", short_func,
" ", full_func, "\n", NULL);
}
- FREEMEM(novel_methods);
+ FREEMEM(fresh_methods);
CFCMethod **methods = CFCClass_methods(client);
const char *cnick = CFCClass_get_cnick(client);
Modified: incubator/lucy/trunk/clownfish/src/CFCClass.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCClass.c?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCClass.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCClass.c Fri Jan 13 21:29:59 2012
@@ -462,7 +462,7 @@ CFCClass_method(CFCClass *self, const ch
}
CFCMethod*
-CFCClass_novel_method(CFCClass *self, const char *sym) {
+CFCClass_fresh_method(CFCClass *self, const char *sym) {
CFCMethod *method = CFCClass_method(self, sym);
if (method) {
const char *cnick = CFCClass_get_cnick(self);
@@ -540,7 +540,12 @@ S_bequeath_methods(CFCClass *self) {
// if child class is a final class.
if (child->is_final) {
for (i = 0; i < num_methods; i++) {
- methods[i] = CFCMethod_finalize(methods[i]);
+ if (CFCMethod_final(methods[i])) {
+ CFCBase_incref((CFCBase*)methods[i]);
+ }
+ else {
+ methods[i] = CFCMethod_finalize(methods[i]);
+ }
}
}
else {
@@ -637,33 +642,33 @@ CFCClass_tree_to_ladder(CFCClass *self)
}
static CFCSymbol**
-S_novel_syms(CFCClass *self, CFCSymbol **syms) {
+S_fresh_syms(CFCClass *self, CFCSymbol **syms) {
const char *cnick = CFCClass_get_cnick(self);
size_t count = 0;
while (syms[count] != NULL) { count++; }
size_t amount = (count + 1) * sizeof(CFCSymbol*);
- CFCSymbol **novel = (CFCSymbol**)MALLOCATE(amount);
- size_t num_novel = 0;
+ CFCSymbol **fresh = (CFCSymbol**)MALLOCATE(amount);
+ size_t num_fresh = 0;
size_t i;
for (i = 0; i < count; i++) {
CFCSymbol *sym = syms[i];
const char *sym_cnick = CFCSymbol_get_class_cnick(sym);
if (strcmp(sym_cnick, cnick) == 0) {
- novel[num_novel++] = sym;
+ fresh[num_fresh++] = sym;
}
}
- novel[num_novel] = NULL;
- return novel;
+ fresh[num_fresh] = NULL;
+ return fresh;
}
CFCMethod**
-CFCClass_novel_methods(CFCClass *self) {
- return (CFCMethod**)S_novel_syms(self, (CFCSymbol**)self->methods);
+CFCClass_fresh_methods(CFCClass *self) {
+ return (CFCMethod**)S_fresh_syms(self, (CFCSymbol**)self->methods);
}
CFCVariable**
-CFCClass_novel_member_vars(CFCClass *self) {
- return (CFCVariable**)S_novel_syms(self, (CFCSymbol**)self->member_vars);
+CFCClass_fresh_member_vars(CFCClass *self) {
+ return (CFCVariable**)S_fresh_syms(self, (CFCSymbol**)self->member_vars);
}
CFCClass**
Modified: incubator/lucy/trunk/clownfish/src/CFCClass.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCClass.h?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCClass.h (original)
+++ incubator/lucy/trunk/clownfish/src/CFCClass.h Fri Jan 13 21:29:59 2012
@@ -136,10 +136,10 @@ struct CFCMethod*
CFCClass_method(CFCClass *self, const char *sym);
/** Return a Method object if the Method corresponding to the supplied sym is
- * novel.
+ * implemented in this class.
*/
struct CFCMethod*
-CFCClass_novel_method(CFCClass *self, const char *sym);
+CFCClass_fresh_method(CFCClass *self, const char *sym);
/** Bequeath all inherited methods and members to children.
*/
@@ -152,15 +152,15 @@ CFCClass_grow_tree(CFCClass *self);
CFCClass**
CFCClass_tree_to_ladder(CFCClass *self);
-/** Return an array of all novel methods.
+/** Return an array of all methods implemented in this class.
*/
struct CFCMethod**
-CFCClass_novel_methods(CFCClass *self);
+CFCClass_fresh_methods(CFCClass *self);
-/** Return an array of all novel member variables.
+/** Return an array of all member variables declared in this class.
*/
struct CFCVariable**
-CFCClass_novel_member_vars(CFCClass *self);
+CFCClass_fresh_member_vars(CFCClass *self);
/** Return an array of all child classes.
*/
Modified: incubator/lucy/trunk/clownfish/src/CFCDumpable.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCDumpable.c?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCDumpable.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCDumpable.c Fri Jan 13 21:29:59 2012
@@ -91,19 +91,19 @@ CFCDumpable_add_dumpables(CFCDumpable *s
CFCUtil_die("Class %s isn't dumpable", CFCClass_get_class_name(klass));
}
- // Inherit Dump/Load from parent if no novel member vars.
+ // Inherit Dump/Load from parent if no fresh member vars.
CFCClass *parent = CFCClass_get_parent(klass);
if (parent && CFCClass_has_attribute(parent, "dumpable")) {
- CFCVariable **novel = CFCClass_novel_member_vars(klass);
- int needs_autogenerated_dumpables = novel[0] != NULL ? true : false;
- FREEMEM(novel);
+ CFCVariable **fresh = CFCClass_fresh_member_vars(klass);
+ int needs_autogenerated_dumpables = fresh[0] != NULL ? true : false;
+ FREEMEM(fresh);
if (!needs_autogenerated_dumpables) { return; }
}
- if (!CFCClass_novel_method(klass, "Dump")) {
+ if (!CFCClass_fresh_method(klass, "Dump")) {
S_add_dump_method(klass);
}
- if (!CFCClass_novel_method(klass, "Load")) {
+ if (!CFCClass_fresh_method(klass, "Load")) {
S_add_load_method(klass);
}
}
@@ -188,12 +188,12 @@ S_add_dump_method(CFCClass *klass) {
full_typedef, vtable_var, cnick);
CFCClass_append_autocode(klass, autocode);
FREEMEM(autocode);
- CFCVariable **novel = CFCClass_novel_member_vars(klass);
+ CFCVariable **fresh = CFCClass_fresh_member_vars(klass);
size_t i;
- for (i = 0; novel[i] != NULL; i++) {
- S_process_dump_member(klass, novel[i], buf, BUF_SIZE);
+ for (i = 0; fresh[i] != NULL; i++) {
+ S_process_dump_member(klass, fresh[i], buf, BUF_SIZE);
}
- FREEMEM(novel);
+ FREEMEM(fresh);
}
else {
const char pattern[] =
@@ -255,12 +255,12 @@ S_add_load_method(CFCClass *klass) {
full_typedef, vtable_var, cnick, full_struct, full_struct);
CFCClass_append_autocode(klass, autocode);
FREEMEM(autocode);
- CFCVariable **novel = CFCClass_novel_member_vars(klass);
+ CFCVariable **fresh = CFCClass_fresh_member_vars(klass);
size_t i;
- for (i = 0; novel[i] != NULL; i++) {
- S_process_load_member(klass, novel[i], buf, BUF_SIZE);
+ for (i = 0; fresh[i] != NULL; i++) {
+ S_process_load_member(klass, fresh[i], buf, BUF_SIZE);
}
- FREEMEM(novel);
+ FREEMEM(fresh);
}
else {
const char pattern[] =
Modified: incubator/lucy/trunk/clownfish/src/CFCMethod.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCMethod.c?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCMethod.c (original)
+++ incubator/lucy/trunk/clownfish/src/CFCMethod.c Fri Jan 13 21:29:59 2012
@@ -143,8 +143,8 @@ CFCMethod_init(CFCMethod *self, CFCParce
sprintf(self->full_override_sym, "%s_OVERRIDE", full_func_sym);
// Assume that this method is novel until we discover when applying
- // inheritance that it was overridden.
- self->is_novel = 1;
+ // inheritance that it overrides another.
+ self->is_novel = true;
// Cache typedefs.
S_update_typedefs(self, CFCSymbol_short_sym((CFCSymbol*)self));
@@ -240,7 +240,7 @@ CFCMethod_finalize(CFCMethod *self) {
self->function.param_list,
self->function.docucomment, true,
self->is_abstract);
- finalized->is_novel = self->is_final; // Is this right?
+ finalized->is_novel = false;
S_update_typedefs(finalized, CFCSymbol_short_sym((CFCSymbol*)self));
return finalized;
}
Modified: incubator/lucy/trunk/clownfish/src/CFCMethod.h
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/src/CFCMethod.h?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/src/CFCMethod.h (original)
+++ incubator/lucy/trunk/clownfish/src/CFCMethod.h Fri Jan 13 21:29:59 2012
@@ -169,9 +169,8 @@ CFCMethod_final(CFCMethod *self);
int
CFCMethod_abstract(CFCMethod *self);
-/** Returns true if the method's class is the first in the inheritance
- * hierarchy in which the method was declared -- i.e. the method is neither
- * inherited nor overridden.
+/** Returns true if this method is the first implemenation in the inheritance
+ * hierarchy in which the method was declared.
*/
int
CFCMethod_novel(CFCMethod *self);
Modified: incubator/lucy/trunk/core/Lucy/Object/VTable.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Object/VTable.c?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Object/VTable.c (original)
+++ incubator/lucy/trunk/core/Lucy/Object/VTable.c Fri Jan 13 21:29:59 2012
@@ -126,8 +126,8 @@ VTable_singleton(const CharBuf *subclass
VTable *singleton = (VTable*)LFReg_Fetch(VTable_registry, (Obj*)subclass_name);
if (singleton == NULL) {
- VArray *novel_host_methods;
- uint32_t num_novel;
+ VArray *fresh_host_methods;
+ uint32_t num_fresh;
if (parent == NULL) {
CharBuf *parent_class = VTable_find_parent_class(subclass_name);
@@ -150,15 +150,15 @@ VTable_singleton(const CharBuf *subclass
singleton->name = CB_Clone(subclass_name);
// Allow host methods to override.
- novel_host_methods = VTable_novel_host_methods(subclass_name);
- num_novel = VA_Get_Size(novel_host_methods);
- if (num_novel) {
- Hash *meths = Hash_new(num_novel);
+ fresh_host_methods = VTable_fresh_host_methods(subclass_name);
+ num_fresh = VA_Get_Size(fresh_host_methods);
+ if (num_fresh) {
+ Hash *meths = Hash_new(num_fresh);
uint32_t i;
CharBuf *scrunched = CB_new(0);
ZombieCharBuf *callback_name = ZCB_BLANK();
- for (i = 0; i < num_novel; i++) {
- CharBuf *meth = (CharBuf*)VA_fetch(novel_host_methods, i);
+ for (i = 0; i < num_fresh; i++) {
+ CharBuf *meth = (CharBuf*)VA_fetch(fresh_host_methods, i);
S_scrunch_charbuf(meth, scrunched);
Hash_Store(meths, (Obj*)scrunched, INCREF(&EMPTY));
}
@@ -177,7 +177,7 @@ VTable_singleton(const CharBuf *subclass
DECREF(scrunched);
DECREF(meths);
}
- DECREF(novel_host_methods);
+ DECREF(fresh_host_methods);
// Register the new class, both locally and with host.
if (VTable_add_to_registry(singleton)) {
Modified: incubator/lucy/trunk/core/Lucy/Object/VTable.cfh
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/core/Lucy/Object/VTable.cfh?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/core/Lucy/Object/VTable.cfh (original)
+++ incubator/lucy/trunk/core/Lucy/Object/VTable.cfh Fri Jan 13 21:29:59 2012
@@ -82,11 +82,10 @@ class Lucy::Object::VTable inherits Lucy
inert nullable CharBuf*
find_parent_class(const CharBuf *class_name);
- /** List all of the methods that a class has overridden via the host
- * language.
+ /** List all of the methods defined directly within a host subclass.
*/
inert incremented VArray*
- novel_host_methods(const CharBuf *class_name);
+ fresh_host_methods(const CharBuf *class_name);
/** Replace a function pointer in the VTable.
*/
Modified: incubator/lucy/trunk/example-lang/src/Lucy/Object/VTable.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/example-lang/src/Lucy/Object/VTable.c?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/example-lang/src/Lucy/Object/VTable.c (original)
+++ incubator/lucy/trunk/example-lang/src/Lucy/Object/VTable.c Fri Jan 13 21:29:59 2012
@@ -31,7 +31,7 @@ lucy_VTable_register_with_host(lucy_VTab
}
lucy_VArray*
-lucy_VTable_novel_host_methods(const lucy_CharBuf *class_name) {
+lucy_VTable_fresh_host_methods(const lucy_CharBuf *class_name) {
THROW(LUCY_ERR, "TODO");
UNREACHABLE_RETURN(lucy_VArray*);
}
Modified: incubator/lucy/trunk/perl/lib/Lucy.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/lib/Lucy.pm?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/lib/Lucy.pm (original)
+++ incubator/lucy/trunk/perl/lib/Lucy.pm Fri Jan 13 21:29:59 2012
@@ -176,7 +176,7 @@ sub error {$Lucy::Object::Err::error}
return;
}
- sub novel_host_methods {
+ sub fresh_host_methods {
my ( undef, $package ) = @_;
no strict 'refs';
my $stash = \%{"$package\::"};
Modified: incubator/lucy/trunk/perl/t/021-vtable.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/t/021-vtable.t?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/t/021-vtable.t (original)
+++ incubator/lucy/trunk/perl/t/021-vtable.t Fri Jan 13 21:29:59 2012
@@ -87,8 +87,8 @@ $resurrected->store( "ooga", $booga );
is( $resurrected->fetch("ooga"),
"booga", "subclassed object still performs correctly at the C level" );
-my $methods = Lucy::Object::VTable->novel_host_methods('MyHash');
-is_deeply( $methods->to_perl, ['oodle'], "novel_host_methods" );
+my $methods = Lucy::Object::VTable->fresh_host_methods('MyHash');
+is_deeply( $methods->to_perl, ['oodle'], "fresh_host_methods" );
my $folder = RAMFolderOfDeath->new;
eval { $folder->slurp_file('foo') }; # calls open_in, which dies per above.
Modified: incubator/lucy/trunk/perl/xs/Lucy/Object/VTable.c
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/xs/Lucy/Object/VTable.c?rev=1231312&r1=1231311&r2=1231312&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/xs/Lucy/Object/VTable.c (original)
+++ incubator/lucy/trunk/perl/xs/Lucy/Object/VTable.c Fri Jan 13 21:29:59 2012
@@ -42,10 +42,10 @@ lucy_VTable_register_with_host(lucy_VTab
}
lucy_VArray*
-lucy_VTable_novel_host_methods(const lucy_CharBuf *class_name) {
+lucy_VTable_fresh_host_methods(const lucy_CharBuf *class_name) {
return (lucy_VArray*)lucy_Host_callback_obj(
LUCY_VTABLE,
- "novel_host_methods", 1,
+ "fresh_host_methods", 1,
CFISH_ARG_STR("class_name", class_name));
}