Permalink
Browse files

Cleaned Whitespace

Perltidied and Artistic Styled the code base. 
This was done according to JIRA 197.



git-svn-id: https://svn.apache.org/repos/asf/incubator/lucy/trunk@1215523 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 903ebe8 commit e21d2bc5ee707368b27027c4baa4c6705c6ef84f Logan J. Bell committed Dec 17, 2011
Showing with 269 additions and 256 deletions.
  1. +1 −2 c/src/liblucy.c
  2. +2 −2 charmonizer/src/Charmonizer/Core/OperatingSystem.c
  3. +3 −3 charmonizer/src/Charmonizer/Probe/LargeFiles.h
  4. +5 −5 charmonizer/src/Charmonizer/Test.h
  5. +2 −2 charmonizer/src/Charmonizer/Test/TestLargeFiles.c
  6. +6 −6 clownfish/perl/buildlib/Clownfish/Build.pm
  7. +3 −2 clownfish/perl/lib/Clownfish.pm
  8. +1 −1 clownfish/perl/lib/Clownfish/Binding/Perl.pm
  9. +4 −3 clownfish/perl/lib/Clownfish/Binding/Perl/Class.pm
  10. +2 −2 clownfish/perl/t/100-type.t
  11. +2 −2 clownfish/perl/t/102-integer_type.t
  12. +1 −1 clownfish/perl/t/103-float_type.t
  13. +1 −2 clownfish/perl/t/106-va_list_type.t
  14. +2 −3 clownfish/perl/t/107-arbitrary_type.t
  15. +1 −2 clownfish/perl/t/201-method.t
  16. +1 −2 clownfish/perl/t/301-param_list.t
  17. +1 −1 clownfish/src/CFCBindClass.c
  18. +2 −2 clownfish/src/CFCDumpable.c
  19. +2 −4 clownfish/src/CFCParser.c
  20. +2 −2 clownfish/src/CFCPerlClass.c
  21. +1 −1 clownfish/src/CFCPerlConstructor.c
  22. +8 −8 clownfish/src/CFCPerlMethod.c
  23. +1 −1 clownfish/src/CFCPerlPod.c
  24. +3 −4 clownfish/src/CFCPerlSub.c
  25. +12 −12 clownfish/src/CFCPerlTypeMap.c
  26. +1 −1 clownfish/src/CFCType.c
  27. +1 −1 clownfish/src/CFCVariable.c
  28. +1 −1 core/Lucy/Index/Indexer.c
  29. +1 −1 core/Lucy/Search/NOTQuery.c
  30. +1 −1 core/Lucy/Search/ORQuery.c
  31. +1 −1 core/Lucy/Search/PhraseQuery.c
  32. +1 −1 core/Lucy/Search/RangeQuery.c
  33. +1 −1 core/Lucy/Search/RequiredOptionalQuery.c
  34. +1 −1 core/Lucy/Search/TermQuery.c
  35. +5 −5 core/Lucy/Test/Object/TestNum.c
  36. +2 −2 core/Lucy/Test/Search/TestQueryParserLogic.c
  37. +22 −22 core/Lucy/Test/Util/TestStringHelper.c
  38. +18 −18 core/Lucy/Util/StringHelper.c
  39. +1 −1 core/LucyX/Search/ProximityQuery.c
  40. +2 −2 devel/bin/gen_charmonizer_makefiles.pl
  41. +3 −3 perl/Build.PL
  42. +7 −6 perl/buildlib/Lucy/Build.pm
  43. +22 −8 perl/lib/LucyX/Remote/ClusterSearcher.pm
  44. +2 −0 perl/lib/LucyX/Remote/SearchClient.pm
  45. +3 −2 perl/lib/LucyX/Remote/SearchServer.pm
  46. +4 −4 perl/t/303-highlighter.t
  47. +1 −1 perl/t/518-or_scorer.t
  48. +1 −1 perl/t/519-req_opt_matcher.t
  49. +5 −7 perl/t/550-cluster_searcher.t
  50. +91 −88 tcl/src/tcllucy.c
  51. +2 −2 tcl/src/tcllucy.h
View
3 c/src/liblucy.c
@@ -3,8 +3,7 @@
int lucy_test();
-int lucy_test()
-{
+int lucy_test() {
printf("charmony achieved!\n");
printf("size of CHY_SIZEOF_INT=%d\n", CHY_SIZEOF_INT);
return 1;
View
4 charmonizer/src/Charmonizer/Core/OperatingSystem.c
@@ -171,7 +171,7 @@ OS_mkdir(const char *filepath) {
#if (defined(SHELL_IS_POSIX) || defined (SHELL_IS_CMD_EXE))
char *mkdir_command = "mkdir";
#endif
- unsigned size = strlen(mkdir_command) + 1 + strlen (filepath) + 1;
+ unsigned size = strlen(mkdir_command) + 1 + strlen(filepath) + 1;
char *command = (char*)malloc(size);
sprintf(command, "%s %s", mkdir_command, filepath);
OS_run_quietly(command);
@@ -185,7 +185,7 @@ OS_rmdir(const char *filepath) {
#elif defined(SHELL_IS_CMD_EXE)
char *rmdir_command = "rmdir /q";
#endif
- unsigned size = strlen(rmdir_command) + 1 + strlen (filepath) + 1;
+ unsigned size = strlen(rmdir_command) + 1 + strlen(filepath) + 1;
char *command = (char*)malloc(size);
sprintf(command, "%s %s", rmdir_command, filepath);
OS_run_quietly(command);
View
6 charmonizer/src/Charmonizer/Probe/LargeFiles.h
@@ -39,15 +39,15 @@ extern "C" {
* If off64_t or its equivalent is available, this will be defined:
*
* HAS_64BIT_OFFSET_TYPE
- *
+ *
* If 64-bit variants of fopen, ftell, and fseek are available, this will be
* defined:
*
* HAS_64BIT_STDIO
- *
+ *
* If 64-bit variants of pread and lseek are available, then corresponding
* symbols will be defined:
- *
+ *
* HAS_64BIT_PREAD
* HAS_64BIT_LSEEK
*
View
10 charmonizer/src/Charmonizer/Test.h
@@ -58,28 +58,28 @@ void
chaz_Test_plan(chaz_TestBatch *batch);
#define CHAZ_TEST_OK(_expression, _message) \
- chaz_Test_ok(chaz_Test_current, (_expression), (_message))
+ chaz_Test_ok(chaz_Test_current, (_expression), (_message))
void
chaz_Test_ok(chaz_TestBatch *batch, int expression, const char *message);
#define CHAZ_TEST_STR_EQ(_got, _expected, _message) \
- chaz_Test_str_eq(chaz_Test_current, (_got), (_expected), (_message))
+ chaz_Test_str_eq(chaz_Test_current, (_got), (_expected), (_message))
void
chaz_Test_str_eq(chaz_TestBatch *batch, const char *got,
const char *expected, const char *message);
#define CHAZ_TEST_PASS(_message) \
- chaz_Test_pass(chaz_Test_current, (_message))
+ chaz_Test_pass(chaz_Test_current, (_message))
void
chaz_Test_pass(chaz_TestBatch *batch, const char *message);
#define CHAZ_TEST_FAIL(_message) \
- chaz_Test_fail(chaz_Test_current, (_message))
+ chaz_Test_fail(chaz_Test_current, (_message))
void
chaz_Test_fail(chaz_TestBatch *batch, const char *message);
#define CHAZ_TEST_LONG_EQ(_got, _expected, _message) \
- chaz_Test_long_eq(chaz_Test_current, (_got), (_expected), (_message))
+ chaz_Test_long_eq(chaz_Test_current, (_got), (_expected), (_message))
void
chaz_Test_long_eq(chaz_TestBatch *batch, long got, long expected,
const char *message);
View
4 charmonizer/src/Charmonizer/Test/TestLargeFiles.c
@@ -50,7 +50,7 @@ S_check_sparse_files(void);
/* Helper for check_sparse_files().
*/
-static chaz_bool_t
+static chaz_bool_t
S_test_sparse_file(long offset, struct stat *st);
/* See if trying to write a 5 GB file in a subprocess bombs out. If it
@@ -170,7 +170,7 @@ S_run_tests(void) {
check_val = read(fd, &check_char, 1);
LONG_EQ(check_val, 1, "read() after multiple lseek64 calls");
LONG_EQ(check_char, 'X',
- "read() correct data after multiple lseek64 calls");
+ "read() correct data after multiple lseek64 calls");
#ifdef HAS_64BIT_PREAD
check_char = 0;
check_val = pread64(fd, &check_char, 1, gb4_plus);
View
12 clownfish/perl/buildlib/Clownfish/Build.pm
@@ -23,9 +23,9 @@ use File::Spec::Functions qw( catfile updir catdir );
use Config;
use Cwd qw( getcwd );
-my $base_dir = catdir( updir(), updir() );
-my $PPPORT_H_PATH = catfile( updir(), qw( include ppport.h ) );
-my $LEMON_DIR = catdir( $base_dir, 'lemon' );
+my $base_dir = catdir( updir(), updir() );
+my $PPPORT_H_PATH = catfile( updir(), qw( include ppport.h ) );
+my $LEMON_DIR = catdir( $base_dir, 'lemon' );
my $LEMON_EXE_PATH = catfile( $LEMON_DIR, "lemon$Config{_exe}" );
my $CFC_SOURCE_DIR = catdir( updir(), 'src' );
@@ -124,8 +124,8 @@ sub ACTION_lemon {
print "Building the Lemon parser generator...\n\n";
$self->_run_make(
dir => $LEMON_DIR,
- args => [],
- );
+ args => [],
+ );
}
# Run all .y files through lemon.
@@ -160,7 +160,7 @@ sub ACTION_lexers {
$h_file =~ s/\.l$/.h/ or die "no match";
next
if $self->up_to_date( [ $l_file, @$y_files ],
- [ $c_file, $h_file ] );
+ [ $c_file, $h_file ] );
system( 'flex', '-o', $c_file, "--header-file=$h_file", $l_file )
and die "flex failed";
}
View
5 clownfish/perl/lib/Clownfish.pm
@@ -50,7 +50,8 @@ BEGIN { XSLoader::load( 'Clownfish', '0.01' ) }
# Verify that args came in pairs.
if ( @_ % 2 ) {
my ( $package, $filename, $line ) = caller(1);
- $@ = "Parameter error: odd number of args at $filename line $line\n";
+ $@
+ = "Parameter error: odd number of args at $filename line $line\n";
return 0;
}
@@ -285,7 +286,7 @@ BEGIN { XSLoader::load( 'Clownfish', '0.01' ) }
my ( $either, %args ) = @_;
verify_args( \%new_PARAMS, %args ) or confess $@;
confess "no subclassing allowed" unless $either eq __PACKAGE__;
- my $variadic = delete $args{variadic} || 0;
+ my $variadic = delete $args{variadic} || 0;
return _new($variadic);
}
}
View
2 clownfish/perl/lib/Clownfish/Binding/Perl.pm
@@ -182,7 +182,7 @@ sub write_bindings {
next unless delete $has_methods{$class_name};
my $class_binding
= Clownfish::Binding::Perl::Class->singleton($class_name);
- my @bound = $class_binding->method_bindings;
+ my @bound = $class_binding->method_bindings;
$generated_xs .= $_->xsub_def . "\n" for @bound;
push @xsubs, @bound;
}
View
7 clownfish/perl/lib/Clownfish/Binding/Perl/Class.pm
@@ -61,7 +61,8 @@ sub register {
# Create Pod spec if needed.
my $pod_spec;
if ( $args{make_pod} ) {
- $pod_spec = Clownfish::Binding::Perl::Pod->new( %{ $args{make_pod} } );
+ $pod_spec
+ = Clownfish::Binding::Perl::Pod->new( %{ $args{make_pod} } );
}
# Create object.
@@ -194,10 +195,10 @@ sub create_pod {
$inheritance_pod = "=head1 INHERITANCE\n\n";
$inheritance_pod .= $class->get_class_name;
for my $ancestor (@ancestors) {
- my $class_name = $ancestor->get_class_name;
+ my $class_name = $ancestor->get_class_name;
if ( __PACKAGE__->singleton($class_name) ) {
$inheritance_pod .= " isa L<$class_name>";
- }
+ }
else {
$inheritance_pod .= " isa $class_name";
}
View
4 clownfish/perl/t/100-type.t
@@ -22,8 +22,8 @@ use Clownfish::Parcel;
my $neato_parcel = Clownfish::Parcel->singleton( name => 'Neato' );
my $type = Clownfish::Type->new( parcel => 'Neato', specifier => 'mytype_t' );
-is( ${ $type->get_parcel }, $$neato_parcel,
- "constructor changes parcel name to Parcel singleton" );
+is( ${ $type->get_parcel },
+ $$neato_parcel, "constructor changes parcel name to Parcel singleton" );
is( $type->to_c, '', "to_c()" );
$type->set_c_string("mytype_t");
View
4 clownfish/perl/t/102-integer_type.t
@@ -57,7 +57,7 @@ for my $chy_specifier (@chy_specifiers) {
isa_ok( $type, "Clownfish::Type" );
ok( $type && $type->is_integer, "parsed const Type is_integer()" );
ok( $type && $type->const, "parsed const Type is const()" );
- SKIP: {
+SKIP: {
skip( "No way to catch parser exception at present", 1 );
my $bogus = $chy_specifier . "oot_toot";
ok( !$parser->parse($bogus),
@@ -73,7 +73,7 @@ for my $c_specifier (@c_specifiers) {
isa_ok( $type, "Clownfish::Type" );
ok( $type && $type->is_integer, "parsed const Type is_integer()" );
ok( $type && $type->const, "parsed const Type is const()" );
- SKIP: {
+SKIP: {
skip( "No way to catch parser exception at present", 1 );
my $bogus = $c_specifier . "y";
ok( !$parser->parse($bogus),
View
2 clownfish/perl/t/103-float_type.t
@@ -38,7 +38,7 @@ for my $specifier (qw( float double)) {
isa_ok( $type, "Clownfish::Type" );
ok( $type && $type->is_floating, "parsed const specifier is_floating()" );
ok( $type && $type->const, "parsed const specifier is_floating()" );
- SKIP: {
+SKIP: {
skip( "No way to catch parser exception at present", 1 );
my $bogus = $specifier . "y";
ok( !$parser->parse($bogus),
View
3 clownfish/perl/t/106-va_list_type.t
@@ -32,7 +32,6 @@ ok( $type && $type->is_va_list, "parse va_list" );
SKIP: {
skip( "No way to catch parser exception at present", 1 );
ok( !$parser->parse('va_listable'),
- "va_list_type_specifier guards against partial word matches"
- );
+ "va_list_type_specifier guards against partial word matches" );
}
View
5 clownfish/perl/t/107-arbitrary_type.t
@@ -49,10 +49,9 @@ my $parser = Clownfish::Parser->new;
for my $specifier (qw( foo_t Sort_compare_t )) {
my $type = $parser->parse($specifier);
ok( $type && $type->is_arbitrary, "arbitrary_type '$specifier'" );
- SKIP: {
+SKIP: {
skip( "Can't recover from bad specifier", 1 );
ok( !$parser->parse( $specifier . "_y_p_e eep;" ),
- "arbitrary_type_specifier guards against partial word matches"
- );
+ "arbitrary_type_specifier guards against partial word matches" );
}
}
View
3 clownfish/perl/t/201-method.t
@@ -55,8 +55,7 @@ ok( !$method->compatible($macro_sym_differs),
ok( !$macro_sym_differs->compatible($method), "... reversed" );
my $extra_param = Clownfish::Method->new( %args,
- param_list =>
- $parser->parse('(Foo *self, int32_t count = 0, int b)'), );
+ param_list => $parser->parse('(Foo *self, int32_t count = 0, int b)'), );
ok( !$method->compatible($macro_sym_differs),
"extra param spoils compatible()"
);
View
3 clownfish/perl/t/301-param_list.t
@@ -26,8 +26,7 @@ my $parser = Clownfish::Parser->new;
$parser->parse('parcel Neato;')
or die "failed to process parcel_definition";
-isa_ok( $parser->parse($_),
- "Clownfish::Variable", "param_variable: $_" )
+isa_ok( $parser->parse($_), "Clownfish::Variable", "param_variable: $_" )
for ( 'uint32_t baz', 'CharBuf *stuff', 'float **ptr', );
my $param_list = $parser->parse("(Obj *self, int num)");
View
2 clownfish/src/CFCBindClass.c
@@ -93,7 +93,7 @@ static char*
S_short_names(CFCBindClass *self);
const static CFCMeta CFCBINDCLASS_META = {
- "Clownfish::Binding::Core::Class",
+ "Clownfish::Binding::Core::Class",
sizeof(CFCBindClass),
(CFCBase_destroy_t)CFCBindClass_destroy
};
View
4 clownfish/src/CFCDumpable.c
@@ -131,7 +131,7 @@ S_make_method_obj(CFCClass *klass, const char *method_name) {
else if (strcmp(method_name, "Load") == 0) {
CFCType *dump_type = CFCType_new_object(0, cf_parcel, "Obj", 1);
CFCVariable *dump_var = CFCVariable_new(cf_parcel, NULL, NULL,
- NULL, "dump", dump_type,
+ NULL, "dump", dump_type,
false);
param_list = CFCParamList_new(false);
CFCParamList_add_param(param_list, self_var, NULL);
@@ -315,7 +315,7 @@ S_process_dump_member(CFCClass *klass, CFCVariable *member, char *buf,
" Cfish_Hash_Store_Str(dump, \"%s\", %u, (cfish_Obj*)cfish_CB_newf(\"%%f64\", (double)self->%s));\n";
char bool_pattern[] =
" Cfish_Hash_Store_Str(dump, \"%s\", %u, (cfish_Obj*)cfish_Bool_singleton(self->%s));\n";
- const char *pattern;
+ const char *pattern;
if (strcmp(specifier, "bool_t") == 0
|| strcmp(specifier, "chy_bool_t") == 0
) {
View
6 clownfish/src/CFCParser.c
@@ -137,15 +137,13 @@ CFCParser_allocate(CFCParser *self, size_t size) {
}
void
-CFCParser_set_result(CFCParser *self, CFCBase *result)
-{
+CFCParser_set_result(CFCParser *self, CFCBase *result) {
CFCBase_decref(self->result);
self->result = CFCBase_incref(result);
}
void
-CFCParser_set_errors(CFCParser *self, int errors)
-{
+CFCParser_set_errors(CFCParser *self, int errors) {
self->errors = errors;
}
View
4 clownfish/src/CFCPerlClass.c
@@ -49,7 +49,7 @@ const static CFCMeta CFCPERLCLASS_META = {
};
CFCPerlClass*
-CFCPerlClass_new(CFCParcel *parcel, const char *class_name, CFCClass *client,
+CFCPerlClass_new(CFCParcel *parcel, const char *class_name, CFCClass *client,
const char *xs_code, CFCPerlPod *pod_spec) {
CFCPerlClass *self = (CFCPerlClass*)CFCBase_allocate(&CFCPERLCLASS_META);
return CFCPerlClass_init(self, parcel, class_name, client, xs_code,
@@ -92,7 +92,7 @@ CFCPerlClass_add_to_registry(CFCPerlClass *self) {
if (registry_size == registry_cap) {
size_t new_cap = registry_cap + 10;
registry = (CFCPerlClass**)REALLOCATE(registry,
- (new_cap + 1) * sizeof(CFCPerlClass*));
+ (new_cap + 1) * sizeof(CFCPerlClass*));
for (size_t i = registry_cap; i <= new_cap; i++) {
registry[i] = NULL;
}
View
2 clownfish/src/CFCPerlConstructor.c
@@ -125,7 +125,7 @@ CFCPerlConstructor_xsub_def(CFCPerlConstructor *self) {
}
}
- const char pattern[] =
+ const char pattern[] =
"XS(%s);\n"
"XS(%s) {\n"
" dXSARGS;\n"
View
16 clownfish/src/CFCPerlMethod.c
@@ -122,7 +122,7 @@ S_xsub_body(CFCPerlMethod *self) {
if (CFCType_is_void(CFCMethod_get_return_type(method))) {
// Invoke method in void context.
- body = CFCUtil_cat(body, full_func_sym, "(", name_list,
+ body = CFCUtil_cat(body, full_func_sym, "(", name_list,
");\n XSRETURN(0);", NULL);
}
else {
@@ -133,7 +133,7 @@ S_xsub_body(CFCPerlMethod *self) {
body = CFCUtil_cat(body, type_str, " retval = ", full_func_sym, "(",
name_list, ");\n ST(0) = ", assignment, ";",
NULL);
- if (CFCType_is_object(return_type)
+ if (CFCType_is_object(return_type)
&& CFCType_incremented(return_type)
) {
body = CFCUtil_cat(body, "\n CFISH_DECREF(retval);", NULL);
@@ -156,7 +156,7 @@ S_self_assign_statement(CFCPerlMethod *self, CFCType *type,
CFCUtil_die("Not an object type: %s", type_c);
}
const char *vtable_var = CFCType_get_vtable_var(type);
-
+
// Make an exception for deserialize -- allow self to be NULL if called as
// a class method.
char *binding_func = strcmp(method_name, "deserialize") == 0
@@ -166,7 +166,7 @@ S_self_assign_statement(CFCPerlMethod *self, CFCType *type,
size_t size = sizeof(pattern)
+ strlen(type_c) * 2
+ strlen(binding_func)
- + strlen(vtable_var)
+ + strlen(vtable_var)
+ 10;
char *statement = (char*)MALLOCATE(size);
sprintf(statement, pattern, type_c, type_c, binding_func, vtable_var);
@@ -235,7 +235,7 @@ S_xsub_def_positional_args(CFCPerlMethod *self) {
min_required = i + 1;
}
}
- char *xs_name_list = num_vars > 0
+ char *xs_name_list = num_vars > 0
? CFCUtil_strdup(CFCVariable_micro_sym(arg_vars[0]))
: CFCUtil_strdup("");
for (unsigned i = 1; i < num_vars; i++) {
@@ -248,7 +248,7 @@ S_xsub_def_positional_args(CFCPerlMethod *self) {
NULL);
}
}
- const char num_args_pattern[] =
+ const char num_args_pattern[] =
"if (items %s %u) { CFISH_THROW(CFISH_ERR, \"Usage: %%s(%s)\", GvNAME(CvGV(cv))); }";
size_t num_args_check_size = sizeof(num_args_pattern)
+ strlen(xs_name_list)
@@ -285,7 +285,7 @@ S_xsub_def_positional_args(CFCPerlMethod *self) {
char *conversion
= CFCPerlTypeMap_from_perl(var_type, perl_stack_var);
if (val) {
- char pattern[] =
+ char pattern[] =
"\n %s %s = ( items >= %u && XSBind_sv_defined(ST(%u)) )"
" ? %s : %s;";
size_t size = sizeof(pattern)
@@ -310,7 +310,7 @@ S_xsub_def_positional_args(CFCPerlMethod *self) {
}
}
- char pattern[] =
+ char pattern[] =
"XS(%s);\n"
"XS(%s) {\n"
" dXSARGS;\n"
View
2 clownfish/src/CFCPerlPod.c
@@ -284,7 +284,7 @@ CFCPerlPod_gen_subroutine_pod(CFCPerlPod *self, CFCFunction *func,
while (isspace(*after_comma)) { after_comma++; }
pod = CFCUtil_cat(pod, "(", after_comma, ")\n\n", NULL);
}
- else {
+ else {
// num_args == 1, leave off 'self'.
pod = CFCUtil_cat(pod, "()\n\n", NULL);
}
View
7 clownfish/src/CFCPerlSub.c
@@ -74,8 +74,7 @@ CFCPerlSub_destroy(CFCPerlSub *self) {
}
char*
-CFCPerlSub_params_hash_def(CFCPerlSub *self)
-{
+CFCPerlSub_params_hash_def(CFCPerlSub *self) {
if (!self->use_labeled_params) {
return NULL;
}
@@ -177,7 +176,7 @@ S_allot_params_arg(CFCType *type, const char *label, int required) {
const char *prim_type = prim_type_to_allot_macro[i].prim_type;
if (strcmp(prim_type, type_c_string) == 0) {
const char *allot = prim_type_to_allot_macro[i].allot_macro;
- char pattern[] = "%s(&%s, \"%s\", %u, %s)";
+ char pattern[] = "%s(&%s, \"%s\", %u, %s)";
size_t size = sizeof(pattern)
+ strlen(allot)
+ label_len * 2
@@ -237,7 +236,7 @@ CFCPerlSub_build_allot_params(CFCPerlSub *self) {
FREEMEM(arg);
}
allot_params
- = CFCUtil_cat(allot_params, " NULL);\n",
+ = CFCUtil_cat(allot_params, " NULL);\n",
" if (!args_ok) {\n"
" CFISH_RETHROW(CFISH_INCREF(cfish_Err_get_error()));\n"
" }", NULL);
View
24 clownfish/src/CFCPerlTypeMap.c
@@ -49,13 +49,13 @@ CFCPerlTypeMap_from_perl(CFCType *type, const char *xs_var) {
// Share buffers rather than copy between Perl scalars and
// Clownfish string types.
result = CFCUtil_cat(CFCUtil_strdup(""), "(", struct_sym,
- "*)XSBind_sv_to_cfish_obj(", xs_var,
- ", ", vtable_var,
+ "*)XSBind_sv_to_cfish_obj(", xs_var,
+ ", ", vtable_var,
", alloca(cfish_ZCB_size()))", NULL);
}
else {
result = CFCUtil_cat(CFCUtil_strdup(""), "(", struct_sym,
- "*)XSBind_sv_to_cfish_obj(", xs_var,
+ "*)XSBind_sv_to_cfish_obj(", xs_var,
", ", vtable_var, ", NULL)", NULL);
}
}
@@ -132,8 +132,8 @@ CFCPerlTypeMap_to_perl(CFCType *type, const char *cf_var) {
if (CFCType_is_object(type)) {
result = CFCUtil_cat(CFCUtil_strdup(""), "(", cf_var,
- " == NULL ? newSV(0) : "
- "XSBind_cfish_to_perl((cfish_Obj*)",
+ " == NULL ? newSV(0) : "
+ "XSBind_cfish_to_perl((cfish_Obj*)",
cf_var, "))", NULL);
}
else if (CFCType_is_primitive(type)) {
@@ -155,7 +155,7 @@ CFCPerlTypeMap_to_perl(CFCType *type, const char *cf_var) {
sprintf(result, "newSViv(%s)", cf_var);
}
else if (strcmp(specifier, "long") == 0) {
- char pattern[] =
+ char pattern[] =
"((sizeof(long) <= sizeof(IV)) ? "
"newSViv((IV)%s) : newSVnv((NV)%s))";
sprintf(result, pattern, cf_var, cf_var);
@@ -201,8 +201,8 @@ CFCPerlTypeMap_to_perl(CFCType *type, const char *cf_var) {
if (strcmp(type_str, "void*") == 0) {
// Assume that void* is a reference SV -- either a hashref or an
// arrayref.
- result = CFCUtil_cat(CFCUtil_strdup(""), "newRV_inc((SV*)",
- cf_var,")", NULL);
+ result = CFCUtil_cat(CFCUtil_strdup(""), "newRV_inc((SV*)",
+ cf_var, ")", NULL);
}
}
@@ -292,14 +292,14 @@ CFCPerlTypeMap_write_xs_typemap(CFCHierarchy *hierarchy) {
", NULL);\n\n", NULL);
output = CFCUtil_cat(output, vtable_var, "_\n"
- " $arg = (SV*)Cfish_Obj_To_Host((cfish_Obj*)$var);\n"
- " CFISH_DECREF($var);\n"
- "\n", NULL);
+ " $arg = (SV*)Cfish_Obj_To_Host((cfish_Obj*)$var);\n"
+ " CFISH_DECREF($var);\n"
+ "\n", NULL);
}
char *content = CFCUtil_strdup("");
content = CFCUtil_cat(content, typemap_start, start, "\n\n",
- typemap_input, input, "\n\n",
+ typemap_input, input, "\n\n",
typemap_output, output, "\n\n", NULL);
CFCUtil_write_if_changed("typemap", content, strlen(content));
View
2 clownfish/src/CFCType.c
@@ -43,7 +43,7 @@ struct CFCType {
struct CFCType *child;
};
-const static CFCMeta CFCTYPE_META= {
+const static CFCMeta CFCTYPE_META = {
"Clownfish::Type",
sizeof(CFCType),
(CFCBase_destroy_t)CFCType_destroy
View
2 clownfish/src/CFCVariable.c
@@ -88,7 +88,7 @@ CFCVariable_init(CFCVariable *self, struct CFCParcel *parcel,
sprintf(self->local_dec, "%s;", self->local_c);
const char *full_sym = CFCVariable_full_sym(self);
size_t full_size = strlen(type_str) + sizeof(" ") + strlen(full_sym) +
- strlen(postfix) + 1;
+ strlen(postfix) + 1;
self->global_c = (char*)MALLOCATE(full_size);
sprintf(self->global_c, "%s %s%s", type_str, full_sym, postfix);
View
2 core/Lucy/Index/Indexer.c
@@ -417,7 +417,7 @@ S_maybe_merge(Indexer *self, VArray *seg_readers) {
// Get a list of segments to recycle. Validate and confirm that there are
// no dupes in the list.
VArray *to_merge = IxManager_Recycle(self->manager, self->polyreader,
- self->del_writer, cutoff, self->optimize);
+ self->del_writer, cutoff, self->optimize);
Hash *seen = Hash_new(VA_Get_Size(to_merge));
for (uint32_t i = 0, max = VA_Get_Size(to_merge); i < max; i++) {
View
2 core/Lucy/Search/NOTQuery.c
@@ -72,7 +72,7 @@ NOTQuery_make_compiler(NOTQuery *self, Searcher *searcher, float boost,
NOTCompiler *compiler = NOTCompiler_new(self, searcher, boost);
if (!subordinate) {
NOTCompiler_Normalize(compiler);
- }
+ }
return (Compiler*)compiler;
}
View
2 core/Lucy/Search/ORQuery.c
@@ -43,7 +43,7 @@ ORQuery_make_compiler(ORQuery *self, Searcher *searcher, float boost,
ORCompiler *compiler = ORCompiler_new(self, searcher, boost);
if (!subordinate) {
ORCompiler_Normalize(compiler);
- }
+ }
return (Compiler*)compiler;
}
View
2 core/Lucy/Search/PhraseQuery.c
@@ -141,7 +141,7 @@ PhraseQuery_make_compiler(PhraseQuery *self, Searcher *searcher,
= PhraseCompiler_new(self, searcher, boost);
if (!subordinate) {
PhraseCompiler_Normalize(compiler);
- }
+ }
return (Compiler*)compiler;
}
}
View
2 core/Lucy/Search/RangeQuery.c
@@ -162,7 +162,7 @@ RangeQuery_make_compiler(RangeQuery *self, Searcher *searcher,
RangeCompiler *compiler = RangeCompiler_new(self, searcher, boost);
if (!subordinate) {
RangeCompiler_Normalize(compiler);
- }
+ }
return compiler;
}
View
2 core/Lucy/Search/RequiredOptionalQuery.c
@@ -87,7 +87,7 @@ ReqOptQuery_make_compiler(RequiredOptionalQuery *self, Searcher *searcher,
= ReqOptCompiler_new(self, searcher, boost);
if (!subordinate) {
ReqOptCompiler_Normalize(compiler);
- }
+ }
return (Compiler*)compiler;
}
View
2 core/Lucy/Search/TermQuery.c
@@ -106,7 +106,7 @@ TermQuery_make_compiler(TermQuery *self, Searcher *searcher, float boost,
TermCompiler *compiler = TermCompiler_new((Query*)self, searcher, boost);
if (!subordinate) {
TermCompiler_Normalize(compiler);
- }
+ }
return (Compiler*)compiler;
}
View
10 core/Lucy/Test/Object/TestNum.c
@@ -177,15 +177,15 @@ test_Equals_and_Compare_To(TestBatch *batch) {
TEST_TRUE(batch, Int32_Compare_To(i32, (Obj*)f32) < 0,
"Integer32 comparison to Float32");
- TEST_TRUE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_TRUE),
+ TEST_TRUE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_TRUE),
"CFISH_TRUE Equals itself");
- TEST_TRUE(batch, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_FALSE),
+ TEST_TRUE(batch, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_FALSE),
"CFISH_FALSE Equals itself");
- TEST_FALSE(batch, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_TRUE),
+ TEST_FALSE(batch, Bool_Equals(CFISH_FALSE, (Obj*)CFISH_TRUE),
"CFISH_FALSE not Equals CFISH_TRUE ");
- TEST_FALSE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_FALSE),
+ TEST_FALSE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CFISH_FALSE),
"CFISH_TRUE not Equals CFISH_FALSE ");
- TEST_FALSE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CHARBUF),
+ TEST_FALSE(batch, Bool_Equals(CFISH_TRUE, (Obj*)CHARBUF),
"CFISH_TRUE not Equals random other object ");
DECREF(i64);
View
4 core/Lucy/Test/Search/TestQueryParserLogic.c
@@ -416,7 +416,7 @@ logical_test_a_OR_b_AND_c_AND_d(uint32_t boolop) {
Query *b_query = make_leaf_query(NULL, "b");
Query *c_query = make_leaf_query(NULL, "c");
Query *d_query = make_leaf_query(NULL, "d");
- Query *right = make_poly_query(BOOLOP_AND, b_query, c_query, d_query,
+ Query *right = make_poly_query(BOOLOP_AND, b_query, c_query, d_query,
NULL);
Query *tree = make_poly_query(BOOLOP_OR, a_query, right, NULL);
UNUSED_VAR(boolop);
@@ -430,7 +430,7 @@ logical_test_a_OR_b_AND_c_OR_d(uint32_t boolop) {
Query *c_query = make_leaf_query(NULL, "c");
Query *d_query = make_leaf_query(NULL, "d");
Query *middle = make_poly_query(BOOLOP_AND, b_query, c_query, NULL);
- Query *tree = make_poly_query(BOOLOP_OR, a_query, middle, d_query,
+ Query *tree = make_poly_query(BOOLOP_OR, a_query, middle, d_query,
NULL);
UNUSED_VAR(boolop);
return TestQP_new("a OR b AND c OR d", tree, NULL, 4);
View
44 core/Lucy/Test/Util/TestStringHelper.c
@@ -29,8 +29,8 @@
#define TRAIL_OK(n) (n >= 0x80 && n <= 0xBF)
static bool_t
S_utf8_valid_alt(const char *maybe_utf8, size_t size) {
- const uint8_t *string = (const uint8_t*)maybe_utf8;
- const uint8_t *const end = string + size;
+ const uint8_t *string = (const uint8_t*)maybe_utf8;
+ const uint8_t *const end = string + size;
while (string < end) {
int count = StrHelp_UTF8_COUNT[*string];
bool_t valid = false;
@@ -79,7 +79,7 @@ S_utf8_valid_alt(const char *maybe_utf8, size_t size) {
else if (count == 4) {
if (string[0] == 0xF0) {
if (string[1] >= 0x90 && string[1] <= 0xBF
- && TRAIL_OK(string[2])
+ && TRAIL_OK(string[2])
&& TRAIL_OK(string[3])
) {
valid = true;
@@ -225,25 +225,25 @@ test_utf8_valid(TestBatch *batch) {
// Bad continuations.
S_test_validity(batch, "\xE2\x98\xBA\xE2\x98\xBA", 6, true,
"SmileySmiley");
- S_test_validity(batch, "\xE2\xBA\xE2\x98\xBA", 5, false,
+ S_test_validity(batch, "\xE2\xBA\xE2\x98\xBA", 5, false,
"missing first continuation byte");
- S_test_validity(batch, "\xE2\x98\xE2\x98\xBA", 5, false,
+ S_test_validity(batch, "\xE2\x98\xE2\x98\xBA", 5, false,
"missing second continuation byte");
- S_test_validity(batch, "\xE2\xE2\x98\xBA", 4, false,
+ S_test_validity(batch, "\xE2\xE2\x98\xBA", 4, false,
"missing both continuation bytes");
- S_test_validity(batch, "\xBA\xE2\x98\xBA\xE2\xBA", 5, false,
+ S_test_validity(batch, "\xBA\xE2\x98\xBA\xE2\xBA", 5, false,
"missing first continuation byte (end)");
- S_test_validity(batch, "\xE2\x98\xBA\xE2\x98", 5, false,
+ S_test_validity(batch, "\xE2\x98\xBA\xE2\x98", 5, false,
"missing second continuation byte (end)");
- S_test_validity(batch, "\xE2\x98\xBA\xE2", 4, false,
+ S_test_validity(batch, "\xE2\x98\xBA\xE2", 4, false,
"missing both continuation bytes (end)");
- S_test_validity(batch, "\xBA\xE2\x98\xBA", 4, false,
+ S_test_validity(batch, "\xBA\xE2\x98\xBA", 4, false,
"isolated continuation byte 0xBA");
- S_test_validity(batch, "\x98\xE2\x98\xBA", 4, false,
+ S_test_validity(batch, "\x98\xE2\x98\xBA", 4, false,
"isolated continuation byte 0x98");
- S_test_validity(batch, "\xE2\x98\xBA\xBA", 4, false,
+ S_test_validity(batch, "\xE2\x98\xBA\xBA", 4, false,
"isolated continuation byte 0xBA (end)");
- S_test_validity(batch, "\xE2\x98\xBA\x98", 4, false,
+ S_test_validity(batch, "\xE2\x98\xBA\x98", 4, false,
"isolated continuation byte 0x98 (end)");
}
@@ -287,11 +287,11 @@ test_utf8proc_normalization(TestBatch *batch) {
// Normalize once.
uint8_t *normalized;
int32_t check = utf8proc_map(CB_Get_Ptr8(source), CB_Get_Size(source),
- &normalized,
- UTF8PROC_STABLE |
- UTF8PROC_COMPOSE |
- UTF8PROC_COMPAT |
- UTF8PROC_CASEFOLD);
+ &normalized,
+ UTF8PROC_STABLE |
+ UTF8PROC_COMPOSE |
+ UTF8PROC_COMPAT |
+ UTF8PROC_CASEFOLD);
if (check < 0) {
lucy_Json_set_tolerant(1);
CharBuf *json = lucy_Json_to_json((Obj*)source);
@@ -308,10 +308,10 @@ test_utf8proc_normalization(TestBatch *batch) {
size_t normalized_len = strlen((char*)normalized);
uint8_t *dupe;
int32_t dupe_check = utf8proc_map(normalized, normalized_len, &dupe,
- UTF8PROC_STABLE |
- UTF8PROC_COMPOSE |
- UTF8PROC_COMPAT |
- UTF8PROC_CASEFOLD);
+ UTF8PROC_STABLE |
+ UTF8PROC_COMPOSE |
+ UTF8PROC_COMPAT |
+ UTF8PROC_CASEFOLD);
if (dupe_check < 0) {
THROW(ERR, "Unexpected normalization error: %i32", dupe_check);
}
View
36 core/Lucy/Util/StringHelper.c
@@ -81,40 +81,40 @@ StrHelp_utf8_valid(const char *ptr, size_t size) {
const uint8_t *string = (const uint8_t*)ptr;
const uint8_t *const end = string + size;
while (string < end) {
- const uint8_t header_byte = *string++;
+ const uint8_t header_byte = *string++;
int count = StrHelp_UTF8_COUNT[header_byte] & 0x7;
switch (count & 0x7) {
case 1:
- // ASCII
+ // ASCII
break;
case 2:
if (string == end) { return false; }
- // Disallow non-shortest-form ASCII.
+ // Disallow non-shortest-form ASCII.
if (!(header_byte & 0x1E)) { return false; }
if ((*string++ & 0xC0) != 0x80) { return false; }
break;
case 3:
if (end - string < 2) { return false; }
- if (header_byte == 0xED) {
- if (*string < 0x80 || *string > 0x9F) {
- return false;
- }
- }
- else if (!(header_byte & 0x0F)) {
- if (!(*string & 0x20)) {
- return false;
- }
- }
+ if (header_byte == 0xED) {
+ if (*string < 0x80 || *string > 0x9F) {
+ return false;
+ }
+ }
+ else if (!(header_byte & 0x0F)) {
+ if (!(*string & 0x20)) {
+ return false;
+ }
+ }
if ((*string++ & 0xC0) != 0x80) { return false; }
if ((*string++ & 0xC0) != 0x80) { return false; }
break;
case 4:
if (end - string < 3) { return false; }
- if (!(header_byte & 0x07)) {
- if (!(*string & 0x30)) {
- return false;
- }
- }
+ if (!(header_byte & 0x07)) {
+ if (!(*string & 0x30)) {
+ return false;
+ }
+ }
if ((*string++ & 0xC0) != 0x80) { return false; }
if ((*string++ & 0xC0) != 0x80) { return false; }
if ((*string++ & 0xC0) != 0x80) { return false; }
View
2 core/LucyX/Search/ProximityQuery.c
@@ -148,7 +148,7 @@ ProximityQuery_make_compiler(ProximityQuery *self, Searcher *searcher,
= ProximityCompiler_new(self, searcher, boost, self->within);
if (!subordinate) {
ProximityCompiler_Normalize(compiler);
- }
+ }
return (Compiler*)compiler;
}
}
View
4 devel/bin/gen_charmonizer_makefiles.pl
@@ -231,8 +231,8 @@ package Charmonizer::Build::Makefile::MSVC;
sub new {
my $class = shift;
- my $flags = '-nologo -D_CRT_SECURE_NO_WARNINGS '
- . '-D_SCL_SECURE_NO_WARNINGS';
+ my $flags
+ = '-nologo -D_CRT_SECURE_NO_WARNINGS ' . '-D_SCL_SECURE_NO_WARNINGS';
return $class->SUPER::new(
filename => 'Makefile.MSVC',
obj_ext => '.obj',
View
6 perl/Build.PL
@@ -24,10 +24,10 @@ my $builder = Lucy::Build->new(
license => 'apache',
dist_author =>
'The Apache Lucy Project <lucy-dev at incubator dot apache dot org>',
- dist_version => '0.2.0',
- requires => { 'perl' => '5.8.3', },
+ dist_version => '0.2.0',
+ requires => { 'perl' => '5.8.3', },
configure_requires => { 'Module::Build' => 0.280801 },
- build_requires => {
+ build_requires => {
'Module::Build' => 0.280801,
'ExtUtils::CBuilder' => 0.21,
'ExtUtils::ParseXS' => 2.18,
View
13 perl/buildlib/Lucy/Build.pm
@@ -122,11 +122,11 @@ my $SNOWSTEM_SRC_DIR
my $SNOWSTEM_INC_DIR = catdir( $SNOWSTEM_SRC_DIR, 'include' );
my $SNOWSTOP_SRC_DIR
= catdir( $base_dir, qw( modules analysis snowstop source ) );
-my $UCD_INC_DIR = catdir( $base_dir, qw( modules unicode ucd ) );
+my $UCD_INC_DIR = catdir( $base_dir, qw( modules unicode ucd ) );
my $UTF8PROC_SRC_DIR = catdir( $base_dir, qw( modules unicode utf8proc ) );
my $UTF8PROC_C = catfile( $UTF8PROC_SRC_DIR, 'utf8proc.c' );
my $CORE_SOURCE_DIR = catdir( $base_dir, 'core' );
-my $CLOWNFISH_DIR = catdir( $base_dir, 'clownfish', 'perl' );
+my $CLOWNFISH_DIR = catdir( $base_dir, 'clownfish', 'perl' );
my $CLOWNFISH_BUILD = catfile( $CLOWNFISH_DIR, 'Build' );
my $AUTOGEN_DIR = 'autogen';
my $XS_SOURCE_DIR = 'xs';
@@ -182,7 +182,7 @@ sub ACTION_charmony {
if ( $ENV{CHARM_VALGRIND} ) {
unshift @command, "valgrind", "--leak-check=yes";
}
- print join(" ", @command), $/;
+ print join( " ", @command ), $/;
system(@command) and die "Failed to write $CHARMONY_PATH: $!";
}
@@ -510,8 +510,9 @@ sub ACTION_compile_custom_xs {
my $archdir = catdir( $self->blib, 'arch', 'auto', 'Lucy', );
mkpath( $archdir, 0, 0777 ) unless -d $archdir;
my @include_dirs = (
- getcwd(), $CORE_SOURCE_DIR, $AUTOGEN_DIR, $XS_SOURCE_DIR,
- $SNOWSTEM_INC_DIR, $UCD_INC_DIR, $UTF8PROC_SRC_DIR
+ getcwd(), $CORE_SOURCE_DIR, $AUTOGEN_DIR,
+ $XS_SOURCE_DIR, $SNOWSTEM_INC_DIR, $UCD_INC_DIR,
+ $UTF8PROC_SRC_DIR
);
my @objects;
@@ -755,7 +756,7 @@ sub ACTION_clean {
and die "Clownfish clean failed";
}
$self->_run_make( dir => $CHARMONIZER_ORIG_DIR, args => ['clean'] );
- $self->_run_make( dir => $LEMON_DIR, args => ['clean'] );
+ $self->_run_make( dir => $LEMON_DIR, args => ['clean'] );
$self->SUPER::ACTION_clean;
}
View
30 perl/lib/LucyX/Remote/ClusterSearcher.pm
@@ -129,10 +129,14 @@ sub _multi_rpc {
$remaining--;
}
}
+
+=end disabled
+
=cut
+
my @responses;
for ( my $i = 0; $i < $num_shards; $i++ ) {
- my $response = $self->_retrieve_response_from_shard($i);
+ my $response = $self->_retrieve_response_from_shard($i);
$responses[$i] = $response->{retval};
}
return \@responses;
@@ -160,25 +164,31 @@ sub _serialize_request {
# Send a serialized request to one shard.
sub _send_request_to_shard {
my ( $self, $shard_num, $request ) = @_;
- my $sock = $socks{$$self}[$shard_num];
+ my $sock = $socks{$$self}[$shard_num];
print $sock $$request or confess $!;
+
=begin disabled
my $check_val = $sock->syswrite($$request);
confess $! unless $check_val == length($$request);
+
+=end disabled
+
=cut
+
}
# Retrieve the response from a shard.
sub _retrieve_response_from_shard {
my ( $self, $shard_num ) = @_;
- my $sock = $socks{$$self}[$shard_num];
+ my $sock = $socks{$$self}[$shard_num];
my $packed_len = "";
my $serialized = "";
- my $check_val = $sock->read( $packed_len, 4 );
+ my $check_val = $sock->read( $packed_len, 4 );
confess $! unless $check_val == 4;
my $arg_len = unpack( 'N', $packed_len );
$check_val = $sock->read( $serialized, $arg_len );
confess $! unless $check_val == $arg_len;
+
=begin disabled
my $check_val;
$! = undef;
@@ -201,7 +211,11 @@ sub _retrieve_response_from_shard {
my $arg_len = unpack( 'N', $packed_len );
$check_val = $sock->sysread( $serialized, $arg_len );
confess $! unless $check_val == $arg_len;
+
+=end disabled
+
=cut
+
return thaw($serialized);
}
@@ -264,10 +278,10 @@ sub terminate {
sub fetch_doc {
my ( $self, $doc_id ) = @_;
- my $starts = $starts{$$self};
- my $tick = Lucy::Index::PolyReader::sub_tick( $starts, $doc_id );
- my $start = $starts->get($tick);
- my %args = ( doc_id => $doc_id - $start, _action => 'fetch_doc' );
+ my $starts = $starts{$$self};
+ my $tick = Lucy::Index::PolyReader::sub_tick( $starts, $doc_id );
+ my $start = $starts->get($tick);
+ my %args = ( doc_id => $doc_id - $start, _action => 'fetch_doc' );
my $hit_doc = $self->_single_rpc( \%args, $tick );
$hit_doc->set_doc_id($doc_id);
return $hit_doc;
View
2 perl/lib/LucyX/Remote/SearchClient.pm
@@ -74,10 +74,12 @@ sub _rpc {
my $serialized = nfreeze($args);
my $packed_len = pack( 'N', length($serialized) );
print $sock "$packed_len$serialized" or confess $!;
+
=begin disabled
my $check_val = $sock->syswrite("$packed_len$serialized");
confess $! if $check_val != length($serialized) + 4;
=cut
+
my $check_val;
# Bail out if we're either closing or shutting down the server remotely.
View
5 perl/lib/LucyX/Remote/SearchServer.pm
@@ -115,7 +115,8 @@ sub serve {
}
# Process the method call.
- $dispatch{$method} or confess "ERROR: Bad method name: $method\n";
+ $dispatch{$method}
+ or confess "ERROR: Bad method name: $method\n";
my $response = $dispatch{$method}->( $self, $args );
my $frozen = nfreeze($response);
my $packed_len = pack( 'N', length($frozen) );
@@ -125,7 +126,7 @@ sub serve {
# Remote signal to close the server.
if ( $method eq 'terminate' ) {
my @all_handles = $read_set->handles;
- $read_set->remove(\@all_handles);
+ $read_set->remove( \@all_handles );
$client_sock->close;
$main_sock->close;
return;
View
8 perl/t/303-highlighter.t
@@ -253,9 +253,9 @@ $hl->_highlight_excerpt(
raw_excerpt => "$phi Oook. Urk. Ick. $phi",
spans => make_spans(
[ 2, 10, 1.0 ],
- [ 2, 4, 1.0 ],
- [ 8, 9, 1.0 ],
- [ 8, 4, 1.0 ],
+ [ 2, 4, 1.0 ],
+ [ 8, 9, 1.0 ],
+ [ 8, 4, 1.0 ],
),
top => 0,
highlighted => $target,
@@ -393,7 +393,7 @@ is_deeply(
);
$q = $searcher->glean_query("foo");
-my $compiler = $q->make_compiler(searcher => $searcher);
+my $compiler = $q->make_compiler( searcher => $searcher );
$hl = Lucy::Highlight::Highlighter->new(
searcher => $searcher,
query => $compiler,
View
2 perl/t/518-or_scorer.t
@@ -17,7 +17,7 @@ use strict;
use warnings;
use lib 'buildlib';
-use Test::More tests => 1617;
+use Test::More tests => 1617;
use Lucy::Test;
use LucyX::Search::MockMatcher;
use Lucy::Test::TestUtils qw( modulo_set doc_ids_from_td_coll );
View
2 perl/t/519-req_opt_matcher.t
@@ -25,7 +25,7 @@ use Lucy::Test::TestUtils qw( modulo_set doc_ids_from_td_coll );
my $sim = Lucy::Index::Similarity->new;
for my $req_interval ( 1 .. 10, 75 ) {
- for my $opt_interval ( 1 .. 10, 75, 1000 ) { # 1000 = no matches
+ for my $opt_interval ( 1 .. 10, 75, 1000 ) { # 1000 = no matches
check_matcher( $req_interval, $opt_interval );
check_matcher( $opt_interval, $req_interval );
}
View
12 perl/t/550-cluster_searcher.t
@@ -74,7 +74,7 @@ for my $port (@ports) {
number => $number,
port => $port,
);
- $indexer->add_doc(\%doc);
+ $indexer->add_doc( \%doc );
$number += 2;
}
$indexer->commit;
@@ -114,7 +114,8 @@ my $solo_cluster_searcher = LucyX::Remote::ClusterSearcher->new(
is( $solo_cluster_searcher->doc_freq( field => 'content', term => 'x' ),
3, "doc_freq" );
is( $solo_cluster_searcher->doc_max, 3, "doc_max" );
-isa_ok( $solo_cluster_searcher->fetch_doc(1), "Lucy::Document::HitDoc", "fetch_doc" );
+isa_ok( $solo_cluster_searcher->fetch_doc(1),
+ "Lucy::Document::HitDoc", "fetch_doc" );
isa_ok( $solo_cluster_searcher->fetch_doc_vec(1),
"Lucy::Index::DocVector", "fetch_doc_vec" );
@@ -183,11 +184,8 @@ my @reversed;
while ( my $hit = $hits->next ) {
push @reversed, $hit->{number};
}
-is_deeply(
- \@got,
- [ reverse @reversed ],
- "Sort hits accross multiple shards"
-);
+is_deeply( \@got, [ reverse @reversed ],
+ "Sort hits accross multiple shards" );
END {
$solo_cluster_searcher->close if defined $solo_cluster_searcher;
View
179 tcl/src/tcllucy.c
@@ -16,108 +16,111 @@
#include "tcllucy.h"
-void delete_termqueryCmd(ClientData clientData){
- // lucy_termquery *tq;
- // tq=(lucy_termquery *)clientData;
- // ckfree(tq);
+void delete_termqueryCmd(ClientData clientData) {
+ // lucy_termquery *tq;
+ // tq=(lucy_termquery *)clientData;
+ // ckfree(tq);
}
-int x_termqueryObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]){
- /* a generic termquery instance. */
+int x_termqueryObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
+ /* a generic termquery instance. */
- if(1==objc){
- Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?arg?");
- return TCL_ERROR;
- }
+ if (1 == objc) {
+ Tcl_WrongNumArgs(interp, 1, objv, "subcommand ?arg?");
+ return TCL_ERROR;
+ }
- int subcmd_idx, rc, field_len;
- char *field;
- Tcl_Obj *retObj;
- lucy_termquery *tq;
- tq=(lucy_termquery *)clientData;
+ int subcmd_idx, rc, field_len;
+ char *field;
+ Tcl_Obj *retObj;
+ lucy_termquery *tq;
+ tq = (lucy_termquery *)clientData;
- enum {
- TL_SETFIELD,
- TL_GETFIELD
- };
+ enum {
+ TL_SETFIELD,
+ TL_GETFIELD
+ };
- static const char *termquery_subcmd[]={
- "setfield",
- "getfield",
- NULL
- };
+ static const char *termquery_subcmd[] = {
+ "setfield",
+ "getfield",
+ NULL
+ };
- if(TCL_ERROR==Tcl_GetIndexFromObj(interp, objv[1], termquery_subcmd, "subcommand", 0, &subcmd_idx))
- return TCL_ERROR;
+ if (TCL_ERROR == Tcl_GetIndexFromObj(interp, objv[1], termquery_subcmd, "subcommand", 0, &subcmd_idx))
+ return TCL_ERROR;
- switch(subcmd_idx){
- case TL_SETFIELD:
- if(3!=objc){
- Tcl_WrongNumArgs(interp, 2, objv, "value");
- return TCL_ERROR;
- }else{
- if(tq->field)
- ckfree(tq->field);
- field=Tcl_GetStringFromObj(objv[2], &field_len);
- // lucy_load_field(tq, field, field_len); assuming copies input string...
- tq->field=ckalloc(sizeof(char)*(field_len+1));
- strcpy(tq->field, field);
- Tcl_SetObjResult(interp, Tcl_NewStringObj(field, field_len));
- rc=TCL_OK;
- }
- break;
- case TL_GETFIELD:
- if(2!=objc){
- Tcl_WrongNumArgs(interp, 2, objv, NULL);
- rc=TCL_ERROR;
- }else{
- // retObj=Tcl_NewStringObj(lucy_get_queryfield(tq), get_queryfield_len(tq));
- if(tq->field){
- retObj=Tcl_NewStringObj(tq->field, -1);
- Tcl_SetObjResult(interp, retObj);
- rc=TCL_OK;
- }else{
- retObj=Tcl_NewStringObj("field unset", 11);
- Tcl_SetObjResult(interp, retObj);
- rc=TCL_ERROR;
- }
+ switch (subcmd_idx) {
+ case TL_SETFIELD:
+ if (3 != objc) {
+ Tcl_WrongNumArgs(interp, 2, objv, "value");
+ return TCL_ERROR;
+ }
+ else {
+ if (tq->field)
+ ckfree(tq->field);
+ field = Tcl_GetStringFromObj(objv[2], &field_len);
+ // lucy_load_field(tq, field, field_len); assuming copies input string...
+ tq->field = ckalloc(sizeof(char) * (field_len + 1));
+ strcpy(tq->field, field);
+ Tcl_SetObjResult(interp, Tcl_NewStringObj(field, field_len));
+ rc = TCL_OK;
+ }
+ break;
+ case TL_GETFIELD:
+ if (2 != objc) {
+ Tcl_WrongNumArgs(interp, 2, objv, NULL);
+ rc = TCL_ERROR;
+ }
+ else {
+ // retObj=Tcl_NewStringObj(lucy_get_queryfield(tq), get_queryfield_len(tq));
+ if (tq->field) {
+ retObj = Tcl_NewStringObj(tq->field, -1);
+ Tcl_SetObjResult(interp, retObj);
+ rc = TCL_OK;
+ }
+ else {
+ retObj = Tcl_NewStringObj("field unset", 11);
+ Tcl_SetObjResult(interp, retObj);
+ rc = TCL_ERROR;
+ }
+ }
+ break;
+ default:
+ assert("subcmd not accounted-for in switch()" && 0);
}
- break;
- default:
- assert("subcmd not accounted-for in switch()" && 0);
- }
- return rc;
+ return rc;
}
-int new_termqueryObjCmd(ClientData *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]){
- /* create cmd, instantiate state */
- /* usage: termquery name */
- if(2!=objc){
- Tcl_WrongNumArgs(interp, 1, objv, "name");
- return TCL_ERROR;
- }
+int new_termqueryObjCmd(ClientData *clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) {
+ /* create cmd, instantiate state */
+ /* usage: termquery name */
+ if (2 != objc) {
+ Tcl_WrongNumArgs(interp, 1, objv, "name");
+ return TCL_ERROR;
+ }
- lucy_termquery *tq;
- tq=ckalloc(sizeof(lucy_termquery));
- tq->field=NULL; /* not yet set... */
+ lucy_termquery *tq;
+ tq = ckalloc(sizeof(lucy_termquery));
+ tq->field = NULL; /* not yet set... */
- /* should check if clobbering existing cmd, but we're not */
- Tcl_CreateObjCommand(interp, Tcl_GetString(objv[1]), x_termqueryObjCmd, (ClientData *)tq, delete_termqueryCmd);
- Tcl_SetObjResult(interp, Tcl_DuplicateObj(objv[1])); /* return newly created cmdname as result */
- return TCL_OK;
+ /* should check if clobbering existing cmd, but we're not */
+ Tcl_CreateObjCommand(interp, Tcl_GetString(objv[1]), x_termqueryObjCmd, (ClientData *)tq, delete_termqueryCmd);
+ Tcl_SetObjResult(interp, Tcl_DuplicateObj(objv[1])); /* return newly created cmdname as result */
+ return TCL_OK;
}
-int Tcllucy_Init(Tcl_Interp *interp){
- if (NULL == Tcl_InitStubs(interp, "8.4",0)){
- Tcl_SetObjResult(interp, Tcl_NewStringObj("Error in \"Tcl_InitStubs\"", 24));
- return TCL_ERROR;
- }
-
- Tcl_Namespace *namespace;
- namespace = Tcl_CreateNamespace(interp, "lucy", NULL, NULL);
- Tcl_CreateObjCommand (interp, "lucy::termquery", (Tcl_ObjCmdProc *)new_termqueryObjCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
- Tcl_Export(interp, namespace, "*", 0);
- Tcl_PkgProvide(interp, "lucy", "0.0.1");
- return TCL_OK;
+int Tcllucy_Init(Tcl_Interp *interp) {
+ if (NULL == Tcl_InitStubs(interp, "8.4", 0)) {
+ Tcl_SetObjResult(interp, Tcl_NewStringObj("Error in \"Tcl_InitStubs\"", 24));
+ return TCL_ERROR;
+ }
+
+ Tcl_Namespace *namespace;
+ namespace = Tcl_CreateNamespace(interp, "lucy", NULL, NULL);
+ Tcl_CreateObjCommand(interp, "lucy::termquery", (Tcl_ObjCmdProc *)new_termqueryObjCmd, (ClientData)NULL, (Tcl_CmdDeleteProc *)NULL);
+ Tcl_Export(interp, namespace, "*", 0);
+ Tcl_PkgProvide(interp, "lucy", "0.0.1");
+ return TCL_OK;
}
View
4 tcl/src/tcllucy.h
@@ -20,5 +20,5 @@
#include <string.h>
typedef struct {
- char *field;
-}lucy_termquery;
+ char *field;
+} lucy_termquery;

0 comments on commit e21d2bc

Please sign in to comment.