You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2013/09/01 22:16:52 UTC
[lucy-commits] [04/24] Rename CharBuf to String (cnick Str)
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/buildlib/Lucy/Build/Binding/Index.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Index.pm b/perl/buildlib/Lucy/Build/Binding/Index.pm
index 5825d4a..ac31d09 100644
--- a/perl/buildlib/Lucy/Build/Binding/Index.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Index.pm
@@ -303,8 +303,8 @@ set_race_condition_debug1(val_sv)
SV *val_sv;
PPCODE:
CFISH_DECREF(lucy_PolyReader_race_condition_debug1);
- lucy_PolyReader_race_condition_debug1 = (cfish_CharBuf*)
- XSBind_maybe_sv_to_cfish_obj(val_sv, CFISH_CHARBUF, NULL);
+ lucy_PolyReader_race_condition_debug1 = (cfish_String*)
+ XSBind_maybe_sv_to_cfish_obj(val_sv, CFISH_STRING, NULL);
if (lucy_PolyReader_race_condition_debug1) {
(void)CFISH_INCREF(lucy_PolyReader_race_condition_debug1);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/buildlib/Lucy/Build/Binding/Misc.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Misc.pm b/perl/buildlib/Lucy/Build/Binding/Misc.pm
index fec0a9a..287ef18 100644
--- a/perl/buildlib/Lucy/Build/Binding/Misc.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Misc.pm
@@ -143,7 +143,7 @@ PPCODE:
cfish_StackString *klass
= CFISH_SStr_WRAP_STR(class_name, strlen(class_name));
cfish_VTable *vtable
- = (cfish_VTable*)cfish_VTable_singleton((cfish_CharBuf*)klass, NULL);
+ = (cfish_VTable*)cfish_VTable_singleton((cfish_String*)klass, NULL);
STRLEN len;
char *ptr = SvPV(serialized_sv, len);
cfish_ViewByteBuf *contents = cfish_ViewBB_new(ptr, len);
@@ -184,7 +184,7 @@ bool
run_tests(package)
char *package;
CODE:
- cfish_CharBuf *class_name = cfish_CB_newf("%s", package);
+ cfish_String *class_name = cfish_Str_newf("%s", package);
cfish_TestFormatter *formatter
= (cfish_TestFormatter*)cfish_TestFormatterTAP_new();
cfish_TestSuite *suite = testlucy_Test_create_test_suite();
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/buildlib/Lucy/Build/Binding/Search.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Search.pm b/perl/buildlib/Lucy/Build/Binding/Search.pm
index fcc4518..9372f8b 100644
--- a/perl/buildlib/Lucy/Build/Binding/Search.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Search.pm
@@ -464,11 +464,11 @@ CODE:
}
else if (strcmp(type_str, "FIELD") == 0) {
type = LUCY_QPARSER_TOKEN_FIELD;
- value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), CFISH_CHARBUF);
+ value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), CFISH_STRING);
}
else if (strcmp(type_str, "STRING") == 0) {
type = LUCY_QPARSER_TOKEN_STRING;
- value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), CFISH_CHARBUF);
+ value = CFISH_CERTIFY(XSBind_perl_to_cfish(value_sv), CFISH_STRING);
}
else if (strcmp(type_str, "QUERY") == 0) {
type = LUCY_QPARSER_TOKEN_QUERY;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/buildlib/Lucy/Build/Binding/Util.pm
----------------------------------------------------------------------
diff --git a/perl/buildlib/Lucy/Build/Binding/Util.pm b/perl/buildlib/Lucy/Build/Binding/Util.pm
index 6d6ee2d..e525dda 100644
--- a/perl/buildlib/Lucy/Build/Binding/Util.pm
+++ b/perl/buildlib/Lucy/Build/Binding/Util.pm
@@ -203,7 +203,7 @@ MODULE = Lucy PACKAGE = Lucy::Util::IndexFileNames
uint64_t
extract_gen(name)
- const cfish_CharBuf *name;
+ const cfish_String *name;
CODE:
RETVAL = lucy_IxFileNames_extract_gen(name);
OUTPUT: RETVAL
@@ -213,7 +213,7 @@ latest_snapshot(folder)
lucy_Folder *folder;
CODE:
{
- cfish_CharBuf *latest = lucy_IxFileNames_latest_snapshot(folder);
+ cfish_String *latest = lucy_IxFileNames_latest_snapshot(folder);
RETVAL = XSBind_cb_to_sv(latest);
CFISH_DECREF(latest);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/t/021-vtable.t
----------------------------------------------------------------------
diff --git a/perl/t/021-vtable.t b/perl/t/021-vtable.t
index 723e7d0..5141e7f 100644
--- a/perl/t/021-vtable.t
+++ b/perl/t/021-vtable.t
@@ -81,7 +81,7 @@ isa_ok( $resurrected, "MyHash", "subclass name survived Perl destruction" );
is( $resurrected->to_string, $stringified,
"It's the same Hash from earlier (though a different Perl object)" );
-my $booga = Clownfish::CharBuf->new("booga");
+my $booga = Clownfish::String->new("booga");
$resurrected->store( "ooga", $booga );
is( $resurrected->fetch("ooga"),
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/t/109-read_locking.t
----------------------------------------------------------------------
diff --git a/perl/t/109-read_locking.t b/perl/t/109-read_locking.t
index f5567f5..6a39813 100644
--- a/perl/t/109-read_locking.t
+++ b/perl/t/109-read_locking.t
@@ -99,7 +99,7 @@ Test_race_condition_1: {
to => 'seg_1.hidden',
);
Lucy::Index::IndexReader::set_race_condition_debug1(
- Clownfish::CharBuf->new($latest_snapshot_file) );
+ Clownfish::String->new($latest_snapshot_file) );
$reader = Lucy::Index::IndexReader->open(
index => $folder,
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/t/505-hit_queue.t
----------------------------------------------------------------------
diff --git a/perl/t/505-hit_queue.t b/perl/t/505-hit_queue.t
index d2124f5..ed4d7a9 100644
--- a/perl/t/505-hit_queue.t
+++ b/perl/t/505-hit_queue.t
@@ -170,7 +170,7 @@ $hit_q = Lucy::Search::HitQueue->new(
for my $doc_id ( shuffle( 1 .. 100 ) ) {
my $fields = $docs[ $doc_id - 1 ];
my $values = Clownfish::VArray->new( capacity => 1 );
- $values->push( Clownfish::CharBuf->new( $fields->{number} ) );
+ $values->push( Clownfish::String->new( $fields->{number} ) );
my $match_doc = Lucy::Search::MatchDoc->new(
doc_id => $doc_id,
score => $doc_id,
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/t/520-match_doc.t
----------------------------------------------------------------------
diff --git a/perl/t/520-match_doc.t b/perl/t/520-match_doc.t
index 419969f..0a864a5 100644
--- a/perl/t/520-match_doc.t
+++ b/perl/t/520-match_doc.t
@@ -37,8 +37,8 @@ is( $match_doc_copy->get_values, $match_doc->get_values,
"empty values still empty after serialization" );
my $values = Clownfish::VArray->new( capacity => 4 );
-$values->store( 0, Clownfish::CharBuf->new("foo") );
-$values->store( 3, Clownfish::CharBuf->new("bar") );
+$values->store( 0, Clownfish::String->new("foo") );
+$values->store( 3, Clownfish::String->new("bar") );
$match_doc = Lucy::Search::MatchDoc->new(
doc_id => 120,
score => 35,
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/t/binding/016-varray.t
----------------------------------------------------------------------
diff --git a/perl/t/binding/016-varray.t b/perl/t/binding/016-varray.t
index a6b3534..2370203 100644
--- a/perl/t/binding/016-varray.t
+++ b/perl/t/binding/016-varray.t
@@ -22,7 +22,7 @@ use Lucy::Test;
my ( $varray, $twin );
$varray = Clownfish::VArray->new;
-$varray->push( Clownfish::CharBuf->new($_) ) for 1 .. 5;
+$varray->push( Clownfish::String->new($_) ) for 1 .. 5;
$varray->delete(3);
$twin = $varray->_clone;
is_deeply( $twin->to_perl, $varray->to_perl, "clone" );
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/t/binding/017-hash.t
----------------------------------------------------------------------
diff --git a/perl/t/binding/017-hash.t b/perl/t/binding/017-hash.t
index 4fde848..5c02406 100644
--- a/perl/t/binding/017-hash.t
+++ b/perl/t/binding/017-hash.t
@@ -21,8 +21,8 @@ use Lucy::Test;
use Clownfish qw( to_perl to_clownfish );
my $hash = Clownfish::Hash->new( capacity => 10 );
-$hash->store( "foo", Clownfish::CharBuf->new("bar") );
-$hash->store( "baz", Clownfish::CharBuf->new("banana") );
+$hash->store( "foo", Clownfish::String->new("bar") );
+$hash->store( "baz", Clownfish::String->new("banana") );
ok( !defined( $hash->fetch("blah") ),
"fetch for a non-existent key returns undef" );
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/t/binding/029-charbuf.t
----------------------------------------------------------------------
diff --git a/perl/t/binding/029-charbuf.t b/perl/t/binding/029-charbuf.t
index 372fcc5..8b1d073 100644
--- a/perl/t/binding/029-charbuf.t
+++ b/perl/t/binding/029-charbuf.t
@@ -22,11 +22,11 @@ use Lucy::Test::TestUtils qw( utf8_test_strings );
my ( $smiley, $not_a_smiley, $frowny ) = utf8_test_strings();
-my $charbuf = Clownfish::CharBuf->new($smiley);
-isa_ok( $charbuf, "Clownfish::CharBuf" );
+my $charbuf = Clownfish::String->new($smiley);
+isa_ok( $charbuf, "Clownfish::String" );
is( $charbuf->to_perl, $smiley, "round trip UTF-8" );
-$charbuf = Clownfish::CharBuf->new($smiley);
+$charbuf = Clownfish::String->new($smiley);
my $clone = $charbuf->clone;
-is( $clone->to_perl, Clownfish::CharBuf->new($smiley)->to_perl, "clone" );
+is( $clone->to_perl, Clownfish::String->new($smiley)->to_perl, "clone" );
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/t/binding/038-lock_free_registry.t
----------------------------------------------------------------------
diff --git a/perl/t/binding/038-lock_free_registry.t b/perl/t/binding/038-lock_free_registry.t
index c4df365..7575175 100644
--- a/perl/t/binding/038-lock_free_registry.t
+++ b/perl/t/binding/038-lock_free_registry.t
@@ -50,7 +50,7 @@ sub register_many {
my $succeeded = 0;
for my $number (@$nums) {
- my $obj = Clownfish::CharBuf->new($number);
+ my $obj = Clownfish::String->new($number);
$succeeded += $registry->register( key => $obj, value => $obj );
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/xs/Lucy/Analysis/RegexTokenizer.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Analysis/RegexTokenizer.c b/perl/xs/Lucy/Analysis/RegexTokenizer.c
index 154f30c..56fd3be 100644
--- a/perl/xs/Lucy/Analysis/RegexTokenizer.c
+++ b/perl/xs/Lucy/Analysis/RegexTokenizer.c
@@ -25,7 +25,7 @@
#include "Clownfish/Util/StringHelper.h"
static SV*
-S_compile_token_re(const cfish_CharBuf *pattern);
+S_compile_token_re(const cfish_String *pattern);
static void
S_set_token_re_but_not_pattern(lucy_RegexTokenizer *self, void *token_re);
@@ -40,21 +40,21 @@ lucy_RegexTokenizer_is_available(void) {
lucy_RegexTokenizer*
lucy_RegexTokenizer_init(lucy_RegexTokenizer *self,
- const cfish_CharBuf *pattern) {
+ const cfish_String *pattern) {
lucy_Analyzer_init((lucy_Analyzer*)self);
lucy_RegexTokenizerIVARS *const ivars = lucy_RegexTokenizer_IVARS(self);
#define DEFAULT_PATTERN "\\w+(?:['\\x{2019}]\\w+)*"
if (pattern) {
- if (CFISH_CB_Find_Str(pattern, "\\p", 2) != -1
- || CFISH_CB_Find_Str(pattern, "\\P", 2) != -1
+ if (CFISH_Str_Find_Str(pattern, "\\p", 2) != -1
+ || CFISH_Str_Find_Str(pattern, "\\P", 2) != -1
) {
CFISH_DECREF(self);
THROW(CFISH_ERR, "\\p and \\P constructs forbidden");
}
- ivars->pattern = CFISH_CB_Clone(pattern);
+ ivars->pattern = CFISH_Str_Clone(pattern);
}
else {
- ivars->pattern = cfish_CB_new_from_trusted_utf8(
+ ivars->pattern = cfish_Str_new_from_trusted_utf8(
DEFAULT_PATTERN, sizeof(DEFAULT_PATTERN) - 1);
}
@@ -67,7 +67,7 @@ lucy_RegexTokenizer_init(lucy_RegexTokenizer *self,
}
static SV*
-S_compile_token_re(const cfish_CharBuf *pattern) {
+S_compile_token_re(const cfish_String *pattern) {
dSP;
ENTER;
SAVETMPS;
@@ -116,7 +116,7 @@ S_set_pattern_from_token_re(lucy_RegexTokenizer *self, void *token_re) {
STRLEN len = 0;
char *ptr = SvPVutf8((SV*)rv, len);
CFISH_DECREF(ivars->pattern);
- ivars->pattern = cfish_CB_new_from_trusted_utf8(ptr, len);
+ ivars->pattern = cfish_Str_new_from_trusted_utf8(ptr, len);
SvREFCNT_dec(rv);
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/xs/Lucy/Document/Doc.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Document/Doc.c b/perl/xs/Lucy/Document/Doc.c
index f262884..4dedc88 100644
--- a/perl/xs/Lucy/Document/Doc.c
+++ b/perl/xs/Lucy/Document/Doc.c
@@ -52,15 +52,15 @@ LUCY_Doc_Get_Size_IMP(lucy_Doc *self) {
}
void
-LUCY_Doc_Store_IMP(lucy_Doc *self, const cfish_CharBuf *field, cfish_Obj *value) {
+LUCY_Doc_Store_IMP(lucy_Doc *self, const cfish_String *field, cfish_Obj *value) {
lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self);
- char *key = (char*)CFISH_CB_Get_Ptr8(field);
- size_t key_size = CFISH_CB_Get_Size(field);
+ char *key = (char*)CFISH_Str_Get_Ptr8(field);
+ size_t key_size = CFISH_Str_Get_Size(field);
SV *key_sv = newSVpvn(key, key_size);
SV *val_sv = value == NULL
? newSV(0)
- : CFISH_Obj_Is_A(value, CFISH_CHARBUF)
- ? XSBind_cb_to_sv((cfish_CharBuf*)value)
+ : CFISH_Obj_Is_A(value, CFISH_STRING)
+ ? XSBind_cb_to_sv((cfish_String*)value)
: (SV*)CFISH_Obj_To_Host(value);
SvUTF8_on(key_sv);
(void)hv_store_ent((HV*)ivars->fields, key_sv, val_sv, 0);
@@ -143,12 +143,12 @@ LUCY_Doc_Deserialize_IMP(lucy_Doc *self, lucy_InStream *instream) {
}
cfish_Obj*
-LUCY_Doc_Extract_IMP(lucy_Doc *self, cfish_CharBuf *field,
+LUCY_Doc_Extract_IMP(lucy_Doc *self, cfish_String *field,
cfish_ViewCharBuf *target) {
lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self);
cfish_Obj *retval = NULL;
- SV **sv_ptr = hv_fetch((HV*)ivars->fields, (char*)CFISH_CB_Get_Ptr8(field),
- CFISH_CB_Get_Size(field), 0);
+ SV **sv_ptr = hv_fetch((HV*)ivars->fields, (char*)CFISH_Str_Get_Ptr8(field),
+ CFISH_Str_Get_Size(field), 0);
if (sv_ptr && XSBind_sv_defined(*sv_ptr)) {
SV *const sv = *sv_ptr;
@@ -181,9 +181,9 @@ LUCY_Doc_Dump_IMP(lucy_Doc *self) {
lucy_DocIVARS *const ivars = lucy_Doc_IVARS(self);
cfish_Hash *dump = cfish_Hash_new(0);
CFISH_Hash_Store_Str(dump, "_class", 6,
- (cfish_Obj*)CFISH_CB_Clone(LUCY_Doc_Get_Class_Name(self)));
+ (cfish_Obj*)CFISH_Str_Clone(LUCY_Doc_Get_Class_Name(self)));
CFISH_Hash_Store_Str(dump, "doc_id", 7,
- (cfish_Obj*)cfish_CB_newf("%i32", ivars->doc_id));
+ (cfish_Obj*)cfish_Str_newf("%i32", ivars->doc_id));
CFISH_Hash_Store_Str(dump, "fields", 6,
XSBind_perl_to_cfish((SV*)ivars->fields));
return dump;
@@ -192,9 +192,9 @@ LUCY_Doc_Dump_IMP(lucy_Doc *self) {
lucy_Doc*
LUCY_Doc_Load_IMP(lucy_Doc *self, cfish_Obj *dump) {
cfish_Hash *source = (cfish_Hash*)CFISH_CERTIFY(dump, CFISH_HASH);
- cfish_CharBuf *class_name = (cfish_CharBuf*)CFISH_CERTIFY(
+ cfish_String *class_name = (cfish_String*)CFISH_CERTIFY(
CFISH_Hash_Fetch_Str(source, "_class", 6),
- CFISH_CHARBUF);
+ CFISH_STRING);
cfish_VTable *vtable = cfish_VTable_singleton(class_name, NULL);
lucy_Doc *loaded = (lucy_Doc*)CFISH_VTable_Make_Obj(vtable);
cfish_Obj *doc_id = CFISH_CERTIFY(
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/xs/Lucy/Index/DocReader.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/DocReader.c b/perl/xs/Lucy/Index/DocReader.c
index e191d23..97f8649 100644
--- a/perl/xs/Lucy/Index/DocReader.c
+++ b/perl/xs/Lucy/Index/DocReader.c
@@ -64,7 +64,7 @@ LUCY_DefDocReader_Fetch_Doc_IMP(lucy_DefaultDocReader *self, int32_t doc_id) {
cfish_StackString *field_name_zcb
= CFISH_SStr_WRAP_STR(field_name_ptr, field_name_len);
CFISH_SStr_Assign_Str(field_name_zcb, field_name_ptr, field_name_len);
- type = LUCY_Schema_Fetch_Type(schema, (cfish_CharBuf*)field_name_zcb);
+ type = LUCY_Schema_Fetch_Type(schema, (cfish_String*)field_name_zcb);
// Read the field value.
switch (LUCY_FType_Primitive_ID(type) & lucy_FType_PRIMITIVE_ID_MASK) {
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/perl/xs/Lucy/Index/Inverter.c
----------------------------------------------------------------------
diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c
index 3c824d5..093c1d4 100644
--- a/perl/xs/Lucy/Index/Inverter.c
+++ b/perl/xs/Lucy/Index/Inverter.c
@@ -52,14 +52,14 @@ S_fetch_entry(lucy_Inverter *self, HE *hash_entry) {
cfish_StackString *field = CFISH_SStr_WRAP_STR(key, key_len);
int32_t field_num
- = LUCY_Seg_Field_Num(ivars->segment, (cfish_CharBuf*)field);
+ = LUCY_Seg_Field_Num(ivars->segment, (cfish_String*)field);
if (!field_num) {
// This field seems not to be in the segment yet. Try to find it in
// the Schema.
- if (LUCY_Schema_Fetch_Type(schema, (cfish_CharBuf*)field)) {
+ if (LUCY_Schema_Fetch_Type(schema, (cfish_String*)field)) {
// The field is in the Schema. Get a field num from the Segment.
field_num = LUCY_Seg_Add_Field(ivars->segment,
- (cfish_CharBuf*)field);
+ (cfish_String*)field);
}
else {
// We've truly failed to find the field. The user must
@@ -71,7 +71,7 @@ S_fetch_entry(lucy_Inverter *self, HE *hash_entry) {
lucy_InverterEntry *entry
= (lucy_InverterEntry*)CFISH_VA_Fetch(ivars->entry_pool, field_num);
if (!entry) {
- entry = lucy_InvEntry_new(schema, (cfish_CharBuf*)field, field_num);
+ entry = lucy_InvEntry_new(schema, (cfish_String*)field, field_num);
CFISH_VA_Store(ivars->entry_pool, field_num, (cfish_Obj*)entry);
}
return entry;
http://git-wip-us.apache.org/repos/asf/lucy/blob/2c3dbf15/ruby/src/CFBind.h
----------------------------------------------------------------------
diff --git a/ruby/src/CFBind.h b/ruby/src/CFBind.h
index f8443cd..b4c142b 100644
--- a/ruby/src/CFBind.h
+++ b/ruby/src/CFBind.h
@@ -27,7 +27,7 @@ extern "C" {
#include "charmony.h"
#include "Clownfish/Obj.h"
#include "Clownfish/ByteBuf.h"
-#include "Clownfish/CharBuf.h"
+#include "Clownfish/String.h"
#include "Clownfish/Err.h"
#include "Clownfish/Hash.h"
#include "Clownfish/Num.h"