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 2010/04/03 02:34:03 UTC
svn commit: r930448 [1/2] - in /lucene/lucy/trunk: core/Lucy/Index/
core/Lucy/Object/ core/Lucy/Test/Object/ perl/xs/Lucy/Object/
Author: marvin
Date: Sat Apr 3 00:34:02 2010
New Revision: 930448
URL: http://svn.apache.org/viewvc?rev=930448&view=rev
Log:
Switch over to stdint.h integer types within core/Lucy/Object, then deal with
the fallout in other areas.
Modified:
lucene/lucy/trunk/core/Lucy/Index/Segment.bp
lucene/lucy/trunk/core/Lucy/Index/Segment.c
lucene/lucy/trunk/core/Lucy/Object/BitVector.bp
lucene/lucy/trunk/core/Lucy/Object/BitVector.c
lucene/lucy/trunk/core/Lucy/Object/ByteBuf.bp
lucene/lucy/trunk/core/Lucy/Object/ByteBuf.c
lucene/lucy/trunk/core/Lucy/Object/CharBuf.bp
lucene/lucy/trunk/core/Lucy/Object/CharBuf.c
lucene/lucy/trunk/core/Lucy/Object/Err.c
lucene/lucy/trunk/core/Lucy/Object/Hash.bp
lucene/lucy/trunk/core/Lucy/Object/Hash.c
lucene/lucy/trunk/core/Lucy/Object/Host.bp
lucene/lucy/trunk/core/Lucy/Object/I32Array.bp
lucene/lucy/trunk/core/Lucy/Object/I32Array.c
lucene/lucy/trunk/core/Lucy/Object/LockFreeRegistry.c
lucene/lucy/trunk/core/Lucy/Object/Num.bp
lucene/lucy/trunk/core/Lucy/Object/Num.c
lucene/lucy/trunk/core/Lucy/Object/Obj.bp
lucene/lucy/trunk/core/Lucy/Object/Obj.c
lucene/lucy/trunk/core/Lucy/Object/Undefined.bp
lucene/lucy/trunk/core/Lucy/Object/Undefined.c
lucene/lucy/trunk/core/Lucy/Object/VArray.bp
lucene/lucy/trunk/core/Lucy/Object/VArray.c
lucene/lucy/trunk/core/Lucy/Object/VTable.bp
lucene/lucy/trunk/core/Lucy/Object/VTable.c
lucene/lucy/trunk/core/Lucy/Test/Object/TestBitVector.c
lucene/lucy/trunk/core/Lucy/Test/Object/TestCharBuf.c
lucene/lucy/trunk/core/Lucy/Test/Object/TestHash.c
lucene/lucy/trunk/core/Lucy/Test/Object/TestI32Array.c
lucene/lucy/trunk/core/Lucy/Test/Object/TestLockFreeRegistry.bp
lucene/lucy/trunk/core/Lucy/Test/Object/TestLockFreeRegistry.c
lucene/lucy/trunk/core/Lucy/Test/Object/TestObj.c
lucene/lucy/trunk/core/Lucy/Test/Object/TestVArray.c
lucene/lucy/trunk/perl/xs/Lucy/Object/Host.c
lucene/lucy/trunk/perl/xs/Lucy/Object/Obj.c
Modified: lucene/lucy/trunk/core/Lucy/Index/Segment.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Index/Segment.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Index/Segment.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Index/Segment.bp Sat Apr 3 00:34:02 2010
@@ -133,7 +133,7 @@ class Lucy::Index::Segment cnick Seg ext
/** Compare by segment number.
*/
- public i32_t
+ public int32_t
Compare_To(Segment *self, Obj *other);
public void
Modified: lucene/lucy/trunk/core/Lucy/Index/Segment.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Index/Segment.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Index/Segment.c (original)
+++ lucene/lucy/trunk/core/Lucy/Index/Segment.c Sat Apr 3 00:34:02 2010
@@ -211,7 +211,7 @@ Seg_fetch_metadata_str(Segment *self, co
Hash*
Seg_get_metadata(Segment *self) { return self->metadata; }
-i32_t
+int32_t
Seg_compare_to(Segment *self, Obj *other)
{
Segment *other_seg = (Segment*)CERTIFY(other, SEGMENT);
Modified: lucene/lucy/trunk/core/Lucy/Object/BitVector.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/BitVector.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/BitVector.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/BitVector.bp Sat Apr 3 00:34:02 2010
@@ -8,18 +8,18 @@ parcel Lucy;
class Lucy::Object::BitVector cnick BitVec
extends Lucy::Object::Obj {
- u32_t cap;
- u8_t *bits;
+ uint32_t cap;
+ uint8_t *bits;
inert incremented BitVector*
- new(u32_t capacity = 0);
+ new(uint32_t capacity = 0);
/**
* @param capacity The number of bits that the initial array should be
* able to hold.
*/
public inert BitVector*
- init(BitVector *self, u32_t capacity = 0);
+ init(BitVector *self, uint32_t capacity = 0);
/** Return true if the bit at <code>tick</code> has been set, false if it
* hasn't (regardless of whether it lies within the bounds of the
@@ -28,37 +28,37 @@ class Lucy::Object::BitVector cnick BitV
* @param tick The requested bit.
*/
public bool_t
- Get(BitVector *self, u32_t tick);
+ Get(BitVector *self, uint32_t tick);
/** Set the bit at <code>tick</code> to 1.
*
* @param tick The bit to be set.
*/
public void
- Set(BitVector *self, u32_t tick);
+ Set(BitVector *self, uint32_t tick);
/** Accessor for the BitVector's underlying bit array.
*/
- nullable u8_t*
+ nullable uint8_t*
Get_Raw_Bits(BitVector *self);
/** Accessor for capacity.
*/
- u32_t
+ uint32_t
Get_Capacity(BitVector *self);
/** Returns the next set bit equal to or greater than <code>tick</code>,
* or -1 if no such bit exists.
*/
- public i32_t
- Next_Set_Bit(BitVector *self, u32_t tick);
+ public int32_t
+ Next_Set_Bit(BitVector *self, uint32_t tick);
/** Clear the indicated bit. (i.e. set it to 0).
*
* @param tick The bit to be cleared.
*/
public void
- Clear(BitVector *self, u32_t tick);
+ Clear(BitVector *self, uint32_t tick);
/** Clear all bits.
*/
@@ -71,7 +71,7 @@ class Lucy::Object::BitVector cnick BitV
* @param capacity Least number of bits the BitVector should accomodate.
*/
public void
- Grow(BitVector *self, u32_t capacity);
+ Grow(BitVector *self, uint32_t capacity);
/** Modify the contents of this BitVector so that it has the same bits set
* as <code>other</code>.
@@ -117,7 +117,7 @@ class Lucy::Object::BitVector cnick BitV
* @param tick The bit to invert.
*/
public void
- Flip(BitVector *self, u32_t tick);
+ Flip(BitVector *self, uint32_t tick);
/** Invert each bit within a contiguous block.
*
@@ -125,11 +125,11 @@ class Lucy::Object::BitVector cnick BitV
* @param length The number of bits to flip.
*/
public void
- Flip_Block(BitVector *self, u32_t offset, u32_t length);
+ Flip_Block(BitVector *self, uint32_t offset, uint32_t length);
/** Return a count of the number of set bits.
*/
- public u32_t
+ public uint32_t
Count(BitVector *self);
/** Return an array where each element represents a set bit.
Modified: lucene/lucy/trunk/core/Lucy/Object/BitVector.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/BitVector.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/BitVector.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/BitVector.c Sat Apr 3 00:34:02 2010
@@ -14,7 +14,7 @@ S_do_or_or_xor(BitVector *self, const Bi
/* Number of 1 bits given a u8 value.
*/
-static const u32_t BYTE_COUNTS[256] = {
+static const uint32_t BYTE_COUNTS[256] = {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
@@ -35,19 +35,21 @@ static const u32_t BYTE_COUNTS[256] = {
BitVector*
-BitVec_new(u32_t capacity)
+BitVec_new(uint32_t capacity)
{
BitVector *self = (BitVector*)VTable_Make_Obj(BITVECTOR);
return BitVec_init(self, capacity);
}
BitVector*
-BitVec_init(BitVector *self, u32_t capacity)
+BitVec_init(BitVector *self, uint32_t capacity)
{
- const u32_t byte_size = (u32_t)ceil(capacity / 8.0);
+ const uint32_t byte_size = (uint32_t)ceil(capacity / 8.0);
/* Derive. */
- self->bits = capacity ? (u8_t*)CALLOCATE(byte_size, sizeof(u8_t)) : NULL;
+ self->bits = capacity
+ ? (uint8_t*)CALLOCATE(byte_size, sizeof(uint8_t))
+ : NULL;
/* Assign. */
self->cap = byte_size * 8;
@@ -66,7 +68,7 @@ BitVector*
BitVec_clone(BitVector *self)
{
BitVector *evil_twin = BitVec_new(self->cap);
- u32_t byte_size = (u32_t)ceil(self->cap / 8.0);
+ uint32_t byte_size = (uint32_t)ceil(self->cap / 8.0);
/* Forbid inheritance. */
if (BitVec_Get_VTable(self) != BITVECTOR) {
@@ -74,24 +76,24 @@ BitVec_clone(BitVector *self)
BitVec_Get_Class_Name(self));
}
- memcpy(evil_twin->bits, self->bits, byte_size * sizeof(u8_t));
+ memcpy(evil_twin->bits, self->bits, byte_size * sizeof(uint8_t));
return evil_twin;
}
-u8_t*
+uint8_t*
BitVec_get_raw_bits(BitVector *self) { return self->bits; }
-u32_t
+uint32_t
BitVec_get_capacity(BitVector *self) { return self->cap; }
void
BitVec_mimic(BitVector *self, Obj *other)
{
BitVector *evil_twin = (BitVector*)CERTIFY(other, BITVECTOR);
- const u32_t my_byte_size = (u32_t)ceil(self->cap / 8.0);
- const u32_t evil_twin_byte_size = (u32_t)ceil(evil_twin->cap / 8.0);
+ const uint32_t my_byte_size = (uint32_t)ceil(self->cap / 8.0);
+ const uint32_t evil_twin_byte_size = (uint32_t)ceil(evil_twin->cap / 8.0);
if (my_byte_size > evil_twin_byte_size) {
- u32_t space = my_byte_size - evil_twin_byte_size;
+ uint32_t space = my_byte_size - evil_twin_byte_size;
memset(self->bits + evil_twin_byte_size, 0, space);
}
else if (my_byte_size < evil_twin_byte_size) {
@@ -101,21 +103,21 @@ BitVec_mimic(BitVector *self, Obj *other
}
void
-BitVec_grow(BitVector *self, u32_t capacity)
+BitVec_grow(BitVector *self, uint32_t capacity)
{
if (capacity > self->cap) {
const size_t old_byte_cap = (size_t)ceil(self->cap / 8.0);
const size_t new_byte_cap = (size_t)ceil((capacity + 1) / 8.0);
const size_t num_new_bytes = new_byte_cap - old_byte_cap;
- self->bits = (u8_t*)REALLOCATE(self->bits, new_byte_cap);
+ self->bits = (uint8_t*)REALLOCATE(self->bits, new_byte_cap);
memset(self->bits + old_byte_cap, 0, num_new_bytes);
self->cap = new_byte_cap * 8;
}
}
void
-BitVec_set(BitVector *self, u32_t tick)
+BitVec_set(BitVector *self, uint32_t tick)
{
if (tick >= self->cap) {
uint32_t new_cap = (uint32_t)Memory_oversize(tick + 1, 0);
@@ -125,7 +127,7 @@ BitVec_set(BitVector *self, u32_t tick)
}
void
-BitVec_clear(BitVector *self, u32_t tick)
+BitVec_clear(BitVector *self, uint32_t tick)
{
if (tick >= self->cap)
return;
@@ -140,51 +142,51 @@ BitVec_clear_all(BitVector *self)
}
bool_t
-BitVec_get(BitVector *self, u32_t tick)
+BitVec_get(BitVector *self, uint32_t tick)
{
if (tick >= self->cap)
return false;
return NumUtil_u1get(self->bits, tick);
}
-static i32_t
-S_first_bit_in_nonzero_byte(u8_t num)
+static int32_t
+S_first_bit_in_nonzero_byte(uint8_t num)
{
- i32_t first_bit = 0;
+ int32_t first_bit = 0;
if ((num & 0xF) == 0) { first_bit += 4; num >>= 4; }
if ((num & 0x3) == 0) { first_bit += 2; num >>= 2; }
if ((num & 0x1) == 0) { first_bit += 1; }
return first_bit;
}
-i32_t
-BitVec_next_set_bit(BitVector *self, u32_t tick)
+int32_t
+BitVec_next_set_bit(BitVector *self, uint32_t tick)
{
size_t byte_size = (size_t)ceil(self->cap / 8.0);
- u8_t *const limit = self->bits + byte_size;
- u8_t *ptr = self->bits + (tick >> 3);
+ uint8_t *const limit = self->bits + byte_size;
+ uint8_t *ptr = self->bits + (tick >> 3);
if (ptr >= limit) {
return -1;
}
else if (*ptr != 0) {
/* Special case the first byte. */
- const i32_t base = (ptr - self->bits) * 8;
- const i32_t min_sub_tick = tick & 0x7;
+ const int32_t base = (ptr - self->bits) * 8;
+ const int32_t min_sub_tick = tick & 0x7;
unsigned int byte = *ptr >> min_sub_tick;
if (byte) {
- const i32_t candidate = base + min_sub_tick +
+ const int32_t candidate = base + min_sub_tick +
S_first_bit_in_nonzero_byte(byte);
- return candidate < (i32_t)self->cap ? candidate : -1;
+ return candidate < (int32_t)self->cap ? candidate : -1;
}
}
for (ptr++ ; ptr < limit; ptr++) {
if (*ptr != 0) {
/* There's a non-zero bit in this byte. */
- const i32_t base = (ptr - self->bits) * 8;
- const i32_t candidate = base + S_first_bit_in_nonzero_byte(*ptr);
- return candidate < (i32_t)self->cap ? candidate : -1;
+ const int32_t base = (ptr - self->bits) * 8;
+ const int32_t candidate = base + S_first_bit_in_nonzero_byte(*ptr);
+ return candidate < (int32_t)self->cap ? candidate : -1;
}
}
@@ -194,13 +196,13 @@ BitVec_next_set_bit(BitVector *self, u32
void
BitVec_and(BitVector *self, const BitVector *other)
{
- u8_t *bits_a = self->bits;
- u8_t *bits_b = other->bits;
- const u32_t min_cap = self->cap < other->cap
+ uint8_t *bits_a = self->bits;
+ uint8_t *bits_b = other->bits;
+ const uint32_t min_cap = self->cap < other->cap
? self->cap
: other->cap;
const size_t byte_size = (size_t)ceil(min_cap / 8.0);
- u8_t *const limit = bits_a + byte_size;
+ uint8_t *const limit = bits_a + byte_size;
/* Intersection. */
while (bits_a < limit) {
@@ -230,9 +232,9 @@ BitVec_xor(BitVector *self, const BitVec
static void
S_do_or_or_xor(BitVector *self, const BitVector *other, int operation)
{
- u8_t *bits_a, *bits_b;
- u32_t max_cap, min_cap;
- u8_t *limit;
+ uint8_t *bits_a, *bits_b;
+ uint32_t max_cap, min_cap;
+ uint8_t *limit;
double byte_size;
/* Sort out what the minimum and maximum caps are. */
@@ -266,7 +268,7 @@ S_do_or_or_xor(BitVector *self, const Bi
}
}
else {
- THROW(ERR, "Unrecognized operation: %i32", (i32_t)operation);
+ THROW(ERR, "Unrecognized operation: %i32", (int32_t)operation);
}
/* Copy remaining bits if other is bigger than self. */
@@ -280,13 +282,13 @@ S_do_or_or_xor(BitVector *self, const Bi
void
BitVec_and_not(BitVector *self, const BitVector *other)
{
- u8_t *bits_a = self->bits;
- u8_t *bits_b = other->bits;
- const u32_t min_cap = self->cap < other->cap
+ uint8_t *bits_a = self->bits;
+ uint8_t *bits_b = other->bits;
+ const uint32_t min_cap = self->cap < other->cap
? self->cap
: other->cap;
const size_t byte_size = (size_t)ceil(min_cap / 8.0);
- u8_t *const limit = bits_a + byte_size;
+ uint8_t *const limit = bits_a + byte_size;
/* Clear bits set in other. */
while (bits_a < limit) {
@@ -296,7 +298,7 @@ BitVec_and_not(BitVector *self, const Bi
}
void
-BitVec_flip(BitVector *self, u32_t tick)
+BitVec_flip(BitVector *self, uint32_t tick)
{
if (tick >= self->cap) {
uint32_t new_cap = (uint32_t)Memory_oversize(tick + 1, 0);
@@ -306,10 +308,10 @@ BitVec_flip(BitVector *self, u32_t tick)
}
void
-BitVec_flip_block(BitVector *self, u32_t offset, u32_t length)
+BitVec_flip_block(BitVector *self, uint32_t offset, uint32_t length)
{
- u32_t first = offset;
- u32_t last = offset + length - 1;
+ uint32_t first = offset;
+ uint32_t last = offset + length - 1;
/* Bail if there's nothing to flip. */
if (!length) { return; }
@@ -333,10 +335,10 @@ BitVec_flip_block(BitVector *self, u32_t
}
/* They must be multiples of 8, then. */
else {
- const u32_t start_tick = first >> 3;
- const u32_t limit_tick = last >> 3;
- u8_t *bits = self->bits + start_tick;
- u8_t *limit = self->bits + limit_tick;
+ const uint32_t start_tick = first >> 3;
+ const uint32_t limit_tick = last >> 3;
+ uint8_t *bits = self->bits + start_tick;
+ uint8_t *limit = self->bits + limit_tick;
/* Last actually belongs to the following byte (e.g. 8, in byte 2). */
NumUtil_u1flip(self->bits, last);
@@ -348,13 +350,13 @@ BitVec_flip_block(BitVector *self, u32_t
}
}
-u32_t
+uint32_t
BitVec_count(BitVector *self)
{
- u32_t count = 0;
+ uint32_t count = 0;
const size_t byte_size = (size_t)ceil(self->cap / 8.0);
- u8_t *ptr = self->bits;
- u8_t *const limit = ptr + byte_size;
+ uint8_t *ptr = self->bits;
+ uint8_t *const limit = ptr + byte_size;
for( ; ptr < limit; ptr++) {
count += BYTE_COUNTS[*ptr];
@@ -366,18 +368,18 @@ BitVec_count(BitVector *self)
I32Array*
BitVec_to_array(BitVector *self)
{
- u32_t count = BitVec_Count(self);
- u32_t num_left = count;
- const u32_t capacity = self->cap;
- u32_t *const array = (u32_t *const)(u32_t*)CALLOCATE(count, sizeof(u32_t));
- const size_t byte_size = (size_t)ceil(self->cap / 8.0);
- u8_t *const bits = self->bits;
- u8_t *const limit = bits + byte_size;
- u32_t num = 0;
- u32_t i = 0;
+ uint32_t count = BitVec_Count(self);
+ uint32_t num_left = count;
+ const uint32_t capacity = self->cap;
+ uint32_t *const array = (uint32_t*)CALLOCATE(count, sizeof(uint32_t));
+ const size_t byte_size = (size_t)ceil(self->cap / 8.0);
+ uint8_t *const bits = self->bits;
+ uint8_t *const limit = bits + byte_size;
+ uint32_t num = 0;
+ uint32_t i = 0;
while (num_left) {
- u8_t *ptr = bits + (num >> 3);
+ uint8_t *ptr = bits + (num >> 3);
while (ptr < limit && *ptr == 0) {
num += 8;
ptr++;
@@ -393,7 +395,7 @@ BitVec_to_array(BitVector *self)
} while (++num % 8);
}
- return I32Arr_new_steal((i32_t*)array, count);
+ return I32Arr_new_steal((int32_t*)array, count);
}
/* Copyright 2009 The Apache Software Foundation
Modified: lucene/lucy/trunk/core/Lucy/Object/ByteBuf.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/ByteBuf.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/ByteBuf.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/ByteBuf.bp Sat Apr 3 00:34:02 2010
@@ -98,7 +98,7 @@ class Lucy::Object::ByteBuf cnick BB ext
public bool_t
Equals(ByteBuf *self, Obj *other);
- public i32_t
+ public int32_t
Hash_Code(ByteBuf *self);
public void
Modified: lucene/lucy/trunk/core/Lucy/Object/ByteBuf.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/ByteBuf.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/ByteBuf.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/ByteBuf.c Sat Apr 3 00:34:02 2010
@@ -28,7 +28,7 @@ BB_new(size_t capacity)
ByteBuf*
BB_init(ByteBuf *self, size_t capacity)
{
- size_t amount = capacity ? capacity : sizeof(i64_t);
+ size_t amount = capacity ? capacity : sizeof(int64_t);
self->buf = NULL;
self->size = 0;
self->cap = 0;
@@ -74,7 +74,7 @@ BB_set_size(ByteBuf *self, size_t size)
{
if (size > self->cap) {
THROW(ERR, "Can't set size to %u64 ( greater than capacity of %u64)",
- (u64_t)size, (u64_t)self->cap);
+ (uint64_t)size, (uint64_t)self->cap);
}
self->size = size;
}
@@ -108,12 +108,12 @@ BB_equals_bytes(ByteBuf *self, const voi
return SI_equals_bytes(self, bytes, size);
}
-i32_t
+int32_t
BB_hash_code(ByteBuf *self)
{
size_t size = self->size;
- const u8_t *buf = (const u8_t*)self->buf;
- u32_t hashvalue = 0;
+ const uint8_t *buf = (const uint8_t*)self->buf;
+ uint32_t hashvalue = 0;
while (size--) {
hashvalue += *buf++;
@@ -124,7 +124,7 @@ BB_hash_code(ByteBuf *self)
hashvalue ^= (hashvalue >> 11);
hashvalue += (hashvalue << 15);
- return (i32_t) hashvalue;
+ return (int32_t) hashvalue;
}
static INLINE void
@@ -204,7 +204,7 @@ ByteBuf*
BB_deserialize(ByteBuf *self, InStream *instream)
{
const size_t size = InStream_Read_C32(instream);
- const size_t capacity = size ? size : sizeof(i64_t);
+ const size_t capacity = size ? size : sizeof(int64_t);
self = self ? self : (ByteBuf*)VTable_Make_Obj(BYTEBUF);
if (capacity > self->cap) { S_grow(self, capacity); }
self->size = size;
@@ -219,7 +219,7 @@ BB_compare(const void *va, const void *v
const ByteBuf *b = *(const ByteBuf**)vb;
const size_t size = a->size < b->size ? a->size : b->size;
- i32_t comparison = memcmp(a->buf, b->buf, size);
+ int32_t comparison = memcmp(a->buf, b->buf, size);
if (comparison == 0 && a->size != b->size)
comparison = a->size < b->size ? -1 : 1;
Modified: lucene/lucy/trunk/core/Lucy/Object/CharBuf.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/CharBuf.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/CharBuf.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/CharBuf.bp Sat Apr 3 00:34:02 2010
@@ -113,21 +113,21 @@ class Lucy::Object::CharBuf cnick CB
/** Concatenate one Unicode character onto the end of the CharBuf.
*/
void
- Cat_Char(CharBuf *self, u32_t code_point);
+ Cat_Char(CharBuf *self, uint32_t code_point);
/** Replace all instances of one character for the other. For now, both
* the source and replacement code points must be ASCII.
*/
- i32_t
- Swap_Chars(CharBuf *self, u32_t match, u32_t replacement);
+ int32_t
+ Swap_Chars(CharBuf *self, uint32_t match, uint32_t replacement);
- public i64_t
+ public int64_t
To_I64(CharBuf *self);
/** Extract a 64-bit integer from a variable-base stringified version.
*/
- i64_t
- BaseX_To_I64(CharBuf *self, u32_t base);
+ int64_t
+ BaseX_To_I64(CharBuf *self, uint32_t base);
public double
To_F64(CharBuf *self);
@@ -184,7 +184,7 @@ class Lucy::Object::CharBuf cnick CB
/** Return the internal backing array for the CharBuf if its internal
* encoding is UTF-8. If it is not encoded as UTF-8 throw an exception.
*/
- u8_t*
+ uint8_t*
Get_Ptr8(CharBuf *self);
/** Return a fresh copy of the string data in a CharBuf with an internal
@@ -202,10 +202,10 @@ class Lucy::Object::CharBuf cnick CB
public bool_t
Equals(CharBuf *self, Obj *other);
- public i32_t
+ public int32_t
Compare_To(CharBuf *self, Obj *other);
- public i32_t
+ public int32_t
Hash_Code(CharBuf *self);
public incremented CharBuf*
@@ -222,17 +222,17 @@ class Lucy::Object::CharBuf cnick CB
/** Remove Unicode whitespace characters from both top and tail.
*/
- u32_t
+ uint32_t
Trim(CharBuf *self);
/** Remove leading Unicode whitespace.
*/
- u32_t
+ uint32_t
Trim_Top(CharBuf *self);
/** Remove trailing Unicode whitespace.
*/
- u32_t
+ uint32_t
Trim_Tail(CharBuf *self);
/** Remove characters (measured in code points) from the top of the
@@ -244,7 +244,7 @@ class Lucy::Object::CharBuf cnick CB
/** Remove one character from the top of the CharBuf. Returns the code
* point, or 0 if the string was empty.
*/
- i32_t
+ int32_t
Nip_One(CharBuf *self);
/** Remove characters (measured in code points) from the end of the
@@ -267,14 +267,14 @@ class Lucy::Object::CharBuf cnick CB
* better to throw an exception, but that's not practical with UTF-8 and
* no cached length.)
*/
- u32_t
+ uint32_t
Code_Point_At(CharBuf *self, size_t tick);
/** Return the Unicode code point at the specified number of code points
* counted backwards from the end of the string. Return 0 if outside the
* string.
*/
- u32_t
+ uint32_t
Code_Point_From(CharBuf *self, size_t tick);
/** Return a newly allocated CharBuf containing a copy of the indicated
@@ -310,13 +310,13 @@ class Lucy::Object::ViewCharBuf cnick Vi
void
Assign_Str(ViewCharBuf *self, const char *utf8, size_t size);
- u32_t
+ uint32_t
Trim_Top(ViewCharBuf *self);
size_t
Nip(ViewCharBuf *self, size_t count);
- i32_t
+ int32_t
Nip_One(ViewCharBuf *self);
/** Throws an error. */
Modified: lucene/lucy/trunk/core/Lucy/Object/CharBuf.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/CharBuf.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/CharBuf.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/CharBuf.c Sat Apr 3 00:34:02 2010
@@ -123,22 +123,22 @@ CB_destroy(CharBuf *self)
SUPER_DESTROY(self, CHARBUF);
}
-i32_t
+int32_t
CB_hash_code(CharBuf *self)
{
- u32_t hashvalue = 5381;
+ uint32_t hashvalue = 5381;
ZombieCharBuf *iterator = ZCB_WRAP(self);
{
const CB_nip_one_t nip_one
= (CB_nip_one_t)METHOD(iterator->vtable, CB, Nip_One);
while (iterator->size) {
- u32_t code_point = (u32_t)nip_one((CharBuf*)iterator);
+ uint32_t code_point = (uint32_t)nip_one((CharBuf*)iterator);
hashvalue = ((hashvalue << 5) + hashvalue) ^ code_point;
}
}
- return (i32_t) hashvalue;
+ return (int32_t) hashvalue;
}
static void
@@ -243,19 +243,19 @@ CB_vcatf(CharBuf *self, const char *patt
break;
case 'i': {
- i64_t val = 0;
+ int64_t val = 0;
size_t size;
if (pattern[1] == '8') {
- val = va_arg(args, i32_t);
+ val = va_arg(args, int32_t);
pattern++;
}
else if (pattern[1] == '3' && pattern[2] == '2') {
- val = va_arg(args, i32_t);
+ val = va_arg(args, int32_t);
pattern += 2;
}
else if (pattern[1] == '6' && pattern[2] == '4') {
- val = va_arg(args, i64_t);
+ val = va_arg(args, int64_t);
pattern += 2;
}
else {
@@ -267,19 +267,19 @@ CB_vcatf(CharBuf *self, const char *patt
break;
case 'u': {
- u64_t val = 0;
+ uint64_t val = 0;
size_t size;
if (pattern[1] == '8') {
- val = va_arg(args, u32_t);
+ val = va_arg(args, uint32_t);
pattern += 1;
}
else if (pattern[1] == '3' && pattern[2] == '2') {
- val = va_arg(args, u32_t);
+ val = va_arg(args, uint32_t);
pattern += 2;
}
else if (pattern[1] == '6' && pattern[2] == '4') {
- val = va_arg(args, u64_t);
+ val = va_arg(args, uint64_t);
pattern += 2;
}
else {
@@ -305,7 +305,7 @@ CB_vcatf(CharBuf *self, const char *patt
case 'x': {
if (pattern[1] == '3' && pattern[2] == '2') {
- unsigned long val = va_arg(args, u32_t);
+ unsigned long val = va_arg(args, uint32_t);
size_t size = sprintf(buf, "%.8lx", val);
CB_Cat_Trusted_Str(self, buf, size);
pattern += 2;
@@ -351,21 +351,21 @@ CB_to_string(CharBuf *self)
}
void
-CB_cat_char(CharBuf *self, u32_t code_point)
+CB_cat_char(CharBuf *self, uint32_t code_point)
{
const size_t MAX_UTF8_BYTES = 4;
if (self->size + MAX_UTF8_BYTES >= self->cap) {
S_grow(self, Memory_oversize(self->size + MAX_UTF8_BYTES,
sizeof(char)));
}
- self->size += StrHelp_encode_utf8_char(code_point, (u8_t*)CBEND(self));
+ self->size += StrHelp_encode_utf8_char(code_point, (uint8_t*)CBEND(self));
*CBEND(self) = '\0';
}
-i32_t
-CB_swap_chars(CharBuf *self, u32_t match, u32_t replacement)
+int32_t
+CB_swap_chars(CharBuf *self, uint32_t match, uint32_t replacement)
{
- i32_t num_swapped = 0;
+ int32_t num_swapped = 0;
if (match > 127) {
THROW(ERR, "match point too high: %u32", match);
@@ -387,17 +387,17 @@ CB_swap_chars(CharBuf *self, u32_t match
return num_swapped;
}
-i64_t
+int64_t
CB_to_i64(CharBuf *self)
{
return CB_BaseX_To_I64(self, 10);
}
-i64_t
-CB_basex_to_i64(CharBuf *self, u32_t base)
+int64_t
+CB_basex_to_i64(CharBuf *self, uint32_t base)
{
ZombieCharBuf *iterator = ZCB_WRAP(self);
- i64_t retval = 0;
+ int64_t retval = 0;
bool_t is_negative = false;
/* Advance past minus sign. */
@@ -408,12 +408,12 @@ CB_basex_to_i64(CharBuf *self, u32_t bas
/* Accumulate. */
while (iterator->size) {
- i32_t code_point = ZCB_Nip_One(iterator);
+ int32_t code_point = ZCB_Nip_One(iterator);
if (isalnum(code_point)) {
- i32_t addend = isdigit(code_point)
- ? code_point - '0'
- : tolower(code_point) - 'a' + 10;
- if (addend > (i32_t)base) break;
+ int32_t addend = isdigit(code_point)
+ ? code_point - '0'
+ : tolower(code_point) - 'a' + 10;
+ if (addend > (int32_t)base) break;
retval *= base;
retval += addend;
}
@@ -560,7 +560,7 @@ CB_equals(CharBuf *self, Obj *other)
return CB_equals_str(self, evil_twin->ptr, evil_twin->size);
}
-i32_t
+int32_t
CB_compare_to(CharBuf *self, Obj *other)
{
return CB_compare(&self, &other);
@@ -592,23 +592,23 @@ CB_ends_with_str(CharBuf *self, const ch
return false;
}
-u32_t
+uint32_t
CB_trim(CharBuf *self)
{
return CB_Trim_Top(self) + CB_Trim_Tail(self);
}
-u32_t
+uint32_t
CB_trim_top(CharBuf *self)
{
- char *ptr = self->ptr;
- char *end = CBEND(self);
- u32_t count = 0;
+ char *ptr = self->ptr;
+ char *end = CBEND(self);
+ uint32_t count = 0;
while (ptr < end) {
- u32_t code_point = StrHelp_decode_utf8_char(ptr);
+ uint32_t code_point = StrHelp_decode_utf8_char(ptr);
if (!StrHelp_is_whitespace(code_point)) break;
- ptr += StrHelp_UTF8_SKIP[*(u8_t*)ptr];
+ ptr += StrHelp_UTF8_SKIP[*(uint8_t*)ptr];
count++;
}
@@ -621,15 +621,15 @@ CB_trim_top(CharBuf *self)
return count;
}
-u32_t
+uint32_t
CB_trim_tail(CharBuf *self)
{
- u32_t count = 0;
+ uint32_t count = 0;
const char *ptr = CBEND(self);
char *const top = self->ptr;
while (NULL != (ptr = StrHelp_back_utf8_char(ptr, top))) {
- u32_t code_point = StrHelp_decode_utf8_char(ptr);
+ uint32_t code_point = StrHelp_decode_utf8_char(ptr);
if (!StrHelp_is_whitespace(code_point)) break;
self->size -= (CBEND(self) - ptr);
count++;
@@ -644,7 +644,7 @@ CB_nip(CharBuf *self, size_t count)
size_t num_nipped = 0;
char *const end = CBEND(self);
char *ptr = self->ptr;
- for ( ; ptr < end && count--; ptr += StrHelp_UTF8_SKIP[*(u8_t*)ptr]) {
+ for ( ; ptr < end && count--; ptr += StrHelp_UTF8_SKIP[*(uint8_t*)ptr]) {
num_nipped++;
}
self->size = end - ptr;
@@ -652,16 +652,16 @@ CB_nip(CharBuf *self, size_t count)
return num_nipped;
}
-i32_t
+int32_t
CB_nip_one(CharBuf *self)
{
if (self->size == 0) {
return 0;
}
else {
- i32_t retval = (i32_t)StrHelp_decode_utf8_char(self->ptr);
- size_t consumed = StrHelp_UTF8_SKIP[*(u8_t*)self->ptr];
- char *ptr = self->ptr + StrHelp_UTF8_SKIP[*(u8_t*)self->ptr];
+ int32_t retval = (int32_t)StrHelp_decode_utf8_char(self->ptr);
+ size_t consumed = StrHelp_UTF8_SKIP[*(uint8_t*)self->ptr];
+ char *ptr = self->ptr + StrHelp_UTF8_SKIP[*(uint8_t*)self->ptr];
self->size -= consumed;
memmove(self->ptr, ptr, self->size);
return retval;
@@ -688,7 +688,7 @@ CB_length(CharBuf *self)
char *ptr = self->ptr;
char *end = CBEND(self);
while (ptr < end) {
- ptr += StrHelp_UTF8_SKIP[*(u8_t*)ptr];
+ ptr += StrHelp_UTF8_SKIP[*(uint8_t*)ptr];
len++;
}
return len;
@@ -697,21 +697,21 @@ CB_length(CharBuf *self)
size_t
CB_truncate(CharBuf *self, size_t count)
{
- u32_t num_code_points;
+ uint32_t num_code_points;
ZombieCharBuf *iterator = ZCB_WRAP(self);
num_code_points = ZCB_Nip(iterator, count);
self->size -= iterator->size;
return num_code_points;
}
-u32_t
+uint32_t
CB_code_point_at(CharBuf *self, size_t tick)
{
size_t count = 0;
char *ptr = self->ptr;
char *const end = CBEND(self);
- for ( ; ptr < end; ptr += StrHelp_UTF8_SKIP[*(u8_t*)ptr]) {
+ for ( ; ptr < end; ptr += StrHelp_UTF8_SKIP[*(uint8_t*)ptr]) {
if (count == tick) return StrHelp_decode_utf8_char(ptr);
count++;
}
@@ -719,7 +719,7 @@ CB_code_point_at(CharBuf *self, size_t t
return 0;
}
-u32_t
+uint32_t
CB_code_point_from(CharBuf *self, size_t tick)
{
size_t count = 0;
@@ -755,9 +755,9 @@ CB_compare(const void *va, const void *v
ZombieCharBuf *iterator_a = ZCB_WRAP(a);
ZombieCharBuf *iterator_b = ZCB_WRAP(b);
while (iterator_a->size && iterator_b->size) {
- i32_t code_point_a = ZCB_Nip_One(iterator_a);
- i32_t code_point_b = ZCB_Nip_One(iterator_b);
- const i32_t comparison = code_point_a - code_point_b;
+ int32_t code_point_a = ZCB_Nip_One(iterator_a);
+ int32_t code_point_b = ZCB_Nip_One(iterator_b);
+ const int32_t comparison = code_point_a - code_point_b;
if (comparison != 0) return comparison;
}
if (iterator_a->size != iterator_b->size) {
@@ -776,8 +776,8 @@ void
CB_set_size(CharBuf *self, size_t size) { self->size = size; }
size_t
CB_get_size(CharBuf *self) { return self->size; }
-u8_t*
-CB_get_ptr8(CharBuf *self) { return (u8_t*)self->ptr; }
+uint8_t*
+CB_get_ptr8(CharBuf *self) { return (uint8_t*)self->ptr; }
/*****************************************************************/
@@ -829,17 +829,17 @@ ViewCB_assign_str(ViewCharBuf *self, con
self->size = size;
}
-u32_t
+uint32_t
ViewCB_trim_top(ViewCharBuf *self)
{
- u32_t count = 0;
- char *ptr = self->ptr;
- char *end = CBEND(self);
+ uint32_t count = 0;
+ char *ptr = self->ptr;
+ char *end = CBEND(self);
while (ptr < end) {
- u32_t code_point = StrHelp_decode_utf8_char(ptr);
+ uint32_t code_point = StrHelp_decode_utf8_char(ptr);
if (!StrHelp_is_whitespace(code_point)) break;
- ptr += StrHelp_UTF8_SKIP[*(u8_t*)ptr];
+ ptr += StrHelp_UTF8_SKIP[*(uint8_t*)ptr];
count++;
}
@@ -859,7 +859,7 @@ ViewCB_nip(ViewCharBuf *self, size_t cou
char *end = CBEND(self);
for (num_nipped = 0;
ptr < end && count--;
- ptr += StrHelp_UTF8_SKIP[*(u8_t*)ptr]
+ ptr += StrHelp_UTF8_SKIP[*(uint8_t*)ptr]
) {
num_nipped++;
}
@@ -868,15 +868,15 @@ ViewCB_nip(ViewCharBuf *self, size_t cou
return num_nipped;
}
-i32_t
+int32_t
ViewCB_nip_one(ViewCharBuf *self)
{
if (self->size == 0) {
return 0;
}
else {
- i32_t retval = (i32_t)StrHelp_decode_utf8_char(self->ptr);
- size_t consumed = StrHelp_UTF8_SKIP[*(u8_t*)self->ptr];
+ int32_t retval = (int32_t)StrHelp_decode_utf8_char(self->ptr);
+ size_t consumed = StrHelp_UTF8_SKIP[*(uint8_t*)self->ptr];
self->ptr += consumed;
self->size -= consumed;
return retval;
Modified: lucene/lucy/trunk/core/Lucy/Object/Err.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Err.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Err.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Err.c Sat Apr 3 00:34:02 2010
@@ -108,9 +108,9 @@ S_vcat_mess(CharBuf *message, const char
CB_Grow(message, guess_len);
CB_VCatF(message, pattern, args);
if (func != NULL)
- CB_catf(message, ", %s at %s line %i32\n", func, file, (i32_t)line);
+ CB_catf(message, ", %s at %s line %i32\n", func, file, (int32_t)line);
else
- CB_catf(message, " at %s line %i32\n", file, (i32_t)line);
+ CB_catf(message, " at %s line %i32\n", file, (int32_t)line);
}
CharBuf*
@@ -146,10 +146,10 @@ Err_add_frame(Err *self, const char *fil
{
if (func != NULL) {
CB_catf(self->mess, ",\n\t %s at %s line %i32\n", func, file,
- (i32_t)line);
+ (int32_t)line);
}
else {
- CB_catf(self->mess, "\n\tat %s line %i32\n", file, (i32_t)line);
+ CB_catf(self->mess, "\n\tat %s line %i32\n", file, (int32_t)line);
}
}
Modified: lucene/lucy/trunk/core/Lucy/Object/Hash.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Hash.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Hash.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Hash.bp Sat Apr 3 00:34:02 2010
@@ -11,20 +11,20 @@ parcel Lucy;
class Lucy::Object::Hash extends Lucy::Object::Obj {
void *entries;
- u32_t capacity;
- u32_t size;
- u32_t threshold; /* rehashing trigger point */
- i32_t iter_tick; /* used when iterating */
+ uint32_t capacity;
+ uint32_t size;
+ uint32_t threshold; /* rehashing trigger point */
+ int32_t iter_tick; /* used when iterating */
inert incremented Hash*
- new(u32_t capacity = 0);
+ new(uint32_t capacity = 0);
/**
* @param capacity The number of elements that the hash will be asked to
* hold initially.
*/
inert Hash*
- init(Hash *self, u32_t capacity = 0);
+ init(Hash *self, uint32_t capacity = 0);
/** Empty the hash of all key-value pairs.
*/
@@ -66,7 +66,7 @@ class Lucy::Object::Hash extends Lucy::O
*
* @return the number of pairs which will be iterated over.
*/
- u32_t
+ uint32_t
Iter_Init(Hash *self);
/** Retrieve the next key-value pair from the hash, setting the supplied
@@ -82,7 +82,7 @@ class Lucy::Object::Hash extends Lucy::O
* rather than its value.
*/
nullable Obj*
- Find_Key(Hash *self, const Obj *key, i32_t hash_code);
+ Find_Key(Hash *self, const Obj *key, int32_t hash_code);
/** Return an VArray of pointers to the hash's keys.
*/
@@ -99,16 +99,16 @@ class Lucy::Object::Hash extends Lucy::O
* true for Equals(). By default, calls Clone().
*/
public incremented Obj*
- Make_Key(Hash *self, Obj *key, i32_t hash_code);
+ Make_Key(Hash *self, Obj *key, int32_t hash_code);
- u32_t
+ uint32_t
Get_Capacity(Hash *self);
/** Accessor for Hash's "size" member.
*
* @return the number of key-value pairs.
*/
- public u32_t
+ public uint32_t
Get_Size(Hash *self);
public bool_t
Modified: lucene/lucy/trunk/core/Lucy/Object/Hash.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Hash.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Hash.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Hash.c Sat Apr 3 00:34:02 2010
@@ -20,9 +20,9 @@
#define HashEntry lucy_HashEntry
typedef struct lucy_HashEntry {
- Obj *key;
- Obj *value;
- i32_t hash_code;
+ Obj *key;
+ Obj *value;
+ int32_t hash_code;
} lucy_HashEntry;
/* Reset the iterator. Hash_iter_init must be called to restart iteration.
@@ -33,7 +33,7 @@ SI_kill_iter(Hash *self);
/* Return the entry associated with the key, if any.
*/
static INLINE HashEntry*
-SI_fetch_entry(Hash *self, const Obj *key, i32_t hash_code);
+SI_fetch_entry(Hash *self, const Obj *key, int32_t hash_code);
/* Double the number of buckets and redistribute all entries.
*
@@ -45,19 +45,19 @@ HashEntry*
lucy_Hash_rebuild_hash(Hash *self);
Hash*
-Hash_new(u32_t capacity)
+Hash_new(uint32_t capacity)
{
Hash *self = (Hash*)VTable_Make_Obj(HASH);
return Hash_init(self, capacity);
}
Hash*
-Hash_init(Hash *self, u32_t capacity)
+Hash_init(Hash *self, uint32_t capacity)
{
/* Allocate enough space to hold the requested number of elements without
* triggering a rebuild. */
- u32_t requested_capacity = capacity < I32_MAX ? capacity : I32_MAX;
- u32_t threshold;
+ uint32_t requested_capacity = capacity < I32_MAX ? capacity : I32_MAX;
+ uint32_t threshold;
capacity = 16;
while (1) {
threshold = (capacity / 3) * 2;
@@ -164,7 +164,7 @@ Hash_serialize(Hash *self, OutStream *ou
{
Obj *key;
Obj *val;
- u32_t charbuf_count = 0;
+ uint32_t charbuf_count = 0;
OutStream_Write_C32(outstream, self->size);
/* Write CharBuf keys first. CharBuf keys are the common case; grouping
@@ -196,9 +196,9 @@ Hash_serialize(Hash *self, OutStream *ou
Hash*
Hash_deserialize(Hash *self, InStream *instream)
{
- u32_t size = InStream_Read_C32(instream);
- u32_t num_charbufs = InStream_Read_C32(instream);
- u32_t num_other = size - num_charbufs;
+ uint32_t size = InStream_Read_C32(instream);
+ uint32_t num_charbufs = InStream_Read_C32(instream);
+ uint32_t num_other = size - num_charbufs;
CharBuf *key = num_charbufs ? CB_new(0) : NULL;
if (self) Hash_init(self, size);
@@ -206,7 +206,7 @@ Hash_deserialize(Hash *self, InStream *i
/* Read key-value pairs with CharBuf keys. */
while (num_charbufs--) {
- u32_t len = InStream_Read_C32(instream);
+ uint32_t len = InStream_Read_C32(instream);
char *key_buf = CB_Grow(key, len);
InStream_Read_Bytes(instream, key_buf, len);
key_buf[len] = '\0';
@@ -246,18 +246,17 @@ Hash_clear(Hash *self)
void
lucy_Hash_do_store(Hash *self, Obj *key, Obj *value,
- i32_t hash_code, bool_t use_this_key)
+ int32_t hash_code, bool_t use_this_key)
{
- HashEntry *entries = self->size >= self->threshold
- ? lucy_Hash_rebuild_hash(self)
- : (HashEntry*)self->entries;
- HashEntry *entry;
- u32_t tick = hash_code;
- const u32_t mask = self->capacity - 1;
+ HashEntry *entries = self->size >= self->threshold
+ ? lucy_Hash_rebuild_hash(self)
+ : (HashEntry*)self->entries;
+ uint32_t tick = hash_code;
+ const uint32_t mask = self->capacity - 1;
while (1) {
tick &= mask;
- entry = entries + tick;
+ HashEntry *entry = entries + tick;
if (entry->key == (Obj*)UNDEF || !entry->key) {
if (entry->key == (Obj*)UNDEF) {
/* Take note of diminished tombstone clutter. */
@@ -297,7 +296,7 @@ Hash_store_str(Hash *self, const char *k
}
Obj*
-Hash_make_key(Hash *self, Obj *key, i32_t hash_code)
+Hash_make_key(Hash *self, Obj *key, int32_t hash_code)
{
UNUSED_VAR(self);
UNUSED_VAR(hash_code);
@@ -312,9 +311,9 @@ Hash_fetch_str(Hash *self, const char *k
}
static INLINE HashEntry*
-SI_fetch_entry(Hash *self, const Obj *key, i32_t hash_code)
+SI_fetch_entry(Hash *self, const Obj *key, int32_t hash_code)
{
- u32_t tick = hash_code;
+ uint32_t tick = hash_code;
HashEntry *const entries = (HashEntry*)self->entries;
HashEntry *entry;
@@ -367,7 +366,7 @@ Hash_delete_str(Hash *self, const char *
return Hash_delete(self, (Obj*)key_buf);
}
-u32_t
+uint32_t
Hash_iter_init(Hash *self)
{
SI_kill_iter(self);
@@ -384,7 +383,7 @@ bool_t
Hash_iter_next(Hash *self, Obj **key, Obj **value)
{
while (1) {
- if (++self->iter_tick >= (i32_t)self->capacity) {
+ if (++self->iter_tick >= (int32_t)self->capacity) {
/* Bail since we've completed the iteration. */
--self->iter_tick;
*key = NULL;
@@ -405,7 +404,7 @@ Hash_iter_next(Hash *self, Obj **key, Ob
}
Obj*
-Hash_find_key(Hash *self, const Obj *key, i32_t hash_code)
+Hash_find_key(Hash *self, const Obj *key, int32_t hash_code)
{
HashEntry *entry = SI_fetch_entry(self, key, hash_code);
return entry ? entry->key : NULL;
@@ -455,9 +454,9 @@ Hash_equals(Hash *self, Obj *other)
return true;
}
-u32_t
+uint32_t
Hash_get_capacity(Hash *self) { return self->capacity; }
-u32_t
+uint32_t
Hash_get_size(Hash *self) { return self->size; }
HashEntry*
Modified: lucene/lucy/trunk/core/Lucy/Object/Host.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Host.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Host.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Host.bp Sat Apr 3 00:34:02 2010
@@ -1,18 +1,18 @@
parcel Lucy;
__C__
-#define LUCY_HOST_ARGTYPE_I32 (chy_i32_t)0x00000001
-#define LUCY_HOST_ARGTYPE_I64 (chy_i32_t)0x00000002
-#define LUCY_HOST_ARGTYPE_F32 (chy_i32_t)0x00000003
-#define LUCY_HOST_ARGTYPE_F64 (chy_i32_t)0x00000004
-#define LUCY_HOST_ARGTYPE_STR (chy_i32_t)0x00000006
-#define LUCY_HOST_ARGTYPE_OBJ (chy_i32_t)0x00000007
-#define LUCY_HOST_ARGTYPE_MASK 0x00000007
+#define LUCY_HOST_ARGTYPE_I32 (int32_t)0x00000001
+#define LUCY_HOST_ARGTYPE_I64 (int32_t)0x00000002
+#define LUCY_HOST_ARGTYPE_F32 (int32_t)0x00000003
+#define LUCY_HOST_ARGTYPE_F64 (int32_t)0x00000004
+#define LUCY_HOST_ARGTYPE_STR (int32_t)0x00000006
+#define LUCY_HOST_ARGTYPE_OBJ (int32_t)0x00000007
+#define LUCY_HOST_ARGTYPE_MASK 0x00000007
#define LUCY_ARG_I32(_label, _value) \
- LUCY_HOST_ARGTYPE_I32, (_label), ((chy_i32_t)_value)
+ LUCY_HOST_ARGTYPE_I32, (_label), ((int32_t)_value)
#define LUCY_ARG_I64(_label, _value) \
- LUCY_HOST_ARGTYPE_I64, (_label), ((chy_i64_t)_value)
+ LUCY_HOST_ARGTYPE_I64, (_label), ((int64_t)_value)
#define LUCY_ARG_F32(_label, _value) \
LUCY_HOST_ARGTYPE_F32, (_label), ((double)_value)
#define LUCY_ARG_F64(_label, _value) \
@@ -38,7 +38,7 @@ __END_C__
* All the callback functions are variadic, and all are designed to take a
* series of arguments using the ARG_XXX macros.
*
- * i32_t area = (i32_t)Host_callback_i64(self, "calc_area", 2,
+ * int32_t area = (int32_t)Host_callback_i64(self, "calc_area", 2,
* ARG_I32("length", len), ARG_I32("width", width) );
*
* The first argument is void* to avoid the need for tiresome casting to Obj*,
@@ -52,18 +52,18 @@ inert class Lucy::Object::Host {
/** Invoke an object method in a void context.
*/
inert void
- callback(void *self, char *method, u32_t num_args, ...);
+ callback(void *self, char *method, uint32_t num_args, ...);
/** Invoke an object method, expecting an integer.
*/
- inert i64_t
- callback_i64(void *self, char *method, u32_t num_args, ...);
+ inert int64_t
+ callback_i64(void *self, char *method, uint32_t num_args, ...);
/** Invoke an object method, expecting a 64-bit floating point return
* value.
*/
inert double
- callback_f64(void *self, char *method, u32_t num_args, ...);
+ callback_f64(void *self, char *method, uint32_t num_args, ...);
/** Invoke an object method, expecting a Obj-derived object back, or
* possibly NULL. In order to ensure that the host environment doesn't
@@ -71,19 +71,19 @@ inert class Lucy::Object::Host {
* caller will have to deal with.
*/
inert incremented nullable Obj*
- callback_obj(void *self, char *method, u32_t num_args, ...);
+ callback_obj(void *self, char *method, uint32_t num_args, ...);
/** Invoke an object method, expecting a host string of some kind back,
* which will be converted into a newly allocated CharBuf.
*/
inert incremented nullable CharBuf*
- callback_str(void *self, char *method, u32_t num_args, ...);
+ callback_str(void *self, char *method, uint32_t num_args, ...);
/** Invoke an object method, expecting a host data structure back. It's
* up to the caller to know how to process it.
*/
inert nullable void*
- callback_host(void *self, char *method, u32_t num_args, ...);
+ callback_host(void *self, char *method, uint32_t num_args, ...);
}
/* Copyright 2009 The Apache Software Foundation
Modified: lucene/lucy/trunk/core/Lucy/Object/I32Array.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/I32Array.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/I32Array.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/I32Array.bp Sat Apr 3 00:34:02 2010
@@ -1,27 +1,27 @@
parcel Lucy;
class Lucy::Object::I32Array cnick I32Arr extends Lucy::Object::Obj {
- i32_t *ints;
- u32_t size;
+ int32_t *ints;
+ uint32_t size;
inert incremented I32Array*
- new(i32_t *ints, u32_t size);
+ new(int32_t *ints, uint32_t size);
inert incremented I32Array*
- new_steal(i32_t *ints, u32_t size);
+ new_steal(int32_t *ints, uint32_t size);
inert I32Array*
- init(I32Array *self, i32_t *ints, u32_t size);
+ init(I32Array *self, int32_t *ints, uint32_t size);
/** Return the value at <code>tick</code>, or throw an error if
* <code>tick</code> is out of bounds.
*/
- i32_t
- Get(I32Array *self, u32_t tick);
+ int32_t
+ Get(I32Array *self, uint32_t tick);
/** Accessor for 'size' member.
*/
- u32_t
+ uint32_t
Get_Size(I32Array *self);
public void
Modified: lucene/lucy/trunk/core/Lucy/Object/I32Array.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/I32Array.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/I32Array.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/I32Array.c Sat Apr 3 00:34:02 2010
@@ -4,23 +4,23 @@
#include "Lucy/Object/I32Array.h"
I32Array*
-I32Arr_new(i32_t *ints, u32_t size)
+I32Arr_new(int32_t *ints, uint32_t size)
{
I32Array *self = (I32Array*)VTable_Make_Obj(I32ARRAY);
- i32_t *ints_copy = (i32_t*)MALLOCATE(size * sizeof(i32_t));
- memcpy(ints_copy, ints, size * sizeof(i32_t));
+ int32_t *ints_copy = (int32_t*)MALLOCATE(size * sizeof(int32_t));
+ memcpy(ints_copy, ints, size * sizeof(int32_t));
return I32Arr_init(self, ints_copy, size);
}
I32Array*
-I32Arr_new_steal(i32_t *ints, u32_t size)
+I32Arr_new_steal(int32_t *ints, uint32_t size)
{
I32Array *self = (I32Array*)VTable_Make_Obj(I32ARRAY);
return I32Arr_init(self, ints, size);
}
I32Array*
-I32Arr_init(I32Array *self, i32_t *ints, u32_t size)
+I32Arr_init(I32Array *self, int32_t *ints, uint32_t size)
{
self->ints = ints;
self->size = size;
@@ -34,8 +34,8 @@ I32Arr_destroy(I32Array *self)
SUPER_DESTROY(self, I32ARRAY);
}
-i32_t
-I32Arr_get(I32Array *self, u32_t tick)
+int32_t
+I32Arr_get(I32Array *self, uint32_t tick)
{
if (tick >= self->size) {
THROW(ERR, "Out of bounds: %u32 >= %u32", tick, self->size);
@@ -43,7 +43,7 @@ I32Arr_get(I32Array *self, u32_t tick)
return self->ints[tick];
}
-u32_t
+uint32_t
I32Arr_get_size(I32Array *self) { return self->size; }
/* Copyright 2009 The Apache Software Foundation
Modified: lucene/lucy/trunk/core/Lucy/Object/LockFreeRegistry.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/LockFreeRegistry.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/LockFreeRegistry.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/LockFreeRegistry.c Sat Apr 3 00:34:02 2010
@@ -9,9 +9,9 @@
#include "Lucy/Util/Memory.h"
typedef struct lucy_LFRegEntry {
- Obj *key;
- Obj *value;
- i32_t hash_code;
+ Obj *key;
+ Obj *value;
+ int32_t hash_code;
struct lucy_LFRegEntry *volatile next;
} lucy_LFRegEntry;
#define LFRegEntry lucy_LFRegEntry
@@ -36,8 +36,8 @@ bool_t
LFReg_register(LockFreeRegistry *self, Obj *key, Obj *value)
{
LFRegEntry *new_entry = NULL;
- i32_t hash_code = Obj_Hash_Code(key);
- size_t bucket = (u32_t)hash_code % self->capacity;
+ int32_t hash_code = Obj_Hash_Code(key);
+ size_t bucket = (uint32_t)hash_code % self->capacity;
LFRegEntry *volatile *entries = (LFRegEntry*volatile*)self->entries;
LFRegEntry *volatile *slot = &(entries[bucket]);
@@ -78,8 +78,8 @@ LFReg_register(LockFreeRegistry *self, O
Obj*
LFReg_fetch(LockFreeRegistry *self, Obj *key)
{
- i32_t hash_code = Obj_Hash_Code(key);
- size_t bucket = (u32_t)hash_code % self->capacity;
+ int32_t hash_code = Obj_Hash_Code(key);
+ size_t bucket = (uint32_t)hash_code % self->capacity;
LFRegEntry **entries = (LFRegEntry**)self->entries;
LFRegEntry *entry = entries[bucket];
Modified: lucene/lucy/trunk/core/Lucy/Object/Num.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Num.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Num.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Num.bp Sat Apr 3 00:34:02 2010
@@ -10,7 +10,7 @@ abstract class Lucy::Object::Num extends
public bool_t
Equals(Num *self, Obj *other);
- public i32_t
+ public int32_t
Compare_To(Num *self, Obj *other);
}
@@ -59,13 +59,13 @@ class Lucy::Object::Float32 extends Lucy
float
Get_Value(Float32 *self);
- public i64_t
+ public int64_t
To_I64(Float32 *self);
public double
To_F64(Float32 *self);
- public i32_t
+ public int32_t
Hash_Code(Float32 *self);
public void
@@ -102,13 +102,13 @@ class Lucy::Object::Float64 extends Lucy
double
Get_Value(Float64 *self);
- public i64_t
+ public int64_t
To_I64(Float64 *self);
public double
To_F64(Float64 *self);
- public i32_t
+ public int32_t
Hash_Code(Float64 *self);
public void
@@ -129,30 +129,30 @@ class Lucy::Object::Float64 extends Lucy
class Lucy::Object::Integer32 cnick Int32
extends Lucy::Object::IntNum {
- i32_t value;
+ int32_t value;
/**
* @param value Initial value.
*/
inert Integer32*
- init(Integer32* self, i32_t value);
+ init(Integer32* self, int32_t value);
inert Integer32*
- new(i32_t value);
+ new(int32_t value);
void
- Set_Value(Integer32 *self, i32_t value);
+ Set_Value(Integer32 *self, int32_t value);
- i32_t
+ int32_t
Get_Value(Integer32 *self);
- public i64_t
+ public int64_t
To_I64(Integer32 *self);
public double
To_F64(Integer32 *self);
- public i32_t
+ public int32_t
Hash_Code(Integer32 *self);
public void
@@ -174,30 +174,30 @@ class Lucy::Object::Integer32 cnick Int3
class Lucy::Object::Integer64 cnick Int64
extends Lucy::Object::IntNum {
- i64_t value;
+ int64_t value;
/**
* @param value Initial value.
*/
inert Integer64*
- init(Integer64* self, i64_t value);
+ init(Integer64* self, int64_t value);
inert Integer64*
- new(i64_t value);
+ new(int64_t value);
void
- Set_Value(Integer64 *self, i64_t value);
+ Set_Value(Integer64 *self, int64_t value);
- i64_t
+ int64_t
Get_Value(Integer64 *self);
- public i64_t
+ public int64_t
To_I64(Integer64 *self);
public double
To_F64(Integer64 *self);
- public i32_t
+ public int32_t
Hash_Code(Integer64 *self);
public bool_t
Modified: lucene/lucy/trunk/core/Lucy/Object/Num.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Num.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Num.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Num.c Sat Apr 3 00:34:02 2010
@@ -33,7 +33,7 @@ Num_equals(Num *self, Obj *other)
return true;
}
-i32_t
+int32_t
Num_compare_to(Num *self, Obj *other)
{
Num *evil_twin = (Num*)CERTIFY(other, NUM);
@@ -43,7 +43,7 @@ Num_compare_to(Num *self, Obj *other)
else if (f64_diff > 0) { return 1; }
}
else {
- i64_t i64_diff = Num_To_I64(self) - Num_To_I64(evil_twin);
+ int64_t i64_diff = Num_To_I64(self) - Num_To_I64(evil_twin);
if (i64_diff) {
if (i64_diff < 0) { return -1; }
else if (i64_diff > 0) { return 1; }
@@ -109,16 +109,16 @@ Float32_to_f64(Float32 *self)
return self->value;
}
-i64_t
+int64_t
Float32_to_i64(Float32 *self)
{
- return (i64_t)self->value;
+ return (int64_t)self->value;
}
-i32_t
+int32_t
Float32_hash_code(Float32 *self)
{
- return *(i32_t*)&self->value;
+ return *(int32_t*)&self->value;
}
Float32*
@@ -174,10 +174,10 @@ Float64_to_f64(Float64 *self)
return self->value;
}
-i64_t
+int64_t
Float64_to_i64(Float64 *self)
{
- return (i64_t)self->value;
+ return (int64_t)self->value;
}
Float64*
@@ -193,10 +193,10 @@ Float64_mimic(Float64 *self, Obj *other)
self->value = evil_twin->value;
}
-i32_t
+int32_t
Float64_hash_code(Float64 *self)
{
- i32_t *ints = (i32_t*)&self->value;
+ int32_t *ints = (int32_t*)&self->value;
return ints[0] ^ ints[1];
}
@@ -216,23 +216,23 @@ Float64_deserialize(Float64 *self, InStr
/***************************************************************************/
Integer32*
-Int32_new(i32_t value)
+Int32_new(int32_t value)
{
Integer32 *self = (Integer32*)VTable_Make_Obj(INTEGER32);
return Int32_init(self, value);
}
Integer32*
-Int32_init(Integer32 *self, i32_t value)
+Int32_init(Integer32 *self, int32_t value)
{
self->value = value;
return (Integer32*)IntNum_init((IntNum*)self);
}
-i32_t
+int32_t
Int32_get_value(Integer32 *self) { return self->value; }
void
-Int32_set_value(Integer32 *self, i32_t value) { self->value = value; }
+Int32_set_value(Integer32 *self, int32_t value) { self->value = value; }
double
Int32_to_f64(Integer32 *self)
@@ -240,7 +240,7 @@ Int32_to_f64(Integer32 *self)
return self->value;
}
-i64_t
+int64_t
Int32_to_i64(Integer32 *self)
{
return self->value;
@@ -259,7 +259,7 @@ Int32_mimic(Integer32 *self, Obj *other)
self->value = evil_twin->value;
}
-i32_t
+int32_t
Int32_hash_code(Integer32 *self)
{
return self->value;
@@ -268,36 +268,36 @@ Int32_hash_code(Integer32 *self)
void
Int32_serialize(Integer32 *self, OutStream *outstream)
{
- OutStream_Write_C32(outstream, (u32_t)self->value);
+ OutStream_Write_C32(outstream, (uint32_t)self->value);
}
Integer32*
Int32_deserialize(Integer32 *self, InStream *instream)
{
- i32_t value = (i32_t)InStream_Read_C32(instream);
+ int32_t value = (int32_t)InStream_Read_C32(instream);
return self ? Int32_init(self, value) : Int32_new(value);
}
/***************************************************************************/
Integer64*
-Int64_new(i64_t value)
+Int64_new(int64_t value)
{
Integer64 *self = (Integer64*)VTable_Make_Obj(INTEGER64);
return Int64_init(self, value);
}
Integer64*
-Int64_init(Integer64 *self, i64_t value)
+Int64_init(Integer64 *self, int64_t value)
{
self->value = value;
return (Integer64*)FloatNum_init((FloatNum*)self);
}
-i64_t
+int64_t
Int64_get_value(Integer64 *self) { return self->value; }
void
-Int64_set_value(Integer64 *self, i64_t value) { self->value = value; }
+Int64_set_value(Integer64 *self, int64_t value) { self->value = value; }
double
Int64_to_f64(Integer64 *self)
@@ -305,7 +305,7 @@ Int64_to_f64(Integer64 *self)
return (double)self->value;
}
-i64_t
+int64_t
Int64_to_i64(Integer64 *self)
{
return self->value;
@@ -324,10 +324,10 @@ Int64_mimic(Integer64 *self, Obj *other)
self->value = evil_twin->value;
}
-i32_t
+int32_t
Int64_hash_code(Integer64 *self)
{
- i32_t *ints = (i32_t*)&self->value;
+ int32_t *ints = (int32_t*)&self->value;
return ints[0] ^ ints[1];
}
@@ -338,8 +338,8 @@ Int64_equals(Integer64 *self, Obj *other
if (evil_twin == (Num*)self) { return true; }
if (!Obj_Is_A(other, NUM)) { return false; }
if (Num_Is_A(evil_twin, FLOATNUM)) {
- double floating_val = Num_To_F64(evil_twin);
- i64_t int_val = (i64_t)floating_val;
+ double floating_val = Num_To_F64(evil_twin);
+ int64_t int_val = (int64_t)floating_val;
if ((double)int_val != floating_val) { return false; }
if (int_val != self->value) { return false; }
}
@@ -352,13 +352,13 @@ Int64_equals(Integer64 *self, Obj *other
void
Int64_serialize(Integer64 *self, OutStream *outstream)
{
- OutStream_Write_C64(outstream, (u64_t)self->value);
+ OutStream_Write_C64(outstream, (uint64_t)self->value);
}
Integer64*
Int64_deserialize(Integer64 *self, InStream *instream)
{
- i64_t value = (i64_t)InStream_Read_C64(instream);
+ int64_t value = (int64_t)InStream_Read_C64(instream);
return self ? Int64_init(self, value) : Int64_new(value);
}
Modified: lucene/lucy/trunk/core/Lucy/Object/Obj.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Obj.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Obj.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Obj.bp Sat Apr 3 00:34:02 2010
@@ -20,7 +20,7 @@ class Lucy::Object::Obj {
/** Return an object's refcount.
*/
- u32_t
+ uint32_t
Get_RefCount(Obj *self);
/** Increment an object's refcount.
@@ -42,7 +42,7 @@ class Lucy::Object::Obj {
*
* @return the modified refcount.
*/
- u32_t
+ uint32_t
Dec_RefCount(Obj *self);
/** NULL-safe invocation of Dec_RefCount().
@@ -50,7 +50,7 @@ class Lucy::Object::Obj {
* @return NULL if <code>self</code> is NULL, otherwise the return value
* of Dec_RefCount().
*/
- inert inline u32_t
+ inert inline uint32_t
decref(Obj *self);
/** Return a host-language object wrapper for this object.
@@ -93,12 +93,12 @@ class Lucy::Object::Obj {
* <code>self</code> is less than <code>other</code>, and a positive
* number if <code>self</code> is greater than <code>other</code>.
*/
- public abstract i32_t
+ public abstract int32_t
Compare_To(Obj *self, Obj *other);
/** Return a hash code for the object -- by default, the memory address.
*/
- public i32_t
+ public int32_t
Hash_Code(Obj *self);
/** Return the object's VTable.
@@ -123,7 +123,7 @@ class Lucy::Object::Obj {
/** Convert the object to a 64-bit integer.
*/
- public abstract i64_t
+ public abstract int64_t
To_I64(Obj *self);
/** Convert the object to a double precision floating point number.
@@ -190,7 +190,7 @@ lucy_Obj_incref(lucy_Obj *self)
#define LUCY_INCREF(_self) lucy_Obj_incref((lucy_Obj*)_self)
-static CHY_INLINE chy_u32_t
+static CHY_INLINE uint32_t
lucy_Obj_decref(lucy_Obj *self)
{
if (self != NULL) { return Lucy_Obj_Dec_RefCount(self); }
Modified: lucene/lucy/trunk/core/Lucy/Object/Obj.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Obj.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Obj.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Obj.c Sat Apr 3 00:34:02 2010
@@ -29,10 +29,10 @@ Obj_destroy(Obj *self)
FREEMEM(self);
}
-i32_t
+int32_t
Obj_hash_code(Obj *self)
{
- return (i32_t)self;
+ return (int32_t)self;
}
bool_t
@@ -86,8 +86,8 @@ Obj_to_string(Obj *self)
return CB_newf("%o@0x%x32", Obj_Get_Class_Name(self), self);
#elif (SIZEOF_PTR == 8)
size_t address = self;
- u32_t address_hi = address >> 32;
- u32_t address_lo = address & 0xFFFFFFFF;
+ uint32_t address_hi = address >> 32;
+ uint32_t address_lo = address & 0xFFFFFFFF;
return CB_newf("%o@0x%x32%x32", Obj_Get_Class_Name(self), address_hi,
address_lo);
#endif
Modified: lucene/lucy/trunk/core/Lucy/Object/Undefined.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Undefined.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Undefined.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Undefined.bp Sat Apr 3 00:34:02 2010
@@ -2,13 +2,13 @@ parcel Lucy;
class Lucy::Object::Undefined extends Lucy::Object::Obj {
- u32_t
+ uint32_t
Get_RefCount(Undefined* self);
incremented Undefined*
Inc_RefCount(Undefined* self);
- u32_t
+ uint32_t
Dec_RefCount(Undefined* self);
}
Modified: lucene/lucy/trunk/core/Lucy/Object/Undefined.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/Undefined.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/Undefined.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/Undefined.c Sat Apr 3 00:34:02 2010
@@ -8,7 +8,7 @@
static Undefined the_undef_object = { UNDEFINED, {1} };
Undefined *UNDEF = &the_undef_object;
-u32_t
+uint32_t
Undefined_get_refcount(Undefined* self)
{
CHY_UNUSED_VAR(self);
@@ -21,7 +21,7 @@ Undefined_inc_refcount(Undefined* self)
return self;
}
-u32_t
+uint32_t
Undefined_dec_refcount(Undefined* self)
{
UNUSED_VAR(self);
Modified: lucene/lucy/trunk/core/Lucy/Object/VArray.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/VArray.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/VArray.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/VArray.bp Sat Apr 3 00:34:02 2010
@@ -4,7 +4,7 @@ __C__
#include "Lucy/Util/SortUtils.h"
typedef chy_bool_t
-(*lucy_VA_grep_test_t)(lucy_VArray *self, chy_u32_t tick, void *data);
+(*lucy_VA_grep_test_t)(lucy_VArray *self, uint32_t tick, void *data);
#ifdef LUCY_USE_SHORT_NAMES
#define VA_grep_test_t lucy_VA_grep_test_t
@@ -15,19 +15,19 @@ __END_C__
*/
class Lucy::Object::VArray cnick VA extends Lucy::Object::Obj {
- Obj **elems;
- u32_t size;
- u32_t cap;
+ Obj **elems;
+ uint32_t size;
+ uint32_t cap;
inert incremented VArray*
- new(u32_t capacity);
+ new(uint32_t capacity);
/**
* @param capacity Initial number of elements that the object will be able
* to hold before reallocation.
*/
inert VArray*
- init(VArray *self, u32_t capacity);
+ init(VArray *self, uint32_t capacity);
/** Push an item onto the end of a VArray.
*/
@@ -58,31 +58,31 @@ class Lucy::Object::VArray cnick VA exte
* elements.
*/
void
- Grow(VArray *self, u32_t capacity);
+ Grow(VArray *self, uint32_t capacity);
/** Fetch the element at <code>tick</tick>.
*/
nullable Obj*
- Fetch(VArray *self, u32_t tick);
+ Fetch(VArray *self, uint32_t tick);
/** Store an element at index <code>tick</code>, possibly displacing an
* existing element.
*/
void
- Store(VArray *self, u32_t tick, decremented Obj *elem);
+ Store(VArray *self, uint32_t tick, decremented Obj *elem);
/** Replace an element in the VArray with NULL and return it.
*
* @return whatever was stored at <code>tick</code>.
*/
incremented nullable Obj*
- Delete(VArray *self, u32_t tick);
+ Delete(VArray *self, uint32_t tick);
/** Remove <code>length</code> elements from the array, starting at
* <code>offset</code>. Move elements over to fill in the gap.
*/
void
- Splice(VArray *self, u32_t offset, u32_t length);
+ Splice(VArray *self, uint32_t offset, uint32_t length);
/** Clone the VArray but merely increment the refcounts of its elements
* rather than clone them.
@@ -114,7 +114,7 @@ class Lucy::Object::VArray cnick VA exte
* than the current size, decrement and discard truncated elements.
*/
void
- Resize(VArray *self, u32_t size);
+ Resize(VArray *self, uint32_t size);
/** Empty the VArray.
*/
@@ -123,12 +123,12 @@ class Lucy::Object::VArray cnick VA exte
/** Accessor for <code>size</code> member.
*/
- public u32_t
+ public uint32_t
Get_Size(VArray *self);
/** Accessor for <code>capacity</code> member.
*/
- u32_t
+ uint32_t
Get_Capacity(VArray *self);
/** Return all elements for which <code>test</code> returns true.
Modified: lucene/lucy/trunk/core/Lucy/Object/VArray.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/VArray.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/VArray.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/VArray.c Sat Apr 3 00:34:02 2010
@@ -15,7 +15,7 @@
#include "Lucy/Store/OutStream.h"
VArray*
-VA_new(u32_t capacity)
+VA_new(uint32_t capacity)
{
VArray *self = (VArray*)VTable_Make_Obj(VARRAY);
VA_init(self, capacity);
@@ -23,7 +23,7 @@ VA_new(u32_t capacity)
}
VArray*
-VA_init(VArray *self, u32_t capacity)
+VA_init(VArray *self, uint32_t capacity)
{
/* Init. */
self->size = 0;
@@ -55,7 +55,7 @@ VArray*
VA_dump(VArray *self)
{
VArray *dump = VA_new(self->size);
- u32_t i, max;
+ uint32_t i, max;
for (i = 0, max = self->size; i < max; i++) {
Obj *elem = VA_Fetch(self, i);
if (elem) { VA_Store(dump, i, Obj_Dump(elem)); }
@@ -68,7 +68,7 @@ VA_load(VArray *self, Obj *dump)
{
VArray *source = (VArray*)CERTIFY(dump, VARRAY);
VArray *loaded = VA_new(source->size);
- u32_t i, max;
+ uint32_t i, max;
UNUSED_VAR(self);
for (i = 0, max = source->size; i < max; i++) {
@@ -84,8 +84,8 @@ VA_load(VArray *self, Obj *dump)
void
VA_serialize(VArray *self, OutStream *outstream)
{
- u32_t i;
- u32_t last_valid_tick = 0;
+ uint32_t i;
+ uint32_t last_valid_tick = 0;
OutStream_Write_C32(outstream, self->size);
for (i = 0; i < self->size; i++) {
Obj *elem = self->elems[i];
@@ -102,8 +102,8 @@ VA_serialize(VArray *self, OutStream *ou
VArray*
VA_deserialize(VArray *self, InStream *instream)
{
- u32_t tick;
- u32_t size = InStream_Read_C32(instream);
+ uint32_t tick;
+ uint32_t size = InStream_Read_C32(instream);
if (self) {
self->size = size;
self->cap = size + 1;
@@ -124,7 +124,7 @@ VA_deserialize(VArray *self, InStream *i
VArray*
VA_clone(VArray *self)
{
- u32_t i;
+ uint32_t i;
VArray *evil_twin = VA_new(self->size);
/* Clone each element. */
@@ -144,7 +144,7 @@ VA_clone(VArray *self)
VArray*
VA_shallow_copy(VArray *self)
{
- u32_t i;
+ uint32_t i;
VArray *evil_twin;
Obj **elems;
@@ -174,9 +174,9 @@ VA_push(VArray *self, Obj *element)
void
VA_push_varray(VArray *self, VArray *other)
{
- u32_t i;
- u32_t tick = self->size;
- u32_t new_size = self->size + other->size;
+ uint32_t i;
+ uint32_t tick = self->size;
+ uint32_t new_size = self->size + other->size;
if (new_size > self->cap) {
VA_Grow(self, Memory_oversize(new_size, sizeof(Obj*)));
}
@@ -227,7 +227,7 @@ VA_shift(VArray *self)
}
Obj*
-VA_fetch(VArray *self, u32_t num)
+VA_fetch(VArray *self, uint32_t num)
{
if (num >= self->size)
return NULL;
@@ -236,7 +236,7 @@ VA_fetch(VArray *self, u32_t num)
}
void
-VA_store(VArray *self, u32_t tick, Obj *elem)
+VA_store(VArray *self, uint32_t tick, Obj *elem)
{
if (tick >= self->cap) {
VA_Grow(self, Memory_oversize(tick + 1, sizeof(Obj*)));
@@ -247,7 +247,7 @@ VA_store(VArray *self, u32_t tick, Obj *
}
void
-VA_grow(VArray *self, u32_t capacity)
+VA_grow(VArray *self, uint32_t capacity)
{
if (capacity > self->cap) {
self->elems = (Obj**)REALLOCATE(self->elems, capacity * sizeof(Obj*));
@@ -258,7 +258,7 @@ VA_grow(VArray *self, u32_t capacity)
}
Obj*
-VA_delete(VArray *self, u32_t num)
+VA_delete(VArray *self, uint32_t num)
{
Obj *elem = NULL;
if (num < self->size) {
@@ -269,10 +269,10 @@ VA_delete(VArray *self, u32_t num)
}
void
-VA_splice(VArray *self, u32_t offset, u32_t length)
+VA_splice(VArray *self, uint32_t offset, uint32_t length)
{
- u32_t i;
- u32_t num_to_move;
+ uint32_t i;
+ uint32_t num_to_move;
if (self->size <= offset) return;
else if (self->size < offset + length) length = self->size - offset;
@@ -294,7 +294,7 @@ VA_clear(VArray *self)
}
void
-VA_resize(VArray *self, u32_t size)
+VA_resize(VArray *self, uint32_t size)
{
if (size < self->size) {
VA_Splice(self, size, self->size - size);
@@ -305,9 +305,9 @@ VA_resize(VArray *self, u32_t size)
self->size = size;
}
-u32_t
+uint32_t
VA_get_size(VArray *self) { return self->size; }
-u32_t
+uint32_t
VA_get_capacity(VArray *self) { return self->cap; }
static int
@@ -339,7 +339,7 @@ VA_equals(VArray *self, Obj *other)
return false;
}
else {
- u32_t i, max;
+ uint32_t i, max;
for (i = 0, max = self->size; i < max; i++) {
Obj *val = self->elems[i];
Obj *other_val = evil_twin->elems[i];
@@ -353,7 +353,7 @@ VA_equals(VArray *self, Obj *other)
VArray*
VA_grep(VArray *self, VA_grep_test_t test, void *data)
{
- u32_t i, max;
+ uint32_t i, max;
VArray *grepped = VA_new(self->size);
for (i = 0, max = self->size; i < max; i++) {
if (test(self, i, data)) {
Modified: lucene/lucy/trunk/core/Lucy/Object/VTable.bp
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/VTable.bp?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/VTable.bp (original)
+++ lucene/lucy/trunk/core/Lucy/Object/VTable.bp Sat Apr 3 00:34:02 2010
@@ -11,7 +11,7 @@ class Lucy::Object::VTable extends Lucy:
VTable *parent;
CharBuf *name;
- u32_t flags;
+ uint32_t flags;
void *x; /* Reserved for future expansion */
size_t obj_alloc_size;
size_t vt_alloc_size;
@@ -112,10 +112,10 @@ class Lucy::Object::VTable extends Lucy:
incremented Obj*
Inc_RefCount(VTable *self);
- u32_t
+ uint32_t
Dec_RefCount(VTable *self);
- u32_t
+ uint32_t
Get_RefCount(VTable *self);
void*
Modified: lucene/lucy/trunk/core/Lucy/Object/VTable.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Object/VTable.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Object/VTable.c (original)
+++ lucene/lucy/trunk/core/Lucy/Object/VTable.c Sat Apr 3 00:34:02 2010
@@ -49,14 +49,14 @@ VTable_inc_refcount(VTable *self)
return (Obj*)self;
}
-u32_t
+uint32_t
VTable_dec_refcount(VTable *self)
{
UNUSED_VAR(self);
return 1;
}
-u32_t
+uint32_t
VTable_get_refcount(VTable *self)
{
UNUSED_VAR(self);
@@ -112,7 +112,7 @@ VTable_singleton(const CharBuf *subclass
VTable *singleton = (VTable*)LFReg_Fetch(VTable_registry, (Obj*)subclass_name);
if (singleton == NULL) {
VArray *novel_host_methods;
- u32_t num_novel;
+ uint32_t num_novel;
if (parent == NULL) {
CharBuf *parent_class = VTable_find_parent_class(subclass_name);
@@ -139,7 +139,7 @@ VTable_singleton(const CharBuf *subclass
num_novel = VA_Get_Size(novel_host_methods);
if (num_novel) {
Hash *meths = Hash_new(num_novel);
- u32_t i;
+ uint32_t i;
CharBuf *scrunched = CB_new(0);
ZombieCharBuf *callback_name = ZCB_BLANK();
for (i = 0; i < num_novel; i++) {
@@ -214,7 +214,7 @@ S_scrunch_charbuf(CharBuf *source, CharB
ZombieCharBuf *iterator = ZCB_WRAP(source);
CB_Set_Size(target, 0);
while (ZCB_Get_Size(iterator)) {
- u32_t code_point = ZCB_Nip_One(iterator);
+ uint32_t code_point = ZCB_Nip_One(iterator);
if (code_point > 127) {
THROW(ERR, "Can't fold case for %o", source);
}
Modified: lucene/lucy/trunk/core/Lucy/Test/Object/TestBitVector.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Test/Object/TestBitVector.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Test/Object/TestBitVector.c (original)
+++ lucene/lucy/trunk/core/Lucy/Test/Object/TestBitVector.c Sat Apr 3 00:34:02 2010
@@ -9,9 +9,9 @@ static void
test_Set_and_Get(TestBatch *batch)
{
unsigned i, max;
- const u32_t three = 3;
- const u32_t seventeen = 17;
- BitVector *bit_vec = BitVec_new(8);
+ const uint32_t three = 3;
+ const uint32_t seventeen = 17;
+ BitVector *bit_vec = BitVec_new(8);
BitVec_Set(bit_vec, three);
ASSERT_TRUE(batch, BitVec_Get_Capacity(bit_vec) < seventeen,
@@ -104,10 +104,10 @@ test_Flip_Block_descending(TestBatch *ba
static void
test_Flip_Block_bulk(TestBatch *batch)
{
- i32_t offset;
+ int32_t offset;
for (offset = 0; offset <= 17; offset++) {
- i32_t len;
+ int32_t len;
for (len = 0; len <= 17; len++) {
int i;
int upper = offset + len - 1;
@@ -310,7 +310,7 @@ test_Count(TestBatch *batch)
}
for (i = 0; i < 64; i++) {
BitVec_Set(bit_vec, shuffled[i]);
- if (BitVec_Count(bit_vec) != (u32_t)(i + 1)) { break; }
+ if (BitVec_Count(bit_vec) != (uint32_t)(i + 1)) { break; }
}
ASSERT_INT_EQ(batch, i, 64, "Count() returns the right number of bits");
@@ -378,8 +378,8 @@ test_Clone(TestBatch *batch)
static int
S_compare_u64s(void *context, const void *va, const void *vb)
{
- u64_t a = *(u64_t*)va;
- u64_t b = *(u64_t*)vb;
+ uint64_t a = *(uint64_t*)va;
+ uint64_t b = *(uint64_t*)vb;
UNUSED_VAR(context);
return a == b ? 0 : a < b ? -1 : 1;
}
@@ -387,14 +387,14 @@ S_compare_u64s(void *context, const void
static void
test_To_Array(TestBatch *batch)
{
- u64_t *source_ints = TestUtils_random_u64s(NULL, 20, 0, 200);
+ uint64_t *source_ints = TestUtils_random_u64s(NULL, 20, 0, 200);
BitVector *bit_vec = BitVec_new(0);
I32Array *array;
long num_unique = 0;
long i;
/* Unique the random ints. */
- Sort_quicksort(source_ints, 20, sizeof(u64_t),
+ Sort_quicksort(source_ints, 20, sizeof(uint64_t),
S_compare_u64s, NULL);
for (i = 0; i < 19; i++) {
if (source_ints[i] != source_ints[i + 1]) {
@@ -405,13 +405,13 @@ test_To_Array(TestBatch *batch)
/* Set bits. */
for (i = 0; i < num_unique; i++) {
- BitVec_Set(bit_vec, (u32_t)source_ints[i]);
+ BitVec_Set(bit_vec, (uint32_t)source_ints[i]);
}
/* Create the array and compare it to the source. */
array = BitVec_To_Array(bit_vec);
for (i = 0; i < num_unique; i++) {
- if (I32Arr_Get(array, i) != (i32_t)source_ints[i]) { break; }
+ if (I32Arr_Get(array, i) != (int32_t)source_ints[i]) { break; }
}
ASSERT_INT_EQ(batch, i, num_unique, "To_Array (%ld == %ld)", i,
num_unique);
Modified: lucene/lucy/trunk/core/Lucy/Test/Object/TestCharBuf.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Test/Object/TestCharBuf.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Test/Object/TestCharBuf.c (original)
+++ lucene/lucy/trunk/core/Lucy/Test/Object/TestCharBuf.c Sat Apr 3 00:34:02 2010
@@ -9,7 +9,7 @@
#include "Lucy/Test/Object/TestCharBuf.h"
static char smiley[] = { (char)0xE2, (char)0x98, (char)0xBA, 0 };
-static u32_t smiley_len = 3;
+static uint32_t smiley_len = 3;
static CharBuf*
S_get_cb(char *string)
@@ -70,13 +70,13 @@ test_Mimic_and_Clone(TestBatch *batch)
static void
test_Code_Point_At_and_From(TestBatch *batch)
{
- u32_t code_points[] = { 'a', 0x263A, 0x263A, 'b', 0x263A, 'c' };
- u32_t num_code_points = sizeof(code_points) / sizeof(u32_t);
+ uint32_t code_points[] = { 'a', 0x263A, 0x263A, 'b', 0x263A, 'c' };
+ uint32_t num_code_points = sizeof(code_points) / sizeof(uint32_t);
CharBuf *string = CB_newf("a%s%sb%sc", smiley, smiley, smiley);
- u32_t i;
+ uint32_t i;
for (i = 0; i < num_code_points; i++) {
- u32_t from = num_code_points - i - 1;
+ uint32_t from = num_code_points - i - 1;
ASSERT_INT_EQ(batch, CB_Code_Point_At(string, i), code_points[i],
"Code_Point_At %ld", (long)i);
ASSERT_INT_EQ(batch, CB_Code_Point_At(string, from),
@@ -134,14 +134,14 @@ test_Truncate(TestBatch *batch)
static void
test_Trim(TestBatch *batch)
{
- u32_t spaces[] = {
+ uint32_t spaces[] = {
' ', '\t', '\r', '\n', 0x000B, 0x000C, 0x000D, 0x0085,
0x00A0, 0x1680, 0x180E, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004,
0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029,
0x202F, 0x205F, 0x3000
};
- u32_t num_spaces = sizeof(spaces) / sizeof(u32_t);
- u32_t i;
+ uint32_t num_spaces = sizeof(spaces) / sizeof(uint32_t);
+ uint32_t i;
CharBuf *got = CB_new(0);
/* Surround a smiley with lots of whitespace. */
@@ -262,7 +262,7 @@ static void
test_vcatf_i8(TestBatch *batch)
{
CharBuf *wanted = S_get_cb("foo bar -3 baz");
- i8_t num = -3;
+ int8_t num = -3;
CharBuf *got = S_get_cb("foo ");
CB_catf(got, "bar %i8 baz", num);
ASSERT_TRUE(batch, CB_Equals(wanted, (Obj*)got), "%%i8");
@@ -274,7 +274,7 @@ static void
test_vcatf_i32(TestBatch *batch)
{
CharBuf *wanted = S_get_cb("foo bar -100000 baz");
- i32_t num = -100000;
+ int32_t num = -100000;
CharBuf *got = S_get_cb("foo ");
CB_catf(got, "bar %i32 baz", num);
ASSERT_TRUE(batch, CB_Equals(wanted, (Obj*)got), "%%i32");
@@ -286,7 +286,7 @@ static void
test_vcatf_i64(TestBatch *batch)
{
CharBuf *wanted = S_get_cb("foo bar -5000000000 baz");
- i64_t num = I64_C(-5000000000);
+ int64_t num = I64_C(-5000000000);
CharBuf *got = S_get_cb("foo ");
CB_catf(got, "bar %i64 baz", num);
ASSERT_TRUE(batch, CB_Equals(wanted, (Obj*)got), "%%i64");
@@ -298,7 +298,7 @@ static void
test_vcatf_u8(TestBatch *batch)
{
CharBuf *wanted = S_get_cb("foo bar 3 baz");
- u8_t num = 3;
+ uint8_t num = 3;
CharBuf *got = S_get_cb("foo ");
CB_catf(got, "bar %u8 baz", num);
ASSERT_TRUE(batch, CB_Equals(wanted, (Obj*)got), "%%u8");
@@ -310,7 +310,7 @@ static void
test_vcatf_u32(TestBatch *batch)
{
CharBuf *wanted = S_get_cb("foo bar 100000 baz");
- u32_t num = 100000;
+ uint32_t num = 100000;
CharBuf *got = S_get_cb("foo ");
CB_catf(got, "bar %u32 baz", num);
ASSERT_TRUE(batch, CB_Equals(wanted, (Obj*)got), "%%u32");
@@ -322,7 +322,7 @@ static void
test_vcatf_u64(TestBatch *batch)
{
CharBuf *wanted = S_get_cb("foo bar 5000000000 baz");
- u64_t num = U64_C(5000000000);
+ uint64_t num = U64_C(5000000000);
CharBuf *got = S_get_cb("foo ");
CB_catf(got, "bar %u64 baz", num);
ASSERT_TRUE(batch, CB_Equals(wanted, (Obj*)got), "%%u64");
@@ -358,7 +358,7 @@ test_vcatf_x32(TestBatch *batch)
sprintf(buf, "foo bar %.8x baz", (unsigned)num);
#endif
wanted = CB_new_from_trusted_utf8(buf, strlen(buf));
- CB_catf(got, "bar %x32 baz", (u32_t)num);
+ CB_catf(got, "bar %x32 baz", (uint32_t)num);
ASSERT_TRUE(batch, CB_Equals(wanted, (Obj*)got), "%%x32");
DECREF(wanted);
DECREF(got);
Modified: lucene/lucy/trunk/core/Lucy/Test/Object/TestHash.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Test/Object/TestHash.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Test/Object/TestHash.c (original)
+++ lucene/lucy/trunk/core/Lucy/Test/Object/TestHash.c Sat Apr 3 00:34:02 2010
@@ -11,12 +11,12 @@
static CharBuf*
S_random_string()
{
- u32_t len = rand() % 1200;
+ uint32_t len = rand() % 1200;
CharBuf *string = CB_new(len * 3);
while (len--) {
- u8_t bytes = (rand() % 3) + 1;
- u32_t code_point = 0;
+ uint8_t bytes = (rand() % 3) + 1;
+ uint32_t code_point = 0;
switch (bytes & 0x3) {
case 1:
code_point = rand() % 0x80;
@@ -64,13 +64,13 @@ test_Store_and_Fetch(TestBatch *batch)
{
Hash *hash = Hash_new(100);
Hash *dupe = Hash_new(100);
- const u32_t starting_cap = Hash_Get_Capacity(hash);
+ const uint32_t starting_cap = Hash_Get_Capacity(hash);
VArray *expected = VA_new(100);
VArray *got = VA_new(100);
ZombieCharBuf *twenty = ZCB_WRAP_STR("20", 2);
ZombieCharBuf *forty = ZCB_WRAP_STR("40", 2);
ZombieCharBuf *foo = ZCB_WRAP_STR("foo", 3);
- i32_t i;
+ int32_t i;
for (i = 0; i < 100; i++) {
CharBuf *cb = CB_newf("%i32", i);
@@ -130,7 +130,7 @@ test_Store_and_Fetch(TestBatch *batch)
static void
test_Keys_Values_Iter(TestBatch *batch)
{
- u32_t i;
+ uint32_t i;
Hash *hash = Hash_new(0); /* trigger multiple rebuilds. */
VArray *expected = VA_new(100);
VArray *keys;
@@ -222,7 +222,7 @@ test_serialization(TestBatch *batch)
{
Hash *wanted = Hash_new(0);
Hash *got;
- u32_t i;
+ uint32_t i;
for (i = 0; i < 10; i++) {
CharBuf *cb = S_random_string();
@@ -242,7 +242,7 @@ test_serialization(TestBatch *batch)
static void
test_stress(TestBatch *batch)
{
- u32_t i;
+ uint32_t i;
Hash *hash = Hash_new(0); /* trigger multiple rebuilds. */
VArray *expected = VA_new(1000);
VArray *keys;
Modified: lucene/lucy/trunk/core/Lucy/Test/Object/TestI32Array.c
URL: http://svn.apache.org/viewvc/lucene/lucy/trunk/core/Lucy/Test/Object/TestI32Array.c?rev=930448&r1=930447&r2=930448&view=diff
==============================================================================
--- lucene/lucy/trunk/core/Lucy/Test/Object/TestI32Array.c (original)
+++ lucene/lucy/trunk/core/Lucy/Test/Object/TestI32Array.c Sat Apr 3 00:34:02 2010
@@ -4,18 +4,18 @@
#include "Lucy/Test.h"
#include "Lucy/Test/Object/TestI32Array.h"
-static i32_t source_ints[] = { -1, 0, I32_MIN, I32_MAX, 1 };
-static size_t num_ints = sizeof(source_ints) / sizeof(i32_t);
+static int32_t source_ints[] = { -1, 0, I32_MIN, I32_MAX, 1 };
+static size_t num_ints = sizeof(source_ints) / sizeof(int32_t);
static void
test_all(TestBatch *batch)
{
I32Array *i32_array = I32Arr_new(source_ints, num_ints);
- i32_t *ints_copy = (i32_t*)malloc(num_ints * sizeof(i32_t));
+ int32_t *ints_copy = (int32_t*)malloc(num_ints * sizeof(int32_t));
I32Array *stolen = I32Arr_new_steal(ints_copy, num_ints);
size_t num_matched;
- memcpy(ints_copy, source_ints, num_ints * sizeof(i32_t));
+ memcpy(ints_copy, source_ints, num_ints * sizeof(int32_t));
ASSERT_TRUE(batch, I32Arr_Get_Size(i32_array) == num_ints,
"Get_Size");