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 2013/07/26 03:30:41 UTC

[lucy-commits] [1/6] git commit: refs/heads/move-dumpable - Remove class "attributes" from Clownfish.

Updated Branches:
  refs/heads/move-dumpable [created] d294f1e5b


Remove class "attributes" from Clownfish.

Remove the "attributes" misfeature from Clownfish, now that we don't
need it to support "dumpable" any more.


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

Branch: refs/heads/move-dumpable
Commit: d294f1e5bf08b876e10893b2673c723758634cc1
Parents: 251d2bc
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 25 18:22:22 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Jul 25 18:27:24 2013 -0700

----------------------------------------------------------------------
 clownfish/compiler/perl/lib/Clownfish.pod    |  7 +-
 clownfish/compiler/perl/lib/Clownfish/CFC.xs | 17 -----
 clownfish/compiler/perl/t/401-class.t        |  9 +--
 clownfish/compiler/src/CFCClass.c            | 44 ------------
 clownfish/compiler/src/CFCClass.h            | 11 ---
 clownfish/compiler/src/CFCLexHeader.c        | 85 +++++++++++------------
 clownfish/compiler/src/CFCLexHeader.h        |  2 +-
 clownfish/compiler/src/CFCLexHeader.l        |  1 -
 clownfish/compiler/src/CFCParseHeader.y      |  6 --
 clownfish/compiler/src/CFCTestClass.c        | 12 +---
 10 files changed, 46 insertions(+), 148 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/perl/lib/Clownfish.pod
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish.pod b/clownfish/compiler/perl/lib/Clownfish.pod
index d9a8e58..6e86f9e 100644
--- a/clownfish/compiler/perl/lib/Clownfish.pod
+++ b/clownfish/compiler/perl/lib/Clownfish.pod
@@ -101,8 +101,7 @@ Boat_capsize() is a function, Boat_Capsize() is a method.
 
 =head2 Class declaration syntax
 
-    [final] [inert] class CLASSNAME [cnick CNICK] 
-        [inherits PARENT] [ : ATTRIBUTE ]* {
+    [final] [inert] class CLASSNAME [cnick CNICK] [inherits PARENT] {
     
         [declarations]
     
@@ -129,10 +128,6 @@ prefix for every function and method.
 
 =item * B<PARENT> - The full name of the parent class.
 
-=item * B<ATTRIBUTE> - An arbitrary attribute, e.g. "dumpable", or perhaps
-"serializable".  A class may have multiple attributes, each preceded by a
-colon.
-
 =back
 
 =head2 Memory management

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC.xs b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
index 205d191..415f863 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.xs
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
@@ -228,23 +228,6 @@ PPCODE:
     CFCClass_add_method(self, method);
 
 void
-add_attribute(self, name, value_sv)
-    CFCClass *self;
-    const char *name;
-    SV *value_sv;
-PPCODE:
-    char *value = SvOK(value_sv) ? SvPV_nolen(value_sv) : NULL;
-    CFCClass_add_attribute(self, name, value);
-
-int
-has_attribute(self, name)
-    CFCClass *self;
-    const char *name;
-CODE:
-    RETVAL = CFCClass_has_attribute(self, name);
-OUTPUT: RETVAL
-
-void
 grow_tree(self)
     CFCClass *self;
 PPCODE:

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/perl/t/401-class.t
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/t/401-class.t b/clownfish/compiler/perl/t/401-class.t
index c92d545..f6eac88 100644
--- a/clownfish/compiler/perl/t/401-class.t
+++ b/clownfish/compiler/perl/t/401-class.t
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 56;
+use Test::More tests => 53;
 use Clownfish::CFC::Model::Class;
 use Clownfish::CFC::Parser;
 
@@ -81,9 +81,7 @@ my $foo_jr = Clownfish::CFC::Model::Class->create(
     class_name        => 'Foo::FooJr',
     parent_class_name => 'Foo',
 );
-$foo_jr->add_attribute( dumpable => 1 );
 
-ok( $foo_jr->has_attribute('dumpable'), 'has_attribute' );
 is( $foo_jr->get_struct_sym,  'FooJr',       "struct_sym" );
 is( $foo_jr->full_struct_sym, 'neato_FooJr', "full_struct_sym" );
 
@@ -98,7 +96,6 @@ my $final_foo = Clownfish::CFC::Model::Class->create(
     file_spec         => $file_spec,
     final             => 1,
 );
-$final_foo->add_attribute( dumpable => 1 );
 ok( $final_foo->final, "final" );
 is( $final_foo->include_h, 'Foo/FooJr.h', "inlude_h uses path_part" );
 is( $final_foo->get_parent_class_name, 'Foo::FooJr',
@@ -182,7 +179,7 @@ $class_content = q|
      *
      * Wow wow wow.
      */
-    public class Animal::Dog inherits Animal : lovable : drooly {
+    public class Animal::Dog inherits Animal {
         public inert Dog* init(Dog *self, CharBuf *name, CharBuf *fave_food);
         inert uint32_t count();
         inert uint64_t num_dogs;
@@ -233,8 +230,6 @@ for my $method ( @{ $class->methods } ) {
 }
 is( ( scalar grep { $_->public } @{ $class->methods } ),
     6, "pass acl to Method constructor" );
-ok( $class->has_attribute('lovable'), "parsed class attribute" );
-ok( $class->has_attribute('drooly'),  "parsed second class attribute" );
 
 $class_content = qq|
     inert class Rigor::Mortis cnick Mort {

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.c b/clownfish/compiler/src/CFCClass.c
index 7b3fa5a..c2d5a2b 100644
--- a/clownfish/compiler/src/CFCClass.c
+++ b/clownfish/compiler/src/CFCClass.c
@@ -34,11 +34,6 @@
 #include "CFCVariable.h"
 #include "CFCFileSpec.h"
 
-typedef struct CFCClassAttribute {
-    char *name;
-    char *value;
-} CFCClassAttribute;
-
 typedef struct CFCClassRegEntry {
     char *key;
     struct CFCClass *klass;
@@ -67,8 +62,6 @@ struct CFCClass {
     size_t num_member_vars;
     CFCVariable **inert_vars;
     size_t num_inert_vars;
-    CFCClassAttribute **attributes;
-    size_t num_attributes;
     CFCFileSpec *file_spec;
     char *parent_class_name;
     int is_final;
@@ -146,8 +139,6 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
     self->num_member_vars = 0;
     self->inert_vars      = (CFCVariable**)CALLOCATE(1, sizeof(CFCVariable*));
     self->num_inert_vars  = 0;
-    self->attributes      = (CFCClassAttribute**)CALLOCATE(1, sizeof(CFCClassAttribute*));
-    self->num_attributes  = 0;
     self->parent_class_name = CFCUtil_strdup(parent_class_name);
     self->docucomment
         = (CFCDocuComment*)CFCBase_incref((CFCBase*)docucomment);
@@ -233,19 +224,12 @@ CFCClass_destroy(CFCClass *self) {
     for (size_t i = 0; self->inert_vars[i] != NULL; i++) {
         CFCBase_decref((CFCBase*)self->inert_vars[i]);
     }
-    for (size_t i = 0; self->attributes[i] != NULL; i++) {
-        CFCClassAttribute *attribute = self->attributes[i];
-        FREEMEM(attribute->name);
-        FREEMEM(attribute->value);
-        FREEMEM(attribute);
-    }
     CFCBase_decref((CFCBase*)self->file_spec);
     FREEMEM(self->children);
     FREEMEM(self->functions);
     FREEMEM(self->methods);
     FREEMEM(self->member_vars);
     FREEMEM(self->inert_vars);
-    FREEMEM(self->attributes);
     FREEMEM(self->parent_class_name);
     FREEMEM(self->struct_sym);
     FREEMEM(self->ivars_struct);
@@ -439,34 +423,6 @@ CFCClass_add_inert_var(CFCClass *self, CFCVariable *var) {
     self->inert_vars[self->num_inert_vars] = NULL;
 }
 
-void
-CFCClass_add_attribute(CFCClass *self, const char *name, const char *value) {
-    if (!name || !strlen(name)) { CFCUtil_die("'name' is required"); }
-    if (CFCClass_has_attribute(self, name)) {
-        CFCUtil_die("Attribute '%s' already registered", name);
-    }
-    CFCClassAttribute *attribute
-        = (CFCClassAttribute*)MALLOCATE(sizeof(CFCClassAttribute));
-    attribute->name  = CFCUtil_strdup(name);
-    attribute->value = CFCUtil_strdup(value);
-    self->num_attributes++;
-    size_t size = (self->num_attributes + 1) * sizeof(CFCClassAttribute*);
-    self->attributes = (CFCClassAttribute**)REALLOCATE(self->attributes, size);
-    self->attributes[self->num_attributes - 1] = attribute;
-    self->attributes[self->num_attributes] = NULL;
-}
-
-int
-CFCClass_has_attribute(CFCClass *self, const char *name) {
-    CFCUTIL_NULL_CHECK(name);
-    for (size_t i = 0; i < self->num_attributes; i++) {
-        if (strcmp(name, self->attributes[i]->name) == 0) {
-            return true;
-        }
-    }
-    return false;
-}
-
 #define MAX_FUNC_LEN 128
 
 static CFCFunction*

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/src/CFCClass.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.h b/clownfish/compiler/src/CFCClass.h
index a26c9c3..5c52728 100644
--- a/clownfish/compiler/src/CFCClass.h
+++ b/clownfish/compiler/src/CFCClass.h
@@ -117,17 +117,6 @@ CFCClass_add_member_var(CFCClass *self, struct CFCVariable *var);
 void
 CFCClass_add_inert_var(CFCClass *self, struct CFCVariable *var);
 
-/** Add an arbitrary attribute to the class.
- */
-void
-CFCClass_add_attribute(CFCClass *self, const char *name, const char *value);
-
-/** Returns true if the Class object has the supplied attribute, false
- * otherwise.
- */
-int
-CFCClass_has_attribute(CFCClass *self, const char *name);
-
 /* Return the inert Function object for the supplied sym, if any.
  */
 struct CFCFunction*

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/src/CFCLexHeader.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCLexHeader.c b/clownfish/compiler/src/CFCLexHeader.c
index 7ea1c76..b4362a8 100644
--- a/clownfish/compiler/src/CFCLexHeader.c
+++ b/clownfish/compiler/src/CFCLexHeader.c
@@ -377,8 +377,8 @@ static void yy_fatal_error (yyconst char msg[]  );
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
 
-#define YY_NUM_RULES 28
-#define YY_END_OF_BUFFER 29
+#define YY_NUM_RULES 27
+#define YY_END_OF_BUFFER 28
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -388,14 +388,14 @@ struct yy_trans_info
 	};
 static yyconst flex_int16_t yy_accept[76] =
     {   0,
-        0,    0,    0,    0,   29,   27,   26,   26,   27,    7,
-        8,    2,   10,   27,   27,   27,   16,   16,   12,   11,
-       13,   18,    5,    6,   18,    3,    4,   22,   22,   23,
-        0,   17,    0,   16,   16,    0,    0,    0,    0,    1,
-       18,   18,   22,   23,    9,    0,    0,   15,   14,   18,
-        0,   23,    0,    0,    0,   25,   18,    0,   25,    0,
-        0,   24,    0,    0,   18,    0,   24,   24,   19,    0,
-        0,    0,   21,   20,    0
+        0,    0,    0,    0,   28,   26,   25,   25,   26,    7,
+        8,    2,   10,   26,   26,   26,   15,   15,   26,   11,
+       12,   17,    5,    6,   17,    3,    4,   21,   21,   22,
+        0,   16,    0,   15,   15,    0,    0,    0,    0,    1,
+       17,   17,   21,   22,    9,    0,    0,   14,   13,   17,
+        0,   22,    0,    0,    0,   24,   17,    0,   24,    0,
+        0,   23,    0,    0,   17,    0,   23,   23,   18,    0,
+        0,    0,   20,   19,    0
     } ;
 
 static yyconst flex_int32_t yy_ec[256] =
@@ -508,10 +508,10 @@ static yyconst flex_int16_t yy_chk[162] =
     } ;
 
 /* Table of booleans, true if rule could match eol. */
-static yyconst flex_int32_t yy_rule_can_match_eol[29] =
+static yyconst flex_int32_t yy_rule_can_match_eol[28] =
     {   0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 
-    0, 1, 1, 0, 1, 1, 1, 0, 0,     };
+0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 
+    1, 1, 0, 1, 1, 1, 0, 0,     };
 
 static yy_state_type yy_last_accepting_state;
 static char *yy_last_accepting_cpos;
@@ -941,49 +941,50 @@ YY_RULE_SETUP
 case 12:
 YY_RULE_SETUP
 #line 111 "../src/CFCLexHeader.l"
-{ PARSE(CFC_TOKENTYPE_COLON); }
+{ PARSE(CFC_TOKENTYPE_EQUALS); }
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 112 "../src/CFCLexHeader.l"
-{ PARSE(CFC_TOKENTYPE_EQUALS); }
+#line 113 "../src/CFCLexHeader.l"
+{ PARSE(CFC_TOKENTYPE_HEX_LITERAL); }
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
 #line 114 "../src/CFCLexHeader.l"
-{ PARSE(CFC_TOKENTYPE_HEX_LITERAL); }
+{ PARSE(CFC_TOKENTYPE_FLOAT_LITERAL); }
 	YY_BREAK
 case 15:
 YY_RULE_SETUP
 #line 115 "../src/CFCLexHeader.l"
-{ PARSE(CFC_TOKENTYPE_FLOAT_LITERAL); }
+{ PARSE(CFC_TOKENTYPE_INTEGER_LITERAL); }
 	YY_BREAK
 case 16:
+/* rule 16 can match eol */
 YY_RULE_SETUP
 #line 116 "../src/CFCLexHeader.l"
-{ PARSE(CFC_TOKENTYPE_INTEGER_LITERAL); }
+{ PARSE(CFC_TOKENTYPE_STRING_LITERAL); }
 	YY_BREAK
 case 17:
-/* rule 17 can match eol */
 YY_RULE_SETUP
-#line 117 "../src/CFCLexHeader.l"
-{ PARSE(CFC_TOKENTYPE_STRING_LITERAL); }
+#line 118 "../src/CFCLexHeader.l"
+{ PARSE(S_identifier_or_keyword(yytext)); }
 	YY_BREAK
 case 18:
+/* rule 18 can match eol */
 YY_RULE_SETUP
-#line 119 "../src/CFCLexHeader.l"
-{ PARSE(S_identifier_or_keyword(yytext)); }
+#line 120 "../src/CFCLexHeader.l"
+{ BEGIN(CBLOCK);  PARSE(CFC_TOKENTYPE_CBLOCK_START); }
 	YY_BREAK
 case 19:
-/* rule 19 can match eol */
 YY_RULE_SETUP
 #line 121 "../src/CFCLexHeader.l"
-{ BEGIN(CBLOCK);  PARSE(CFC_TOKENTYPE_CBLOCK_START); }
+{ BEGIN(INITIAL); PARSE(CFC_TOKENTYPE_CBLOCK_CLOSE); }
 	YY_BREAK
 case 20:
+/* rule 20 can match eol */
 YY_RULE_SETUP
 #line 122 "../src/CFCLexHeader.l"
-{ BEGIN(INITIAL); PARSE(CFC_TOKENTYPE_CBLOCK_CLOSE); }
+{ PARSE(CFC_TOKENTYPE_BLOB); }
 	YY_BREAK
 case 21:
 /* rule 21 can match eol */
@@ -992,38 +993,32 @@ YY_RULE_SETUP
 { PARSE(CFC_TOKENTYPE_BLOB); }
 	YY_BREAK
 case 22:
-/* rule 22 can match eol */
 YY_RULE_SETUP
 #line 124 "../src/CFCLexHeader.l"
 { PARSE(CFC_TOKENTYPE_BLOB); }
 	YY_BREAK
+/* Parse docucomments, but skip ordinary comments */
 case 23:
+/* rule 23 can match eol */
 YY_RULE_SETUP
-#line 125 "../src/CFCLexHeader.l"
-{ PARSE(CFC_TOKENTYPE_BLOB); }
+#line 127 "../src/CFCLexHeader.l"
+{ PARSE(CFC_TOKENTYPE_DOCUCOMMENT); }
 	YY_BREAK
-/* Parse docucomments, but skip ordinary comments */
 case 24:
 /* rule 24 can match eol */
 YY_RULE_SETUP
 #line 128 "../src/CFCLexHeader.l"
-{ PARSE(CFC_TOKENTYPE_DOCUCOMMENT); }
+
 	YY_BREAK
 case 25:
 /* rule 25 can match eol */
 YY_RULE_SETUP
-#line 129 "../src/CFCLexHeader.l"
-
+#line 130 "../src/CFCLexHeader.l"
+/* Skip whitespace. */
 	YY_BREAK
 case 26:
-/* rule 26 can match eol */
 YY_RULE_SETUP
 #line 131 "../src/CFCLexHeader.l"
-/* Skip whitespace. */
-	YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 132 "../src/CFCLexHeader.l"
 { 
                 printf("Bad input character '%s' at line %d\n", yytext, yylineno);
                 yyterminate();
@@ -1031,15 +1026,15 @@ YY_RULE_SETUP
 	YY_BREAK
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(CBLOCK):
-#line 136 "../src/CFCLexHeader.l"
+#line 135 "../src/CFCLexHeader.l"
 { yyterminate(); }
 	YY_BREAK
-case 28:
+case 27:
 YY_RULE_SETUP
-#line 137 "../src/CFCLexHeader.l"
+#line 136 "../src/CFCLexHeader.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 1043 "../src/CFCLexHeader.c"
+#line 1038 "../src/CFCLexHeader.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -2043,7 +2038,7 @@ void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 137 "../src/CFCLexHeader.l"
+#line 136 "../src/CFCLexHeader.l"
 
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/src/CFCLexHeader.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCLexHeader.h b/clownfish/compiler/src/CFCLexHeader.h
index a983964..16b76f2 100644
--- a/clownfish/compiler/src/CFCLexHeader.h
+++ b/clownfish/compiler/src/CFCLexHeader.h
@@ -307,7 +307,7 @@ extern int yylex (void);
 #undef YY_DECL
 #endif
 
-#line 137 "../src/CFCLexHeader.l"
+#line 136 "../src/CFCLexHeader.l"
 
 
 #line 314 "../src/CFCLexHeader.h"

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/src/CFCLexHeader.l
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCLexHeader.l b/clownfish/compiler/src/CFCLexHeader.l
index 878789b..567cbeb 100644
--- a/clownfish/compiler/src/CFCLexHeader.l
+++ b/clownfish/compiler/src/CFCLexHeader.l
@@ -108,7 +108,6 @@
 \.\.\.     { PARSE(CFC_TOKENTYPE_ELLIPSIS); }
 ,          { PARSE(CFC_TOKENTYPE_COMMA); }
 ;          { PARSE(CFC_TOKENTYPE_SEMICOLON); }
-:          { PARSE(CFC_TOKENTYPE_COLON); }
 =          { PARSE(CFC_TOKENTYPE_EQUALS); }
 
 -?0x[0-9A-Fa-f]+       { PARSE(CFC_TOKENTYPE_HEX_LITERAL); }

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/src/CFCParseHeader.y
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCParseHeader.y b/clownfish/compiler/src/CFCParseHeader.y
index 3c4c9c6..40530be 100644
--- a/clownfish/compiler/src/CFCParseHeader.y
+++ b/clownfish/compiler/src/CFCParseHeader.y
@@ -381,12 +381,6 @@ class_head(A) ::=                exposure_specifier(C)
 class_head(A) ::= docucomment(B)                                                    CLASS qualified_id(E)                              .  { A = S_start_class(state, B,    NULL, NULL, E,    NULL, NULL ); }
 class_head(A) ::=                                                                   CLASS qualified_id(E)                              .  { A = S_start_class(state, NULL, NULL, NULL, E,    NULL, NULL ); }
 
-class_head(A) ::= class_head(B) COLON IDENTIFIER(C).
-{
-    A = B;
-    CFCClass_add_attribute(A, C, "1");
-}
-
 class_defs(A) ::= class_head(B) LEFT_CURLY_BRACE.
 {
     A = B;

http://git-wip-us.apache.org/repos/asf/lucy/blob/d294f1e5/clownfish/compiler/src/CFCTestClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestClass.c b/clownfish/compiler/src/CFCTestClass.c
index f94a71b..81e09bb 100644
--- a/clownfish/compiler/src/CFCTestClass.c
+++ b/clownfish/compiler/src/CFCTestClass.c
@@ -44,7 +44,7 @@ S_has_symbol(CFCSymbol **symbols, const char *micro_sym);
 
 const CFCTestBatch CFCTEST_BATCH_CLASS = {
     "Clownfish::CFC::Model::Class",
-    86,
+    83,
     S_run_tests
 };
 
@@ -100,8 +100,6 @@ S_run_tests(CFCTest *test) {
     CFCClass *foo_jr
         = CFCClass_create(neato, NULL, "Foo::FooJr", NULL, NULL, NULL, NULL,
                           "Foo", 0, 0);
-    CFCClass_add_attribute(foo_jr, "dumpable", "1");
-    OK(test, CFCClass_has_attribute(foo_jr, "dumpable"), "has_attribute");
     STR_EQ(test, CFCClass_get_struct_sym(foo_jr), "FooJr",
            "get_struct_sym");
     STR_EQ(test, CFCClass_full_struct_sym(foo_jr), "neato_FooJr",
@@ -110,7 +108,6 @@ S_run_tests(CFCTest *test) {
     CFCClass *final_foo
         = CFCClass_create(neato, NULL, "Foo::FooJr::FinalFoo", NULL, NULL, NULL,
                           file_spec, "Foo::FooJr", 1, 0);
-    CFCClass_add_attribute(final_foo, "dumpable", "1");
     OK(test, CFCClass_final(final_foo), "final");
     STR_EQ(test, CFCClass_include_h(final_foo), "Foo/FooJr.h",
            "include_h uses path_part");
@@ -256,7 +253,7 @@ S_run_tests(CFCTest *test) {
             " *\n"
             " * Wow wow wow.\n"
             " */\n"
-            "public class Animal::Dog inherits Animal : lovable : drooly {\n"
+            "public class Animal::Dog inherits Animal {\n"
             "    public inert Dog* init(Dog *self, CharBuf *name,\n"
             "                           CharBuf *fave_food);\n"
             "    inert uint32_t count();\n"
@@ -306,11 +303,6 @@ S_run_tests(CFCTest *test) {
         }
         INT_EQ(test, num_public_methods, 6, "pass acl to Method constructor");
 
-        OK(test, CFCClass_has_attribute(klass, "lovable"),
-           "parsed class attribute");
-        OK(test, CFCClass_has_attribute(klass, "drooly"),
-           "parsed second class attribute");
-
         CFCBase_decref((CFCBase*)klass);
     }
 


[lucy-commits] [4/6] git commit: refs/heads/move-dumpable - Remove CFCDumpable.

Posted by ma...@apache.org.
Remove CFCDumpable.

CFCDumpable is obsolete since we are no longer using it to autogenerate
implementations for Dump/Load -- remove it.


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

Branch: refs/heads/move-dumpable
Commit: c9be1053e893609d15505f52724efd6ca365d745
Parents: 163c43e
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 25 16:31:13 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Jul 25 18:27:24 2013 -0700

----------------------------------------------------------------------
 clownfish/compiler/include/CFC.h                |   1 -
 clownfish/compiler/perl/lib/Clownfish/CFC.pm    |   5 -
 clownfish/compiler/perl/lib/Clownfish/CFC.xs    |  21 -
 .../compiler/perl/lib/Clownfish/CFC/Dumpable.pm |  20 -
 clownfish/compiler/perl/t/401-class.t           |   3 +-
 clownfish/compiler/perl/typemap                 |   1 -
 clownfish/compiler/src/CFCClass.c               |  28 --
 clownfish/compiler/src/CFCDumpable.c            | 405 -------------------
 clownfish/compiler/src/CFCDumpable.h            |  68 ----
 clownfish/compiler/src/CFCTestClass.c           |   7 +-
 10 files changed, 2 insertions(+), 557 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/include/CFC.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/include/CFC.h b/clownfish/compiler/include/CFC.h
index 080ad61..9a13607 100644
--- a/clownfish/compiler/include/CFC.h
+++ b/clownfish/compiler/include/CFC.h
@@ -18,7 +18,6 @@
 #include "CFCCBlock.h"
 #include "CFCClass.h"
 #include "CFCDocuComment.h"
-#include "CFCDumpable.h"
 #include "CFCFile.h"
 #include "CFCFileSpec.h"
 #include "CFCFunction.h"

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/perl/lib/Clownfish/CFC.pm
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC.pm b/clownfish/compiler/perl/lib/Clownfish/CFC.pm
index b891516..c918155 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.pm
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.pm
@@ -167,11 +167,6 @@ BEGIN { XSLoader::load( 'Clownfish::CFC', '0.01' ) }
 }
 
 {
-    package Clownfish::CFC::Dumpable;
-    BEGIN { push our @ISA, 'Clownfish::CFC::Base' }
-}
-
-{
     package Clownfish::CFC::Model::File;
     BEGIN { push our @ISA, 'Clownfish::CFC::Base' }
     use Clownfish::CFC::Util qw( verify_args );

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC.xs b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
index fafe3c3..2af743f 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.xs
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
@@ -512,27 +512,6 @@ PPCODE:
     END_SET_OR_GET_SWITCH
 }
 
-MODULE = Clownfish::CFC   PACKAGE = Clownfish::CFC::Dumpable
-
-SV*
-new(klass)
-    const char *klass;
-CODE:
-    if (strcmp(klass, "Clownfish::CFC::Dumpable")) {
-        croak("No subclassing allowed");
-    }
-    CFCDumpable *self = CFCDumpable_new();
-    RETVAL = S_cfcbase_to_perlref(self);
-    CFCBase_decref((CFCBase*)self);
-OUTPUT: RETVAL
-
-void
-add_dumpables(self, klass)
-    CFCDumpable *self;
-    CFCClass *klass;
-PPCODE:
-    CFCDumpable_add_dumpables(self, klass);
-
 
 MODULE = Clownfish::CFC   PACKAGE = Clownfish::CFC::Model::File
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/perl/lib/Clownfish/CFC/Dumpable.pm
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC/Dumpable.pm b/clownfish/compiler/perl/lib/Clownfish/CFC/Dumpable.pm
deleted file mode 100644
index 05a2197..0000000
--- a/clownfish/compiler/perl/lib/Clownfish/CFC/Dumpable.pm
+++ /dev/null
@@ -1,20 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-package Clownfish::CFC::Dumpable;
-use Clownfish::CFC;
-
-1;
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/perl/t/401-class.t
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/t/401-class.t b/clownfish/compiler/perl/t/401-class.t
index 6cf51a2..c92d545 100644
--- a/clownfish/compiler/perl/t/401-class.t
+++ b/clownfish/compiler/perl/t/401-class.t
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 57;
+use Test::More tests => 56;
 use Clownfish::CFC::Model::Class;
 use Clownfish::CFC::Parser;
 
@@ -156,7 +156,6 @@ 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->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 ],
     'tree_to_ladder' );
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/perl/typemap
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/typemap b/clownfish/compiler/perl/typemap
index 17be341..d744071 100644
--- a/clownfish/compiler/perl/typemap
+++ b/clownfish/compiler/perl/typemap
@@ -18,7 +18,6 @@ CFCBase*	CLOWNFISH_TYPE
 CFCCBlock*	CLOWNFISH_MODEL
 CFCClass*	CLOWNFISH_MODEL
 CFCDocuComment*	CLOWNFISH_MODEL
-CFCDumpable*	CLOWNFISH_TYPE
 CFCFile*	CLOWNFISH_MODEL
 CFCFileSpec*	CLOWNFISH_MODEL
 CFCFunction*	CLOWNFISH_MODEL

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.c b/clownfish/compiler/src/CFCClass.c
index 79c1ec6..6e9179d 100644
--- a/clownfish/compiler/src/CFCClass.c
+++ b/clownfish/compiler/src/CFCClass.c
@@ -26,7 +26,6 @@
 #define CFC_NEED_SYMBOL_STRUCT_DEF
 #include "CFCSymbol.h"
 #include "CFCClass.h"
-#include "CFCDumpable.h"
 #include "CFCFunction.h"
 #include "CFCMethod.h"
 #include "CFCParcel.h"
@@ -96,15 +95,6 @@ S_establish_ancestry(CFCClass *self);
 static void
 S_bequeath_member_vars(CFCClass *self);
 
-// Create auto-generated methods.  This must be called after member vars are
-// passed down but before methods are passed down.
-static void
-S_generate_automethods(CFCClass *self);
-
-// Create dumpable functions unless hand coded versions were supplied.
-static void
-S_create_dumpables(CFCClass *self);
-
 // Pass down methods to from parent to children.
 static void
 S_bequeath_methods(CFCClass *self);
@@ -651,15 +641,6 @@ S_family_tree_size(CFCClass *self) {
     return count;
 }
 
-static void
-S_create_dumpables(CFCClass *self) {
-    if (CFCClass_has_attribute(self, "dumpable")) {
-        CFCDumpable *dumpable = CFCDumpable_new();
-        CFCDumpable_add_dumpables(dumpable, self);
-        CFCBase_decref((CFCBase*)dumpable);
-    }
-}
-
 void
 CFCClass_grow_tree(CFCClass *self) {
     if (self->tree_grown) {
@@ -667,19 +648,10 @@ CFCClass_grow_tree(CFCClass *self) {
     }
     S_establish_ancestry(self);
     S_bequeath_member_vars(self);
-    S_generate_automethods(self);
     S_bequeath_methods(self);
     self->tree_grown = 1;
 }
 
-static void
-S_generate_automethods(CFCClass *self) {
-    S_create_dumpables(self);
-    for (size_t i = 0; i < self->num_kids; i++) {
-        S_generate_automethods(self->children[i]);
-    }
-}
-
 // Return value is valid only so long as object persists (elements are not
 // refcounted).
 CFCClass**

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/src/CFCDumpable.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCDumpable.c b/clownfish/compiler/src/CFCDumpable.c
deleted file mode 100644
index 269eddd..0000000
--- a/clownfish/compiler/src/CFCDumpable.c
+++ /dev/null
@@ -1,405 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <string.h>
-#include <stdio.h>
-
-#ifndef true
-    #define true 1
-    #define false 0
-#endif
-
-#define CFC_NEED_BASE_STRUCT_DEF
-#include "CFCBase.h"
-#include "CFCDumpable.h"
-#include "CFCClass.h"
-#include "CFCFunction.h"
-#include "CFCMethod.h"
-#include "CFCParamList.h"
-#include "CFCParcel.h"
-#include "CFCSymbol.h"
-#include "CFCType.h"
-#include "CFCVariable.h"
-#include "CFCUtil.h"
-
-// Add an autogenerated Dump method to the CFCClass.
-static void
-S_add_dump_method(CFCClass *klass);
-
-// Add an autogenerated Load method to the CFCClass.
-static void
-S_add_load_method(CFCClass *klass);
-
-// Create a Clownfish::CFC::Model::Method object for either Dump() or Load().
-static CFCMethod*
-S_make_method_obj(CFCClass *klass, const char *method_name);
-
-// Generate code for dumping a single member var.
-static void
-S_process_dump_member(CFCClass *klass, CFCVariable *member, char *buf,
-                      size_t buf_size);
-
-// Generate code for loading a single member var.
-static void
-S_process_load_member(CFCClass *klass, CFCVariable *member, char *buf,
-                      size_t buf_size);
-
-struct CFCDumpable {
-    CFCBase base;
-};
-
-static const CFCMeta CFCDUMPABLE_META = {
-    "Clownfish::CFC::Dumpable",
-    sizeof(CFCDumpable),
-    (CFCBase_destroy_t)CFCDumpable_destroy
-};
-
-CFCDumpable*
-CFCDumpable_new(void) {
-    CFCDumpable *self = (CFCDumpable*)CFCBase_allocate(&CFCDUMPABLE_META);
-    return CFCDumpable_init(self);
-}
-
-CFCDumpable*
-CFCDumpable_init(CFCDumpable *self) {
-    return self;
-}
-
-void
-CFCDumpable_destroy(CFCDumpable *self) {
-    CFCBase_destroy((CFCBase*)self);
-}
-
-void
-CFCDumpable_add_dumpables(CFCDumpable *self, CFCClass *klass) {
-    (void)self;
-
-    if (!CFCClass_has_attribute(klass, "dumpable")) {
-        CFCUtil_die("Class %s isn't dumpable", CFCClass_get_class_name(klass));
-    }
-
-    // Inherit Dump/Load from parent if no fresh member vars.
-    CFCClass *parent = CFCClass_get_parent(klass);
-    if (parent && CFCClass_has_attribute(parent, "dumpable")) {
-        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_fresh_method(klass, "Dump")) {
-        S_add_dump_method(klass);
-    }
-    if (!CFCClass_fresh_method(klass, "Load")) {
-        S_add_load_method(klass);
-    }
-}
-
-static CFCMethod*
-S_make_method_obj(CFCClass *klass, const char *method_name) {
-    const char *klass_full_struct_sym = CFCClass_full_struct_sym(klass);
-    const char *klass_name   = CFCClass_get_class_name(klass);
-    const char *klass_cnick  = CFCClass_get_cnick(klass);
-    CFCParcel  *klass_parcel = CFCClass_get_parcel(klass);
-
-    CFCType *return_type = CFCType_new_object(CFCTYPE_INCREMENTED,
-                                              klass_parcel, "cfish_Obj", 1);
-    CFCType *self_type = CFCType_new_object(0, klass_parcel,
-                                            klass_full_struct_sym, 1);
-    CFCVariable *self_var = CFCVariable_new(NULL, NULL, NULL, NULL, "self",
-                                            self_type, false);
-    CFCParamList *param_list = NULL;
-
-    if (strcmp(method_name, "Dump") == 0) {
-        param_list = CFCParamList_new(false);
-        CFCParamList_add_param(param_list, self_var, NULL);
-    }
-    else if (strcmp(method_name, "Load") == 0) {
-        CFCType *dump_type = CFCType_new_object(0, klass_parcel, "cfish_Obj",
-                                                1);
-        CFCVariable *dump_var = CFCVariable_new(NULL, NULL, NULL, NULL, "dump",
-                                                dump_type, false);
-        param_list = CFCParamList_new(false);
-        CFCParamList_add_param(param_list, self_var, NULL);
-        CFCParamList_add_param(param_list, dump_var, NULL);
-        CFCBase_decref((CFCBase*)dump_var);
-        CFCBase_decref((CFCBase*)dump_type);
-    }
-    else {
-        CFCUtil_die("Unexpected method_name: '%s'", method_name);
-    }
-
-    CFCMethod *method = CFCMethod_new(klass_parcel, "public", klass_name,
-                                      klass_cnick, method_name, return_type,
-                                      param_list, NULL, false, false);
-
-    CFCBase_decref((CFCBase*)param_list);
-    CFCBase_decref((CFCBase*)self_type);
-    CFCBase_decref((CFCBase*)self_var);
-    CFCBase_decref((CFCBase*)return_type);
-
-    return method;
-}
-
-#define BUF_SIZE 400
-
-static void
-S_add_dump_method(CFCClass *klass) {
-    CFCMethod *method = S_make_method_obj(klass, "Dump");
-    CFCClass_add_method(klass, method);
-    CFCBase_decref((CFCBase*)method);
-    const char *full_func_sym = CFCMethod_implementing_func_sym(method);
-    const char *full_struct   = CFCClass_full_struct_sym(klass);
-    const char *vtable_var    = CFCClass_full_vtable_var(klass);
-    const char *prefix        = CFCClass_get_prefix(klass);
-    const char *class_cnick   = CFCClass_get_cnick(klass);
-    CFCClass   *parent        = CFCClass_get_parent(klass);
-    char buf[BUF_SIZE];
-
-    if (parent && CFCClass_has_attribute(parent, "dumpable")) {
-        char *full_typedef = CFCMethod_full_typedef(method, klass);
-        char *full_meth    = CFCMethod_full_method_sym(method, klass);
-
-        const char pattern[] =
-            "cfish_Obj*\n"
-            "%s(%s *self)\n"
-            "{\n"
-            "    %sIVARS *ivars = %s%s_IVARS(self);\n"
-            "    %s super_dump = CFISH_SUPER_METHOD_PTR(%s, %s);\n"
-            "    cfish_Hash *dump = (cfish_Hash*)super_dump(self);\n";
-        char *autocode
-            = CFCUtil_sprintf(pattern, full_func_sym, full_struct,
-                              full_struct, prefix, class_cnick,
-                              full_typedef, vtable_var, full_meth);
-        CFCClass_append_autocode(klass, autocode);
-        FREEMEM(full_meth);
-        FREEMEM(full_typedef);
-        FREEMEM(autocode);
-
-        CFCVariable **fresh = CFCClass_fresh_member_vars(klass);
-        for (size_t i = 0; fresh[i] != NULL; i++) {
-            S_process_dump_member(klass, fresh[i], buf, BUF_SIZE);
-        }
-        FREEMEM(fresh);
-    }
-    else {
-        const char pattern[] =
-            "cfish_Obj*\n"
-            "%s(%s *self)\n"
-            "{\n"
-            "    %sIVARS *ivars = %s%s_IVARS(self);\n"
-            "    cfish_Hash *dump = cfish_Hash_new(0);\n"
-            "    Cfish_Hash_Store_Str(dump, \"_class\", 6,\n"
-            "        (cfish_Obj*)Cfish_CB_Clone(Cfish_Obj_Get_Class_Name((cfish_Obj*)self)));\n";
-        char *autocode
-            = CFCUtil_sprintf(pattern, full_func_sym, full_struct,
-                              full_struct, prefix, class_cnick);
-        CFCClass_append_autocode(klass, autocode);
-        FREEMEM(autocode);
-        CFCVariable **members = CFCClass_member_vars(klass);
-        for (size_t i = 0; members[i] != NULL; i++) {
-            S_process_dump_member(klass, members[i], buf, BUF_SIZE);
-        }
-    }
-
-    CFCClass_append_autocode(klass, "    return (cfish_Obj*)dump;\n}\n\n");
-}
-
-static void
-S_add_load_method(CFCClass *klass) {
-    CFCMethod *method = S_make_method_obj(klass, "Load");
-    CFCClass_add_method(klass, method);
-    CFCBase_decref((CFCBase*)method);
-    const char *full_func_sym = CFCMethod_implementing_func_sym(method);
-    const char *full_struct   = CFCClass_full_struct_sym(klass);
-    const char *vtable_var    = CFCClass_full_vtable_var(klass);
-    CFCClass   *parent        = CFCClass_get_parent(klass);
-    const char *prefix        = CFCClass_get_prefix(klass);
-    const char *class_cnick   = CFCClass_get_cnick(klass);
-    char buf[BUF_SIZE];
-
-    if (parent && CFCClass_has_attribute(parent, "dumpable")) {
-        char *full_typedef = CFCMethod_full_typedef(method, klass);
-        char *full_meth    = CFCMethod_full_method_sym(method, klass);
-
-        const char pattern[] =
-            "cfish_Obj*\n"
-            "%s(%s *self, cfish_Obj *dump)\n"
-            "{\n"
-            "    cfish_Hash *source = (cfish_Hash*)CFISH_CERTIFY(dump, CFISH_HASH);\n"
-            "    %s super_load = CFISH_SUPER_METHOD_PTR(%s, %s);\n"
-            "    %s *loaded = (%s*)super_load(self, dump);\n"
-            "    %sIVARS *ivars = %s%s_IVARS(loaded);\n";
-        char *autocode
-            = CFCUtil_sprintf(pattern, full_func_sym, full_struct,
-                              full_typedef, vtable_var, full_meth, full_struct,
-                              full_struct, full_struct, prefix, class_cnick);
-        CFCClass_append_autocode(klass, autocode);
-        FREEMEM(full_meth);
-        FREEMEM(full_typedef);
-        FREEMEM(autocode);
-
-        CFCVariable **fresh = CFCClass_fresh_member_vars(klass);
-        for (size_t i = 0; fresh[i] != NULL; i++) {
-            S_process_load_member(klass, fresh[i], buf, BUF_SIZE);
-        }
-        FREEMEM(fresh);
-    }
-    else {
-        const char pattern[] =
-            "cfish_Obj*\n"
-            "%s(%s *self, cfish_Obj *dump)\n"
-            "{\n"
-            "    cfish_Hash *source = (cfish_Hash*)CFISH_CERTIFY(dump, CFISH_HASH);\n"
-            "    cfish_CharBuf *class_name = (cfish_CharBuf*)CFISH_CERTIFY(\n"
-            "        Cfish_Hash_Fetch_Str(source, \"_class\", 6), CFISH_CHARBUF);\n"
-            "    cfish_VTable *vtable = cfish_VTable_singleton(class_name, NULL);\n"
-            "    %s *loaded = (%s*)Cfish_VTable_Make_Obj(vtable);\n"
-            "    %sIVARS *ivars = %s%s_IVARS(loaded);\n"
-            "    CHY_UNUSED_VAR(self);\n";
-        char *autocode
-            = CFCUtil_sprintf(pattern, full_func_sym, full_struct, full_struct,
-                              full_struct,
-                              full_struct, prefix, class_cnick);
-        CFCClass_append_autocode(klass, autocode);
-        FREEMEM(autocode);
-        CFCVariable **members = CFCClass_member_vars(klass);
-        for (size_t i = 0; members[i] != NULL; i++) {
-            S_process_load_member(klass, members[i], buf, BUF_SIZE);
-        }
-    }
-
-    CFCClass_append_autocode(klass, "    return (cfish_Obj*)loaded;\n}\n\n");
-}
-
-static void
-S_process_dump_member(CFCClass *klass, CFCVariable *member, char *buf,
-                      size_t buf_size) {
-    CFCUTIL_NULL_CHECK(member);
-    CFCType *type = CFCVariable_get_type(member);
-    const char *name = CFCVariable_micro_sym(member);
-    unsigned name_len = (unsigned)strlen(name);
-    const char *specifier = CFCType_get_specifier(type);
-
-    // Skip the VTable.
-    if (strcmp(specifier, "cfish_VTable") == 0) {
-        return;
-    }
-
-    if (CFCType_is_integer(type) || CFCType_is_floating(type)) {
-        char int_pattern[] =
-            "    Cfish_Hash_Store_Str(dump, \"%s\", %u, (cfish_Obj*)cfish_CB_newf(\"%%i64\", (int64_t)ivars->%s));\n";
-        char float_pattern[] =
-            "    Cfish_Hash_Store_Str(dump, \"%s\", %u, (cfish_Obj*)cfish_CB_newf(\"%%f64\", (double)ivars->%s));\n";
-        char bool_pattern[] =
-            "    Cfish_Hash_Store_Str(dump, \"%s\", %u, (cfish_Obj*)cfish_Bool_singleton(ivars->%s));\n";
-        const char *pattern;
-        if (strcmp(specifier, "bool") == 0) {
-            pattern = bool_pattern;
-        }
-        else if (CFCType_is_integer(type)) {
-            pattern = int_pattern;
-        }
-        else {
-            pattern = float_pattern;
-        }
-        size_t needed = strlen(pattern) + name_len * 2 + 20;
-        if (buf_size < needed) {
-            CFCUtil_die("Buffer not big enough (%lu < %lu)",
-                        (unsigned long)buf_size, (unsigned long)needed);
-        }
-        sprintf(buf, pattern, name, name_len, name);
-    }
-    else if (CFCType_is_object(type)) {
-        char pattern[] =
-            "    if (ivars->%s) {\n"
-            "        Cfish_Hash_Store_Str(dump, \"%s\", %u, Cfish_Obj_Dump((cfish_Obj*)ivars->%s));\n"
-            "    }\n";
-
-        size_t needed = strlen(pattern) + name_len * 3 + 20;
-        if (buf_size < needed) {
-            CFCUtil_die("Buffer not big enough (%lu < %lu)",
-                        (unsigned long)buf_size, (unsigned long)needed);
-        }
-        sprintf(buf, pattern, name, name, name_len, name);
-    }
-    else {
-        CFCUtil_die("Don't know how to dump a %s",
-                    CFCType_get_specifier(type));
-    }
-
-    CFCClass_append_autocode(klass, buf);
-}
-
-static void
-S_process_load_member(CFCClass *klass, CFCVariable *member, char *buf,
-                      size_t buf_size) {
-    CFCUTIL_NULL_CHECK(member);
-    CFCType *type = CFCVariable_get_type(member);
-    const char *type_str = CFCType_to_c(type);
-    const char *name = CFCVariable_micro_sym(member);
-    unsigned name_len = (unsigned)strlen(name);
-    char extraction[200];
-    const char *specifier = CFCType_get_specifier(type);
-
-    // Skip the VTable.
-    if (strcmp(specifier, "cfish_VTable") == 0) {
-        return;
-    }
-
-    if (2 * strlen(type_str) + 100 > sizeof(extraction)) { // play it safe
-        CFCUtil_die("type_str too long: '%s'", type_str);
-    }
-    if (CFCType_is_integer(type)) {
-        if (strcmp(specifier, "bool") == 0) {
-            sprintf(extraction, "Cfish_Obj_To_Bool(var)");
-        }
-        else {
-            sprintf(extraction, "(%s)Cfish_Obj_To_I64(var)", type_str);
-        }
-    }
-    else if (CFCType_is_floating(type)) {
-        sprintf(extraction, "(%s)Cfish_Obj_To_F64(var)", type_str);
-    }
-    else if (CFCType_is_object(type)) {
-        const char *vtable_var = CFCType_get_vtable_var(type);
-        sprintf(extraction,
-                "(%s*)CFISH_CERTIFY(Cfish_Obj_Load(var, var), %s)",
-                specifier, vtable_var);
-    }
-    else {
-        CFCUtil_die("Don't know how to load %s", specifier);
-    }
-
-    const char *pattern =
-        "    {\n"
-        "        cfish_Obj *var = Cfish_Hash_Fetch_Str(source, \"%s\", %u);\n"
-        "        if (var) { ivars->%s = %s; }\n"
-        "    }\n";
-    size_t needed = sizeof(pattern)
-                    + (name_len * 2)
-                    + strlen(extraction)
-                    + 20;
-    if (buf_size < needed) {
-        CFCUtil_die("Buffer not big enough (%lu < %lu)",
-                    (unsigned long)buf_size, (unsigned long)needed);
-    }
-    sprintf(buf, pattern, name, name_len, name, extraction);
-
-    CFCClass_append_autocode(klass, buf);
-}
-
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/src/CFCDumpable.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCDumpable.h b/clownfish/compiler/src/CFCDumpable.h
deleted file mode 100644
index c76bd89..0000000
--- a/clownfish/compiler/src/CFCDumpable.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/** Clownfish::CFC::Dumpable - Auto-generate code for "dumpable" classes.
- *
- * If a class declares that it has the attribute "dumpable", but does not
- * declare either Dump or Load(), Clownfish::CFC::Dumpable will attempt to
- * auto-generate those methods if methods inherited from the parent class do
- * not suffice.
- *
- *     class Foo::Bar inherits Foo : dumpable {
- *         Thing *thing;
- *
- *         public inert incremented Bar*
- *         new();
- *
- *         void
- *         Destroy(Bar *self);
- *     }
- */
-
-#ifndef H_CFCDUMPABLE
-#define H_CFCDUMPABLE
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct CFCDumpable CFCDumpable;
-struct CFCClass;
-
-/** Constructor.
- */
-CFCDumpable*
-CFCDumpable_new(void);
-
-CFCDumpable*
-CFCDumpable_init(CFCDumpable *self);
-
-void
-CFCDumpable_destroy(CFCDumpable *self);
-
-
-/** Analyze a class with the attribute "dumpable" and add Dump() or Load()
- * methods as necessary.
- */
-void
-CFCDumpable_add_dumpables(CFCDumpable *self, struct CFCClass *klass);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* H_CFCDUMPABLE */
-

http://git-wip-us.apache.org/repos/asf/lucy/blob/c9be1053/clownfish/compiler/src/CFCTestClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCTestClass.c b/clownfish/compiler/src/CFCTestClass.c
index 2eb4183..f94a71b 100644
--- a/clownfish/compiler/src/CFCTestClass.c
+++ b/clownfish/compiler/src/CFCTestClass.c
@@ -44,7 +44,7 @@ S_has_symbol(CFCSymbol **symbols, const char *micro_sym);
 
 const CFCTestBatch CFCTEST_BATCH_CLASS = {
     "Clownfish::CFC::Model::Class",
-    87,
+    86,
     S_run_tests
 };
 
@@ -202,11 +202,6 @@ S_run_tests(CFCTest *test) {
     }
 
     {
-        const char *autocode = CFCClass_get_autocode(foo_jr);
-        OK(test, strstr(autocode, "load") != NULL, "autogenerate Dump/Load");
-    }
-
-    {
         CFCClass **ladder = CFCClass_tree_to_ladder(foo);
         OK(test, ladder[0] == foo, "ladder[0]");
         OK(test, ladder[1] == foo_jr, "ladder[1]");


[lucy-commits] [2/6] git commit: refs/heads/move-dumpable - Strip "dumpable" attribute.

Posted by ma...@apache.org.
Strip "dumpable" attribute.

The "dumpable" attribute was used to help determine which classes needed
autogenerated Dump/Load.  It is now obsolete, so zap it.


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

Branch: refs/heads/move-dumpable
Commit: ee8fc5c31e6f06a8a0dea685594705d927f39286
Parents: 4b8f8f8
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 25 17:03:05 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Jul 25 18:27:24 2013 -0700

----------------------------------------------------------------------
 core/Lucy/Analysis/Analyzer.cfh           |  3 +--
 core/Lucy/Analysis/CaseFolder.cfh         |  3 +--
 core/Lucy/Analysis/EasyAnalyzer.cfh       |  3 +--
 core/Lucy/Analysis/Normalizer.cfh         |  3 +--
 core/Lucy/Analysis/PolyAnalyzer.cfh       |  3 +--
 core/Lucy/Analysis/SnowballStemmer.cfh    |  2 +-
 core/Lucy/Analysis/SnowballStopFilter.cfh |  2 +-
 core/Lucy/Document/Doc.cfh                |  3 +--
 core/Lucy/Index/Similarity.cfh            |  3 +--
 core/Lucy/Index/Snapshot.cfh              |  2 +-
 core/Lucy/Plan/BlobType.cfh               |  3 +--
 core/Lucy/Plan/FullTextType.cfh           |  3 +--
 core/Lucy/Plan/NumericType.cfh            | 21 +++++++--------------
 core/Lucy/Plan/StringType.cfh             |  3 +--
 core/Lucy/Search/ANDQuery.cfh             |  3 +--
 core/Lucy/Search/LeafQuery.cfh            |  3 +--
 core/Lucy/Search/MatchAllQuery.cfh        |  3 +--
 core/Lucy/Search/NOTQuery.cfh             |  3 +--
 core/Lucy/Search/NoMatchQuery.cfh         |  3 +--
 core/Lucy/Search/ORQuery.cfh              |  3 +--
 core/Lucy/Search/PhraseQuery.cfh          |  3 +--
 core/Lucy/Search/PolyQuery.cfh            |  3 +--
 core/Lucy/Search/Query.cfh                |  2 +-
 core/Lucy/Search/RangeQuery.cfh           |  3 +--
 core/Lucy/Search/TermQuery.cfh            |  3 +--
 core/LucyX/Search/ProximityQuery.cfh      |  3 +--
 26 files changed, 32 insertions(+), 60 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Analysis/Analyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Analyzer.cfh b/core/Lucy/Analysis/Analyzer.cfh
index f435aa8..7d01ddc 100644
--- a/core/Lucy/Analysis/Analyzer.cfh
+++ b/core/Lucy/Analysis/Analyzer.cfh
@@ -24,8 +24,7 @@ parcel Lucy;
  * might perform case folding to facilitate case-insensitive search
  * (L<Normalizer|Lucy::Analysis::Normalizer>).
  */
-public abstract class Lucy::Analysis::Analyzer
-    inherits Clownfish::Obj : dumpable {
+public abstract class Lucy::Analysis::Analyzer inherits Clownfish::Obj {
 
     public inert Analyzer*
     init(Analyzer *self);

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Analysis/CaseFolder.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/CaseFolder.cfh b/core/Lucy/Analysis/CaseFolder.cfh
index 137905d..a173e9d 100644
--- a/core/Lucy/Analysis/CaseFolder.cfh
+++ b/core/Lucy/Analysis/CaseFolder.cfh
@@ -25,8 +25,7 @@ parcel Lucy;
  * searches will be case-insensitive.
  */
 
-public class Lucy::Analysis::CaseFolder
-    inherits Lucy::Analysis::Analyzer : dumpable {
+public class Lucy::Analysis::CaseFolder inherits Lucy::Analysis::Analyzer {
 
     Normalizer *normalizer;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Analysis/EasyAnalyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/EasyAnalyzer.cfh b/core/Lucy/Analysis/EasyAnalyzer.cfh
index 495ec0d..e0c7498 100644
--- a/core/Lucy/Analysis/EasyAnalyzer.cfh
+++ b/core/Lucy/Analysis/EasyAnalyzer.cfh
@@ -41,8 +41,7 @@ parcel Lucy;
  *     sv => Swedish,
  *     tr => Turkish,
  */
-public class Lucy::Analysis::EasyAnalyzer
-    inherits Lucy::Analysis::Analyzer : dumpable {
+public class Lucy::Analysis::EasyAnalyzer inherits Lucy::Analysis::Analyzer {
 
     CharBuf *language;
     StandardTokenizer *tokenizer;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Analysis/Normalizer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Normalizer.cfh b/core/Lucy/Analysis/Normalizer.cfh
index da1882b..c65d5f1 100644
--- a/core/Lucy/Analysis/Normalizer.cfh
+++ b/core/Lucy/Analysis/Normalizer.cfh
@@ -27,8 +27,7 @@ parcel Lucy;
  * because it might add or remove characters.
  */
 
-public class Lucy::Analysis::Normalizer
-    inherits Lucy::Analysis::Analyzer : dumpable {
+public class Lucy::Analysis::Normalizer inherits Lucy::Analysis::Analyzer {
 
     int options;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Analysis/PolyAnalyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.cfh b/core/Lucy/Analysis/PolyAnalyzer.cfh
index 1edffc0..2bafa55 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.cfh
+++ b/core/Lucy/Analysis/PolyAnalyzer.cfh
@@ -47,8 +47,7 @@ parcel Lucy;
  *     sv => Swedish,
  *     tr => Turkish,
  */
-public class Lucy::Analysis::PolyAnalyzer
-    inherits Lucy::Analysis::Analyzer : dumpable {
+public class Lucy::Analysis::PolyAnalyzer inherits Lucy::Analysis::Analyzer {
 
     VArray  *analyzers;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Analysis/SnowballStemmer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStemmer.cfh b/core/Lucy/Analysis/SnowballStemmer.cfh
index 3419eb2..e644dbc 100644
--- a/core/Lucy/Analysis/SnowballStemmer.cfh
+++ b/core/Lucy/Analysis/SnowballStemmer.cfh
@@ -26,7 +26,7 @@ parcel Lucy;
  */
 
 public class Lucy::Analysis::SnowballStemmer cnick SnowStemmer
-    inherits Lucy::Analysis::Analyzer : dumpable {
+    inherits Lucy::Analysis::Analyzer {
 
     void *snowstemmer;
     CharBuf *language;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Analysis/SnowballStopFilter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.cfh b/core/Lucy/Analysis/SnowballStopFilter.cfh
index 68e172a..1c253e6 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.cfh
+++ b/core/Lucy/Analysis/SnowballStopFilter.cfh
@@ -55,7 +55,7 @@ parcel Lucy;
  */
 
 public class Lucy::Analysis::SnowballStopFilter cnick SnowStop
-    inherits Lucy::Analysis::Analyzer : dumpable {
+    inherits Lucy::Analysis::Analyzer {
 
     Hash *stoplist;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Document/Doc.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Document/Doc.cfh b/core/Lucy/Document/Doc.cfh
index 60c906d..12df64d 100644
--- a/core/Lucy/Document/Doc.cfh
+++ b/core/Lucy/Document/Doc.cfh
@@ -22,8 +22,7 @@ parcel Lucy;
  * or more fields, each of which has a value.
  */
 
-public class Lucy::Document::Doc inherits Clownfish::Obj
-    : dumpable {
+public class Lucy::Document::Doc inherits Clownfish::Obj {
 
     void        *fields;
     int32_t      doc_id;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Index/Similarity.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Similarity.cfh b/core/Lucy/Index/Similarity.cfh
index bbb314b..ca523aa 100644
--- a/core/Lucy/Index/Similarity.cfh
+++ b/core/Lucy/Index/Similarity.cfh
@@ -33,8 +33,7 @@ parcel Lucy;
  * scores from multiple fields.
  */
 
-public class Lucy::Index::Similarity cnick Sim
-    inherits Clownfish::Obj : dumpable {
+public class Lucy::Index::Similarity cnick Sim inherits Clownfish::Obj {
 
     float  *norm_decoder;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Index/Snapshot.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Index/Snapshot.cfh b/core/Lucy/Index/Snapshot.cfh
index 8df8c77..d82714f 100644
--- a/core/Lucy/Index/Snapshot.cfh
+++ b/core/Lucy/Index/Snapshot.cfh
@@ -26,7 +26,7 @@ parcel Lucy;
  * associated with a single Snapshot.
  */
 
-public class Lucy::Index::Snapshot inherits Clownfish::Obj : dumpable {
+public class Lucy::Index::Snapshot inherits Clownfish::Obj {
 
     Hash        *entries;
     CharBuf     *path;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Plan/BlobType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/BlobType.cfh b/core/Lucy/Plan/BlobType.cfh
index b68486c..3679ddc 100644
--- a/core/Lucy/Plan/BlobType.cfh
+++ b/core/Lucy/Plan/BlobType.cfh
@@ -21,8 +21,7 @@ parcel Lucy;
  * BlobType is an implementation of FieldType tuned for use with fields
  * containing binary data, which cannot be indexed or searched -- only stored.
  */
-public class Lucy::Plan::BlobType inherits Lucy::Plan::FieldType
-    : dumpable {
+public class Lucy::Plan::BlobType inherits Lucy::Plan::FieldType {
 
     /**
      * @param stored boolean indicating whether the field should be stored.

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Plan/FullTextType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/FullTextType.cfh b/core/Lucy/Plan/FullTextType.cfh
index 7228f70..d94c69d 100644
--- a/core/Lucy/Plan/FullTextType.cfh
+++ b/core/Lucy/Plan/FullTextType.cfh
@@ -28,8 +28,7 @@ parcel Lucy;
  * For an exact-match, single value field type using character data, see
  * L<StringType|Lucy::Plan::StringType>.
  */
-public class Lucy::Plan::FullTextType
-    inherits Lucy::Plan::TextType : dumpable {
+public class Lucy::Plan::FullTextType inherits Lucy::Plan::TextType {
 
     bool        highlightable;
     Analyzer   *analyzer;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Plan/NumericType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/NumericType.cfh b/core/Lucy/Plan/NumericType.cfh
index db514ec..33c7216 100644
--- a/core/Lucy/Plan/NumericType.cfh
+++ b/core/Lucy/Plan/NumericType.cfh
@@ -16,8 +16,7 @@
 
 parcel Lucy;
 
-class Lucy::Plan::NumericType cnick NumType
-    inherits Lucy::Plan::FieldType : dumpable {
+class Lucy::Plan::NumericType cnick NumType inherits Lucy::Plan::FieldType {
 
     public inert NumericType*
     init(NumericType *self);
@@ -47,11 +46,9 @@ class Lucy::Plan::NumericType cnick NumType
     Load(NumericType *self, Obj *dump);
 }
 
-abstract class Lucy::Plan::FloatType
-    inherits Lucy::Plan::NumericType : dumpable { }
+abstract class Lucy::Plan::FloatType inherits Lucy::Plan::NumericType { }
 
-class Lucy::Plan::Float64Type
-    inherits Lucy::Plan::FloatType : dumpable {
+class Lucy::Plan::Float64Type inherits Lucy::Plan::FloatType {
 
     public inert Float64Type*
     new();
@@ -73,8 +70,7 @@ class Lucy::Plan::Float64Type
     Equals(Float64Type *self, Obj *other);
 }
 
-class Lucy::Plan::Float32Type
-    inherits Lucy::Plan::FloatType : dumpable {
+class Lucy::Plan::Float32Type inherits Lucy::Plan::FloatType {
 
     public inert Float32Type*
     new();
@@ -96,11 +92,9 @@ class Lucy::Plan::Float32Type
     Equals(Float32Type *self, Obj *other);
 }
 
-abstract class Lucy::Plan::IntType
-    inherits Lucy::Plan::NumericType : dumpable { }
+abstract class Lucy::Plan::IntType inherits Lucy::Plan::NumericType { }
 
-class Lucy::Plan::Int32Type
-    inherits Lucy::Plan::IntType : dumpable {
+class Lucy::Plan::Int32Type inherits Lucy::Plan::IntType {
 
     public inert Int32Type*
     new();
@@ -122,8 +116,7 @@ class Lucy::Plan::Int32Type
     Equals(Int32Type *self, Obj *other);
 }
 
-class Lucy::Plan::Int64Type
-    inherits Lucy::Plan::IntType : dumpable {
+class Lucy::Plan::Int64Type inherits Lucy::Plan::IntType {
 
     public inert Int64Type*
     new();

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Plan/StringType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/StringType.cfh b/core/Lucy/Plan/StringType.cfh
index fa8667e..a906172 100644
--- a/core/Lucy/Plan/StringType.cfh
+++ b/core/Lucy/Plan/StringType.cfh
@@ -20,8 +20,7 @@ parcel Lucy;
  *
  * Lucy::Plan::StringType is used for "exact-match" strings.
  */
-public class Lucy::Plan::StringType
-    inherits Lucy::Plan::TextType : dumpable {
+public class Lucy::Plan::StringType inherits Lucy::Plan::TextType {
 
     /**
      * @param boost floating point per-field boost.

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/ANDQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ANDQuery.cfh b/core/Lucy/Search/ANDQuery.cfh
index e7d2bb3..f17eeda 100644
--- a/core/Lucy/Search/ANDQuery.cfh
+++ b/core/Lucy/Search/ANDQuery.cfh
@@ -22,8 +22,7 @@ parcel Lucy;
  * only when all of its children match, so its result set is the intersection
  * of their result sets.  Documents which match receive a summed score.
  */
-public class Lucy::Search::ANDQuery inherits Lucy::Search::PolyQuery
-    : dumpable {
+public class Lucy::Search::ANDQuery inherits Lucy::Search::PolyQuery {
 
     inert incremented ANDQuery*
     new(VArray *children = NULL);

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/LeafQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.cfh b/core/Lucy/Search/LeafQuery.cfh
index 568898e..a5ac359 100644
--- a/core/Lucy/Search/LeafQuery.cfh
+++ b/core/Lucy/Search/LeafQuery.cfh
@@ -25,8 +25,7 @@ parcel Lucy;
  * L<PhraseQuery|Lucy::Search::PhraseQuery> objects, as attempting to
  * search a LeafQuery causes an error.
  */
-public class Lucy::Search::LeafQuery inherits Lucy::Search::Query
-    : dumpable {
+public class Lucy::Search::LeafQuery inherits Lucy::Search::Query {
 
     CharBuf *field;
     CharBuf *text;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/MatchAllQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/MatchAllQuery.cfh b/core/Lucy/Search/MatchAllQuery.cfh
index 224392a..bdbbc72 100644
--- a/core/Lucy/Search/MatchAllQuery.cfh
+++ b/core/Lucy/Search/MatchAllQuery.cfh
@@ -23,8 +23,7 @@ parcel Lucy;
  * which matches against another part of the query will be ranked higher than
  * a document which matches only via the MatchAllQuery.
  */
-public class Lucy::Search::MatchAllQuery
-    inherits Lucy::Search::Query : dumpable {
+public class Lucy::Search::MatchAllQuery inherits Lucy::Search::Query {
 
     inert incremented MatchAllQuery*
     new();

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/NOTQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NOTQuery.cfh b/core/Lucy/Search/NOTQuery.cfh
index 874dbb8..66f8eb8 100644
--- a/core/Lucy/Search/NOTQuery.cfh
+++ b/core/Lucy/Search/NOTQuery.cfh
@@ -27,8 +27,7 @@ parcel Lucy;
  * semantics.
  */
 
-public class Lucy::Search::NOTQuery inherits Lucy::Search::PolyQuery
-    : dumpable {
+public class Lucy::Search::NOTQuery inherits Lucy::Search::PolyQuery {
 
     /**
      * @param negated_query The Query to be inverted.

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/NoMatchQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/NoMatchQuery.cfh b/core/Lucy/Search/NoMatchQuery.cfh
index 461274f..3abfcc1 100644
--- a/core/Lucy/Search/NoMatchQuery.cfh
+++ b/core/Lucy/Search/NoMatchQuery.cfh
@@ -23,8 +23,7 @@ parcel Lucy;
  * L<QueryParser|Lucy::Search::QueryParser> is asked to parse an empty
  * string.
  */
-public class Lucy::Search::NoMatchQuery inherits Lucy::Search::Query
-    : dumpable {
+public class Lucy::Search::NoMatchQuery inherits Lucy::Search::Query {
 
     bool fails_to_match;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/ORQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/ORQuery.cfh b/core/Lucy/Search/ORQuery.cfh
index c7bcdd9..5845c54 100644
--- a/core/Lucy/Search/ORQuery.cfh
+++ b/core/Lucy/Search/ORQuery.cfh
@@ -24,8 +24,7 @@ parcel Lucy;
  * child Queries.
  */
 
-public class Lucy::Search::ORQuery inherits Lucy::Search::PolyQuery
-    : dumpable {
+public class Lucy::Search::ORQuery inherits Lucy::Search::PolyQuery {
 
     inert incremented ORQuery*
     new(VArray *children = NULL);

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/PhraseQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.cfh b/core/Lucy/Search/PhraseQuery.cfh
index 34e4936..eaae333 100644
--- a/core/Lucy/Search/PhraseQuery.cfh
+++ b/core/Lucy/Search/PhraseQuery.cfh
@@ -22,8 +22,7 @@ parcel Lucy;
  * against an ordered sequence of terms.
  */
 
-public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query
-    : dumpable {
+public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query {
 
     CharBuf       *field;
     VArray        *terms;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/PolyQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.cfh b/core/Lucy/Search/PolyQuery.cfh
index 9b70142..f0c78ff 100644
--- a/core/Lucy/Search/PolyQuery.cfh
+++ b/core/Lucy/Search/PolyQuery.cfh
@@ -26,8 +26,7 @@ parcel Lucy;
  * these classes may serve as nodes in composite Query with a tree structure
  * which may be walked.
  */
-public abstract class Lucy::Search::PolyQuery
-    inherits Lucy::Search::Query : dumpable {
+public abstract class Lucy::Search::PolyQuery inherits Lucy::Search::Query {
 
     VArray    *children;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/Query.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Query.cfh b/core/Lucy/Search/Query.cfh
index 92653bb..1bcfc23 100644
--- a/core/Lucy/Search/Query.cfh
+++ b/core/Lucy/Search/Query.cfh
@@ -34,7 +34,7 @@ parcel Lucy;
  * can actually match and score documents.
  */
 
-public class Lucy::Search::Query inherits Clownfish::Obj : dumpable {
+public class Lucy::Search::Query inherits Clownfish::Obj {
 
     float boost;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/RangeQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.cfh b/core/Lucy/Search/RangeQuery.cfh
index 01d9a9e..fcbd2e3 100644
--- a/core/Lucy/Search/RangeQuery.cfh
+++ b/core/Lucy/Search/RangeQuery.cfh
@@ -22,8 +22,7 @@ parcel Lucy;
  * within a given range.
  */
 
-public class Lucy::Search::RangeQuery inherits Lucy::Search::Query
-    : dumpable {
+public class Lucy::Search::RangeQuery inherits Lucy::Search::Query {
 
     CharBuf  *field;
     Obj      *lower_term;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/Lucy/Search/TermQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.cfh b/core/Lucy/Search/TermQuery.cfh
index 3960497..cf6b293 100644
--- a/core/Lucy/Search/TermQuery.cfh
+++ b/core/Lucy/Search/TermQuery.cfh
@@ -23,8 +23,7 @@ parcel Lucy;
  * individual terms in a specific field.
  */
 
-public class Lucy::Search::TermQuery inherits Lucy::Search::Query
-    : dumpable {
+public class Lucy::Search::TermQuery inherits Lucy::Search::Query {
 
     CharBuf *field;
     Obj     *term;

http://git-wip-us.apache.org/repos/asf/lucy/blob/ee8fc5c3/core/LucyX/Search/ProximityQuery.cfh
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.cfh b/core/LucyX/Search/ProximityQuery.cfh
index d55eb54..0d02a24 100644
--- a/core/LucyX/Search/ProximityQuery.cfh
+++ b/core/LucyX/Search/ProximityQuery.cfh
@@ -22,8 +22,7 @@ parcel Lucy;
  * against an ordered sequence of terms.
  */
 
-public class LucyX::Search::ProximityQuery inherits Lucy::Search::Query
-    : dumpable {
+public class LucyX::Search::ProximityQuery inherits Lucy::Search::Query {
 
     CharBuf       *field;
     VArray        *terms;


[lucy-commits] [3/6] git commit: refs/heads/move-dumpable - Implement Dump/Load manually.

Posted by ma...@apache.org.
Implement Dump/Load manually.

For classes which have heretofore relied on CFCDumpable for
autogenerating Dump/Load, create manual implementations.


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

Branch: refs/heads/move-dumpable
Commit: 163c43ed86b381971adfa25959fdcdc3b63a0f9a
Parents: f1585ac
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 25 16:07:02 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Jul 25 18:27:24 2013 -0700

----------------------------------------------------------------------
 core/Lucy/Analysis/Analyzer.c             | 20 ++++++++++
 core/Lucy/Analysis/Analyzer.cfh           |  6 +++
 core/Lucy/Analysis/PolyAnalyzer.c         | 13 +++++++
 core/Lucy/Analysis/PolyAnalyzer.cfh       |  3 ++
 core/Lucy/Analysis/SnowballStopFilter.c   | 28 ++++++++++++++
 core/Lucy/Analysis/SnowballStopFilter.cfh |  6 +++
 core/Lucy/Search/LeafQuery.c              | 32 ++++++++++++++++
 core/Lucy/Search/LeafQuery.cfh            |  6 +++
 core/Lucy/Search/PhraseQuery.c            | 29 ++++++++++++++
 core/Lucy/Search/PhraseQuery.cfh          |  6 +++
 core/Lucy/Search/PolyQuery.c              | 24 ++++++++++++
 core/Lucy/Search/PolyQuery.cfh            |  6 +++
 core/Lucy/Search/Query.c                  | 26 +++++++++++++
 core/Lucy/Search/Query.cfh                |  6 +++
 core/Lucy/Search/RangeQuery.c             | 52 ++++++++++++++++++++++++++
 core/Lucy/Search/RangeQuery.cfh           |  6 +++
 core/Lucy/Search/TermQuery.c              | 27 +++++++++++++
 core/Lucy/Search/TermQuery.cfh            |  6 +++
 core/LucyX/Search/ProximityQuery.c        | 31 +++++++++++++++
 core/LucyX/Search/ProximityQuery.cfh      |  6 +++
 20 files changed, 339 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/Analyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Analyzer.c b/core/Lucy/Analysis/Analyzer.c
index ab23fdc..9a16c16 100644
--- a/core/Lucy/Analysis/Analyzer.c
+++ b/core/Lucy/Analysis/Analyzer.c
@@ -58,4 +58,24 @@ Analyzer_split(Analyzer *self, CharBuf *text) {
     return out;
 }
 
+Obj*
+Analyzer_dump(Analyzer *self)
+{
+    Hash *dump = Hash_new(0);
+    Hash_Store_Str(dump, "_class", 6,
+                   (Obj*)CB_Clone(Obj_Get_Class_Name((Obj*)self)));
+    return (Obj*)dump;
+}
+
+Obj*
+Analyzer_load(Analyzer *self, Obj *dump)
+{
+    CHY_UNUSED_VAR(self);
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    CharBuf *class_name
+        = (CharBuf*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), CHARBUF);
+    VTable *vtable = VTable_singleton(class_name, NULL);
+    Analyzer *loaded = (Analyzer*)VTable_Make_Obj(vtable);
+    return (Obj*)loaded;
+}
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/Analyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/Analyzer.cfh b/core/Lucy/Analysis/Analyzer.cfh
index 4071bdb..f435aa8 100644
--- a/core/Lucy/Analysis/Analyzer.cfh
+++ b/core/Lucy/Analysis/Analyzer.cfh
@@ -49,6 +49,12 @@ public abstract class Lucy::Analysis::Analyzer
      */
     public incremented VArray*
     Split(Analyzer *self, CharBuf *text);
+
+    public incremented Obj*
+    Dump(Analyzer *self);
+
+    public incremented Obj*
+    Load(Analyzer *self, Obj *dump);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/PolyAnalyzer.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.c b/core/Lucy/Analysis/PolyAnalyzer.c
index f755e4e..0f64d16 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.c
+++ b/core/Lucy/Analysis/PolyAnalyzer.c
@@ -120,6 +120,19 @@ PolyAnalyzer_equals(PolyAnalyzer *self, Obj *other) {
     return true;
 }
 
+Obj*
+PolyAnalyzer_dump(PolyAnalyzer *self)
+{
+    PolyAnalyzerIVARS *const ivars = PolyAnalyzer_IVARS(self);
+    PolyAnalyzer_Dump_t super_dump
+        = SUPER_METHOD_PTR(POLYANALYZER, Lucy_PolyAnalyzer_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    if (ivars->analyzers) {
+        Hash_Store_Str(dump, "analyzers", 9, Obj_Dump((Obj*)ivars->analyzers));
+    }
+    return (Obj*)dump;
+}
+
 PolyAnalyzer*
 PolyAnalyzer_load(PolyAnalyzer *self, Obj *dump) {
     Hash *source = (Hash*)CERTIFY(dump, HASH);

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/PolyAnalyzer.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/PolyAnalyzer.cfh b/core/Lucy/Analysis/PolyAnalyzer.cfh
index a7cdd93..1edffc0 100644
--- a/core/Lucy/Analysis/PolyAnalyzer.cfh
+++ b/core/Lucy/Analysis/PolyAnalyzer.cfh
@@ -83,6 +83,9 @@ public class Lucy::Analysis::PolyAnalyzer
     public bool
     Equals(PolyAnalyzer *self, Obj *other);
 
+    public incremented Obj*
+    Dump(PolyAnalyzer *self);
+
     public incremented PolyAnalyzer*
     Load(PolyAnalyzer *self, Obj *dump);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/SnowballStopFilter.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.c b/core/Lucy/Analysis/SnowballStopFilter.c
index e0d1f63..576ab08 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.c
+++ b/core/Lucy/Analysis/SnowballStopFilter.c
@@ -89,6 +89,34 @@ SnowStop_equals(SnowballStopFilter *self, Obj *other) {
     return true;
 }
 
+Obj*
+SnowStop_dump(SnowballStopFilter *self)
+{
+    SnowballStopFilterIVARS *ivars = SnowStop_IVARS(self);
+    SnowStop_Dump_t super_dump
+        = SUPER_METHOD_PTR(SNOWBALLSTOPFILTER, Lucy_SnowStop_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    if (ivars->stoplist) {
+        Hash_Store_Str(dump, "stoplist", 8, Obj_Dump((Obj*)ivars->stoplist));
+    }
+    return (Obj*)dump;
+}
+
+Obj*
+SnowStop_load(SnowballStopFilter *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    SnowStop_Load_t super_load
+        = SUPER_METHOD_PTR(SNOWBALLSTOPFILTER, Lucy_SnowStop_Load);
+    SnowballStopFilter *loaded = (SnowballStopFilter*)super_load(self, dump);
+    Obj *stoplist = Hash_Fetch_Str(source, "stoplist", 8);
+    if (stoplist) {
+        SnowStop_IVARS(loaded)->stoplist
+            = (Hash*)CERTIFY(Obj_Load(stoplist, stoplist), HASH);
+    }
+    return (Obj*)loaded;
+}
+
 Hash*
 SnowStop_gen_stoplist(const CharBuf *language) {
     CharBuf *lang = CB_new(3);

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Analysis/SnowballStopFilter.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Analysis/SnowballStopFilter.cfh b/core/Lucy/Analysis/SnowballStopFilter.cfh
index 3303a96..68e172a 100644
--- a/core/Lucy/Analysis/SnowballStopFilter.cfh
+++ b/core/Lucy/Analysis/SnowballStopFilter.cfh
@@ -95,6 +95,12 @@ public class Lucy::Analysis::SnowballStopFilter cnick SnowStop
     public bool
     Equals(SnowballStopFilter *self, Obj *other);
 
+    public incremented Obj*
+    Dump(SnowballStopFilter *self);
+
+    public incremented Obj*
+    Load(SnowballStopFilter *self, Obj *dump);
+
     public void
     Destroy(SnowballStopFilter *self);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/LeafQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.c b/core/Lucy/Search/LeafQuery.c
index f5fb944..e248504 100644
--- a/core/Lucy/Search/LeafQuery.c
+++ b/core/Lucy/Search/LeafQuery.c
@@ -111,6 +111,38 @@ LeafQuery_deserialize(LeafQuery *self, InStream *instream) {
     return self;
 }
 
+Obj*
+LeafQuery_dump(LeafQuery *self)
+{
+    LeafQueryIVARS *ivars = LeafQuery_IVARS(self);
+    LeafQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(LEAFQUERY, Lucy_LeafQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    if (ivars->field) {
+        Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    }
+    Hash_Store_Str(dump, "text", 4, Obj_Dump((Obj*)ivars->text));
+    return (Obj*)dump;
+}
+
+Obj*
+LeafQuery_load(LeafQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    LeafQuery_Load_t super_load
+        = SUPER_METHOD_PTR(LEAFQUERY, Lucy_LeafQuery_Load);
+    LeafQuery *loaded = (LeafQuery*)super_load(self, dump);
+    LeafQueryIVARS *loaded_ivars = LeafQuery_IVARS(loaded);
+    Obj *field = Hash_Fetch_Str(source, "field", 5);
+    if (field) {
+        loaded_ivars->field
+            = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    }
+    Obj *text = CERTIFY(Hash_Fetch_Str(source, "text", 4), OBJ);
+    loaded_ivars->text = (CharBuf*)CERTIFY(Obj_Load(text, text), CHARBUF);
+    return (Obj*)loaded;
+}
+
 Compiler*
 LeafQuery_make_compiler(LeafQuery *self, Searcher *searcher, float boost,
                         bool subordinate) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/LeafQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/LeafQuery.cfh b/core/Lucy/Search/LeafQuery.cfh
index d6c7bb6..568898e 100644
--- a/core/Lucy/Search/LeafQuery.cfh
+++ b/core/Lucy/Search/LeafQuery.cfh
@@ -63,6 +63,12 @@ public class Lucy::Search::LeafQuery inherits Lucy::Search::Query
     public incremented LeafQuery*
     Deserialize(decremented LeafQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(LeafQuery *self);
+
+    public incremented Obj*
+    Load(LeafQuery *self, Obj *dump);
+
     /** Throws an error.
      */
     public incremented Compiler*

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/PhraseQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.c b/core/Lucy/Search/PhraseQuery.c
index 2c62e2f..7bcca36 100644
--- a/core/Lucy/Search/PhraseQuery.c
+++ b/core/Lucy/Search/PhraseQuery.c
@@ -90,6 +90,35 @@ PhraseQuery_deserialize(PhraseQuery *self, InStream *instream) {
     return S_do_init(self, field, terms, boost);
 }
 
+Obj*
+PhraseQuery_dump(PhraseQuery *self)
+{
+    PhraseQueryIVARS *ivars = PhraseQuery_IVARS(self);
+    PhraseQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(PHRASEQUERY, Lucy_PhraseQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    Hash_Store_Str(dump, "terms", 5, Obj_Dump((Obj*)ivars->terms));
+    return (Obj*)dump;
+}
+
+Obj*
+PhraseQuery_load(PhraseQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    PhraseQuery_Load_t super_load
+        = SUPER_METHOD_PTR(PHRASEQUERY, Lucy_PhraseQuery_Load);
+    PhraseQuery *loaded = (PhraseQuery*)super_load(self, dump);
+    PhraseQueryIVARS *loaded_ivars = PhraseQuery_IVARS(loaded);
+    Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+    loaded_ivars->field
+        = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    Obj *terms = CERTIFY(Hash_Fetch_Str(source, "terms", 5), OBJ);
+    loaded_ivars->terms
+        = (VArray*)CERTIFY(Obj_Load(terms, terms), VARRAY);
+    return (Obj*)loaded;
+}
+
 bool
 PhraseQuery_equals(PhraseQuery *self, Obj *other) {
     if ((PhraseQuery*)other == self)   { return true; }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/PhraseQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PhraseQuery.cfh b/core/Lucy/Search/PhraseQuery.cfh
index 6991430..34e4936 100644
--- a/core/Lucy/Search/PhraseQuery.cfh
+++ b/core/Lucy/Search/PhraseQuery.cfh
@@ -64,6 +64,12 @@ public class Lucy::Search::PhraseQuery inherits Lucy::Search::Query
     public incremented PhraseQuery*
     Deserialize(decremented PhraseQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(PhraseQuery *self);
+
+    public incremented Obj*
+    Load(PhraseQuery *self, Obj *dump);
+
     public void
     Destroy(PhraseQuery *self);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/PolyQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.c b/core/Lucy/Search/PolyQuery.c
index da87dc1..74222a6 100644
--- a/core/Lucy/Search/PolyQuery.c
+++ b/core/Lucy/Search/PolyQuery.c
@@ -92,6 +92,30 @@ PolyQuery_deserialize(PolyQuery *self, InStream *instream) {
     return self;
 }
 
+Obj*
+PolyQuery_dump(PolyQuery *self)
+{
+    PolyQueryIVARS *ivars = PolyQuery_IVARS(self);
+    PolyQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(POLYQUERY, Lucy_PolyQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "children", 8, Obj_Dump((Obj*)ivars->children));
+    return (Obj*)dump;
+}
+
+Obj*
+PolyQuery_load(PolyQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    PolyQuery_Load_t super_load
+        = SUPER_METHOD_PTR(POLYQUERY, Lucy_PolyQuery_Load);
+    PolyQuery *loaded = (PolyQuery*)super_load(self, dump);
+    Obj *children = CERTIFY(Hash_Fetch_Str(source, "children", 8), OBJ);
+    PolyQuery_IVARS(loaded)->children
+        = (VArray*)CERTIFY(Obj_Load(children, children), VARRAY);
+    return (Obj*)loaded;
+}
+
 bool
 PolyQuery_equals(PolyQuery *self, Obj *other) {
     if ((PolyQuery*)other == self)                          { return true; }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/PolyQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/PolyQuery.cfh b/core/Lucy/Search/PolyQuery.cfh
index e4fc450..9b70142 100644
--- a/core/Lucy/Search/PolyQuery.cfh
+++ b/core/Lucy/Search/PolyQuery.cfh
@@ -54,6 +54,12 @@ public abstract class Lucy::Search::PolyQuery
     public incremented PolyQuery*
     Deserialize(decremented PolyQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(PolyQuery *self);
+
+    public incremented Obj*
+    Load(PolyQuery *self, Obj *dump);
+
     public bool
     Equals(PolyQuery *self, Obj *other);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/Query.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Query.c b/core/Lucy/Search/Query.c
index 20243ed..50a5bc0 100644
--- a/core/Lucy/Search/Query.c
+++ b/core/Lucy/Search/Query.c
@@ -51,3 +51,29 @@ Query_deserialize(Query *self, InStream *instream) {
     return Query_init(self, boost);
 }
 
+Obj*
+Query_dump(Query *self)
+{
+    QueryIVARS *ivars = Query_IVARS(self);
+    Hash *dump = Hash_new(0);
+    Hash_Store_Str(dump, "_class", 6,
+                   (Obj*)CB_Clone(Obj_Get_Class_Name((Obj*)self)));
+    Hash_Store_Str(dump, "boost", 5,
+                   (Obj*)CB_newf("%f64", (double)ivars->boost));
+    return (Obj*)dump;
+}
+
+Obj*
+Query_load(Query *self, Obj *dump)
+{
+    CHY_UNUSED_VAR(self);
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    CharBuf *class_name
+        = (CharBuf*)CERTIFY(Hash_Fetch_Str(source, "_class", 6), CHARBUF);
+    VTable *vtable = VTable_singleton(class_name, NULL);
+    Query *loaded = (Query*)VTable_Make_Obj(vtable);
+    Obj *boost = CERTIFY(Hash_Fetch_Str(source, "boost", 5), OBJ);
+    Query_IVARS(loaded)->boost = (float)Obj_To_F64(boost);
+    return (Obj*)loaded;
+}
+

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/Query.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/Query.cfh b/core/Lucy/Search/Query.cfh
index 0b48b15..92653bb 100644
--- a/core/Lucy/Search/Query.cfh
+++ b/core/Lucy/Search/Query.cfh
@@ -76,6 +76,12 @@ public class Lucy::Search::Query inherits Clownfish::Obj : dumpable {
 
     public incremented Query*
     Deserialize(decremented Query *self, InStream *instream);
+
+    public incremented Obj*
+    Dump(Query *self);
+
+    public incremented Obj*
+    Load(Query *self, Obj *dump);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/RangeQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.c b/core/Lucy/Search/RangeQuery.c
index 3f7ff15..3047e8a 100644
--- a/core/Lucy/Search/RangeQuery.c
+++ b/core/Lucy/Search/RangeQuery.c
@@ -160,6 +160,58 @@ RangeQuery_deserialize(RangeQuery *self, InStream *instream) {
     return self;
 }
 
+Obj*
+RangeQuery_dump(RangeQuery *self)
+{
+    RangeQueryIVARS *ivars = RangeQuery_IVARS(self);
+    RangeQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(RANGEQUERY, Lucy_RangeQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    if (ivars->lower_term) {
+        Hash_Store_Str(dump, "lower_term", 10,
+                       Obj_Dump((Obj*)ivars->lower_term));
+    }
+    if (ivars->upper_term) {
+        Hash_Store_Str(dump, "upper_term", 10,
+                       Obj_Dump((Obj*)ivars->upper_term));
+    }
+    Hash_Store_Str(dump, "include_lower", 13,
+                   (Obj*)Bool_singleton(ivars->include_lower));
+    Hash_Store_Str(dump, "include_upper", 13,
+                   (Obj*)Bool_singleton(ivars->include_upper));
+    return (Obj*)dump;
+}
+
+Obj*
+RangeQuery_load(RangeQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    RangeQuery_Load_t super_load
+        = SUPER_METHOD_PTR(RANGEQUERY, Lucy_RangeQuery_Load);
+    RangeQuery *loaded = (RangeQuery*)super_load(self, dump);
+    RangeQueryIVARS *loaded_ivars = RangeQuery_IVARS(loaded);
+    Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+    loaded_ivars->field = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    Obj *lower_term = Hash_Fetch_Str(source, "lower_term", 10);
+    if (lower_term) {
+        loaded_ivars->lower_term
+            = (Obj*)CERTIFY(Obj_Load(lower_term, lower_term), OBJ);
+    }
+    Obj *upper_term = Hash_Fetch_Str(source, "upper_term", 10);
+    if (upper_term) {
+        loaded_ivars->upper_term
+            = (Obj*)CERTIFY(Obj_Load(upper_term, upper_term), OBJ);
+    }
+    Obj *include_lower
+        = CERTIFY(Hash_Fetch_Str(source, "include_lower", 13), OBJ);
+    loaded_ivars->include_lower = Obj_To_Bool(include_lower);
+    Obj *include_upper
+        = CERTIFY(Hash_Fetch_Str(source, "include_upper", 13), OBJ);
+    loaded_ivars->include_upper = Obj_To_Bool(include_upper);
+    return (Obj*)loaded;
+}
+
 RangeCompiler*
 RangeQuery_make_compiler(RangeQuery *self, Searcher *searcher,
                          float boost, bool subordinate) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/RangeQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/RangeQuery.cfh b/core/Lucy/Search/RangeQuery.cfh
index 1ad4ff4..01d9a9e 100644
--- a/core/Lucy/Search/RangeQuery.cfh
+++ b/core/Lucy/Search/RangeQuery.cfh
@@ -70,6 +70,12 @@ public class Lucy::Search::RangeQuery inherits Lucy::Search::Query
     public incremented RangeQuery*
     Deserialize(decremented RangeQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(RangeQuery *self);
+
+    public incremented Obj*
+    Load(RangeQuery *self, Obj *dump);
+
     public void
     Destroy(RangeQuery *self);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/TermQuery.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.c b/core/Lucy/Search/TermQuery.c
index 924e13f..18f36f5 100644
--- a/core/Lucy/Search/TermQuery.c
+++ b/core/Lucy/Search/TermQuery.c
@@ -74,6 +74,33 @@ TermQuery_deserialize(TermQuery *self, InStream *instream) {
     return self;
 }
 
+Obj*
+TermQuery_dump(TermQuery *self)
+{
+    TermQueryIVARS *ivars = TermQuery_IVARS(self);
+    TermQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(TERMQUERY, Lucy_TermQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    Hash_Store_Str(dump, "term", 4, Obj_Dump(ivars->term));
+    return (Obj*)dump;
+}
+
+Obj*
+TermQuery_load(TermQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    TermQuery_Load_t super_load
+        = SUPER_METHOD_PTR(TERMQUERY, Lucy_TermQuery_Load);
+    TermQuery *loaded = (TermQuery*)super_load(self, dump);
+    TermQueryIVARS *loaded_ivars = TermQuery_IVARS(loaded);
+    Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+    loaded_ivars->field = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    Obj *term = CERTIFY(Hash_Fetch_Str(source, "term", 4), OBJ);
+    loaded_ivars->term = (Obj*)CERTIFY(Obj_Load(term, term), OBJ);
+    return (Obj*)loaded;
+}
+
 CharBuf*
 TermQuery_get_field(TermQuery *self) {
     return TermQuery_IVARS(self)->field;

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/Lucy/Search/TermQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/TermQuery.cfh b/core/Lucy/Search/TermQuery.cfh
index 70b01a6..3960497 100644
--- a/core/Lucy/Search/TermQuery.cfh
+++ b/core/Lucy/Search/TermQuery.cfh
@@ -62,6 +62,12 @@ public class Lucy::Search::TermQuery inherits Lucy::Search::Query
     public incremented TermQuery*
     Deserialize(decremented TermQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(TermQuery *self);
+
+    public incremented Obj*
+    Load(TermQuery *self, Obj *dump);
+
     public bool
     Equals(TermQuery *self, Obj *other);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/LucyX/Search/ProximityQuery.c
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.c b/core/LucyX/Search/ProximityQuery.c
index 3e8a435..37f7f70 100644
--- a/core/LucyX/Search/ProximityQuery.c
+++ b/core/LucyX/Search/ProximityQuery.c
@@ -96,6 +96,37 @@ ProximityQuery_deserialize(ProximityQuery *self, InStream *instream) {
     return S_do_init(self, field, terms, boost, within);
 }
 
+Obj*
+ProximityQuery_dump(ProximityQuery *self)
+{
+    ProximityQueryIVARS *ivars = ProximityQuery_IVARS(self);
+    ProximityQuery_Dump_t super_dump
+        = SUPER_METHOD_PTR(PROXIMITYQUERY, Lucy_ProximityQuery_Dump);
+    Hash *dump = (Hash*)CERTIFY(super_dump(self), HASH);
+    Hash_Store_Str(dump, "field", 5, Obj_Dump((Obj*)ivars->field));
+    Hash_Store_Str(dump, "terms", 5, Obj_Dump((Obj*)ivars->terms));
+    Hash_Store_Str(dump, "within", 6,
+                   (Obj*)CB_newf("%i64", (int64_t)ivars->within));
+    return (Obj*)dump;
+}
+
+Obj*
+ProximityQuery_load(ProximityQuery *self, Obj *dump)
+{
+    Hash *source = (Hash*)CERTIFY(dump, HASH);
+    ProximityQuery_Load_t super_load
+        = SUPER_METHOD_PTR(PROXIMITYQUERY, Lucy_ProximityQuery_Load);
+    ProximityQuery *loaded = (ProximityQuery*)super_load(self, dump);
+    ProximityQueryIVARS *loaded_ivars = ProximityQuery_IVARS(loaded);
+    Obj *field = CERTIFY(Hash_Fetch_Str(source, "field", 5), OBJ);
+    loaded_ivars->field = (CharBuf*)CERTIFY(Obj_Load(field, field), CHARBUF);
+    Obj *terms = CERTIFY(Hash_Fetch_Str(source, "terms", 5), OBJ);
+    loaded_ivars->terms = (VArray*)CERTIFY(Obj_Load(terms, terms), VARRAY);
+    Obj *within = CERTIFY(Hash_Fetch_Str(source, "within", 6), OBJ);
+    loaded_ivars->within = (uint32_t)Obj_To_I64(within);
+    return (Obj*)loaded;
+}
+
 bool
 ProximityQuery_equals(ProximityQuery *self, Obj *other) {
     if ((ProximityQuery*)other == self)   { return true; }

http://git-wip-us.apache.org/repos/asf/lucy/blob/163c43ed/core/LucyX/Search/ProximityQuery.cfh
----------------------------------------------------------------------
diff --git a/core/LucyX/Search/ProximityQuery.cfh b/core/LucyX/Search/ProximityQuery.cfh
index 2506961..d55eb54 100644
--- a/core/LucyX/Search/ProximityQuery.cfh
+++ b/core/LucyX/Search/ProximityQuery.cfh
@@ -70,6 +70,12 @@ public class LucyX::Search::ProximityQuery inherits Lucy::Search::Query
     public incremented ProximityQuery*
     Deserialize(decremented ProximityQuery *self, InStream *instream);
 
+    public incremented Obj*
+    Dump(ProximityQuery *self);
+
+    public incremented Obj*
+    Load(ProximityQuery *self, Obj *dump);
+
     public void
     Destroy(ProximityQuery *self);
 }


[lucy-commits] [5/6] git commit: refs/heads/move-dumpable - Remove "autocode" from CFCClass.

Posted by ma...@apache.org.
Remove "autocode" from CFCClass.

The "autocode" member var used to hold autogenerated code for Dump/Load.
It's no longer needed.


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

Branch: refs/heads/move-dumpable
Commit: 251d2bcc758d32b5e708d4e52b775f6cad905d9a
Parents: ee8fc5c
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 25 17:12:40 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Jul 25 18:27:24 2013 -0700

----------------------------------------------------------------------
 clownfish/compiler/perl/lib/Clownfish/CFC.xs | 13 -------------
 clownfish/compiler/src/CFCBindClass.c        | 10 ++--------
 clownfish/compiler/src/CFCClass.c            | 15 ---------------
 clownfish/compiler/src/CFCClass.h            |  8 --------
 4 files changed, 2 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/251d2bcc/clownfish/compiler/perl/lib/Clownfish/CFC.xs
----------------------------------------------------------------------
diff --git a/clownfish/compiler/perl/lib/Clownfish/CFC.xs b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
index 2af743f..205d191 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.xs
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
@@ -200,13 +200,6 @@ PPCODE:
     CFCClass_clear_registry();
 
 void
-append_autocode(self, autocode)
-    CFCClass *self;
-    const char *autocode;
-PPCODE:
-    CFCClass_append_autocode(self, autocode);
-
-void
 add_child(self, child)
     CFCClass *self;
     CFCClass *child;
@@ -309,7 +302,6 @@ ALIAS:
     get_cnick             = 2
     set_parent            = 5
     get_parent            = 6
-    get_autocode          = 8
     get_path_part         = 10
     get_parent_class_name = 12
     final                 = 14
@@ -354,11 +346,6 @@ PPCODE:
                 retval = S_cfcbase_to_perlref(parent);
                 break;
             }
-        case 8: {
-                const char *value = CFCClass_get_autocode(self);
-                retval = newSVpvn(value, strlen(value));
-            }
-            break;
         case 10: {
                 const char *value = CFCClass_get_path_part(self);
                 retval = value ? newSVpvn(value, strlen(value)) : newSV(0);

http://git-wip-us.apache.org/repos/asf/lucy/blob/251d2bcc/clownfish/compiler/src/CFCBindClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCBindClass.c b/clownfish/compiler/src/CFCBindClass.c
index f507596..89368f8 100644
--- a/clownfish/compiler/src/CFCBindClass.c
+++ b/clownfish/compiler/src/CFCBindClass.c
@@ -269,12 +269,11 @@ CFCBindClass_to_c_data(CFCBindClass *self) {
     const char *class_name = CFCClass_get_class_name(client);
 
     if (CFCClass_inert(client)) {
-        return CFCUtil_strdup(CFCClass_get_autocode(client));
+        return CFCUtil_strdup("");
     }
 
     const char *ivars_offset = CFCClass_full_ivars_offset(client);
 
-    const char *autocode  = CFCClass_get_autocode(client);
     const char *vt_var    = CFCClass_full_vtable_var(client);
 
     CFCMethod **methods  = CFCClass_methods(client);
@@ -395,16 +394,11 @@ CFCBindClass_to_c_data(CFCBindClass *self) {
         " */\n"
         "\n"
         "cfish_VTable *%s;\n"
-        "\n"
-        "/* Include auxilary automatically generated code for this class.\n"
-        " */\n"
-        "\n"
-        "%s\n"
         "\n";
     char *code
         = CFCUtil_sprintf(pattern, ivars_offset, offsets, method_defs,
                           novel_ms_var, overridden_ms_var, inherited_ms_var,
-                          vt_var, autocode);
+                          vt_var);
 
     FREEMEM(offsets);
     FREEMEM(method_defs);

http://git-wip-us.apache.org/repos/asf/lucy/blob/251d2bcc/clownfish/compiler/src/CFCClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.c b/clownfish/compiler/src/CFCClass.c
index 6e9179d..7b3fa5a 100644
--- a/clownfish/compiler/src/CFCClass.c
+++ b/clownfish/compiler/src/CFCClass.c
@@ -70,7 +70,6 @@ struct CFCClass {
     CFCClassAttribute **attributes;
     size_t num_attributes;
     CFCFileSpec *file_spec;
-    char *autocode;
     char *parent_class_name;
     int is_final;
     int is_inert;
@@ -137,7 +136,6 @@ CFCClass_do_create(CFCClass *self, struct CFCParcel *parcel,
     }
     self->parent     = NULL;
     self->tree_grown = false;
-    self->autocode   = (char*)CALLOCATE(1, sizeof(char));
     self->children        = (CFCClass**)CALLOCATE(1, sizeof(CFCClass*));
     self->num_kids        = 0;
     self->functions       = (CFCFunction**)CALLOCATE(1, sizeof(CFCFunction*));
@@ -248,7 +246,6 @@ CFCClass_destroy(CFCClass *self) {
     FREEMEM(self->member_vars);
     FREEMEM(self->inert_vars);
     FREEMEM(self->attributes);
-    FREEMEM(self->autocode);
     FREEMEM(self->parent_class_name);
     FREEMEM(self->struct_sym);
     FREEMEM(self->ivars_struct);
@@ -768,18 +765,6 @@ CFCClass_get_parent(CFCClass *self) {
     return self->parent;
 }
 
-void
-CFCClass_append_autocode(CFCClass *self, const char *autocode) {
-    size_t size = strlen(self->autocode) + strlen(autocode) + 1;
-    self->autocode = (char*)REALLOCATE(self->autocode, size);
-    strcat(self->autocode, autocode);
-}
-
-const char*
-CFCClass_get_autocode(CFCClass *self) {
-    return self->autocode;
-}
-
 const char*
 CFCClass_get_path_part(CFCClass *self) {
     return self->file_spec ? CFCFileSpec_get_path_part(self->file_spec) : NULL;

http://git-wip-us.apache.org/repos/asf/lucy/blob/251d2bcc/clownfish/compiler/src/CFCClass.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCClass.h b/clownfish/compiler/src/CFCClass.h
index e247e3d..a26c9c3 100644
--- a/clownfish/compiler/src/CFCClass.h
+++ b/clownfish/compiler/src/CFCClass.h
@@ -218,14 +218,6 @@ CFCClass_set_parent(CFCClass *self, CFCClass *parent);
 CFCClass*
 CFCClass_get_parent(CFCClass *self);
 
-/** Append auxiliary C code.
- */
-void
-CFCClass_append_autocode(CFCClass *self, const char *autocode);
-
-const char*
-CFCClass_get_autocode(CFCClass *self);
-
 const char*
 CFCClass_get_path_part(CFCClass *self);
 


[lucy-commits] [6/6] git commit: refs/heads/move-dumpable - MatchAllQuery is not abstract.

Posted by ma...@apache.org.
MatchAllQuery is not abstract.


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

Branch: refs/heads/move-dumpable
Commit: 4b8f8f81507b341614eee56706fab2006e43e5d1
Parents: c9be105
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Thu Jul 25 16:59:10 2013 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Thu Jul 25 18:27:24 2013 -0700

----------------------------------------------------------------------
 core/Lucy/Search/MatchAllQuery.cfh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/4b8f8f81/core/Lucy/Search/MatchAllQuery.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Search/MatchAllQuery.cfh b/core/Lucy/Search/MatchAllQuery.cfh
index 19e32c8..224392a 100644
--- a/core/Lucy/Search/MatchAllQuery.cfh
+++ b/core/Lucy/Search/MatchAllQuery.cfh
@@ -23,7 +23,7 @@ parcel Lucy;
  * which matches against another part of the query will be ranked higher than
  * a document which matches only via the MatchAllQuery.
  */
-public abstract class Lucy::Search::MatchAllQuery
+public class Lucy::Search::MatchAllQuery
     inherits Lucy::Search::Query : dumpable {
 
     inert incremented MatchAllQuery*