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 2011/02/07 22:27:47 UTC

[lucy-commits] svn commit: r1068145 - in /incubator/lucy/trunk/clownfish: lib/Clownfish/Parser.pm lib/Clownfish/Type.pm lib/Clownfish/Type/VAList.pm t/106-va_list_type.t

Author: marvin
Date: Mon Feb  7 21:27:47 2011
New Revision: 1068145

URL: http://svn.apache.org/viewvc?rev=1068145&view=rev
Log:
Absorb Clownfish::Type::VAList into parent class Clownfish::Type.

Removed:
    incubator/lucy/trunk/clownfish/lib/Clownfish/Type/VAList.pm
Modified:
    incubator/lucy/trunk/clownfish/lib/Clownfish/Parser.pm
    incubator/lucy/trunk/clownfish/lib/Clownfish/Type.pm
    incubator/lucy/trunk/clownfish/t/106-va_list_type.t

Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Parser.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Parser.pm?rev=1068145&r1=1068144&r2=1068145&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Parser.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Parser.pm Mon Feb  7 21:27:47 2011
@@ -24,7 +24,6 @@ use Clownfish::Type;
 use Clownfish::Type::Integer;
 use Clownfish::Type::Float;
 use Clownfish::Type::Void;
-use Clownfish::Type::VAList;
 use Clownfish::Type::Arbitrary;
 use Clownfish::Variable;
 use Clownfish::DocuComment;
@@ -194,7 +193,7 @@ void_type:
 
 va_list_type:
     va_list_type_specifier
-    { Clownfish::Type::VAList->new }
+    { Clownfish::Type->new_va_list }
 
 arbitrary_type:
     arbitrary_type_specifier

Modified: incubator/lucy/trunk/clownfish/lib/Clownfish/Type.pm
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/lib/Clownfish/Type.pm?rev=1068145&r1=1068144&r2=1068145&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/lib/Clownfish/Type.pm (original)
+++ incubator/lucy/trunk/clownfish/lib/Clownfish/Type.pm Mon Feb  7 21:27:47 2011
@@ -175,6 +175,19 @@ sub new_composite {
     return $self;
 }
 
+
+our %new_va_list_PARAMS = ( specifier => 'va_list' );
+
+sub new_va_list {
+    my ( $either, %args ) = @_;
+    verify_args( \%new_va_list_PARAMS, %args ) or confess $@;
+    return $either->new(
+        specifier => 'va_list',
+        c_string  => 'va_list',
+        va_list   => 1,
+    );
+}
+
 sub DESTROY {
     my $self = shift;
     delete $array{$self};
@@ -336,6 +349,22 @@ be NULL.
 
 The Parcel's prefix will be prepended to the specifier by new_object().
 
+=head2 new_va_list
+
+    my $type = Clownfish::Type->new_va_list(
+        specifier => 'va_list',    # default: va_list
+    );
+
+=head1 DESCRIPTION
+
+Create a Type representing C's va_list, from stdarg.h.
+
+=over
+
+=item * B<specifier>.  Must be "va_list" if supplied.
+
+=back
+
 =head2 equals
 
     do_stuff() if $type->equals($other);

Modified: incubator/lucy/trunk/clownfish/t/106-va_list_type.t
URL: http://svn.apache.org/viewvc/incubator/lucy/trunk/clownfish/t/106-va_list_type.t?rev=1068145&r1=1068144&r2=1068145&view=diff
==============================================================================
--- incubator/lucy/trunk/clownfish/t/106-va_list_type.t (original)
+++ incubator/lucy/trunk/clownfish/t/106-va_list_type.t Mon Feb  7 21:27:47 2011
@@ -17,10 +17,10 @@ use strict;
 use warnings;
 
 use Test::More tests => 5;
-use Clownfish::Type::VAList;
+use Clownfish::Type;
 use Clownfish::Parser;
 
-my $va_list_type = Clownfish::Type::VAList->new;
+my $va_list_type = Clownfish::Type->new_va_list;
 is( $va_list_type->get_specifier,
     "va_list", "specifier defaults to 'va_list'" );
 is( $va_list_type->to_c, "va_list", "to_c" );
@@ -29,7 +29,8 @@ my $parser = Clownfish::Parser->new;
 
 is( $parser->va_list_type_specifier('va_list'),
     'va_list', 'va_list_type_specifier' );
-isa_ok( $parser->va_list_type('va_list'), "Clownfish::Type::VAList" );
+my $type = $parser->va_list_type('va_list');
+ok( $type && $type->is_va_list, "parse va_list" );
 ok( !$parser->va_list_type_specifier('va_listable'),
     "va_list_type_specifier guards against partial word matches"
 );