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 2013/07/29 14:58:44 UTC

[lucy-commits] [1/3] git commit: refs/heads/perl-method-bindings - Fix CFC Perl bindings

Updated Branches:
  refs/heads/perl-method-bindings 7ef403131 -> e85d4d482


Fix CFC Perl bindings


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

Branch: refs/heads/perl-method-bindings
Commit: f24927d034bc15eb56053c4accd8846fe14d6db0
Parents: 7ef4031
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Jul 29 14:15:44 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Jul 29 14:43:09 2013 +0200

----------------------------------------------------------------------
 clownfish/compiler/perl/lib/Clownfish/CFC.xs | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/f24927d0/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 6e9a51d..9faba1f 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.xs
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
@@ -2286,7 +2286,8 @@ PPCODE:
     CFCPerlClass_append_xs(self, xs);
 
 SV*
-method_bindings(klass)
+method_bindings(unused, klass)
+    SV *unused;
     CFCClass *klass;
 CODE:
     CFCPerlMethod **bound = CFCPerlClass_method_bindings(klass);


[lucy-commits] [3/3] git commit: refs/heads/perl-method-bindings - Remove unneeded binding code

Posted by nw...@apache.org.
Remove unneeded binding code

It's not anymore necessary to create a CFCPerlClass just to generate
method and constructor XSubs.


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

Branch: refs/heads/perl-method-bindings
Commit: e85d4d482fd22afdab52cfc2a51a76bfefe0dfdd
Parents: 1a0b438
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Jul 29 14:37:38 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Jul 29 14:43:10 2013 +0200

----------------------------------------------------------------------
 .../perl/buildlib/Clownfish/Build/Binding.pm    |  18 --
 perl/buildlib/Lucy/Build/Binding/Index.pm       | 216 -------------------
 perl/buildlib/Lucy/Build/Binding/Misc.pm        |   9 -
 perl/buildlib/Lucy/Build/Binding/Search.pm      |  99 ---------
 perl/buildlib/Lucy/Build/Binding/Store.pm       |  27 ---
 perl/buildlib/Lucy/Build/Binding/Util.pm        |  28 ---
 6 files changed, 397 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/e85d4d48/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..563073d 100644
--- a/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
+++ b/clownfish/runtime/perl/buildlib/Clownfish/Build/Binding.pm
@@ -27,13 +27,11 @@ sub bind_all {
     $class->bind_charbuf;
     $class->bind_err;
     $class->bind_hash;
-    $class->bind_lockfreeregistry;
     $class->bind_float32;
     $class->bind_float64;
     $class->bind_obj;
     $class->bind_varray;
     $class->bind_vtable;
-    $class->bind_method;
     $class->bind_stringhelper;
 }
 
@@ -316,14 +314,6 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_lockfreeregistry {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Clownfish",
-        class_name => "Clownfish::LockFreeRegistry",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_float32 {
     my $float32_xs_code = <<'END_XS_CODE';
 MODULE = Clownfish   PACKAGE = Clownfish::Float32
@@ -657,14 +647,6 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_method {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Clownfish",
-        class_name => "Clownfish::Method",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_stringhelper {
     my $xs_code = <<'END_XS_CODE';
 MODULE = Clownfish   PACKAGE = Clownfish::Util::StringHelper

http://git-wip-us.apache.org/repos/asf/lucy/blob/e85d4d48/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..db74b46 100644
--- a/perl/buildlib/Lucy/Build/Binding/Index.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Index.pm
@@ -24,49 +24,25 @@ sub bind_all {
     $class->bind_backgroundmerger;
     $class->bind_datareader;
     $class->bind_datawriter;
-    $class->bind_deletionsreader;
-    $class->bind_defaultdeletionsreader;
     $class->bind_deletionswriter;
-    $class->bind_defaultdeletionswriter;
     $class->bind_docreader;
-    $class->bind_defaultdocreader;
-    $class->bind_docvector;
-    $class->bind_docwriter;
-    $class->bind_filepurger;
-    $class->bind_highlightreader;
-    $class->bind_defaulthighlightreader;
-    $class->bind_highlightwriter;
     $class->bind_indexmanager;
     $class->bind_indexreader;
     $class->bind_indexer;
-    $class->bind_inverter;
     $class->bind_lexicon;
     $class->bind_lexiconreader;
-    $class->bind_defaultlexiconreader;
-    $class->bind_lexiconwriter;
-    $class->bind_polylexicon;
     $class->bind_polyreader;
-    $class->bind_posting;
-    $class->bind_matchposting;
-    $class->bind_richposting;
     $class->bind_scoreposting;
     $class->bind_postinglist;
     $class->bind_postinglistreader;
-    $class->bind_defaultpostinglistreader;
     $class->bind_postinglistwriter;
-    $class->bind_seglexicon;
-    $class->bind_segpostinglist;
     $class->bind_segreader;
     $class->bind_segwriter;
     $class->bind_segment;
     $class->bind_similarity;
     $class->bind_snapshot;
     $class->bind_sortcache;
-    $class->bind_sortreader;
-    $class->bind_defaultsortreader;
     $class->bind_sortwriter;
-    $class->bind_terminfo;
-    $class->bind_termvector;
 }
 
 sub bind_backgroundmerger {
@@ -175,22 +151,6 @@ END_CONSTRUCTOR
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_deletionsreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DeletionsReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_defaultdeletionsreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DefaultDeletionsReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_deletionswriter {
     my @exposed = qw(
         Delete_By_Term
@@ -220,14 +180,6 @@ END_SYNOPSIS
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_defaultdeletionswriter {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DefaultDeletionsWriter",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_docreader {
     my @exposed = qw( Fetch_Doc Aggregator );
 
@@ -248,62 +200,6 @@ END_SYNOPSIS
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_defaultdocreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DefaultDocReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_docvector {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DocVector",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_docwriter {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DocWriter",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_filepurger {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::FilePurger",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_highlightreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::HighlightReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_defaulthighlightreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DefaultHighlightReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_highlightwriter {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::HighlightWriter",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_indexmanager {
     my @exposed = qw(
         Make_Write_Lock
@@ -622,14 +518,6 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_inverter {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::Inverter",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_lexicon {
     my @exposed = qw(
         Seek
@@ -678,30 +566,6 @@ END_SYNOPSIS
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_defaultlexiconreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DefaultLexiconReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_lexiconwriter {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::LexiconWriter",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_polylexicon {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::PolyLexicon",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_polyreader {
     my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
     my $synopsis = <<'END_SYNOPSIS';
@@ -740,30 +604,6 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_posting {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::Posting",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_matchposting {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::Posting::MatchPosting",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_richposting {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::Posting::RichPosting",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_scoreposting {
     my @hand_rolled = qw( Get_Prox );
 
@@ -856,14 +696,6 @@ END_SYNOPSIS
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_defaultpostinglistreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DefaultPostingListReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_postinglistwriter {
     my $xs_code = <<'END_XS';
 MODULE = Lucy    PACKAGE = Lucy::Index::PostingListWriter
@@ -884,22 +716,6 @@ END_XS
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_seglexicon {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::SegLexicon",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_segpostinglist {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::SegPostingList",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_segreader {
     my @exposed = qw(
         Get_Seg_Name
@@ -1135,22 +951,6 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_sortreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::SortReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_defaultsortreader {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::DefaultSortReader",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_sortwriter {
     my $xs_code = <<'END_XS';
 MODULE = Lucy    PACKAGE = Lucy::Index::SortWriter
@@ -1171,20 +971,4 @@ END_XS
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_terminfo {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::TermInfo",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_termvector {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Index::TermVector",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 1;

http://git-wip-us.apache.org/repos/asf/lucy/blob/e85d4d48/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 19036d9..4aab92a 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -24,7 +24,6 @@ sub bind_all {
     $class->inherit_metadata($hierarchy);
     $class->bind_lucy;
     $class->bind_test;
-    $class->bind_testschema;
 }
 
 sub inherit_metadata {
@@ -207,13 +206,5 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_testschema {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "TestLucy",
-        class_name => "Lucy::Test::TestSchema",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 1;
 

http://git-wip-us.apache.org/repos/asf/lucy/blob/e85d4d48/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..b3f3779 100644
--- a/perl/buildlib/Lucy/Build/Binding/Search.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Search.pm
@@ -21,36 +21,26 @@ $VERSION = eval $VERSION;
 
 sub bind_all {
     my $class = shift;
-    $class->bind_andmatcher;
     $class->bind_andquery;
-    $class->bind_bitvecmatcher;
     $class->bind_collector;
     $class->bind_bitcollector;
-    $class->bind_offsetcollector;
-    $class->bind_sortcollector;
     $class->bind_compiler;
-    $class->bind_hitqueue;
     $class->bind_hits;
     $class->bind_indexsearcher;
     $class->bind_leafquery;
     $class->bind_matchallquery;
-    $class->bind_matchdoc;
     $class->bind_matcher;
-    $class->bind_notmatcher;
     $class->bind_notquery;
     $class->bind_nomatchquery;
     $class->bind_orquery;
-    $class->bind_orscorer;
     $class->bind_parserelem;
     $class->bind_phrasequery;
     $class->bind_phrasecompiler;
     $class->bind_polyquery;
     $class->bind_polysearcher;
     $class->bind_query;
-    $class->bind_querylexer;
     $class->bind_queryparser;
     $class->bind_rangequery;
-    $class->bind_requiredoptionalmatcher;
     $class->bind_requiredoptionalquery;
     $class->bind_searcher;
     $class->bind_sortrule;
@@ -58,15 +48,6 @@ sub bind_all {
     $class->bind_span;
     $class->bind_termquery;
     $class->bind_termcompiler;
-    $class->bind_topdocs;
-}
-
-sub bind_andmatcher {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::ANDMatcher",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
 sub bind_andquery {
@@ -98,14 +79,6 @@ END_CONSTRUCTOR
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_bitvecmatcher {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::BitVecMatcher",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_collector {
     my @exposed = qw( Collect );
 
@@ -168,22 +141,6 @@ END_CONSTRUCTOR
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_offsetcollector {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::Collector::OffsetCollector",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_sortcollector {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::Collector::SortCollector",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_compiler {
     my @exposed = qw(
         Make_Matcher
@@ -229,14 +186,6 @@ END_CONSTRUCTOR_CODE_SAMPLE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_hitqueue {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::HitQueue",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_hits {
     my @exposed = qw( Next Total_Hits );
 
@@ -359,14 +308,6 @@ END_CONSTRUCTOR
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_matchdoc {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::MatchDoc",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_matcher {
     my @exposed = qw(
         Next
@@ -395,14 +336,6 @@ END_CONSTRUCTOR_CODE_SAMPLE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_notmatcher {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::NOTMatcher",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_notquery {
     my @exposed = qw(
         Get_Negated_Query
@@ -483,14 +416,6 @@ END_CONSTRUCTOR
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_orscorer {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::ORScorer",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_parserelem {
     my $xs_code = <<'END_XS_CODE';
 MODULE = Lucy   PACKAGE = Lucy::Search::QueryParser::ParserElem
@@ -713,14 +638,6 @@ END_CONSTRUCTOR_CODE_SAMPLE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_querylexer {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::QueryParser::QueryLexer",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_queryparser {
     my @exposed = qw(
         Parse
@@ -807,14 +724,6 @@ END_CONSTRUCTOR
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_requiredoptionalmatcher {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::RequiredOptionalMatcher",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_requiredoptionalquery {
     my @exposed = qw(
         Get_Required_Query
@@ -1051,12 +960,4 @@ sub bind_termcompiler {
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_topdocs {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Search::TopDocs",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 1;

http://git-wip-us.apache.org/repos/asf/lucy/blob/e85d4d48/perl/buildlib/Lucy/Build/Binding/Store.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Store.pm b/perl/buildlib/Lucy/Build/Binding/Store.pm
index fbec036..008f1e8 100644
--- a/perl/buildlib/Lucy/Build/Binding/Store.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Store.pm
@@ -27,12 +27,9 @@ sub bind_all {
     $class->bind_folder;
     $class->bind_instream;
     $class->bind_lock;
-    $class->bind_lockfilelock;
-    $class->bind_sharedlock;
     $class->bind_lockerr;
     $class->bind_lockfactory;
     $class->bind_outstream;
-    $class->bind_ramfile;
     $class->bind_ramfilehandle;
     $class->bind_ramfolder;
 }
@@ -257,22 +254,6 @@ END_CONSTRUCTOR
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_lockfilelock {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Store::LockFileLock",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_sharedlock {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Store::SharedLock",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_lockerr {
     my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
     my $synopsis = <<'END_SYNOPSIS';
@@ -383,14 +364,6 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_ramfile {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Store::RAMFile",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_ramfilehandle {
     my $binding = Clownfish::CFC::Binding::Perl::Class->new(
         parcel     => "Lucy",

http://git-wip-us.apache.org/repos/asf/lucy/blob/e85d4d48/perl/buildlib/Lucy/Build/Binding/Util.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Util.pm b/perl/buildlib/Lucy/Build/Binding/Util.pm
index a64c58b..0501642 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -25,10 +25,7 @@ sub bind_all {
     $class->bind_debug;
     $class->bind_freezer;
     $class->bind_indexfilenames;
-    $class->bind_memorypool;
-    $class->bind_priorityqueue;
     $class->bind_sortexternal;
-    $class->bind_stepper;
 }
 
 sub bind_bbsortex {
@@ -232,22 +229,6 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_memorypool {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Util::MemoryPool",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
-sub bind_priorityqueue {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Util::PriorityQueue",
-    );
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 sub bind_sortexternal {
     my $xs_code = <<'END_XS_CODE';
 MODULE = Lucy    PACKAGE = Lucy::Util::SortExternal
@@ -268,13 +249,4 @@ END_XS_CODE
     Clownfish::CFC::Binding::Perl::Class->register($binding);
 }
 
-sub bind_stepper {
-    my $binding = Clownfish::CFC::Binding::Perl::Class->new(
-        parcel     => "Lucy",
-        class_name => "Lucy::Util::Stepper",
-    );
-
-    Clownfish::CFC::Binding::Perl::Class->register($binding);
-}
-
 1;


[lucy-commits] [2/3] git commit: refs/heads/perl-method-bindings - Generate default constructor XSub for every class

Posted by nw...@apache.org.
Generate default constructor XSub for every class


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

Branch: refs/heads/perl-method-bindings
Commit: 1a0b43808a3e08a6436ee2f0864cb0ac21099d7d
Parents: f24927d
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Mon Jul 29 14:14:57 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Mon Jul 29 14:43:10 2013 +0200

----------------------------------------------------------------------
 clownfish/compiler/perl/lib/Clownfish/CFC.xs |  7 +--
 clownfish/compiler/src/CFCPerl.c             | 18 +++----
 clownfish/compiler/src/CFCPerlClass.c        | 64 ++++++++++++++---------
 clownfish/compiler/src/CFCPerlClass.h        |  2 +-
 4 files changed, 49 insertions(+), 42 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/1a0b4380/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 9faba1f..eda22dc 100644
--- a/clownfish/compiler/perl/lib/Clownfish/CFC.xs
+++ b/clownfish/compiler/perl/lib/Clownfish/CFC.xs
@@ -2296,10 +2296,11 @@ CODE:
 OUTPUT: RETVAL
 
 SV*
-constructor_bindings(self)
-    CFCPerlClass *self;
+constructor_bindings(unused, klass)
+    SV *unused;
+    CFCClass *klass;
 CODE:
-    CFCPerlConstructor **bound = CFCPerlClass_constructor_bindings(self);
+    CFCPerlConstructor **bound = CFCPerlClass_constructor_bindings(klass);
     RETVAL = S_array_of_cfcbase_to_av((CFCBase**)bound);
     FREEMEM(bound);
 OUTPUT: RETVAL

http://git-wip-us.apache.org/repos/asf/lucy/blob/1a0b4380/clownfish/compiler/src/CFCPerl.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerl.c b/clownfish/compiler/src/CFCPerl.c
index a1b961d..6612cd1 100644
--- a/clownfish/compiler/src/CFCPerl.c
+++ b/clownfish/compiler/src/CFCPerl.c
@@ -416,14 +416,13 @@ CFCPerl_write_bindings(CFCPerl *self) {
     }
     generated_xs = CFCUtil_cat(generated_xs, "\n", NULL);
 
-    // Constructors.
-    for (size_t i = 0; registry[i] != NULL; i++) {
-        CFCPerlClass *class_binding = registry[i];
-        CFCClass *client = CFCPerlClass_get_client(class_binding);
-        if (!client) { continue; }
+    for (size_t i = 0; ordered[i] != NULL; i++) {
+        CFCClass *klass = ordered[i];
+        if (CFCClass_included(klass)) { continue; }
 
+        // Constructors.
         CFCPerlConstructor **constructors
-            = CFCPerlClass_constructor_bindings(class_binding);
+            = CFCPerlClass_constructor_bindings(klass);
         for (size_t j = 0; constructors[j] != NULL; j++) {
             CFCPerlSub *xsub = (CFCPerlSub*)constructors[j];
 
@@ -437,13 +436,8 @@ CFCPerl_write_bindings(CFCPerl *self) {
             xs_init = S_add_xs_init(xs_init, xsub);
         }
         FREEMEM(constructors);
-    }
-
-    // Methods.
-    for (size_t i = 0; ordered[i] != NULL; i++) {
-        CFCClass *klass = ordered[i];
-        if (CFCClass_included(klass)) { continue; }
 
+        // Methods.
         CFCPerlMethod **methods = CFCPerlClass_method_bindings(klass);
         for (size_t j = 0; methods[j] != NULL; j++) {
             CFCPerlSub *xsub = (CFCPerlSub*)methods[j];

http://git-wip-us.apache.org/repos/asf/lucy/blob/1a0b4380/clownfish/compiler/src/CFCPerlClass.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlClass.c b/clownfish/compiler/src/CFCPerlClass.c
index e239fff..f90d5fa 100644
--- a/clownfish/compiler/src/CFCPerlClass.c
+++ b/clownfish/compiler/src/CFCPerlClass.c
@@ -311,10 +311,11 @@ CFCPerlClass_method_bindings(CFCClass *klass) {
 static const char NEW[] = "new";
 
 CFCPerlConstructor**
-CFCPerlClass_constructor_bindings(CFCPerlClass *self) {
-    CFCClass     *client    = self->client;
-    CFCFunction **functions = CFCClass_functions(self->client);
-    size_t        num_bound = 0;
+CFCPerlClass_constructor_bindings(CFCClass *klass) {
+    const char    *class_name = CFCClass_get_class_name(klass);
+    CFCPerlClass  *perl_class = CFCPerlClass_singleton(class_name);
+    CFCFunction  **functions  = CFCClass_functions(klass);
+    size_t         num_bound  = 0;
     CFCPerlConstructor **bound 
         = (CFCPerlConstructor**)CALLOCATE(1, sizeof(CFCPerlConstructor*));
 
@@ -327,31 +328,42 @@ CFCPerlClass_constructor_bindings(CFCPerlClass *self) {
         const char   *alias       = NULL;
 
         // Find user-specified alias.
-        for (size_t j = 0; j < self->num_cons; j++) {
-            if (strcmp(micro_sym, self->cons_inits[j]) == 0) {
-                alias = self->cons_aliases[j];
-                if (!S_can_be_bound(param_list, return_type)) {
-                    CFCUtil_die("Can't bind %s as %s -- types can't be mapped",
-                                micro_sym, alias);
-                }
-                break;
+        if (perl_class == NULL) {
+            // Bind init() to new() when possible.
+            if (strcmp(micro_sym, "init") == 0
+                && S_can_be_bound(param_list, return_type)
+               ) {
+                alias = NEW;
             }
         }
-
-        // Automatically bind init() to new() when possible.
-        if (!alias
-            && !self->exclude_cons
-            && strcmp(micro_sym, "init") == 0
-            && S_can_be_bound(param_list, return_type)
-           ) {
-            int saw_new = 0;
-            for (size_t j = 0; j < self->num_cons; j++) {
-                if (strcmp(self->cons_aliases[j], "new") == 0) {
-                    saw_new = 1;
+        else {
+            for (size_t j = 0; j < perl_class->num_cons; j++) {
+                if (strcmp(micro_sym, perl_class->cons_inits[j]) == 0) {
+                    alias = perl_class->cons_aliases[j];
+                    if (!S_can_be_bound(param_list, return_type)) {
+                        CFCUtil_die("Can't bind %s as %s"
+                                    " -- types can't be mapped",
+                                    micro_sym, alias);
+                    }
+                    break;
                 }
             }
-            if (!saw_new) {
-                alias = NEW;
+
+            // Automatically bind init() to new() when possible.
+            if (!alias
+                && !perl_class->exclude_cons
+                && strcmp(micro_sym, "init") == 0
+                && S_can_be_bound(param_list, return_type)
+               ) {
+                int saw_new = 0;
+                for (size_t j = 0; j < perl_class->num_cons; j++) {
+                    if (strcmp(perl_class->cons_aliases[j], "new") == 0) {
+                        saw_new = 1;
+                    }
+                }
+                if (!saw_new) {
+                    alias = NEW;
+                }
             }
         }
 
@@ -361,7 +373,7 @@ CFCPerlClass_constructor_bindings(CFCPerlClass *self) {
 
         // Create the binding, add it to the array.
         CFCPerlConstructor *cons_binding
-            = CFCPerlConstructor_new(client, alias, micro_sym);
+            = CFCPerlConstructor_new(klass, alias, micro_sym);
         size_t size = (num_bound + 2) * sizeof(CFCPerlConstructor*);
         bound = (CFCPerlConstructor**)REALLOCATE(bound, size);
         bound[num_bound] = cons_binding;

http://git-wip-us.apache.org/repos/asf/lucy/blob/1a0b4380/clownfish/compiler/src/CFCPerlClass.h
----------------------------------------------------------------------
diff --git a/clownfish/compiler/src/CFCPerlClass.h b/clownfish/compiler/src/CFCPerlClass.h
index 88a73c6..7051b82 100644
--- a/clownfish/compiler/src/CFCPerlClass.h
+++ b/clownfish/compiler/src/CFCPerlClass.h
@@ -109,7 +109,7 @@ CFCPerlClass_method_bindings(struct CFCClass *klass);
  * representing all bound constructors.
  */
 struct CFCPerlConstructor**
-CFCPerlClass_constructor_bindings(CFCPerlClass *self);
+CFCPerlClass_constructor_bindings(struct CFCClass *klass);
 
 /** Auto-generate POD according to the spec supplied via set_pod_spec().  If
  * no spec was supplied, return NULL.