You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2012/01/26 03:48:40 UTC
[lucy-commits] svn commit: r1236028 [2/2] - in /incubator/lucy/trunk:
clownfish/perl/lib/Clownfish/ clownfish/src/
perl/buildlib/Lucy/Build/Binding/ perl/buildlib/Lucy/Build/Binding/Index/
perl/buildlib/Lucy/Build/Binding/Search/
perl/buildlib/Lucy/Build/Binding/Test...
Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm?rev=1236028&r1=1236027&r2=1236028&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Object.pm Thu Jan 26 02:48:39 2012
@@ -34,6 +34,25 @@ sub bind_all {
}
sub bind_bitvector {
+ my @exposed = qw(
+ Get
+ Set
+ Clear
+ Clear_All
+ And
+ Or
+ And_Not
+ Xor
+ Flip
+ Flip_Block
+ Next_Hit
+ To_Array
+ Grow
+ Count
+ );
+ my @bound = ( @exposed, qw( Get_Capacity ) );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $bit_vec = Lucy::Object::BitVector->new( capacity => 8 );
my $other = Lucy::Object::BitVector->new( capacity => 8 );
@@ -47,54 +66,28 @@ END_SYNOPSIS
capacity => $doc_max + 1, # default 0,
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Object::BitVector",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [
- qw( get
- set
- clear
- clear_all
- and
- or
- and_not
- xor
- flip
- flip_block
- next_hit
- to_array
- grow
- count
- )
- ],
- }
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Get
- Set
- Clear
- Clear_All
- And
- Or
- And_Not
- Xor
- Flip
- Flip_Block
- Next_Hit
- To_Array
- Grow
- Count
- Get_Capacity
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_bytebuf {
+ my @bound = qw(
+ Get_Size
+ Get_Capacity
+ Cat
+ );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Object::ByteBuf
@@ -128,11 +121,8 @@ END_XS_CODE
class_name => "Lucy::Object::ByteBuf",
xs_code => $xs_code,
);
- $binding->bind_method( method => $_ ) for qw(
- Get_Size
- Get_Capacity
- Cat
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -201,10 +191,14 @@ END_XS_CODE
class_name => "Lucy::Object::CharBuf",
xs_code => $xs_code,
);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_err {
+ my @bound = qw( Cat_Mess Get_Mess );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
use Scalar::Util qw( blessed );
my $bg_merger;
@@ -222,18 +216,31 @@ sub bind_err {
}
}
END_SYNOPSIS
+ $pod_spec->set_synopsis($synopsis);
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Object::Err",
- make_pod => { synopsis => $synopsis },
+ parcel => "Lucy",
+ class_name => "Lucy::Object::Err",
);
$binding->bind_constructor( alias => '_new' );
- $binding->bind_method( method => $_ ) for qw( Cat_Mess Get_Mess );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_hash {
+ my @bound = qw(
+ Fetch
+ Delete
+ Keys
+ Values
+ Find_Key
+ Clear
+ Iterate
+ Get_Size
+ );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Object::Hash
@@ -293,16 +300,8 @@ END_XS_CODE
xs_code => $xs_code,
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Fetch
- Delete
- Keys
- Values
- Find_Key
- Clear
- Iterate
- Get_Size
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -393,6 +392,8 @@ END_XS_CODE
}
sub bind_i32array {
+ my @bound = qw( Get Get_Size );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Object::I32Array
@@ -464,21 +465,27 @@ END_XS_CODE
class_name => "Lucy::Object::I32Array",
xs_code => $xs_code,
);
- $binding->bind_method( method => $_ ) for qw( Get Get_Size );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_lockfreeregistry {
+ my @bound = qw( Register Fetch );
+
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Object::LockFreeRegistry",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Register Fetch );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_float32 {
+ my @bound = qw( Set_Value Get_Value );
+
my $float32_xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Object::Float32
@@ -500,11 +507,14 @@ END_XS_CODE
class_name => "Lucy::Object::Float32",
xs_code => $float32_xs_code,
);
- $binding->bind_method( method => $_ ) for qw( Set_Value Get_Value );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_float64 {
+ my @bound = qw( Set_Value Get_Value );
+
my $float64_xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Object::Float64
@@ -526,11 +536,126 @@ END_XS_CODE
class_name => "Lucy::Object::Float64",
xs_code => $float64_xs_code,
);
- $binding->bind_method( method => $_ ) for qw( Set_Value Get_Value );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_obj {
+ my @bound = qw(
+ Get_RefCount
+ Inc_RefCount
+ Dec_RefCount
+ Get_VTable
+ To_String
+ To_I64
+ To_F64
+ Dump
+ Clone
+ Mimic
+ Equals
+ Hash_Sum
+ Serialize
+ Deserialize
+ Destroy
+ );
+
+ my @exposed = qw(
+ To_String
+ To_I64
+ To_F64
+ Equals
+ Dump
+ Load
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
+ my $synopsis = <<'END_SYNOPSIS';
+ package MyObj;
+ use base qw( Lucy::Object::Obj );
+
+ # Inside-out member var.
+ my %foo;
+
+ sub new {
+ my ( $class, %args ) = @_;
+ my $foo = delete $args{foo};
+ my $self = $class->SUPER::new(%args);
+ $foo{$$self} = $foo;
+ return $self;
+ }
+
+ sub get_foo {
+ my $self = shift;
+ return $foo{$$self};
+ }
+
+ sub DESTROY {
+ my $self = shift;
+ delete $foo{$$self};
+ $self->SUPER::DESTROY;
+ }
+END_SYNOPSIS
+ my $description = <<'END_DESCRIPTION';
+All objects in the Lucy:: hierarchy descend from
+Lucy::Object::Obj. All classes are implemented as blessed scalar
+references, with the scalar storing a pointer to a C struct.
+
+=head2 Subclassing
+
+The recommended way to subclass Lucy::Object::Obj and its descendants is
+to use the inside-out design pattern. (See L<Class::InsideOut> for an
+introduction to inside-out techniques.)
+
+Since the blessed scalar stores a C pointer value which is unique per-object,
+C<$$self> can be used as an inside-out ID.
+
+ # Accessor for 'foo' member variable.
+ sub get_foo {
+ my $self = shift;
+ return $foo{$$self};
+ }
+
+
+Caveats:
+
+=over
+
+=item *
+
+Inside-out aficionados will have noted that the "cached scalar id" stratagem
+recommended above isn't compatible with ithreads -- but Lucy doesn't
+support ithreads anyway, so it doesn't matter.
+
+=item *
+
+Overridden methods must not return undef unless the API specifies that
+returning undef is permissible. (Failure to adhere to this rule currently
+results in a segfault rather than an exception.)
+
+=back
+
+=head1 CONSTRUCTOR
+
+=head2 new()
+
+Abstract constructor -- must be invoked via a subclass. Attempting to
+instantiate objects of class "Lucy::Object::Obj" directly causes an
+error.
+
+Takes no arguments; if any are supplied, an error will be reported.
+
+=head1 DESTRUCTOR
+
+=head2 DESTROY
+
+All Lucy classes implement a DESTROY method; if you override it in a
+subclass, you must call C<< $self->SUPER::DESTROY >> to avoid leaking memory.
+END_DESCRIPTION
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->set_description($description);
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Object::Obj
@@ -618,132 +743,29 @@ PPCODE:
}
END_XS_CODE
- my $synopsis = <<'END_SYNOPSIS';
- package MyObj;
- use base qw( Lucy::Object::Obj );
-
- # Inside-out member var.
- my %foo;
-
- sub new {
- my ( $class, %args ) = @_;
- my $foo = delete $args{foo};
- my $self = $class->SUPER::new(%args);
- $foo{$$self} = $foo;
- return $self;
- }
-
- sub get_foo {
- my $self = shift;
- return $foo{$$self};
- }
-
- sub DESTROY {
- my $self = shift;
- delete $foo{$$self};
- $self->SUPER::DESTROY;
- }
-END_SYNOPSIS
-
- my $description = <<'END_DESCRIPTION';
-All objects in the Lucy:: hierarchy descend from
-Lucy::Object::Obj. All classes are implemented as blessed scalar
-references, with the scalar storing a pointer to a C struct.
-
-=head2 Subclassing
-
-The recommended way to subclass Lucy::Object::Obj and its descendants is
-to use the inside-out design pattern. (See L<Class::InsideOut> for an
-introduction to inside-out techniques.)
-
-Since the blessed scalar stores a C pointer value which is unique per-object,
-C<$$self> can be used as an inside-out ID.
-
- # Accessor for 'foo' member variable.
- sub get_foo {
- my $self = shift;
- return $foo{$$self};
- }
-
-
-Caveats:
-
-=over
-
-=item *
-
-Inside-out aficionados will have noted that the "cached scalar id" stratagem
-recommended above isn't compatible with ithreads -- but Lucy doesn't
-support ithreads anyway, so it doesn't matter.
-
-=item *
-
-Overridden methods must not return undef unless the API specifies that
-returning undef is permissible. (Failure to adhere to this rule currently
-results in a segfault rather than an exception.)
-
-=back
-
-=head1 CONSTRUCTOR
-
-=head2 new()
-
-Abstract constructor -- must be invoked via a subclass. Attempting to
-instantiate objects of class "Lucy::Object::Obj" directly causes an
-error.
-
-Takes no arguments; if any are supplied, an error will be reported.
-
-=head1 DESTRUCTOR
-
-=head2 DESTROY
-
-All Lucy classes implement a DESTROY method; if you override it in a
-subclass, you must call C<< $self->SUPER::DESTROY >> to avoid leaking memory.
-END_DESCRIPTION
-
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Object::Obj",
- xs_code => $xs_code,
- make_pod => {
- synopsis => $synopsis,
- description => $description,
- methods => [
- qw(
- to_string
- to_i64
- to_f64
- equals
- dump
- load
- )
- ],
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Object::Obj",
+ xs_code => $xs_code,
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Get_RefCount
- Inc_RefCount
- Dec_RefCount
- Get_VTable
- To_String
- To_I64
- To_F64
- Dump
- Clone
- Mimic
- Equals
- Hash_Sum
- Serialize
- Deserialize
- Destroy
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
$binding->bind_method( alias => '_load', method => 'Load' );
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_varray {
+ my @bound = qw(
+ Push
+ Push_VArray
+ Unshift
+ Excise
+ Resize
+ Get_Size
+ );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Object::VArray
@@ -818,18 +840,14 @@ END_XS_CODE
xs_code => $xs_code,
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Push
- Push_VArray
- Unshift
- Excise
- Resize
- Get_Size
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_vtable {
+ my @bound = qw( Get_Name Get_Parent );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Object::VTable
@@ -880,7 +898,8 @@ END_XS_CODE
class_name => "Lucy::Object::VTable",
xs_code => $xs_code,
);
- $binding->bind_method( method => $_ ) for qw( Get_Name Get_Parent );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Plan.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Plan.pm?rev=1236028&r1=1236027&r2=1236028&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Plan.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Plan.pm Thu Jan 26 02:48:39 2012
@@ -31,6 +31,27 @@ sub bind_all {
}
sub bind_architecture {
+ my @exposed = qw( Register_Doc_Writer Register_Doc_Reader );
+ my @bound = (
+ @exposed,
+ qw(
+ Index_Interval
+ Skip_Interval
+ Init_Seg_Reader
+ Register_Deletions_Writer
+ Register_Deletions_Reader
+ Register_Lexicon_Reader
+ Register_Posting_List_Writer
+ Register_Posting_List_Reader
+ Register_Sort_Writer
+ Register_Sort_Reader
+ Register_Highlight_Writer
+ Register_Highlight_Reader
+ Make_Similarity
+ )
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
package MyArchitecture;
use base qw( Lucy::Plan::Architecture );
@@ -75,47 +96,26 @@ sub bind_architecture {
return MyArchitecture->new(@_);
}
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $arch = Lucy::Plan::Architecture->new;
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Plan::Architecture",
- make_pod => {
- synopsis => $synopsis,
- methods => [
- qw(
- register_doc_writer
- register_doc_reader
- )
- ],
- constructors => [ { sample => $constructor } ],
- }
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Index_Interval
- Skip_Interval
- Init_Seg_Reader
- Register_Doc_Writer
- Register_Doc_Reader
- Register_Deletions_Writer
- Register_Deletions_Reader
- Register_Lexicon_Reader
- Register_Posting_List_Writer
- Register_Posting_List_Reader
- Register_Sort_Writer
- Register_Sort_Reader
- Register_Highlight_Writer
- Register_Highlight_Reader
- Make_Similarity
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_blobtype {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $string_type = Lucy::Plan::StringType->new;
my $blob_type = Lucy::Plan::BlobType->new( stored => 1 );
@@ -128,112 +128,78 @@ END_SYNOPSIS
stored => 1, # default: false
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Plan::BlobType",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Plan::BlobType",
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_fieldtype {
- my $synopis = <<'END_SYNOPSIS';
+ my @exposed = qw(
+ Get_Boost
+ Indexed
+ Stored
+ Sortable
+ Binary
+ );
+ my @bound = ( @exposed, 'Compare_Values' );
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
+ my $synopsis = <<'END_SYNOPSIS';
my @sortable;
for my $field ( @{ $schema->all_fields } ) {
my $type = $schema->fetch_type($field);
next unless $type->sortable;
push @sortable, $field;
}
-
END_SYNOPSIS
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Plan::FieldType",
- make_pod => {
- synopsis => $synopis,
- methods => [
- qw(
- get_boost
- indexed
- stored
- sortable
- binary
- )
- ],
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Plan::FieldType",
);
$binding->bind_constructor( alias => 'new', initializer => 'init2' );
- $binding->bind_method( method => $_ ) for qw(
- Get_Boost
- Indexed
- Stored
- Sortable
- Binary
- Compare_Values
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_float32type {
- my $synopsis = <<'END_SYNOPSIS';
- my $schema = Lucy::Plan::Schema->new;
- my $float32_type = Lucy::Plan::FloatType->new;
- $schema->spec_field( name => 'intensity', type => $float32_type );
-END_SYNOPSIS
- my $constructor = <<'END_CONSTRUCTOR';
- my $float32_type = Lucy::Plan::Float32Type->new(
- indexed => 0, # default true
- stored => 0, # default true
- sortable => 1, # default false
- );
-END_CONSTRUCTOR
-
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Plan::Float32Type",
- #make_pod => {
- # synopsis => $synopsis,
- # constructor => { sample => $constructor },
- #},
);
$binding->bind_constructor( alias => 'new', initializer => 'init2' );
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_float64type {
- my $synopsis = <<'END_SYNOPSIS';
- my $schema = Lucy::Plan::Schema->new;
- my $float64_type = Lucy::Plan::FloatType->new;
- $schema->spec_field( name => 'intensity', type => $float64_type );
-END_SYNOPSIS
- my $constructor = <<'END_CONSTRUCTOR';
- my $float64_type = Lucy::Plan::Float64Type->new(
- indexed => 0 # default true
- stored => 0, # default true
- sortable => 1, # default false
- );
-END_CONSTRUCTOR
-
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Plan::Float64Type",
- #make_pod => {
- # synopsis => $synopsis,
- # constructor => { sample => $constructor },
- #},
);
$binding->bind_constructor( alias => 'new', initializer => 'init2' );
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_fulltexttype {
+ my @exposed = qw(
+ Set_Highlightable
+ Highlightable
+ );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $polyanalyzer = Lucy::Analysis::PolyAnalyzer->new(
language => 'en',
@@ -245,7 +211,6 @@ sub bind_fulltexttype {
$schema->spec_field( name => 'title', type => $type );
$schema->spec_field( name => 'content', type => $type );
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $type = Lucy::Plan::FullTextType->new(
analyzer => $analyzer, # required
@@ -256,82 +221,53 @@ END_SYNOPSIS
highlightable => 1, # default: false
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Plan::FullTextType",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [
- qw(
- set_highlightable
- highlightable
- )
- ],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Plan::FullTextType",
);
$binding->bind_constructor( alias => 'new', initializer => 'init2' );
- $binding->bind_method( method => $_ ) for qw(
- Set_Highlightable
- Highlightable
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_int32type {
- my $synopsis = <<'END_SYNOPSIS';
- my $schema = Lucy::Plan::Schema->new;
- my $int32_type = Lucy::Plan::Int32Type->new;
- $schema->spec_field( name => 'count', type => $int32_type );
-END_SYNOPSIS
- my $constructor = <<'END_CONSTRUCTOR';
- my $int32_type = Lucy::Plan::Int32Type->new(
- indexed => 0, # default true
- stored => 0, # default true
- sortable => 1, # default false
- );
-END_CONSTRUCTOR
-
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Plan::Int32Type",
- #make_pod => {
- # synopsis => $synopsis,
- # constructor => { sample => $constructor },
- #},
);
$binding->bind_constructor( alias => 'new', initializer => 'init2' );
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_int64type {
- my $synopsis = <<'END_SYNOPSIS';
- my $schema = Lucy::Plan::Schema->new;
- my $int64_type = Lucy::Plan::Int64Type->new;
- $schema->spec_field( name => 'count', type => $int64_type );
-END_SYNOPSIS
- my $constructor = <<'END_CONSTRUCTOR';
- my $int64_type = Lucy::Plan::Int64Type->new(
- indexed => 0, # default true
- stored => 0, # default true
- sortable => 1, # default false
- );
-END_CONSTRUCTOR
-
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Plan::Int64Type",
- #make_pod => {
- # synopsis => $synopsis,
- # constructor => { sample => $constructor },
- #},
);
$binding->bind_constructor( alias => 'new', initializer => 'init2' );
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_schema {
+ my @exposed = qw(
+ Spec_Field
+ Num_Fields
+ All_Fields
+ Fetch_Type
+ Fetch_Sim
+ Architecture
+ Get_Architecture
+ Get_Similarity
+ );
+ my @bound = ( @exposed, qw( Fetch_Analyzer Write Eat ) );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
use Lucy::Plan::Schema;
use Lucy::Plan::FullTextType;
@@ -347,55 +283,31 @@ sub bind_schema {
$schema->spec_field( name => 'title', type => $type );
$schema->spec_field( name => 'content', type => $type );
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $schema = Lucy::Plan::Schema->new;
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Plan::Schema",
- make_pod => {
- methods => [
- qw(
- spec_field
- num_fields
- all_fields
- fetch_type
- fetch_sim
- architecture
- get_architecture
- get_similarity
- )
- ],
- synopsis => $synopsis,
- constructors => [ { sample => $constructor } ],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Plan::Schema",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Architecture
- Get_Architecture
- Get_Similarity
- Fetch_Type
- Fetch_Analyzer
- Fetch_Sim
- Num_Fields
- All_Fields
- Spec_Field
- Write
- Eat
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_stringtype {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $type = Lucy::Plan::StringType->new;
my $schema = Lucy::Plan::Schema->new;
$schema->spec_field( name => 'category', type => $type );
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $type = Lucy::Plan::StringType->new(
boost => 0.1, # default: 1.0
@@ -404,16 +316,16 @@ END_SYNOPSIS
sortable => 1, # default: false
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Plan::StringType",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Plan::StringType",
);
$binding->bind_constructor( alias => 'new', initializer => 'init2' );
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Search.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Search.pm?rev=1236028&r1=1236027&r2=1236028&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Search.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Search.pm Thu Jan 26 02:48:39 2012
@@ -64,6 +64,9 @@ sub bind_andmatcher {
}
sub bind_andquery {
+ my @exposed = qw( Add_Child );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $foo_and_bar_query = Lucy::Search::ANDQuery->new(
children => [ $foo_query, $bar_query ],
@@ -71,23 +74,22 @@ sub bind_andquery {
my $hits = $searcher->hits( query => $foo_and_bar_query );
...
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $foo_and_bar_query = Lucy::Search::ANDQuery->new(
children => [ $foo_query, $bar_query ],
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::ANDQuery",
- make_pod => {
- methods => [qw( add_child )],
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::ANDQuery",
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -101,6 +103,18 @@ sub bind_bitvecmatcher {
}
sub bind_collector {
+ my @exposed = qw( Collect );
+ my @bound = (
+ @exposed,
+ qw(
+ Set_Reader
+ Set_Base
+ Set_Matcher
+ Need_Score
+ )
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $constructor = <<'END_CONSTRUCTOR';
package MyCollector;
use base qw( Lucy::Search::Collector );
@@ -112,24 +126,18 @@ sub bind_collector {
return $self;
}
END_CONSTRUCTOR
+ $pod_spec->set_synopsis(" # Abstract base class.\n");
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::Collector",
- make_pod => {
- synopsis => " # Abstract base class.\n",
- constructor => { sample => $constructor },
- methods => [qw( collect )],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::Collector",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Collect
- Set_Reader
- Set_Base
- Set_Matcher
- Need_Score
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -143,6 +151,19 @@ sub bind_offsetcollector {
}
sub bind_compiler {
+ my @exposed = qw(
+ Make_Matcher
+ Get_Weight
+ Sum_Of_Squared_Weights
+ Apply_Norm_Factor
+ Normalize
+ Get_Parent
+ Get_Similarity
+ Highlight_Spans
+ );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
# (Compiler is an abstract base class.)
package MyCompiler;
@@ -153,7 +174,6 @@ sub bind_compiler {
return MyMatcher->new( @_, compiler => $self );
}
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR_CODE_SAMPLE';
my $compiler = MyCompiler->SUPER::new(
parent => $my_query,
@@ -162,38 +182,18 @@ END_SYNOPSIS
boost => undef, # default: see below
);
END_CONSTRUCTOR_CODE_SAMPLE
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::Compiler",
- make_pod => {
- methods => [
- qw(
- make_matcher
- get_weight
- sum_of_squared_weights
- apply_norm_factor
- normalize
- get_parent
- get_similarity
- highlight_spans
- )
- ],
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::Compiler",
);
$binding->bind_constructor( alias => 'do_new' );
- $binding->bind_method( method => $_ ) for qw(
- Make_Matcher
- Get_Parent
- Get_Similarity
- Get_Weight
- Sum_Of_Squared_Weights
- Apply_Norm_Factor
- Normalize
- Highlight_Spans
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -207,6 +207,10 @@ sub bind_hitqueue {
}
sub bind_hits {
+ my @exposed = qw( Next Total_Hits );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $hits = $searcher->hits(
query => $query,
@@ -217,21 +221,35 @@ sub bind_hits {
print "<p>$hit->{title} <em>" . $hit->get_score . "</em></p>\n";
}
END_SYNOPSIS
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::Hits",
- make_pod => {
- synopsis => $synopsis,
- methods => [qw( next total_hits )],
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::Hits",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Total_Hits Next );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_indexsearcher {
+ my @bound = qw( Get_Reader );
+ my @exposed = (
+ qw(
+ Hits
+ Collect
+ Doc_Max
+ Doc_Freq
+ Fetch_Doc
+ Get_Schema
+ ),
+ @bound
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $searcher = Lucy::Search::IndexSearcher->new(
index => '/path/to/index'
@@ -242,36 +260,31 @@ sub bind_indexsearcher {
num_wanted => 100,
);
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $searcher = Lucy::Search::IndexSearcher->new(
index => '/path/to/index'
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::IndexSearcher",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [
- qw( hits
- collect
- doc_max
- doc_freq
- fetch_doc
- get_schema
- get_reader )
- ],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::IndexSearcher",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Get_Reader );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_leafquery {
+ my @exposed = qw( Get_Field Get_Text );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
package MyQueryParser;
use base qw( Lucy::Search::QueryParser );
@@ -289,49 +302,46 @@ sub bind_leafquery {
}
}
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $leaf_query = Lucy::Search::LeafQuery->new(
text => '"three blind mice"', # required
field => 'content', # default: undef
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::LeafQuery",
- make_pod => {
- methods => [qw( get_field get_text )],
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::LeafQuery",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Get_Field Get_Text );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_matchallquery {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $constructor = <<'END_CONSTRUCTOR';
my $match_all_query = Lucy::Search::MatchAllQuery->new;
END_CONSTRUCTOR
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::MatchAllQuery",
- make_pod => { constructor => { sample => $constructor }, }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::MatchAllQuery",
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
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",
- );
- $binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
+ my @bound = qw(
Get_Doc_ID
Set_Doc_ID
Get_Score
@@ -339,35 +349,45 @@ sub bind_matchdoc {
Get_Values
Set_Values
);
+
+ my $binding = Clownfish::CFC::Binding::Perl::Class->new(
+ parcel => "Lucy",
+ class_name => "Lucy::Search::MatchDoc",
+ );
+ $binding->bind_constructor;
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_matcher {
+ my @exposed = qw(
+ Next
+ Advance
+ Get_Doc_ID
+ Score
+ );
+ my @bound = ( @exposed, 'Collect' );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
# abstract base class
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR_CODE_SAMPLE';
my $matcher = MyMatcher->SUPER::new;
END_CONSTRUCTOR_CODE_SAMPLE
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::Matcher",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [qw( next advance get_doc_id score )],
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::Matcher",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Next
- Advance
- Get_Doc_ID
- Score
- Collect
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -381,6 +401,13 @@ sub bind_notmatcher {
}
sub bind_notquery {
+ my @exposed = qw(
+ Get_Negated_Query
+ Set_Negated_Query
+ );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $not_bar_query = Lucy::Search::NOTQuery->new(
negated_query => $bar_query,
@@ -391,45 +418,47 @@ sub bind_notquery {
my $hits = $searcher->hits( query => $foo_and_not_bar_query );
...
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $not_query = Lucy::Search::NOTQuery->new(
negated_query => $query,
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::NOTQuery",
- make_pod => {
- methods => [qw( get_negated_query set_negated_query )],
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::NOTQuery",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Get_Negated_Query
- Set_Negated_Query
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_nomatchquery {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $constructor = <<'END_CONSTRUCTOR';
my $no_match_query = Lucy::Search::NoMatchQuery->new;
END_CONSTRUCTOR
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::NoMatchQuery",
- make_pod => { constructor => { sample => $constructor }, }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::NoMatchQuery",
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_orquery {
+ my @exposed = qw( Add_Child );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $foo_or_bar_query = Lucy::Search::ORQuery->new(
children => [ $foo_query, $bar_query ],
@@ -437,23 +466,22 @@ sub bind_orquery {
my $hits = $searcher->hits( query => $foo_or_bar_query );
...
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $foo_or_bar_query = Lucy::Search::ORQuery->new(
children => [ $foo_query, $bar_query ],
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::ORQuery",
- make_pod => {
- methods => [qw( add_child )],
- synopsis => $synopsis,
- constructor => { sample => $constructor, }
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::ORQuery",
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -467,6 +495,10 @@ sub bind_orscorer {
}
sub bind_phrasequery {
+ my @exposed = qw( Get_Field Get_Terms );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $phrase_query = Lucy::Search::PhraseQuery->new(
field => 'content',
@@ -474,18 +506,18 @@ sub bind_phrasequery {
);
my $hits = $searcher->hits( query => $phrase_query );
END_SYNOPSIS
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new' );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::PhraseQuery",
- make_pod => {
- constructor => { sample => '' },
- synopsis => $synopsis,
- methods => [qw( get_field get_terms )],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::PhraseQuery",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Get_Field Get_Terms );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -499,6 +531,13 @@ sub bind_phrasecompiler {
}
sub bind_polyquery {
+ my @bound = qw(
+ Add_Child
+ Set_Children
+ Get_Children
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
sub walk {
my $query = shift;
@@ -513,22 +552,29 @@ sub bind_polyquery {
else { ... }
}
END_SYNOPSIS
+ $pod_spec->set_synopsis($synopsis);
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::PolyQuery",
- make_pod => { synopsis => $synopsis, },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::PolyQuery",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Add_Child
- Set_Children
- Get_Children
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_polysearcher {
+ my @exposed = qw(
+ Hits
+ Doc_Max
+ Doc_Freq
+ Fetch_Doc
+ Get_Schema
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $schema = MySchema->new;
for my $index (@index_paths) {
@@ -540,35 +586,31 @@ sub bind_polysearcher {
);
my $hits = $poly_searcher->hits( query => $query );
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $poly_searcher = Lucy::Search::PolySearcher->new(
schema => $schema,
searchers => \@searchers,
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::PolySearcher",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [
- qw( hits
- doc_max
- doc_freq
- fetch_doc
- get_schema
- )
- ],
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::PolySearcher",
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_query {
+ my @bound = qw( Set_Boost Get_Boost );
+ my @exposed = ( 'Make_Compiler', @bound );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
# Query is an abstract base class.
package MyQuery;
@@ -586,32 +628,56 @@ sub bind_query {
use base ( Lucy::Search::Compiler );
...
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR_CODE_SAMPLE';
my $query = MyQuery->SUPER::new(
boost => 2.5,
);
END_CONSTRUCTOR_CODE_SAMPLE
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::Query",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [qw( make_compiler set_boost get_boost )],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::Query",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Set_Boost Get_Boost );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
$binding->bind_method(
alias => '_make_compiler',
method => 'Make_Compiler',
);
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_queryparser {
+ my @exposed = qw(
+ Parse
+ Tree
+ Expand
+ Expand_Leaf
+ Prune
+ Set_Heed_Colons
+ Make_Term_Query
+ Make_Phrase_Query
+ Make_AND_Query
+ Make_OR_Query
+ Make_NOT_Query
+ Make_Req_Opt_Query
+ );
+ my @bound = (
+ @exposed,
+ qw(
+ Get_Analyzer
+ Get_Schema
+ Get_Fields
+ Heed_Colons
+ )
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $query_parser = Lucy::Search::QueryParser->new(
schema => $searcher->get_schema,
@@ -620,7 +686,6 @@ sub bind_queryparser {
my $query = $query_parser->parse( $query_string );
my $hits = $searcher->hits( query => $query );
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $query_parser = Lucy::Search::QueryParser->new(
schema => $searcher->get_schema, # required
@@ -629,53 +694,23 @@ END_SYNOPSIS
default_boolop => 'AND', # default: 'OR'
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::QueryParser",
- make_pod => {
- methods => [
- qw( parse
- tree
- expand
- expand_leaf
- prune
- set_heed_colons
- make_term_query
- make_phrase_query
- make_and_query
- make_or_query
- make_not_query
- make_req_opt_query
- )
- ],
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::QueryParser",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Parse
- Tree
- Expand
- Expand_Leaf
- Prune
- Heed_Colons
- Set_Heed_Colons
- Get_Analyzer
- Get_Schema
- Get_Fields
- Make_Term_Query
- Make_Phrase_Query
- Make_AND_Query
- Make_OR_Query
- Make_NOT_Query
- Make_Req_Opt_Query
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_rangequery {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
# Match all articles by "Foo" published since the year 2000.
my $range_query = Lucy::Search::RangeQuery->new(
@@ -693,7 +728,6 @@ sub bind_rangequery {
my $hits = $searcher->hits( query => $and_query );
...
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $range_query = Lucy::Search::RangeQuery->new(
field => 'product_number', # required
@@ -703,16 +737,16 @@ END_SYNOPSIS
include_upper => 0, # default true
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::RangeQuery",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::RangeQuery",
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -726,6 +760,15 @@ sub bind_requiredoptionalmatcher {
}
sub bind_requiredoptionalquery {
+ my @exposed = qw(
+ Get_Required_Query
+ Set_Required_Query
+ Get_Optional_Query
+ Set_Optional_Query
+ );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $foo_and_maybe_bar = Lucy::Search::RequiredOptionalQuery->new(
required_query => $foo_query,
@@ -734,37 +777,47 @@ sub bind_requiredoptionalquery {
my $hits = $searcher->hits( query => $foo_and_maybe_bar );
...
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $reqopt_query = Lucy::Search::RequiredOptionalQuery->new(
required_query => $foo_query, # required
optional_query => $bar_query, # required
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::RequiredOptionalQuery",
- make_pod => {
- methods => [
- qw( get_required_query set_required_query
- get_optional_query set_optional_query )
- ],
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::RequiredOptionalQuery",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Get_Required_Query
- Set_Required_Query
- Get_Optional_Query
- Set_Optional_Query
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_searcher {
+ my @exposed = qw(
+ Hits
+ Collect
+ Glean_Query
+ Doc_Max
+ Doc_Freq
+ Fetch_Doc
+ Get_Schema
+ );
+ my @bound = (
+ @exposed,
+ qw(
+ Top_Docs
+ Fetch_Doc_Vec
+ Close
+ )
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $constructor = <<'END_CONSTRUCTOR';
package MySearcher;
use base qw( Lucy::Search::Searcher );
@@ -774,43 +827,47 @@ sub bind_searcher {
return $self;
}
END_CONSTRUCTOR
+ $pod_spec->set_synopsis(" # Abstract base class.\n");
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::Searcher",
- make_pod => {
- synopsis => " # Abstract base class.\n",
- constructor => { sample => $constructor },
- methods => [
- qw(
- hits
- collect
- glean_query
- doc_max
- doc_freq
- fetch_doc
- get_schema
- )
- ],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::Searcher",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Doc_Max
- Doc_Freq
- Glean_Query
- Hits
- Collect
- Top_Docs
- Fetch_Doc
- Fetch_Doc_Vec
- Get_Schema
- Close
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_sortrule {
+ my @exposed = qw( Get_Field Get_Reverse );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
+ my $synopsis = <<'END_SYNOPSIS';
+ my $sort_spec = Lucy::Search::SortSpec->new(
+ rules => [
+ Lucy::Search::SortRule->new( field => 'date' ),
+ Lucy::Search::SortRule->new( type => 'doc_id' ),
+ ],
+ );
+END_SYNOPSIS
+ my $constructor = <<'END_CONSTRUCTOR';
+ my $by_title = Lucy::Search::SortRule->new( field => 'title' );
+ my $by_score = Lucy::Search::SortRule->new( type => 'score' );
+ my $by_doc_id = Lucy::Search::SortRule->new( type => 'doc_id' );
+ my $reverse_date = Lucy::Search::SortRule->new(
+ field => 'date',
+ reverse => 1,
+ );
+END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Search::SortRule
@@ -833,41 +890,22 @@ CODE:
OUTPUT: RETVAL
END_XS_CODE
- my $synopsis = <<'END_SYNOPSIS';
- my $sort_spec = Lucy::Search::SortSpec->new(
- rules => [
- Lucy::Search::SortRule->new( field => 'date' ),
- Lucy::Search::SortRule->new( type => 'doc_id' ),
- ],
- );
-END_SYNOPSIS
-
- my $constructor = <<'END_CONSTRUCTOR';
- my $by_title = Lucy::Search::SortRule->new( field => 'title' );
- my $by_score = Lucy::Search::SortRule->new( type => 'score' );
- my $by_doc_id = Lucy::Search::SortRule->new( type => 'doc_id' );
- my $reverse_date = Lucy::Search::SortRule->new(
- field => 'date',
- reverse => 1,
- );
-END_CONSTRUCTOR
-
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::SortRule",
- xs_code => $xs_code,
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [qw( get_field get_reverse )],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::SortRule",
+ xs_code => $xs_code,
);
$binding->bind_constructor( alias => '_new' );
- $binding->bind_method( method => $_ ) for qw( Get_Field Get_Reverse );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_sortspec {
+ my @bound = qw( Get_Rules );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $sort_spec = Lucy::Search::SortSpec->new(
rules => [
@@ -880,25 +918,35 @@ sub bind_sortspec {
sort_spec => $sort_spec,
);
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $sort_spec = Lucy::Search::SortSpec->new( rules => \@rules );
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::SortSpec",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::SortSpec",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Get_Rules );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_span {
+ my @exposed = qw(
+ Set_Offset
+ Get_Offset
+ Set_Length
+ Get_Length
+ Set_Weight
+ Get_Weight
+ );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $combined_length = $upper_span->get_length
+ ( $upper_span->get_offset - $lower_span->get_offset );
@@ -908,7 +956,6 @@ sub bind_span {
);
...
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $span = Lucy::Search::Span->new(
offset => 75, # required
@@ -916,36 +963,26 @@ END_SYNOPSIS
weight => 1.0, # default 0.0
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::Span",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [
- qw( set_offset
- get_offset
- set_length
- get_length
- set_weight
- get_weight )
- ],
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Search::Span",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Set_Offset
- Get_Offset
- Set_Length
- Get_Length
- Set_Weight
- Get_Weight
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_termquery {
+ my @exposed = qw( Get_Field Get_Term );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $term_query = Lucy::Search::TermQuery->new(
field => 'content',
@@ -953,25 +990,24 @@ sub bind_termquery {
);
my $hits = $searcher->hits( query => $term_query );
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $term_query = Lucy::Search::TermQuery->new(
field => 'content', # required
term => 'foo', # required
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Search::TermQuery",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [qw( get_field get_term )],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Search::TermQuery",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Get_Field Get_Term );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -985,16 +1021,19 @@ sub bind_termcompiler {
}
sub bind_topdocs {
+ my @bound = qw(
+ Get_Match_Docs
+ Get_Total_Hits
+ Set_Total_Hits
+ );
+
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Search::TopDocs",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Get_Match_Docs
- Get_Total_Hits
- Set_Total_Hits
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Search/Collector.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Search/Collector.pm?rev=1236028&r1=1236027&r2=1236028&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Search/Collector.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Search/Collector.pm Thu Jan 26 02:48:39 2012
@@ -23,6 +23,9 @@ sub bind_all {
}
sub bind_bitcollector {
+ my @exposed = qw( Collect );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $bit_vec = Lucy::Object::BitVector->new(
capacity => $searcher->doc_max + 1,
@@ -35,36 +38,35 @@ sub bind_bitcollector {
query => $query,
);
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $bit_collector = Lucy::Search::Collector::BitCollector->new(
bit_vector => $bit_vec, # required
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Search::Collector::BitCollector",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [qw( collect )],
- },
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_sortcollector {
+ my @bound = qw( Pop_Match_Docs Get_Total_Hits );
+
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Search::Collector::SortCollector",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Pop_Match_Docs
- Get_Total_Hits
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Store.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Store.pm?rev=1236028&r1=1236027&r2=1236028&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Store.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Store.pm Thu Jan 26 02:48:39 2012
@@ -44,27 +44,29 @@ sub bind_fsfilehandle {
}
sub bind_fsfolder {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $folder = Lucy::Store::FSFolder->new(
- path => '/path/to/folder',
+ path => '/path/to/folder',
);
END_SYNOPSIS
-
my $constructor = $synopsis;
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Store::FSFolder",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- },
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_filehandle {
+ my @bound = qw( Length Close );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Store::FileHandle
@@ -124,18 +126,13 @@ END_XS_CODE
xs_code => $xs_code,
);
$binding->bind_constructor( alias => '_open', initializer => 'do_open' );
- $binding->bind_method( method => $_ ) for qw( Length Close );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_folder {
- my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Store::Folder",
- make_pod => { synopsis => " # Abstract base class.\n", },
- );
- $binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
+ my @bound = qw(
Open_Out
Open_In
MkDir
@@ -148,10 +145,40 @@ sub bind_folder {
Close
Get_Path
);
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
+ $pod_spec->set_synopsis(" # Abstract base class.\n");
+
+ my $binding = Clownfish::CFC::Binding::Perl::Class->new(
+ parcel => "Lucy",
+ class_name => "Lucy::Store::Folder",
+ );
+ $binding->bind_constructor;
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_instream {
+ my @bound = qw(
+ Seek
+ Tell
+ Length
+ Reopen
+ Close
+ Read_I8
+ Read_I32
+ Read_I64
+ Read_U8
+ Read_U32
+ Read_U64
+ Read_C32
+ Read_C64
+ Read_F32
+ Read_F64
+ );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Store::InStream
@@ -215,27 +242,29 @@ END_XS_CODE
xs_code => $xs_code,
);
$binding->bind_constructor( alias => 'open', initializer => 'do_open' );
- $binding->bind_method( method => $_ ) for qw(
- Seek
- Tell
- Length
- Reopen
- Close
- Read_I8
- Read_I32
- Read_I64
- Read_U8
- Read_U32
- Read_U64
- Read_C32
- Read_C64
- Read_F32
- Read_F64
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_lock {
+ my @exposed = qw(
+ Obtain
+ Request
+ Release
+ Is_Locked
+ Clear_Stale
+ );
+ my @bound = (
+ @exposed,
+ qw(
+ Get_Name
+ Get_Lock_Path
+ Get_Host
+ )
+ );
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $lock = $lock_factory->make_lock(
name => 'write',
@@ -245,7 +274,6 @@ sub bind_lock {
do_stuff();
$lock->release;
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $lock = Lucy::Store::Lock->new(
name => 'commit', # required
@@ -255,35 +283,18 @@ END_SYNOPSIS
interval => 1000, # default: 100
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Store::Lock",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- methods => [
- qw(
- obtain
- request
- release
- is_locked
- clear_stale
- )
- ],
- },
+ parcel => "Lucy",
+ class_name => "Lucy::Store::Lock",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Obtain
- Request
- Is_Locked
- Release
- Clear_Stale
- Get_Name
- Get_Lock_Path
- Get_Host
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -306,6 +317,7 @@ sub bind_sharedlock {
}
sub bind_lockerr {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
while (1) {
my $bg_merger = eval {
@@ -321,16 +333,25 @@ sub bind_lockerr {
...
}
END_SYNOPSIS
+ $pod_spec->set_synopsis($synopsis);
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Store::LockErr",
- make_pod => { synopsis => $synopsis }
);
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_lockfactory {
+ my @exposed = qw(
+ Make_Lock
+ Make_Shared_Lock
+ );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
use Sys::Hostname qw( hostname );
my $hostname = hostname() or die "Can't get unique hostname";
@@ -347,32 +368,46 @@ sub bind_lockfactory {
interval => 100,
);
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $lock_factory = Lucy::Store::LockFactory->new(
folder => $folder, # required
host => $hostname, # required
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Store::LockFactory",
- make_pod => {
- methods => [qw( make_lock make_shared_lock)],
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Store::LockFactory",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
- Make_Lock
- Make_Shared_Lock
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_outstream {
+ my @bound = qw(
+ Tell
+ Length
+ Flush
+ Close
+ Absorb
+ Write_I8
+ Write_I32
+ Write_I64
+ Write_U8
+ Write_U32
+ Write_U64
+ Write_C32
+ Write_C64
+ Write_F32
+ Write_F64
+ );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Store::OutStream
@@ -402,58 +437,45 @@ PPCODE:
}
END_XS_CODE
- my $synopsis = <<'END_SYNOPSIS'; # Don't use this yet.
- my $outstream = $folder->open_out($filename) or die $@;
- $outstream->write_u64($file_position);
-END_SYNOPSIS
-
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Store::OutStream",
xs_code => $xs_code,
);
$binding->bind_constructor( alias => 'open', initializer => 'do_open' );
- $binding->bind_method( method => $_ ) for qw(
- Tell
- Length
- Flush
- Close
- Absorb
- Write_I8
- Write_I32
- Write_I64
- Write_U8
- Write_U32
- Write_U64
- Write_C32
- Write_C64
- Write_F32
- Write_F64
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_ramfile {
+ my @bound = qw( Get_Contents );
+
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Store::RAMFile",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Get_Contents );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_ramfilehandle {
+ my @bound = qw( Get_File );
+
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Store::RAMFileHandle",
);
$binding->bind_constructor( alias => '_open', initializer => 'do_open' );
- $binding->bind_method( method => $_ ) for qw( Get_File );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_ramfolder {
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $folder = Lucy::Store::RAMFolder->new;
@@ -462,22 +484,21 @@ sub bind_ramfolder {
path => $relative_path,
);
END_SYNOPSIS
-
my $constructor = <<'END_CONSTRUCTOR';
my $folder = Lucy::Store::RAMFolder->new(
path => $relative_path, # default: empty string
);
END_CONSTRUCTOR
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new', sample => $constructor, );
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Store::RAMFolder",
- make_pod => {
- synopsis => $synopsis,
- constructor => { sample => $constructor },
- }
+ parcel => "Lucy",
+ class_name => "Lucy::Store::RAMFolder",
);
$binding->bind_constructor;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Test/Util.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Test/Util.pm?rev=1236028&r1=1236027&r2=1236028&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Test/Util.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Test/Util.pm Thu Jan 26 02:48:39 2012
@@ -72,6 +72,7 @@ END_XS_CODE
xs_code => $xs_code,
);
$binding->bind_constructor;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
Modified: incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Util.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Util.pm?rev=1236028&r1=1236027&r2=1236028&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Util.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/Lucy/Build/Binding/Util.pm Thu Jan 26 02:48:39 2012
@@ -134,6 +134,7 @@ END_XS_CODE
class_name => "Lucy::Util::IndexFileNames",
xs_code => $xs_code,
);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -147,12 +148,7 @@ sub bind_memorypool {
}
sub bind_priorityqueue {
- my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "Lucy::Util::PriorityQueue",
- );
- $binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw(
+ my @bound = qw(
Less_Than
Insert
Pop
@@ -160,10 +156,29 @@ sub bind_priorityqueue {
Peek
Get_Size
);
+
+ my $binding = Clownfish::CFC::Binding::Perl::Class->new(
+ parcel => "Lucy",
+ class_name => "Lucy::Util::PriorityQueue",
+ );
+ $binding->bind_constructor;
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_sortexternal {
+ my @bound = qw(
+ Flush
+ Flip
+ Add_Run
+ Refill
+ Sort_Cache
+ Cache_Count
+ Clear_Cache
+ Set_Mem_Thresh
+ );
+
my $xs_code = <<'END_XS_CODE';
MODULE = Lucy PACKAGE = Lucy::Util::SortExternal
@@ -179,25 +194,20 @@ END_XS_CODE
class_name => "Lucy::Util::SortExternal",
xs_code => $xs_code,
);
- $binding->bind_method( method => $_ ) for qw(
- Flush
- Flip
- Add_Run
- Refill
- Sort_Cache
- Cache_Count
- Clear_Cache
- Set_Mem_Thresh
- );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
sub bind_stepper {
+ my @bound = qw( Read_Record );
+
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
parcel => "Lucy",
class_name => "Lucy::Util::Stepper",
);
- $binding->bind_method( method => $_ ) for qw( Read_Record );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
@@ -298,6 +308,7 @@ END_XS_CODE
class_name => "Lucy::Util::StringHelper",
xs_code => $xs_code,
);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}
Modified: incubator/lucy/trunk/perl/buildlib/LucyX/Build/Binding/Search.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/perl/buildlib/LucyX/Build/Binding/Search.pm?rev=1236028&r1=1236027&r2=1236028&view=diff
==============================================================================
--- incubator/lucy/trunk/perl/buildlib/LucyX/Build/Binding/Search.pm (original)
+++ incubator/lucy/trunk/perl/buildlib/LucyX/Build/Binding/Search.pm Thu Jan 26 02:48:39 2012
@@ -43,6 +43,10 @@ sub bind_mockmatcher {
}
sub bind_proximityquery {
+ my @exposed = qw( Get_Field Get_Terms Get_Within );
+ my @bound = @exposed;
+
+ my $pod_spec = Clownfish::CFC::Binding::Perl::Pod->new;
my $synopsis = <<'END_SYNOPSIS';
my $proximity_query = LucyX::Search::ProximityQuery->new(
field => 'content',
@@ -51,18 +55,18 @@ sub bind_proximityquery {
);
my $hits = $searcher->hits( query => $proximity_query );
END_SYNOPSIS
+ $pod_spec->set_synopsis($synopsis);
+ $pod_spec->add_constructor( alias => 'new' );
+ $pod_spec->add_method( method => $_, alias => lc($_) ) for @exposed;
my $binding = Clownfish::CFC::Binding::Perl::Class->new(
- parcel => "Lucy",
- class_name => "LucyX::Search::ProximityQuery",
- make_pod => {
- constructor => { sample => '' },
- synopsis => $synopsis,
- methods => [qw( get_field get_terms get_within )],
- },
+ parcel => "Lucy",
+ class_name => "LucyX::Search::ProximityQuery",
);
$binding->bind_constructor;
- $binding->bind_method( method => $_ ) for qw( Get_Field Get_Terms );
+ $binding->bind_method( method => $_, alias => lc($_) ) for @bound;
+ $binding->set_pod_spec($pod_spec);
+
Clownfish::CFC::Binding::Perl::Class->register($binding);
}