You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2015/08/23 13:19:07 UTC

[1/2] lucy git commit: Remove to_clownfish hack

Repository: lucy
Updated Branches:
  refs/heads/master 45eac391a -> fd858d715


Remove to_clownfish hack

Clownfish converts arrayrefs and hashrefs correctly now.


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

Branch: refs/heads/master
Commit: fd858d715de52c12e4a3bb4b0681294b892c5c0f
Parents: 3f3318e
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Thu Aug 20 18:09:17 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Aug 20 19:16:44 2015 +0200

----------------------------------------------------------------------
 perl/buildlib/Lucy/Build/Binding/Analysis.pm |  4 ---
 perl/buildlib/Lucy/Build/Binding/Document.pm |  4 ---
 perl/buildlib/Lucy/Build/Binding/Index.pm    |  8 -----
 perl/buildlib/Lucy/Build/Binding/Misc.pm     | 26 --------------
 perl/buildlib/Lucy/Build/Binding/Plan.pm     |  8 -----
 perl/buildlib/Lucy/Build/Binding/Search.pm   |  4 ---
 perl/lib/Lucy.pm                             | 44 ++---------------------
 perl/lib/LucyX/Index/ZlibDocWriter.pm        |  2 +-
 8 files changed, 4 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/fd858d71/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 11dc3b2..60a73b2 100644
--- a/perl/buildlib/Lucy/Build/Binding/Analysis.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Analysis.pm
@@ -47,10 +47,6 @@ 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/fd858d71/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 b495f71..2316034 100644
--- a/perl/buildlib/Lucy/Build/Binding/Document.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Document.pm
@@ -109,10 +109,6 @@ 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/fd858d71/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 7e0e535..d587479 100644
--- a/perl/buildlib/Lucy/Build/Binding/Index.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Index.pm
@@ -820,10 +820,6 @@ END_SYNOPSIS
         parcel     => "Lucy",
         class_name => "Lucy::Index::Segment",
     );
-    $binding->bind_method(
-        alias  => '_store_metadata',
-        method => 'Store_Metadata',
-    );
     $binding->set_pod_spec($pod_spec);
 
     Clownfish::CFC::Binding::Perl::Class->register($binding);
@@ -867,10 +863,6 @@ 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/fd858d71/perl/buildlib/Lucy/Build/Binding/Misc.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm
index 76e20ac..d0f0fb1 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -41,32 +41,6 @@ CODE:
 OUTPUT:
     RETVAL
 
-SV*
-to_clownfish(sv)
-    SV *sv;
-CODE:
-{
-    cfish_Obj *obj = XSBind_perl_to_cfish_nullable(aTHX_ sv, CFISH_OBJ);
-    RETVAL = CFISH_OBJ_TO_SV_NOINC(obj);
-}
-OUTPUT: RETVAL
-
-SV*
-to_perl(sv)
-    SV *sv;
-CODE:
-{
-    if (sv_isobject(sv) && sv_derived_from(sv, "Clownfish::Obj")) {
-        IV tmp = SvIV(SvRV(sv));
-        cfish_Obj* obj = INT2PTR(cfish_Obj*, tmp);
-        RETVAL = XSBind_cfish_to_perl(aTHX_ obj);
-    }
-    else {
-        RETVAL = newSVsv(sv);
-    }
-}
-OUTPUT: RETVAL
-
 void
 STORABLE_freeze(self, ...)
     cfish_Obj *self;

http://git-wip-us.apache.org/repos/asf/lucy/blob/fd858d71/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 461bfbf..817b75e 100644
--- a/perl/buildlib/Lucy/Build/Binding/Plan.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Plan.pm
@@ -151,10 +151,6 @@ 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");
@@ -282,10 +278,6 @@ 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/fd858d71/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 1abd9e9..4293f1a 100644
--- a/perl/buildlib/Lucy/Build/Binding/Search.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Search.pm
@@ -632,10 +632,6 @@ END_CONSTRUCTOR_CODE_SAMPLE
         parcel     => "Lucy",
         class_name => "Lucy::Search::Query",
     );
-    $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/fd858d71/perl/lib/Lucy.pm
----------------------------------------------------------------------
diff --git a/perl/lib/Lucy.pm b/perl/lib/Lucy.pm
index fb89abb..dd03ecc 100644
--- a/perl/lib/Lucy.pm
+++ b/perl/lib/Lucy.pm
@@ -29,14 +29,9 @@ 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.
@@ -69,13 +64,6 @@ BEGIN {
 }
 
 {
-    package Lucy::Analysis::Analyzer;
-    our $VERSION = '0.004000';
-    $VERSION = eval $VERSION;
-    use Lucy qw( load );
-}
-
-{
     package Lucy::Analysis::RegexTokenizer;
     our $VERSION = '0.004000';
     $VERSION = eval $VERSION;
@@ -95,7 +83,7 @@ BEGIN {
     our $VERSION = '0.004000';
     $VERSION = eval $VERSION;
     use Storable ();  # Needed by serialize/deserialize.
-    use Lucy qw( STORABLE_freeze STORABLE_thaw load );
+    use Lucy qw( STORABLE_freeze STORABLE_thaw );
 
     use overload
         fallback => 1,
@@ -149,22 +137,10 @@ BEGIN {
 }
 
 {
-    package Lucy::Index::Segment;
-    our $VERSION = '0.004000';
-    $VERSION = eval $VERSION;
-    use Clownfish qw( to_clownfish );
-    sub store_metadata {
-        my ( $self, %args ) = @_;
-        $self->_store_metadata( %args,
-            metadata => to_clownfish( $args{metadata} ) );
-    }
-}
-
-{
     package Lucy::Index::Similarity;
     our $VERSION = '0.004000';
     $VERSION = eval $VERSION;
-    use Lucy qw( STORABLE_freeze STORABLE_thaw load );
+    use Lucy qw( STORABLE_freeze STORABLE_thaw );
 }
 
 {
@@ -194,20 +170,6 @@ BEGIN {
 }
 
 {
-    package Lucy::Plan::FieldType;
-    our $VERSION = '0.004000';
-    $VERSION = eval $VERSION;
-    use Lucy qw( load );
-}
-
-{
-    package Lucy::Plan::Schema;
-    our $VERSION = '0.004000';
-    $VERSION = eval $VERSION;
-    use Lucy qw( load );
-}
-
-{
     package Lucy::Search::MatchDoc;
     our $VERSION = '0.004000';
     $VERSION = eval $VERSION;
@@ -218,7 +180,7 @@ BEGIN {
     package Lucy::Search::Query;
     our $VERSION = '0.004000';
     $VERSION = eval $VERSION;
-    use Lucy qw( STORABLE_freeze STORABLE_thaw load );
+    use Lucy qw( STORABLE_freeze STORABLE_thaw );
 }
 
 {

http://git-wip-us.apache.org/repos/asf/lucy/blob/fd858d71/perl/lib/LucyX/Index/ZlibDocWriter.pm
----------------------------------------------------------------------
diff --git a/perl/lib/LucyX/Index/ZlibDocWriter.pm b/perl/lib/LucyX/Index/ZlibDocWriter.pm
index 34dba6f..f6a7c11 100644
--- a/perl/lib/LucyX/Index/ZlibDocWriter.pm
+++ b/perl/lib/LucyX/Index/ZlibDocWriter.pm
@@ -21,7 +21,7 @@ use Carp;
 use Scalar::Util qw( blessed );
 use Compress::Zlib qw( compress );
 use Clownfish::Util::StringHelper qw( cat_bytes );
-use Clownfish qw( to_perl );
+use Clownfish;
 use bytes;
 no bytes;
 


[2/2] lucy git commit: Adjust for XSBind_perl_to_cfish changes

Posted by nw...@apache.org.
Adjust for XSBind_perl_to_cfish changes


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

Branch: refs/heads/master
Commit: 3f3318eb86d28eb2deec99f9b6aa8c5b85358120
Parents: 45eac39
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Aug 5 20:44:51 2015 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Thu Aug 20 19:16:44 2015 +0200

----------------------------------------------------------------------
 perl/buildlib/Lucy/Build/Binding/Index.pm  | 5 +----
 perl/buildlib/Lucy/Build/Binding/Misc.pm   | 2 +-
 perl/buildlib/Lucy/Build/Binding/Search.pm | 9 +++------
 perl/xs/Lucy/Document/Doc.c                | 6 ++++--
 4 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/3f3318eb/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 781e0da..7e0e535 100644
--- a/perl/buildlib/Lucy/Build/Binding/Index.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Index.pm
@@ -304,10 +304,7 @@ set_race_condition_debug1(val_sv)
 PPCODE:
     CFISH_DECREF(lucy_PolyReader_race_condition_debug1);
     lucy_PolyReader_race_condition_debug1 = (cfish_String*)
-        XSBind_maybe_sv_to_cfish_obj(aTHX_ val_sv, CFISH_STRING, NULL);
-    if (lucy_PolyReader_race_condition_debug1) {
-        (void)CFISH_INCREF(lucy_PolyReader_race_condition_debug1);
-    }
+        XSBind_perl_to_cfish_nullable(aTHX_ val_sv, CFISH_STRING);
 
 int32_t
 debug1_num_passes()

http://git-wip-us.apache.org/repos/asf/lucy/blob/3f3318eb/perl/buildlib/Lucy/Build/Binding/Misc.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm
index 92c8b95..76e20ac 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -46,7 +46,7 @@ to_clownfish(sv)
     SV *sv;
 CODE:
 {
-    cfish_Obj *obj = XSBind_perl_to_cfish(aTHX_ sv);
+    cfish_Obj *obj = XSBind_perl_to_cfish_nullable(aTHX_ sv, CFISH_OBJ);
     RETVAL = CFISH_OBJ_TO_SV_NOINC(obj);
 }
 OUTPUT: RETVAL

http://git-wip-us.apache.org/repos/asf/lucy/blob/3f3318eb/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 1602945..1abd9e9 100644
--- a/perl/buildlib/Lucy/Build/Binding/Search.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Search.pm
@@ -467,18 +467,15 @@ CODE:
     }
     else if (strcmp(type_str, "FIELD") == 0) {
         type = LUCY_QPARSER_TOKEN_FIELD; 
-        value = CFISH_CERTIFY(XSBind_perl_to_cfish(aTHX_ value_sv),
-                              CFISH_STRING);
+        value = XSBind_perl_to_cfish(aTHX_ value_sv, CFISH_STRING);
     }
     else if (strcmp(type_str, "STRING") == 0) {
         type = LUCY_QPARSER_TOKEN_STRING; 
-        value = CFISH_CERTIFY(XSBind_perl_to_cfish(aTHX_ value_sv),
-                              CFISH_STRING);
+        value = XSBind_perl_to_cfish(aTHX_ value_sv, CFISH_STRING);
     }
     else if (strcmp(type_str, "QUERY") == 0) {
         type = LUCY_QPARSER_TOKEN_QUERY; 
-        value = CFISH_CERTIFY(XSBind_perl_to_cfish(aTHX_ value_sv),
-                              LUCY_QUERY);
+        value = XSBind_perl_to_cfish(aTHX_ value_sv, LUCY_QUERY);
     }
     else {
         CFISH_THROW(CFISH_ERR, "Bad type: '%s'", type_str);

http://git-wip-us.apache.org/repos/asf/lucy/blob/3f3318eb/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index c352f4e..a45f758 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -153,7 +153,7 @@ LUCY_Doc_Extract_IMP(lucy_Doc *self, cfish_String *field) {
                            -CFISH_Str_Get_Size(field), 0);
 
     if (sv_ptr) {
-        retval = XSBind_perl_to_cfish(aTHX_ *sv_ptr);
+        retval = XSBind_perl_to_cfish_nullable(aTHX_ *sv_ptr, CFISH_OBJ);
     }
 
     return retval;
@@ -188,8 +188,10 @@ LUCY_Doc_Dump_IMP(lucy_Doc *self) {
                           (cfish_Obj*)CFISH_Str_Clone(lucy_Doc_get_class_name(self)));
     CFISH_Hash_Store_Utf8(dump, "doc_id", 7,
                           (cfish_Obj*)cfish_Str_newf("%i32", ivars->doc_id));
+    SV *fields_sv = newRV_inc((SV*)ivars->fields);
     CFISH_Hash_Store_Utf8(dump, "fields", 6,
-                          XSBind_perl_to_cfish(aTHX_ (SV*)ivars->fields));
+                          XSBind_perl_to_cfish(aTHX_ fields_sv, CFISH_HASH));
+    SvREFCNT_dec(fields_sv);
     return dump;
 }