lucy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [lucy-commits] [6/6] git commit: refs/heads/move-dumpable - Finish moving Dump/Load from Clownfish to Lucy.
Date Wed, 31 Jul 2013 01:11:18 GMT
Finish moving Dump/Load from Clownfish to Lucy.

Remove Dump/Load methods from the Clownfish runtime and move their
binding specs up into the Lucy classes that need them.


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

Branch: refs/heads/move-dumpable
Commit: 3c3bbaae7485200d566b19438c82fcf9a005a205
Parents: 939a52f
Author: Marvin Humphrey <marvin@rectangular.com>
Authored: Tue Jul 30 18:06:08 2013 -0700
Committer: Marvin Humphrey <marvin@rectangular.com>
Committed: Tue Jul 30 18:06:08 2013 -0700

----------------------------------------------------------------------
 clownfish/runtime/core/Clownfish/CharBuf.c      |  7 --
 clownfish/runtime/core/Clownfish/CharBuf.cfh    |  3 -
 clownfish/runtime/core/Clownfish/Hash.c         | 71 --------------------
 clownfish/runtime/core/Clownfish/Hash.cfh       |  6 --
 clownfish/runtime/core/Clownfish/Obj.c          |  5 --
 clownfish/runtime/core/Clownfish/Obj.cfh        | 15 -----
 .../runtime/core/Clownfish/Test/TestHash.c      | 35 +---------
 clownfish/runtime/core/Clownfish/Test/TestObj.c | 21 +-----
 .../runtime/core/Clownfish/Test/TestVArray.c    | 20 +-----
 clownfish/runtime/core/Clownfish/VArray.c       | 26 -------
 clownfish/runtime/core/Clownfish/VArray.cfh     |  6 --
 .../perl/buildlib/Clownfish/Build/Binding.pm    |  3 -
 clownfish/runtime/perl/lib/Clownfish.pm         |  1 -
 core/Lucy/Plan/FieldType.cfh                    |  6 ++
 perl/buildlib/Lucy/Build/Binding/Analysis.pm    |  4 ++
 perl/buildlib/Lucy/Build/Binding/Document.pm    |  4 ++
 perl/buildlib/Lucy/Build/Binding/Index.pm       |  4 ++
 perl/buildlib/Lucy/Build/Binding/Plan.pm        |  8 +++
 perl/buildlib/Lucy/Build/Binding/Search.pm      |  4 ++
 perl/lib/Lucy.pm                                | 32 ++++++++-
 20 files changed, 62 insertions(+), 219 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/CharBuf.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.c b/clownfish/runtime/core/Clownfish/CharBuf.c
index 3bdc373..8472f5a 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.c
+++ b/clownfish/runtime/core/Clownfish/CharBuf.c
@@ -445,13 +445,6 @@ CB_clone(CharBuf *self) {
     return CB_new_from_trusted_utf8(self->ptr, self->size);
 }
 
-CharBuf*
-CB_load(CharBuf *self, Obj *dump) {
-    CharBuf *source = (CharBuf*)CERTIFY(dump, CHARBUF);
-    UNUSED_VAR(self);
-    return CB_Clone(source);
-}
-
 void
 CB_mimic_str(CharBuf *self, const char* ptr, size_t size) {
     if (!StrHelp_utf8_valid(ptr, size)) {

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/CharBuf.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/CharBuf.cfh b/clownfish/runtime/core/Clownfish/CharBuf.cfh
index 57f2aa5..613dfbf 100644
--- a/clownfish/runtime/core/Clownfish/CharBuf.cfh
+++ b/clownfish/runtime/core/Clownfish/CharBuf.cfh
@@ -239,9 +239,6 @@ class Clownfish::CharBuf cnick CB
     public incremented CharBuf*
     To_String(CharBuf *self);
 
-    public incremented CharBuf*
-    Load(CharBuf *self, Obj *dump);
-
     /** Remove Unicode whitespace characters from both top and tail.
      */
     uint32_t

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/Hash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.c b/clownfish/runtime/core/Clownfish/Hash.c
index a95485b..ffcd102 100644
--- a/clownfish/runtime/core/Clownfish/Hash.c
+++ b/clownfish/runtime/core/Clownfish/Hash.c
@@ -97,77 +97,6 @@ Hash_destroy(Hash *self) {
     SUPER_DESTROY(self, HASH);
 }
 
-Hash*
-Hash_dump(Hash *self) {
-    Hash *dump = Hash_new(self->size);
-    Obj *key;
-    Obj *value;
-
-    Hash_Iterate(self);
-    while (Hash_Next(self, &key, &value)) {
-        // Since JSON only supports text hash keys, Dump() can only support
-        // text hash keys.
-        CERTIFY(key, CHARBUF);
-        Hash_Store(dump, key, Obj_Dump(value));
-    }
-
-    return dump;
-}
-
-Obj*
-Hash_load(Hash *self, Obj *dump) {
-    Hash *source = (Hash*)CERTIFY(dump, HASH);
-    CharBuf *class_name = (CharBuf*)Hash_Fetch_Str(source, "_class", 6);
-    UNUSED_VAR(self);
-
-    // Assume that the presence of the "_class" key paired with a valid class
-    // name indicates the output of a Dump rather than an ordinary Hash. */
-    if (class_name && CB_Is_A(class_name, CHARBUF)) {
-        VTable *vtable = VTable_fetch_vtable(class_name);
-
-        if (!vtable) {
-            CharBuf *parent_class = VTable_find_parent_class(class_name);
-            if (parent_class) {
-                VTable *parent = VTable_singleton(parent_class, NULL);
-                vtable = VTable_singleton(class_name, parent);
-                DECREF(parent_class);
-            }
-            else {
-                // TODO: Fix Hash_Load() so that it works with ordinary hash
-                // keys named "_class".
-                THROW(ERR, "Can't find class '%o'", class_name);
-            }
-        }
-
-        // Dispatch to an alternate Load() method.
-        if (vtable) {
-            Obj_Load_t load = METHOD_PTR(vtable, Cfish_Obj_Load);
-            if (load == Obj_load) {
-                THROW(ERR, "Abstract method Load() not defined for %o",
-                      VTable_Get_Name(vtable));
-            }
-            else if (load != (Obj_Load_t)Hash_load) { // stop inf loop
-                Obj *dummy = VTable_Make_Obj(vtable);
-                Obj *loaded = Obj_Load(dummy, dump);
-                DECREF(dummy);
-                return loaded;
-            }
-        }
-    }
-
-    // It's an ordinary Hash.
-    Hash *loaded = Hash_new(source->size);
-    Obj *key;
-    Obj *value;
-    Hash_Iterate(source);
-    while (Hash_Next(source, &key, &value)) {
-        Hash_Store(loaded, key, Obj_Load(value, value));
-    }
-
-    return (Obj*)loaded;
-
-}
-
 void
 Hash_clear(Hash *self) {
     HashEntry *entry       = (HashEntry*)self->entries;

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/Hash.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Hash.cfh b/clownfish/runtime/core/Clownfish/Hash.cfh
index 6397368..397cc2d 100644
--- a/clownfish/runtime/core/Clownfish/Hash.cfh
+++ b/clownfish/runtime/core/Clownfish/Hash.cfh
@@ -133,12 +133,6 @@ class Clownfish::Hash inherits Clownfish::Obj {
     public bool
     Equals(Hash *self, Obj *other);
 
-    public incremented Hash*
-    Dump(Hash *self);
-
-    public incremented Obj*
-    Load(Hash *self, Obj *dump);
-
     public void
     Destroy(Hash *self);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/Obj.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Obj.c b/clownfish/runtime/core/Clownfish/Obj.c
index f8f6e2d..b8a230a 100644
--- a/clownfish/runtime/core/Clownfish/Obj.c
+++ b/clownfish/runtime/core/Clownfish/Obj.c
@@ -87,11 +87,6 @@ Obj_to_bool(Obj *self) {
     return !!Obj_To_I64(self);
 }
 
-Obj*
-Obj_dump(Obj *self) {
-    return (Obj*)Obj_To_String(self);
-}
-
 VTable*
 Obj_get_vtable(Obj *self) {
     return self->vtable;

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/Obj.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Obj.cfh b/clownfish/runtime/core/Clownfish/Obj.cfh
index 17c39c5..09818bf 100644
--- a/clownfish/runtime/core/Clownfish/Obj.cfh
+++ b/clownfish/runtime/core/Clownfish/Obj.cfh
@@ -152,21 +152,6 @@ public class Clownfish::Obj {
     public bool
     To_Bool(Obj *self);
 
-    /** Return a representation of the object using only scalars, hashes, and
-     * arrays.  Some implementations support JSON serialization via Dump() and
-     * its companion method, Load(); for others, Dump() is only a debugging
-     * aid.  The default simply calls To_String().
-     */
-    public incremented Obj*
-    Dump(Obj *self);
-
-    /** Create an object from the output of a call to Dump().
-     *
-     * @param dump The output of Dump().
-     */
-    public abstract incremented Obj*
-    Load(Obj *self, Obj *dump);
-
     /** Update the internal state of the object to mimic that of
      * <code>other</code>.
      */

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/Test/TestHash.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestHash.c b/clownfish/runtime/core/Clownfish/Test/TestHash.c
index f71203e..abd7617 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestHash.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestHash.c
@@ -183,38 +183,6 @@ test_Keys_Values_Iter(TestBatchRunner *runner) {
 }
 
 static void
-test_Dump_and_Load(TestBatchRunner *runner) {
-    Hash *hash = Hash_new(0);
-    Obj  *dump;
-    Hash *loaded;
-
-    Hash_Store_Str(hash, "foo", 3,
-                   (Obj*)CB_new_from_trusted_utf8("foo", 3));
-    dump = (Obj*)Hash_Dump(hash);
-    loaded = (Hash*)Obj_Load(dump, dump);
-    TEST_TRUE(runner, Hash_Equals(hash, (Obj*)loaded),
-              "Dump => Load round trip");
-    DECREF(dump);
-    DECREF(loaded);
-
-    /* TODO: Fix Hash_Load().
-
-    Hash_Store_Str(hash, "_class", 6,
-        (Obj*)CB_new_from_trusted_utf8("not_a_class", 11));
-    dump = (Obj*)Hash_Dump(hash);
-    loaded = (Hash*)Obj_Load(dump, dump);
-
-    TEST_TRUE(runner, Hash_Equals(hash, (Obj*)loaded),
-              "Load still works with _class if it's not a real class");
-    DECREF(dump);
-    DECREF(loaded);
-
-    */
-
-    DECREF(hash);
-}
-
-static void
 test_stress(TestBatchRunner *runner) {
     Hash     *hash     = Hash_new(0); // trigger multiple rebuilds.
     VArray   *expected = VA_new(1000);
@@ -254,12 +222,11 @@ test_stress(TestBatchRunner *runner) {
 
 void
 TestHash_run(TestHash *self, TestBatchRunner *runner) {
-    TestBatchRunner_Plan(runner, (TestBatch*)self, 28);
+    TestBatchRunner_Plan(runner, (TestBatch*)self, 27);
     srand((unsigned int)time((time_t*)NULL));
     test_Equals(runner);
     test_Store_and_Fetch(runner);
     test_Keys_Values_Iter(runner);
-    test_Dump_and_Load(runner);
     test_stress(runner);
 }
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/Test/TestObj.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestObj.c b/clownfish/runtime/core/Clownfish/Test/TestObj.c
index f1d6d90..4ca121a 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestObj.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestObj.c
@@ -76,18 +76,6 @@ test_To_String(TestBatchRunner *runner) {
 }
 
 static void
-test_Dump(TestBatchRunner *runner) {
-    Obj *testobj = S_new_testobj();
-    CharBuf *string = Obj_To_String(testobj);
-    Obj *dump = Obj_Dump(testobj);
-    TEST_TRUE(runner, Obj_Equals(dump, (Obj*)string),
-              "Default Dump returns To_String");
-    DECREF(dump);
-    DECREF(string);
-    DECREF(testobj);
-}
-
-static void
 test_Equals(TestBatchRunner *runner) {
     Obj *testobj = S_new_testobj();
     Obj *other   = S_new_testobj();
@@ -157,11 +145,6 @@ S_attempt_To_F64(void *context) {
 }
 
 static void
-S_attempt_Load(void *context) {
-    Obj_Load((Obj*)context, (Obj*)context);
-}
-
-static void
 S_attempt_Mimic(void *context) {
     Obj_Mimic((Obj*)context, (Obj*)context);
 }
@@ -190,17 +173,15 @@ test_abstract_routines(TestBatchRunner *runner) {
     S_verify_abstract_error(runner, S_attempt_Compare_To, obj, "Compare_To");
     S_verify_abstract_error(runner, S_attempt_To_I64,     obj, "To_I64");
     S_verify_abstract_error(runner, S_attempt_To_F64,     obj, "To_F64");
-    S_verify_abstract_error(runner, S_attempt_Load,       obj, "Load");
     S_verify_abstract_error(runner, S_attempt_Mimic,      obj, "Mimic");
     DECREF(obj);
 }
 
 void
 TestObj_run(TestObj *self, TestBatchRunner *runner) {
-    TestBatchRunner_Plan(runner, (TestBatch*)self, 20);
+    TestBatchRunner_Plan(runner, (TestBatch*)self, 18);
     test_refcounts(runner);
     test_To_String(runner);
-    test_Dump(runner);
     test_Equals(runner);
     test_Hash_Sum(runner);
     test_Is_A(runner);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/Test/TestVArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/Test/TestVArray.c b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
index b012d7c..802388a 100644
--- a/clownfish/runtime/core/Clownfish/Test/TestVArray.c
+++ b/clownfish/runtime/core/Clownfish/Test/TestVArray.c
@@ -298,26 +298,9 @@ test_Clone_and_Shallow_Copy(TestBatchRunner *runner) {
     DECREF(twin);
 }
 
-static void
-test_Dump_and_Load(TestBatchRunner *runner) {
-    VArray *array = VA_new(0);
-    Obj    *dump;
-    VArray *loaded;
-
-    VA_Push(array, (Obj*)S_new_cb("foo"));
-    dump = (Obj*)VA_Dump(array);
-    loaded = (VArray*)Obj_Load(dump, dump);
-    TEST_TRUE(runner, VA_Equals(array, (Obj*)loaded),
-              "Dump => Load round trip");
-
-    DECREF(array);
-    DECREF(dump);
-    DECREF(loaded);
-}
-
 void
 TestVArray_run(TestVArray *self, TestBatchRunner *runner) {
-    TestBatchRunner_Plan(runner, (TestBatch*)self, 44);
+    TestBatchRunner_Plan(runner, (TestBatch*)self, 43);
     test_Equals(runner);
     test_Store_Fetch(runner);
     test_Push_Pop_Shift_Unshift(runner);
@@ -327,7 +310,6 @@ TestVArray_run(TestVArray *self, TestBatchRunner *runner) {
     test_Push_VArray(runner);
     test_Slice(runner);
     test_Clone_and_Shallow_Copy(runner);
-    test_Dump_and_Load(runner);
 }
 
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/VArray.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VArray.c b/clownfish/runtime/core/Clownfish/VArray.c
index 2370eb9..abe65f9 100644
--- a/clownfish/runtime/core/Clownfish/VArray.c
+++ b/clownfish/runtime/core/Clownfish/VArray.c
@@ -62,32 +62,6 @@ VA_destroy(VArray *self) {
 }
 
 VArray*
-VA_dump(VArray *self) {
-    VArray *dump = VA_new(self->size);
-    for (uint32_t i = 0, max = self->size; i < max; i++) {
-        Obj *elem = VA_Fetch(self, i);
-        if (elem) { VA_Store(dump, i, Obj_Dump(elem)); }
-    }
-    return dump;
-}
-
-VArray*
-VA_load(VArray *self, Obj *dump) {
-    VArray *source = (VArray*)CERTIFY(dump, VARRAY);
-    VArray *loaded = VA_new(source->size);
-    UNUSED_VAR(self);
-
-    for (uint32_t i = 0, max = source->size; i < max; i++) {
-        Obj *elem_dump = VA_Fetch(source, i);
-        if (elem_dump) {
-            VA_Store(loaded, i, Obj_Load(elem_dump, elem_dump));
-        }
-    }
-
-    return loaded;
-}
-
-VArray*
 VA_clone(VArray *self) {
     VArray *twin = VA_new(self->size);
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/core/Clownfish/VArray.cfh
----------------------------------------------------------------------
diff --git a/clownfish/runtime/core/Clownfish/VArray.cfh b/clownfish/runtime/core/Clownfish/VArray.cfh
index f171a7b..e287bc7 100644
--- a/clownfish/runtime/core/Clownfish/VArray.cfh
+++ b/clownfish/runtime/core/Clownfish/VArray.cfh
@@ -162,12 +162,6 @@ class Clownfish::VArray cnick VA inherits Clownfish::Obj {
     public bool
     Equals(VArray *self, Obj *other);
 
-    public incremented VArray*
-    Dump(VArray *self);
-
-    public incremented VArray*
-    Load(VArray *self, Obj *dump);
-
     public void
     Destroy(VArray *self);
 }

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
index 66fa118..890aed3 100644
--- a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -384,8 +384,6 @@ sub bind_obj {
         To_I64
         To_F64
         Equals
-        Dump
-        Load
     );
     my @hand_rolled = qw(
         Is_A
@@ -497,7 +495,6 @@ END_XS_CODE
         parcel     => "Clownfish",
         class_name => "Clownfish::Obj",
     );
-    $binding->bind_method( alias => '_load', method => 'Load' );
     $binding->exclude_method($_) for @hand_rolled;
     $binding->append_xs($xs_code);
     $binding->set_pod_spec($pod_spec);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/clownfish/runtime/perl/lib/Clownfish.pm
----------------------------------------------------------------------
diff --git a/clownfish/runtime/perl/lib/Clownfish.pm b/clownfish/runtime/perl/lib/Clownfish.pm
index 7d6356e..a15c420 100644
--- a/clownfish/runtime/perl/lib/Clownfish.pm
+++ b/clownfish/runtime/perl/lib/Clownfish.pm
@@ -86,7 +86,6 @@ sub error {$Clownfish::Err::error}
     our $VERSION = '0.003000';
     $VERSION = eval $VERSION;
     use Clownfish qw( to_clownfish to_perl );
-    sub load { return $_[0]->_load( to_clownfish( $_[1] ) ) }
 }
 
 {

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/core/Lucy/Plan/FieldType.cfh
----------------------------------------------------------------------
diff --git a/core/Lucy/Plan/FieldType.cfh b/core/Lucy/Plan/FieldType.cfh
index bad2186..1581928 100644
--- a/core/Lucy/Plan/FieldType.cfh
+++ b/core/Lucy/Plan/FieldType.cfh
@@ -159,6 +159,12 @@ public abstract class Lucy::Plan::FieldType cnick FType
     abstract incremented Hash*
     Dump_For_Schema(FieldType *self);
 
+    public abstract incremented Obj*
+    Dump(FieldType *self);
+
+    public abstract incremented Obj*
+    Load(FieldType *self, Obj *dump);
+
     /** Compares all common properties.
      */
     public bool

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/perl/buildlib/Lucy/Build/Binding/Analysis.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Analysis.pm b/perl/buildlib/Lucy/Build/Binding/Analysis.pm
index 981041c..42dc232 100644
--- a/perl/buildlib/Lucy/Build/Binding/Analysis.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Analysis.pm
@@ -42,6 +42,10 @@ sub bind_analyzer {
         parcel     => "Lucy",
         class_name => "Lucy::Analysis::Analyzer",
     );
+    $binding->bind_method(
+        alias  => '_load',
+        method => 'Load',
+    );
     $binding->set_pod_spec($pod_spec);
 
     Clownfish::CFC::Binding::Perl::Class->register($binding);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/perl/buildlib/Lucy/Build/Binding/Document.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Document.pm b/perl/buildlib/Lucy/Build/Binding/Document.pm
index 94706b4..8fc4cbf 100644
--- a/perl/buildlib/Lucy/Build/Binding/Document.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Document.pm
@@ -106,6 +106,10 @@ END_XS_CODE
         class_name => "Lucy::Document::Doc",
     );
     $binding->append_xs($xs_code);
+    $binding->bind_method(
+        alias  => '_load',
+        method => 'Load',
+    );
     $binding->exclude_method($_) for @hand_rolled;
     $binding->exclude_constructor;
     $binding->set_pod_spec($pod_spec);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/perl/buildlib/Lucy/Build/Binding/Index.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Index.pm b/perl/buildlib/Lucy/Build/Binding/Index.pm
index 71913b1..56475a8 100644
--- a/perl/buildlib/Lucy/Build/Binding/Index.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Index.pm
@@ -1054,6 +1054,10 @@ END_XS_CODE
         parcel     => "Lucy",
         class_name => "Lucy::Index::Similarity",
     );
+    $binding->bind_method(
+        alias  => '_load',
+        method => 'Load',
+    );
     $binding->exclude_method($_) for @hand_rolled;
     $binding->append_xs($xs_code);
     $binding->set_pod_spec($pod_spec);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/perl/buildlib/Lucy/Build/Binding/Plan.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Plan.pm b/perl/buildlib/Lucy/Build/Binding/Plan.pm
index 86a3b79..c5581a1 100644
--- a/perl/buildlib/Lucy/Build/Binding/Plan.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Plan.pm
@@ -151,6 +151,10 @@ END_SYNOPSIS
         class_name => "Lucy::Plan::FieldType",
     );
     $binding->bind_constructor( alias => 'new', initializer => 'init2' );
+    $binding->bind_method(
+        alias  => '_load',
+        method => 'Load',
+    );
     $binding->set_pod_spec($pod_spec);
     $binding->add_class_alias("KinoSearch::Plan::FieldType");
     $binding->add_class_alias("KinoSearch::FieldType");
@@ -277,6 +281,10 @@ END_CONSTRUCTOR
         parcel     => "Lucy",
         class_name => "Lucy::Plan::Schema",
     );
+    $binding->bind_method(
+        alias  => '_load',
+        method => 'Load',
+    );
     $binding->set_pod_spec($pod_spec);
     $binding->add_class_alias("KinoSearch::Plan::Schema");
     $binding->add_class_alias("KinoSearch::Schema");

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/perl/buildlib/Lucy/Build/Binding/Search.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Search.pm b/perl/buildlib/Lucy/Build/Binding/Search.pm
index af63475..445075a 100644
--- a/perl/buildlib/Lucy/Build/Binding/Search.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Search.pm
@@ -708,6 +708,10 @@ END_CONSTRUCTOR_CODE_SAMPLE
         alias  => '_make_compiler',
         method => 'Make_Compiler',
     );
+    $binding->bind_method(
+        alias  => '_load',
+        method => 'Load',
+    );
     $binding->set_pod_spec($pod_spec);
 
     Clownfish::CFC::Binding::Perl::Class->register($binding);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3c3bbaae/perl/lib/Lucy.pm
----------------------------------------------------------------------
diff --git a/perl/lib/Lucy.pm b/perl/lib/Lucy.pm
index 4b1e4b3..2a6f371 100644
--- a/perl/lib/Lucy.pm
+++ b/perl/lib/Lucy.pm
@@ -29,9 +29,14 @@ BEGIN {
     our @EXPORT_OK = qw(
         STORABLE_freeze
         STORABLE_thaw
+        load
         );
 }
 
+sub load {
+    return $_[0]->_load( to_clownfish( $_[1] ) );
+}
+
 # On most UNIX variants, this flag makes DynaLoader pass RTLD_GLOBAL to
 # dl_open, so extensions can resolve the needed symbols without explicitly
 # linking against the DSO.
@@ -65,6 +70,13 @@ BEGIN {
 }
 
 {
+    package Lucy::Analysis::Analyzer;
+    our $VERSION = '0.003000';
+    $VERSION = eval $VERSION;
+    use Lucy qw( load );
+}
+
+{
     package Lucy::Analysis::RegexTokenizer;
     our $VERSION = '0.003000';
     $VERSION = eval $VERSION;
@@ -84,7 +96,7 @@ BEGIN {
     our $VERSION = '0.003000';
     $VERSION = eval $VERSION;
     use Storable ();  # Needed by serialize/deserialize.
-    use Lucy qw( STORABLE_freeze STORABLE_thaw );
+    use Lucy qw( STORABLE_freeze STORABLE_thaw load );
 
     use overload
         fallback => 1,
@@ -166,7 +178,7 @@ BEGIN {
     package Lucy::Index::Similarity;
     our $VERSION = '0.003000';
     $VERSION = eval $VERSION;
-    use Lucy qw( STORABLE_freeze STORABLE_thaw );
+    use Lucy qw( STORABLE_freeze STORABLE_thaw load );
 }
 
 {
@@ -196,6 +208,20 @@ BEGIN {
 }
 
 {
+    package Lucy::Plan::FieldType;
+    our $VERSION = '0.003000';
+    $VERSION = eval $VERSION;
+    use Lucy qw( load );
+}
+
+{
+    package Lucy::Plan::Schema;
+    our $VERSION = '0.003000';
+    $VERSION = eval $VERSION;
+    use Lucy qw( load );
+}
+
+{
     package Lucy::Search::MatchDoc;
     our $VERSION = '0.003000';
     $VERSION = eval $VERSION;
@@ -206,7 +232,7 @@ BEGIN {
     package Lucy::Search::Query;
     our $VERSION = '0.003000';
     $VERSION = eval $VERSION;
-    use Lucy qw( STORABLE_freeze STORABLE_thaw );
+    use Lucy qw( STORABLE_freeze STORABLE_thaw load );
 
     sub make_compiler {
         my ( $self, %args ) = @_;


Mime
View raw message