Repository: lucy Updated Branches: refs/heads/master 20dbfa386 -> a1d2e1c6d
Adjust for Float/Integer renaming Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/1d2632f1 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/1d2632f1 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/1d2632f1 Branch: refs/heads/master Commit: 1d2632f175e8b910238104efed6a618f80cdd9f2 Parents: 24df913 Author: Nick Wellnhofer <wellnho...@aevum.de> Authored: Thu Jul 9 16:30:05 2015 +0200 Committer: Nick Wellnhofer <wellnho...@aevum.de> Committed: Thu Jul 9 16:38:43 2015 +0200 ---------------------------------------------------------------------- c/src/Lucy/Index/DocReader.c | 10 +++--- c/src/Lucy/Index/Inverter.c | 8 ++--- core/Lucy/Index/DeletionsWriter.c | 11 +++---- core/Lucy/Index/DocWriter.c | 8 ++--- core/Lucy/Index/Inverter.c | 4 +-- core/Lucy/Index/Segment.c | 10 +++--- core/Lucy/Index/SortCache/NumericSortCache.c | 8 ++--- core/Lucy/Index/SortFieldWriter.c | 10 +++--- core/Lucy/Test/Search/TestSortSpec.c | 14 ++++---- core/Lucy/Test/Util/TestFreezer.c | 18 +++++----- core/Lucy/Test/Util/TestJson.c | 16 ++++----- core/Lucy/Test/Util/TestPriorityQueue.c | 38 ++++++++++----------- core/Lucy/Util/Freezer.c | 20 ++++++------ core/Lucy/Util/Json.c | 40 +++++++++++------------ perl/xs/Lucy/Index/Inverter.c | 12 +++---- 15 files changed, 112 insertions(+), 115 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/c/src/Lucy/Index/DocReader.c ---------------------------------------------------------------------- diff --git a/c/src/Lucy/Index/DocReader.c b/c/src/Lucy/Index/DocReader.c index b775613..1e7767b 100644 --- a/c/src/Lucy/Index/DocReader.c +++ b/c/src/Lucy/Index/DocReader.c @@ -86,18 +86,16 @@ DefDocReader_Fetch_Doc_IMP(DefaultDocReader *self, int32_t doc_id) { break; } case FType_FLOAT32: - value = (Obj*)Float64_new(InStream_Read_F32(dat_in)); + value = (Obj*)Float_new(InStream_Read_F32(dat_in)); break; case FType_FLOAT64: - value = (Obj*)Float64_new(InStream_Read_F64(dat_in)); + value = (Obj*)Float_new(InStream_Read_F64(dat_in)); break; case FType_INT32: - value = (Obj*)Int64_new( - (int32_t)InStream_Read_C32(dat_in)); + value = (Obj*)Int_new((int32_t)InStream_Read_C32(dat_in)); break; case FType_INT64: - value = (Obj*)Int64_new( - (int64_t)InStream_Read_C64(dat_in)); + value = (Obj*)Int_new((int64_t)InStream_Read_C64(dat_in)); break; default: value = NULL; http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/c/src/Lucy/Index/Inverter.c ---------------------------------------------------------------------- diff --git a/c/src/Lucy/Index/Inverter.c b/c/src/Lucy/Index/Inverter.c index 15761f0..9f18761 100644 --- a/c/src/Lucy/Index/Inverter.c +++ b/c/src/Lucy/Index/Inverter.c @@ -93,14 +93,14 @@ Inverter_Invert_Doc_IMP(Inverter *self, Doc *doc) { } case FType_INT32: case FType_INT64: { - Integer64* value = (Integer64*)inventry_ivars->value; - Int64_Mimic(value, obj); + Integer* value = (Integer*)inventry_ivars->value; + Int_Mimic(value, obj); break; } case FType_FLOAT32: case FType_FLOAT64: { - Float64* value = (Float64*)inventry_ivars->value; - Float64_Mimic(value, obj); + Float* value = (Float*)inventry_ivars->value; + Float_Mimic(value, obj); break; } default: http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Index/DeletionsWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/DeletionsWriter.c b/core/Lucy/Index/DeletionsWriter.c index c7c75ee..aa020ad 100644 --- a/core/Lucy/Index/DeletionsWriter.c +++ b/core/Lucy/Index/DeletionsWriter.c @@ -114,7 +114,7 @@ DefDelWriter_init(DefaultDeletionsWriter *self, Schema *schema, Vec_Store(ivars->bit_vecs, i, (Obj*)bit_vec); Hash_Store(ivars->name_to_tick, SegReader_Get_Seg_Name(seg_reader), - (Obj*)Int64_new(i)); + (Obj*)Int_new(i)); } return self; @@ -214,9 +214,9 @@ DefDelWriter_Seg_Deletions_IMP(DefaultDeletionsWriter *self, Matcher *deletions = NULL; Segment *segment = SegReader_Get_Segment(seg_reader); String *seg_name = Seg_Get_Name(segment); - Integer64 *tick_obj = (Integer64*)Hash_Fetch(ivars->name_to_tick, + Integer *tick_obj = (Integer*)Hash_Fetch(ivars->name_to_tick, seg_name); - int32_t tick = tick_obj ? (int32_t)Int64_Get_Value(tick_obj) : 0; + int32_t tick = tick_obj ? (int32_t)Int_Get_Value(tick_obj) : 0; SegReader *candidate = tick_obj ? (SegReader*)Vec_Fetch(ivars->seg_readers, tick) : NULL; @@ -241,10 +241,9 @@ int32_t DefDelWriter_Seg_Del_Count_IMP(DefaultDeletionsWriter *self, String *seg_name) { DefaultDeletionsWriterIVARS *const ivars = DefDelWriter_IVARS(self); - Integer64 *tick - = (Integer64*)Hash_Fetch(ivars->name_to_tick, seg_name); + Integer *tick = (Integer*)Hash_Fetch(ivars->name_to_tick, seg_name); BitVector *deldocs = tick - ? (BitVector*)Vec_Fetch(ivars->bit_vecs, Int64_Get_Value(tick)) + ? (BitVector*)Vec_Fetch(ivars->bit_vecs, Int_Get_Value(tick)) : NULL; return deldocs ? BitVec_Count(deldocs) : 0; } http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Index/DocWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/DocWriter.c b/core/Lucy/Index/DocWriter.c index f9272a7..49bbf6d 100644 --- a/core/Lucy/Index/DocWriter.c +++ b/core/Lucy/Index/DocWriter.c @@ -130,22 +130,22 @@ DocWriter_Add_Inverted_Doc_IMP(DocWriter *self, Inverter *inverter, break; } case FType_INT32: { - int32_t val = (int32_t)Int64_Get_Value((Integer64*)value); + int32_t val = (int32_t)Int_Get_Value((Integer*)value); OutStream_Write_C32(dat_out, val); break; } case FType_INT64: { - int64_t val = Int64_Get_Value((Integer64*)value); + int64_t val = Int_Get_Value((Integer*)value); OutStream_Write_C64(dat_out, val); break; } case FType_FLOAT32: { - float val = (float)Float64_Get_Value((Float64*)value); + float val = (float)Float_Get_Value((Float*)value); OutStream_Write_F32(dat_out, val); break; } case FType_FLOAT64: { - double val = Float64_Get_Value((Float64*)value); + double val = Float_Get_Value((Float*)value); OutStream_Write_F64(dat_out, val); break; } http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Index/Inverter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Inverter.c b/core/Lucy/Index/Inverter.c index ec963a5..92f43ac 100644 --- a/core/Lucy/Index/Inverter.c +++ b/core/Lucy/Index/Inverter.c @@ -222,11 +222,11 @@ InvEntry_init(InverterEntry *self, Schema *schema, String *field, break; case FType_INT32: case FType_INT64: - ivars->value = (Obj*)Int64_new(0); + ivars->value = (Obj*)Int_new(0); break; case FType_FLOAT32: case FType_FLOAT64: - ivars->value = (Obj*)Float64_new(0); + ivars->value = (Obj*)Float_new(0); break; default: THROW(ERR, "Unrecognized primitive id: %i8", prim_id); http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Index/Segment.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/Segment.c b/core/Lucy/Index/Segment.c index 9ef0672..f016512 100644 --- a/core/Lucy/Index/Segment.c +++ b/core/Lucy/Index/Segment.c @@ -160,13 +160,13 @@ Seg_Write_File_IMP(Segment *self, Folder *folder) { int32_t Seg_Add_Field_IMP(Segment *self, String *field) { SegmentIVARS *const ivars = Seg_IVARS(self); - Integer64 *num = (Integer64*)Hash_Fetch(ivars->by_name, field); + Integer *num = (Integer*)Hash_Fetch(ivars->by_name, field); if (num) { - return (int32_t)Int64_Get_Value(num); + return (int32_t)Int_Get_Value(num); } else { int32_t field_num = Vec_Get_Size(ivars->by_num); - Hash_Store(ivars->by_name, field, (Obj*)Int64_new(field_num)); + Hash_Store(ivars->by_name, field, (Obj*)Int_new(field_num)); Vec_Push(ivars->by_num, (Obj*)Str_Clone(field)); return field_num; } @@ -257,8 +257,8 @@ Seg_Field_Num_IMP(Segment *self, String *field) { } else { SegmentIVARS *const ivars = Seg_IVARS(self); - Integer64 *num = (Integer64*)Hash_Fetch(ivars->by_name, field); - return num ? (int32_t)Int64_Get_Value(num) : 0; + Integer *num = (Integer*)Hash_Fetch(ivars->by_name, field); + return num ? (int32_t)Int_Get_Value(num) : 0; } } http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Index/SortCache/NumericSortCache.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortCache/NumericSortCache.c b/core/Lucy/Index/SortCache/NumericSortCache.c index 4389996..3355978 100644 --- a/core/Lucy/Index/SortCache/NumericSortCache.c +++ b/core/Lucy/Index/SortCache/NumericSortCache.c @@ -113,7 +113,7 @@ F64SortCache_Value_IMP(Float64SortCache *self, int32_t ord) { } else { InStream_Seek(ivars->dat_in, ord * sizeof(double)); - return (Obj*)Float64_new(InStream_Read_F64(ivars->dat_in)); + return (Obj*)Float_new(InStream_Read_F64(ivars->dat_in)); } } @@ -151,7 +151,7 @@ F32SortCache_Value_IMP(Float32SortCache *self, int32_t ord) { } else { InStream_Seek(ivars->dat_in, ord * sizeof(float)); - return (Obj*)Float64_new(InStream_Read_F32(ivars->dat_in)); + return (Obj*)Float_new(InStream_Read_F32(ivars->dat_in)); } } @@ -189,7 +189,7 @@ I32SortCache_Value_IMP(Int32SortCache *self, int32_t ord) { } else { InStream_Seek(ivars->dat_in, ord * sizeof(int32_t)); - return (Obj*)Int64_new(InStream_Read_I32(ivars->dat_in)); + return (Obj*)Int_new(InStream_Read_I32(ivars->dat_in)); } } @@ -227,7 +227,7 @@ I64SortCache_Value_IMP(Int64SortCache *self, int32_t ord) { } else { InStream_Seek(ivars->dat_in, ord * sizeof(int64_t)); - return (Obj*)Int64_new(InStream_Read_I64(ivars->dat_in)); + return (Obj*)Int_new(InStream_Read_I64(ivars->dat_in)); } } http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Index/SortFieldWriter.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Index/SortFieldWriter.c b/core/Lucy/Index/SortFieldWriter.c index 010741d..bb05aa0 100644 --- a/core/Lucy/Index/SortFieldWriter.c +++ b/core/Lucy/Index/SortFieldWriter.c @@ -132,7 +132,7 @@ SortFieldWriter_init(SortFieldWriter *self, Schema *schema, ivars->var_width = true; } else { - ivars->mem_per_entry += Class_Get_Obj_Alloc_Size(FLOAT64); + ivars->mem_per_entry += Class_Get_Obj_Alloc_Size(FLOAT); ivars->var_width = false; } @@ -276,22 +276,22 @@ S_write_val(Obj *val, int8_t prim_id, OutStream *ix_out, OutStream *dat_out, break; } case FType_INT32: { - int32_t i32 = (int32_t)Int64_Get_Value((Integer64*)val); + int32_t i32 = (int32_t)Int_Get_Value((Integer*)val); OutStream_Write_I32(dat_out, i32); break; } case FType_INT64: { - int64_t i64 = Int64_Get_Value((Integer64*)val); + int64_t i64 = Int_Get_Value((Integer*)val); OutStream_Write_I64(dat_out, i64); break; } case FType_FLOAT32: { - float f32 = (float)Float64_Get_Value((Float64*)val); + float f32 = (float)Float_Get_Value((Float*)val); OutStream_Write_F32(dat_out, f32); break; } case FType_FLOAT64: { - double f64 = Float64_Get_Value((Float64*)val); + double f64 = Float_Get_Value((Float*)val); OutStream_Write_F64(dat_out, f64); break; } http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Test/Search/TestSortSpec.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Search/TestSortSpec.c b/core/Lucy/Test/Search/TestSortSpec.c index 628918e..6b4afb2 100644 --- a/core/Lucy/Test/Search/TestSortSpec.c +++ b/core/Lucy/Test/Search/TestSortSpec.c @@ -237,13 +237,13 @@ S_add_vehicle(Indexer *indexer, String *name, int32_t speed, int32_t sloth, Doc_Store(doc, home_str, (Obj*)home); Doc_Store(doc, cat_str, (Obj*)cat); - Integer64 *speed_obj = Int64_new(speed); + Integer *speed_obj = Int_new(speed); Doc_Store(doc, speed_str, (Obj*)speed_obj); DECREF(speed_obj); - Integer64 *sloth_obj = Int64_new(sloth); + Integer *sloth_obj = Int_new(sloth); Doc_Store(doc, sloth_str, (Obj*)sloth_obj); DECREF(sloth_obj); - Integer64 *weight_obj = Int64_new(weight); + Integer *weight_obj = Int_new(weight); Doc_Store(doc, weight_str, (Obj*)weight_obj); DECREF(weight_obj); @@ -284,26 +284,26 @@ S_random_string() { static Obj* S_random_int32() { uint64_t num = TestUtils_random_u64(); - return (Obj*)Int64_new(num & 0x7FFFFFFF); + return (Obj*)Int_new(num & 0x7FFFFFFF); } static Obj* S_random_int64() { uint64_t num = TestUtils_random_u64(); - return (Obj*)Int64_new(num & INT64_C(0x7FFFFFFFFFFFFFFF)); + return (Obj*)Int_new(num & INT64_C(0x7FFFFFFFFFFFFFFF)); } static Obj* S_random_float32() { uint64_t num = TestUtils_random_u64(); double d = CHY_U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX); - return (Obj*)Float64_new((float)d); + return (Obj*)Float_new((float)d); } static Obj* S_random_float64() { uint64_t num = TestUtils_random_u64(); - return (Obj*)Float64_new(CHY_U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX)); + return (Obj*)Float_new(CHY_U64_TO_DOUBLE(num) * (10.0 / UINT64_MAX)); } static Vector* http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Test/Util/TestFreezer.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Util/TestFreezer.c b/core/Lucy/Test/Util/TestFreezer.c index aff1aaf..50543bc 100644 --- a/core/Lucy/Test/Util/TestFreezer.c +++ b/core/Lucy/Test/Util/TestFreezer.c @@ -93,7 +93,7 @@ test_hash(TestBatchRunner *runner) { for (uint32_t i = 0; i < 10; i++) { String *str = TestUtils_random_string(rand() % 1200); - Integer64 *num = Int64_new(i); + Integer *num = Int_new(i); Hash_Store(wanted, str, (Obj*)num); DECREF(str); } @@ -117,16 +117,16 @@ test_hash(TestBatchRunner *runner) { static void test_num(TestBatchRunner *runner) { - Float64 *f64 = Float64_new(1.33); - Integer64 *i64 = Int64_new(-1); - Float64 *f64_thaw = (Float64*)S_freeze_thaw((Obj*)f64); - Integer64 *i64_thaw = (Integer64*)S_freeze_thaw((Obj*)i64); + Float *f64 = Float_new(1.33); + Integer *i64 = Int_new(-1); + Float *f64_thaw = (Float*)S_freeze_thaw((Obj*)f64); + Integer *i64_thaw = (Integer*)S_freeze_thaw((Obj*)i64); Boolean *true_thaw = (Boolean*)S_freeze_thaw((Obj*)CFISH_TRUE); - TEST_TRUE(runner, Float64_Equals(f64, (Obj*)f64_thaw), - "Float64 freeze/thaw"); - TEST_TRUE(runner, Int64_Equals(i64, (Obj*)i64_thaw), - "Integer64 freeze/thaw"); + TEST_TRUE(runner, Float_Equals(f64, (Obj*)f64_thaw), + "Float freeze/thaw"); + TEST_TRUE(runner, Int_Equals(i64, (Obj*)i64_thaw), + "Integer freeze/thaw"); TEST_TRUE(runner, Bool_Equals(CFISH_TRUE, (Obj*)true_thaw), "Boolean freeze/thaw"); http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Test/Util/TestJson.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Util/TestJson.c b/core/Lucy/Test/Util/TestJson.c index f6dc731..8e858d8 100644 --- a/core/Lucy/Test/Util/TestJson.c +++ b/core/Lucy/Test/Util/TestJson.c @@ -160,14 +160,14 @@ test_escapes(TestBatchRunner *runner) { static void test_numbers(TestBatchRunner *runner) { - Integer64 *i64 = Int64_new(33); - String *json = Json_to_json((Obj*)i64); - String *trimmed = Str_Trim(json); + Integer *i64 = Int_new(33); + String *json = Json_to_json((Obj*)i64); + String *trimmed = Str_Trim(json); TEST_TRUE(runner, Str_Equals_Utf8(trimmed, "33", 2), "Integer"); DECREF(json); DECREF(trimmed); - Float64 *f64 = Float64_new(33.33); + Float *f64 = Float_new(33.33); json = Json_to_json((Obj*)f64); if (json) { double value = Str_To_F64(json); @@ -278,7 +278,7 @@ test_syntax_errors(TestBatchRunner *runner) { static void S_round_trip_integer(TestBatchRunner *runner, int64_t value) { - Integer64 *num = Int64_new(value); + Integer *num = Int_new(value); Vector *array = Vec_new(1); Vec_Store(array, 0, (Obj*)num); String *json = Json_to_json((Obj*)array); @@ -300,13 +300,13 @@ test_integers(TestBatchRunner *runner) { static void S_round_trip_float(TestBatchRunner *runner, double value, double max_diff) { - Float64 *num = Float64_new(value); + Float *num = Float_new(value); Vector *array = Vec_new(1); Vec_Store(array, 0, (Obj*)num); String *json = Json_to_json((Obj*)array); Obj *dump = CERTIFY(Json_from_json(json), VECTOR); - Float64 *got = (Float64*)CERTIFY(Vec_Fetch((Vector*)dump, 0), FLOAT64); - double diff = Float64_Get_Value(num) - Float64_Get_Value(got); + Float *got = (Float*)CERTIFY(Vec_Fetch((Vector*)dump, 0), FLOAT); + double diff = Float_Get_Value(num) - Float_Get_Value(got); if (diff < 0) { diff = 0 - diff; } TEST_TRUE(runner, diff <= max_diff, "Round trip float %f", value); DECREF(dump); http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Test/Util/TestPriorityQueue.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Test/Util/TestPriorityQueue.c b/core/Lucy/Test/Util/TestPriorityQueue.c index 4e939f2..e84bf3a 100644 --- a/core/Lucy/Test/Util/TestPriorityQueue.c +++ b/core/Lucy/Test/Util/TestPriorityQueue.c @@ -37,23 +37,23 @@ NumPriQ_new(uint32_t max_size) { bool NumPriQ_Less_Than_IMP(NumPriorityQueue *self, Obj *a, Obj *b) { - Float64 *num_a = (Float64*)a; - Float64 *num_b = (Float64*)b; + Float *num_a = (Float*)a; + Float *num_b = (Float*)b; UNUSED_VAR(self); - return Float64_Get_Value(num_a) < Float64_Get_Value(num_b) ? true : false; + return Float_Get_Value(num_a) < Float_Get_Value(num_b) ? true : false; } static void S_insert_num(NumPriorityQueue *pq, int32_t value) { - NumPriQ_Insert(pq, (Obj*)Float64_new((double)value)); + NumPriQ_Insert(pq, (Obj*)Float_new((double)value)); } static int32_t S_pop_num(NumPriorityQueue *pq) { - Float64 *num = (Float64*)NumPriQ_Pop(pq); + Float *num = (Float*)NumPriQ_Pop(pq); int32_t retval; if (!num) { THROW(ERR, "Queue is empty"); } - retval = (int32_t)Float64_Get_Value(num); + retval = (int32_t)Float_Get_Value(num); DECREF(num); return retval; } @@ -61,28 +61,28 @@ S_pop_num(NumPriorityQueue *pq) { static void test_Peek_and_Pop_All(TestBatchRunner *runner) { NumPriorityQueue *pq = NumPriQ_new(5); - Float64 *val; + Float *val; S_insert_num(pq, 3); S_insert_num(pq, 1); S_insert_num(pq, 2); S_insert_num(pq, 20); S_insert_num(pq, 10); - val = (Float64*)CERTIFY(NumPriQ_Peek(pq), FLOAT64); - TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 1, + val = (Float*)CERTIFY(NumPriQ_Peek(pq), FLOAT); + TEST_INT_EQ(runner, (long)Float_Get_Value(val), 1, "peek at the least item in the queue"); Vector *got = NumPriQ_Pop_All(pq); - val = (Float64*)CERTIFY(Vec_Fetch(got, 0), FLOAT64); - TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 20, "pop_all"); - val = (Float64*)CERTIFY(Vec_Fetch(got, 1), FLOAT64); - TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 10, "pop_all"); - val = (Float64*)CERTIFY(Vec_Fetch(got, 2), FLOAT64); - TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 3, "pop_all"); - val = (Float64*)CERTIFY(Vec_Fetch(got, 3), FLOAT64); - TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 2, "pop_all"); - val = (Float64*)CERTIFY(Vec_Fetch(got, 4), FLOAT64); - TEST_INT_EQ(runner, (long)Float64_Get_Value(val), 1, "pop_all"); + val = (Float*)CERTIFY(Vec_Fetch(got, 0), FLOAT); + TEST_INT_EQ(runner, (long)Float_Get_Value(val), 20, "pop_all"); + val = (Float*)CERTIFY(Vec_Fetch(got, 1), FLOAT); + TEST_INT_EQ(runner, (long)Float_Get_Value(val), 10, "pop_all"); + val = (Float*)CERTIFY(Vec_Fetch(got, 2), FLOAT); + TEST_INT_EQ(runner, (long)Float_Get_Value(val), 3, "pop_all"); + val = (Float*)CERTIFY(Vec_Fetch(got, 3), FLOAT); + TEST_INT_EQ(runner, (long)Float_Get_Value(val), 2, "pop_all"); + val = (Float*)CERTIFY(Vec_Fetch(got, 4), FLOAT); + TEST_INT_EQ(runner, (long)Float_Get_Value(val), 1, "pop_all"); DECREF(got); DECREF(pq); http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Util/Freezer.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Util/Freezer.c b/core/Lucy/Util/Freezer.c index afb37e6..11b82d5 100644 --- a/core/Lucy/Util/Freezer.c +++ b/core/Lucy/Util/Freezer.c @@ -64,12 +64,12 @@ Freezer_serialize(Obj *obj, OutStream *outstream) { else if (Obj_is_a(obj, HASH)) { Freezer_serialize_hash((Hash*)obj, outstream); } - else if (Obj_is_a(obj, INTEGER64)) { - int64_t val = Int64_Get_Value((Integer64*)obj); + else if (Obj_is_a(obj, INTEGER)) { + int64_t val = Int_Get_Value((Integer*)obj); OutStream_Write_C64(outstream, (uint64_t)val); } - else if (Obj_is_a(obj, FLOAT64)) { - double val = Float64_Get_Value((Float64*)obj); + else if (Obj_is_a(obj, FLOAT)) { + double val = Float_Get_Value((Float*)obj); OutStream_Write_F64(outstream, val); } else if (Obj_is_a(obj, BOOLEAN)) { @@ -123,13 +123,13 @@ Freezer_deserialize(Obj *obj, InStream *instream) { else if (Obj_is_a(obj, HASH)) { obj = (Obj*)Freezer_deserialize_hash((Hash*)obj, instream); } - else if (Obj_is_a(obj, INTEGER64)) { + else if (Obj_is_a(obj, INTEGER)) { int64_t value = (int64_t)InStream_Read_C64(instream); - obj = (Obj*)Int64_init((Integer64*)obj, value); + obj = (Obj*)Int_init((Integer*)obj, value); } - else if (Obj_is_a(obj, FLOAT64)) { + else if (Obj_is_a(obj, FLOAT)) { double value = InStream_Read_F64(instream); - obj = (Obj*)Float64_init((Float64*)obj, value); + obj = (Obj*)Float_init((Float*)obj, value); } else if (Obj_is_a(obj, BOOLEAN)) { bool value = !!InStream_Read_U8(instream); @@ -358,8 +358,8 @@ Freezer_dump(Obj *obj) { else if (Obj_is_a(obj, QUERY)) { return Query_Dump((Query*)obj); } - else if (Obj_is_a(obj, FLOAT64) - || Obj_is_a(obj, INTEGER64) + else if (Obj_is_a(obj, FLOAT) + || Obj_is_a(obj, INTEGER) || Obj_is_a(obj, BOOLEAN)) { return Obj_Clone(obj); } http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/core/Lucy/Util/Json.c ---------------------------------------------------------------------- diff --git a/core/Lucy/Util/Json.c b/core/Lucy/Util/Json.c index 4d5ad8a..002485e 100644 --- a/core/Lucy/Util/Json.c +++ b/core/Lucy/Util/Json.c @@ -51,7 +51,7 @@ static Obj* S_do_parse_json(void *json_parser, const char *json, size_t len); // Parse a JSON number. Advance the text buffer just past the number. -static Float64* +static Float* S_parse_number(const char **json_ptr, const char *limit); // Parse a JSON string. Advance the text buffer from pointing at the opening @@ -281,11 +281,11 @@ S_to_json(Obj *dump, CharBuf *buf, int32_t depth) { else if (Obj_is_a(dump, STRING)) { S_append_json_string((String*)dump, buf); } - else if (Obj_is_a(dump, INTEGER64)) { - CB_catf(buf, "%i64", Int64_Get_Value((Integer64*)dump)); + else if (Obj_is_a(dump, INTEGER)) { + CB_catf(buf, "%i64", Int_Get_Value((Integer*)dump)); } - else if (Obj_is_a(dump, FLOAT64)) { - CB_catf(buf, "%f64", Float64_Get_Value((Float64*)dump)); + else if (Obj_is_a(dump, FLOAT)) { + CB_catf(buf, "%f64", Float_Get_Value((Float*)dump)); } else if (Obj_is_a(dump, VECTOR)) { Vector *array = (Vector*)dump; @@ -492,7 +492,7 @@ S_do_parse_json(void *json_parser, const char *json, size_t len) { return state.result; } -static Float64* +static Float* S_parse_number(const char **json_ptr, const char *limit) { const char *top = *json_ptr; const char *end = top; @@ -515,13 +515,13 @@ S_parse_number(const char **json_ptr, const char *limit) { } } - Float64 *result = NULL; + Float *result = NULL; if (terminated) { char *terminus; double number = strtod(top, &terminus); if (terminus != top) { *json_ptr = terminus; - result = Float64_new(number); + result = Float_new(number); } } if (!result) { @@ -708,11 +708,11 @@ Json_obj_to_i64(Obj *obj) { if (!obj) { THROW(ERR, "Can't extract integer from NULL"); } - else if (Obj_is_a(obj, INTEGER64)) { - retval = Int64_Get_Value((Integer64*)obj); + else if (Obj_is_a(obj, INTEGER)) { + retval = Int_Get_Value((Integer*)obj); } - else if (Obj_is_a(obj, FLOAT64)) { - retval = Float64_To_I64((Float64*)obj); + else if (Obj_is_a(obj, FLOAT)) { + retval = Float_To_I64((Float*)obj); } else if (Obj_is_a(obj, STRING)) { retval = Str_To_I64((String*)obj); @@ -732,11 +732,11 @@ Json_obj_to_f64(Obj *obj) { if (!obj) { THROW(ERR, "Can't extract float from NULL"); } - else if (Obj_is_a(obj, FLOAT64)) { - retval = Float64_Get_Value((Float64*)obj); + else if (Obj_is_a(obj, FLOAT)) { + retval = Float_Get_Value((Float*)obj); } - else if (Obj_is_a(obj, INTEGER64)) { - retval = Int64_To_F64((Integer64*)obj); + else if (Obj_is_a(obj, INTEGER)) { + retval = Int_To_F64((Integer*)obj); } else if (Obj_is_a(obj, STRING)) { retval = Str_To_F64((String*)obj); @@ -759,11 +759,11 @@ Json_obj_to_bool(Obj *obj) { else if (Obj_is_a(obj, BOOLEAN)) { retval = Bool_Get_Value((Boolean*)obj); } - else if (Obj_is_a(obj, INTEGER64)) { - retval = Int64_To_Bool((Integer64*)obj); + else if (Obj_is_a(obj, INTEGER)) { + retval = Int_To_Bool((Integer*)obj); } - else if (Obj_is_a(obj, FLOAT64)) { - retval = Float64_To_Bool((Float64*)obj); + else if (Obj_is_a(obj, FLOAT)) { + retval = Float_To_Bool((Float*)obj); } else if (Obj_is_a(obj, STRING)) { retval = (Str_To_I64((String*)obj) != 0); http://git-wip-us.apache.org/repos/asf/lucy/blob/1d2632f1/perl/xs/Lucy/Index/Inverter.c ---------------------------------------------------------------------- diff --git a/perl/xs/Lucy/Index/Inverter.c b/perl/xs/Lucy/Index/Inverter.c index b470f3a..f2193bd 100644 --- a/perl/xs/Lucy/Index/Inverter.c +++ b/perl/xs/Lucy/Index/Inverter.c @@ -113,24 +113,24 @@ LUCY_Inverter_Invert_Doc_IMP(lucy_Inverter *self, lucy_Doc *doc) { break; } case lucy_FType_INT32: { - cfish_Integer64* value = (cfish_Integer64*)entry_ivars->value; - CFISH_Int64_Set_Value(value, SvIV(value_sv)); + cfish_Integer* value = (cfish_Integer*)entry_ivars->value; + CFISH_Int_Set_Value(value, SvIV(value_sv)); break; } case lucy_FType_INT64: { - cfish_Integer64* value = (cfish_Integer64*)entry_ivars->value; + cfish_Integer* value = (cfish_Integer*)entry_ivars->value; // nwellnhof: Using SvNOK could avoid a int/float/int // round-trip with 32-bit IVs. int64_t val = sizeof(IV) == 8 ? SvIV(value_sv) : (int64_t)SvNV(value_sv); // lossy - CFISH_Int64_Set_Value(value, val); + CFISH_Int_Set_Value(value, val); break; } case lucy_FType_FLOAT32: case lucy_FType_FLOAT64: { - cfish_Float64* value = (cfish_Float64*)entry_ivars->value; - CFISH_Float64_Set_Value(value, SvNV(value_sv)); + cfish_Float* value = (cfish_Float*)entry_ivars->value; + CFISH_Float_Set_Value(value, SvNV(value_sv)); break; } default: