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 2009/09/15 02:29:54 UTC

svn commit: r814943 - in /lucene/lucy/trunk: boilerplater/lib/Boilerplater/Binding/ boilerplater/lib/Boilerplater/Binding/Core/ core/Lucy/Test/Util/ core/Lucy/Util/ perl/buildlib/Lucy/ perl/lib/ perl/lib/Lucy/ perl/xs/

Author: marvin
Date: Tue Sep 15 00:29:53 2009
New Revision: 814943

URL: http://svn.apache.org/viewvc?rev=814943&view=rev
Log:
Undo a bunch of temporary hacks, such as commented-out pound-includes.  Fix a
couple latent bugs.  However, after this patch is applied, Lucy won't build
until the rest of LUCY-40 and all of its sub-issues are committed.

Modified:
    lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core.pm
    lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core/File.pm
    lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl.pm
    lucene/lucy/trunk/core/Lucy/Test/Util/TestNumberUtils.c
    lucene/lucy/trunk/core/Lucy/Util/ToolSet.h
    lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm
    lucene/lucy/trunk/perl/lib/Lucy.pm
    lucene/lucy/trunk/perl/lib/Lucy/Test.pm
    lucene/lucy/trunk/perl/xs/XSBind.c
    lucene/lucy/trunk/perl/xs/XSBind.h

Modified: lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core.pm?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core.pm (original)
+++ lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core.pm Tue Sep 15 00:29:53 2009
@@ -93,13 +93,6 @@
 #include "charmony.h"
 
 $typedefs
-typedef struct lucy_Obj lucy_Obj;
-typedef struct lucy_VTable lucy_VTable;
-typedef struct lucy_CharBuf lucy_CharBuf;
-typedef struct lucy_ZombieCharBuf lucy_ZombieCharBuf;
-typedef struct lucy_Hash lucy_Hash;
-typedef struct lucy_VArray lucy_VArray;
-typedef struct lucy_Err lucy_Err;
 
 /* Refcount / host object */
 typedef union {

Modified: lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core/File.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core/File.pm?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core/File.pm (original)
+++ lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Core/File.pm Tue Sep 15 00:29:53 2009
@@ -115,12 +115,12 @@
 #define C_LUCY_VTABLE
 #define C_LUCY_ZOMBIECHARBUF
 #include "boil.h"
-/* #include "Lucy/Object/VTable.h" */
-/* #include "Lucy/Object/CharBuf.h" */
-/* #include "Lucy/Object/Err.h" */
-/* #include "Lucy/Object/Hash.h" */
-/* #include "Lucy/Object/Host.h" */
-/* #include "Lucy/Object/VArray.h" */
+#include "Lucy/Object/VTable.h"
+#include "Lucy/Object/CharBuf.h"
+#include "Lucy/Object/Err.h"
+#include "Lucy/Object/Hash.h"
+#include "Lucy/Object/Host.h"
+#include "Lucy/Object/VArray.h"
 
 $content
 

Modified: lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl.pm?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl.pm (original)
+++ lucene/lucy/trunk/boilerplater/lib/Boilerplater/Binding/Perl.pm Tue Sep 15 00:29:53 2009
@@ -48,7 +48,7 @@
     $xs_file_components[-1] .= '.xs';
     $self->{xs_path} = catfile( $lib, @xs_file_components );
 
-    $self->{pm_path} = catfile( $lib, @file_components, 'AutoBinding.pm' );
+    $self->{pm_path} = catfile( $lib, @file_components, 'Autobinding.pm' );
     $self->{boot_h_file} = $parcel->get_prefix . "boot.h";
     $self->{boot_c_file} = $parcel->get_prefix . "boot.c";
     $self->{boot_h_path} = catfile( $dest_dir, $self->{boot_h_file} );
@@ -160,16 +160,13 @@
     my ( $self, $generated_xs, $xs_init, $hand_rolled_xs ) = @_;
     return <<END_STUFF;
 #define C_LUCY_ZOMBIECHARBUF
-/* #include "xs/XSBind.h" */
+#include "xs/XSBind.h"
 #include "boil.h"
 #include "$self->{boot_h_file}"
 
-#include "EXTERN.h"
-#include "perl.h"
-#include "XSUB.h"
-/* #include "Lucy/Object/Host.h" */
-/* #include "Lucy/Util/MemManager.h" */
-/* #include "Lucy/Util/StringHelper.h" */
+#include "Lucy/Object/Host.h"
+#include "Lucy/Util/Memory.h"
+#include "Lucy/Util/StringHelper.h"
 
 #include "Charmonizer/Test.h"
 #include "Charmonizer/Test/AllTests.h"

Modified: lucene/lucy/trunk/core/Lucy/Test/Util/TestNumberUtils.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Test/Util/TestNumberUtils.c?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Test/Util/TestNumberUtils.c (original)
+++ lucene/lucy/trunk/core/Lucy/Test/Util/TestNumberUtils.c Tue Sep 15 00:29:53 2009
@@ -1,7 +1,6 @@
 #define C_LUCY_TESTNUMBERUTILS
 #include "Lucy/Util/ToolSet.h"
 #include <stdlib.h>
-#include <stdio.h>
 #include <time.h>
 
 #include "Lucy/Test.h"
@@ -118,10 +117,7 @@
             ASSERT_INT_EQ(batch, NumUtil_decode_c32(&target), (long)ints[i], 
                 "c32 %lu", (long)ints[i]);
             NumUtil_skip_cint(&skip);
-            if (target > limit) { 
-                fprintf(stderr, "overrun\n");
-                exit(1);
-            }
+            if (target > limit) { THROW(ERR, "overrun"); }
         }
         ASSERT_TRUE(batch, skip == target, "skip %lu == %lu", 
             (unsigned long)skip, (unsigned long)target);
@@ -139,10 +135,7 @@
             ASSERT_INT_EQ(batch, NumUtil_decode_c32(&target), (long)ints[i], 
                 "padded c32 %lu", (long)ints[i]);
             NumUtil_skip_cint(&skip);
-            if (target > limit) { 
-                fprintf(stderr, "overrun\n");
-                exit(1);
-            }
+            if (target > limit) { THROW(ERR, "overrun"); }
         }
         ASSERT_TRUE(batch, skip == target, "skip padded %lu == %lu", 
             (unsigned long)skip, (unsigned long)target);
@@ -185,10 +178,7 @@
             u64_t got = NumUtil_decode_c64(&target);
             ASSERT_TRUE(batch, got == ints[i], 
                 "c64 %" U64P " == %" U64P, got, ints[i]);
-            if (target > limit) { 
-                fprintf(stderr, "overrun\n");
-                exit(1);
-            }
+            if (target > limit) { THROW(ERR, "overrun"); }
             NumUtil_skip_cint(&skip);
         }
         ASSERT_TRUE(batch, skip == target, "skip %lu == %lu", 
@@ -394,6 +384,7 @@
     batch->destroy(batch);
 }
 
+
 /* Copyright 2009 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");

Modified: lucene/lucy/trunk/core/Lucy/Util/ToolSet.h
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Util/ToolSet.h?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Util/ToolSet.h (original)
+++ lucene/lucy/trunk/core/Lucy/Util/ToolSet.h Tue Sep 15 00:29:53 2009
@@ -18,17 +18,17 @@
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
-/* #include "Lucy/Obj.h" */
+#include "Lucy/Object/Obj.h"
 /* #include "Lucy/Object/BitVector.h" */
 /* #include "Lucy/Object/ByteBuf.h" */
-/* #include "Lucy/Object/CharBuf.h" */
-/* #include "Lucy/Object/Err.h" */
-/* #include "Lucy/Object/Hash.h" */
+#include "Lucy/Object/CharBuf.h"
+#include "Lucy/Object/Err.h"
+#include "Lucy/Object/Hash.h"
 /* #include "Lucy/Object/Num.h" */
-/* #include "Lucy/Object/Undefined.h" */
-/* #include "Lucy/Object/VArray.h" */
-/* #include "Lucy/Object/VTable.h" */
-/* #include "Lucy/Util/NumberUtils.h" */
+#include "Lucy/Object/Undefined.h"
+#include "Lucy/Object/VArray.h"
+#include "Lucy/Object/VTable.h"
+#include "Lucy/Util/NumberUtils.h"
 #include "Lucy/Util/Memory.h"
 #include "Lucy/Util/StringHelper.h"
 

Modified: lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm (original)
+++ lucene/lucy/trunk/perl/buildlib/Lucy/Build.pm Tue Sep 15 00:29:53 2009
@@ -349,7 +349,7 @@
 
     # Compile C source files.
     my $c_files = $self->rscan_dir( $CORE_SOURCE_DIR, qr/\.c$/ );
-    #push @$c_files, @{ $self->rscan_dir( $XS_SOURCE_DIR,       qr/\.c$/ ) };
+    push @$c_files, @{ $self->rscan_dir( $XS_SOURCE_DIR,       qr/\.c$/ ) };
     push @$c_files, @{ $self->rscan_dir( $CHARMONIZER_GEN_DIR, qr/\.c$/ ) };
     push @$c_files, @{ $self->rscan_dir( $AUTOGEN_DIR,         qr/\.c$/ ) };
     for my $c_file (@$c_files) {

Modified: lucene/lucy/trunk/perl/lib/Lucy.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/lib/Lucy.pm?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/lib/Lucy.pm (original)
+++ lucene/lucy/trunk/perl/lib/Lucy.pm Tue Sep 15 00:29:53 2009
@@ -10,6 +10,51 @@
 use XSLoader;
 BEGIN { XSLoader::load( 'Lucy', '0.01' ) }
 
+use Lucy::Autobinding;
+
+{
+    package KinoSearch::Object::VArray;
+    no warnings 'redefine';
+    sub clone { CORE::shift->_clone }
+}
+
+{
+    package Lucy::Object::VTable;
+
+    sub find_parent_class {
+        my ( undef, $package ) = @_;
+        no strict 'refs';
+        for my $parent ( @{"$package\::ISA"} ) {
+            return $parent if $parent->isa('Lucy::Object::Obj');
+        }
+        return;
+    }
+
+    sub novel_host_methods {
+        my ( undef, $package ) = @_;
+        no strict 'refs';
+        my $stash = \%{"$package\::"};
+        my $methods
+            = Lucy::Object::VArray->new( capacity => scalar keys %$stash );
+        while ( my ( $symbol, $glob ) = each %$stash ) {
+            next if ref $glob;
+            next unless *$glob{CODE};
+            $methods->push( Lucy::Object::CharBuf->new($symbol) );
+        }
+        return $methods;
+    }
+
+    sub _register {
+        my ( undef, %args ) = @_;
+        my $singleton_class = $args{singleton}->get_name;
+        my $parent_class    = $args{parent}->get_name;
+        if ( !$singleton_class->isa($parent_class) ) {
+            no strict 'refs';
+            push @{"$singleton_class\::ISA"}, $parent_class;
+        }
+    }
+}
+
 1;
 
 __END__
@@ -57,7 +102,7 @@
 =head1 COPYRIGHT AND LICENSE
 
     /**
-     * Copyright 2006 The Apache Software Foundation
+     * Copyright 2009 The Apache Software Foundation
      *
      * Licensed under the Apache License, Version 2.0 (the "License");
      * you may not use this file except in compliance with the License.
@@ -72,3 +117,5 @@
      * permissions and limitations under the License.
      */
 
+=cut
+

Modified: lucene/lucy/trunk/perl/lib/Lucy/Test.pm
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/lib/Lucy/Test.pm?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/lib/Lucy/Test.pm (original)
+++ lucene/lucy/trunk/perl/lib/Lucy/Test.pm Tue Sep 15 00:29:53 2009
@@ -14,15 +14,27 @@
     char *package;
 PPCODE:
 {
-    /* Lucy::Util */
-    if (strEQ(package, "TestNumberUtils")) {
+    /* Lucy::Object */
+    if (strEQ(package, "TestObj")) {
+        lucy_TestObj_run_tests();
+    }
+    else if (strEQ(package, "TestCharBuf")) {
+        lucy_TestCB_run_tests();
+    }
+    else if (strEQ(package, "TestHash")) {
+        lucy_TestHash_run_tests();
+    }
+    else if (strEQ(package, "TestNumberUtils")) {
         lucy_TestNumUtil_run_tests();
     }
     else if (strEQ(package, "TestStringHelper")) {
         lucy_TestStrHelp_run_tests();
     }
+    else if (strEQ(package, "TestVArray")) {
+        lucy_TestVArray_run_tests();
+    }
     else {
-        warn("Unknown test identifier: '%s'", package);
+        THROW(LUCY_ERR, "Unknown test id: %s", package);
     }
 }
 END_XS_CODE
@@ -60,7 +72,7 @@
         batch = chaz_TVariadicMacros_prepare();
     }
     else {
-        warn("Unknown test identifier: '%s'", which);
+        THROW(LUCY_ERR, "Unknown test identifier: '%s'", which);
     }
 
     batch->run_test(batch);
@@ -83,7 +95,7 @@
 __COPYRIGHT__
 
     /**
-     * Copyright 2006 The Apache Software Foundation
+     * Copyright 2009 The Apache Software Foundation
      *
      * Licensed under the Apache License, Version 2.0 (the "License");
      * you may not use this file except in compliance with the License.

Modified: lucene/lucy/trunk/perl/xs/XSBind.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/xs/XSBind.c?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/xs/XSBind.c (original)
+++ lucene/lucy/trunk/perl/xs/XSBind.c Tue Sep 15 00:29:53 2009
@@ -334,12 +334,12 @@
         for (i = num_stack_elems; i >= start + 2; i -= 2) {
             chy_i32_t tick = i - 2;
             SV *const key_sv = stack[tick];
-            const chy_i32_t comparison = lucy_StrHelp_compare_strings(
-                label, SvPVX(key_sv), label_len, SvCUR(key_sv));
-            if (comparison == 0) {
-                *target = stack[tick + 1];
-                args_left--;
-                break;
+            if (SvCUR(key_sv) == label_len) {
+                if (memcmp(SvPVX(key_sv), label, label_len) == 0) {
+                    *target = stack[tick + 1];
+                    args_left--;
+                    break;
+                }
             }
         }
     }

Modified: lucene/lucy/trunk/perl/xs/XSBind.h
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/perl/xs/XSBind.h?rev=814943&r1=814942&r2=814943&view=diff
==============================================================================
--- lucene/lucy/trunk/perl/xs/XSBind.h (original)
+++ lucene/lucy/trunk/perl/xs/XSBind.h Tue Sep 15 00:29:53 2009
@@ -5,7 +5,7 @@
 #define H_LUCY_XSBIND 1
 
 #include "charmony.h"
-#include "Lucy/Obj.h"
+#include "Lucy/Object/Obj.h"
 #include "Lucy/Object/CharBuf.h"
 #include "Lucy/Object/Err.h"
 #include "Lucy/Object/Hash.h"