1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-19 19:20:23 +02:00

Replace uses of scm_t_int8, scm_t_uintmax, etc with stdint types

* libguile/bitvectors.c:
* libguile/bitvectors.h:
* libguile/bytevectors.c:
* libguile/bytevectors.h:
* libguile/chars.c:
* libguile/continuations.c:
* libguile/control.c:
* libguile/conv-integer.i.c:
* libguile/conv-uinteger.i.c:
* libguile/dynstack.c:
* libguile/dynstack.h:
* libguile/foreign.c:
* libguile/frames.c:
* libguile/frames.h:
* libguile/gc-inline.h:
* libguile/gc.h:
* libguile/gsubr.c:
* libguile/gsubr.h:
* libguile/hash.c:
* libguile/i18n.c:
* libguile/instructions.c:
* libguile/intrinsics.c:
* libguile/intrinsics.h:
* libguile/loader.c:
* libguile/loader.h:
* libguile/numbers.c:
* libguile/numbers.h:
* libguile/pairs.c:
* libguile/ports-internal.h:
* libguile/ports.c:
* libguile/ports.h:
* libguile/posix.c:
* libguile/print.c:
* libguile/print.h:
* libguile/programs.c:
* libguile/programs.h:
* libguile/r6rs-ports.c:
* libguile/random.c:
* libguile/random.h:
* libguile/scm.h:
* libguile/socket.c:
* libguile/srfi-4.c:
* libguile/srfi-4.h:
* libguile/stacks.c:
* libguile/stime.c:
* libguile/strings.c:
* libguile/struct.c:
* libguile/struct.h:
* libguile/symbols.c:
* libguile/threads.c:
* libguile/threads.h:
* libguile/uniform.c:
* libguile/vm-engine.c:
* libguile/vm.c:
* libguile/vm.h:
* libguile/vports.c:
* test-suite/standalone/test-conversion.c:
* test-suite/standalone/test-ffi-lib.c:
* test-suite/standalone/test-scm-take-u8vector.c:
* test-suite/standalone/test-srfi-4.c: Replace e.g. scm_t_uint8 with
  uint8_t.
This commit is contained in:
Andy Wingo 2018-06-21 08:39:03 +02:00
parent 5e5afde06f
commit 16879cabed
59 changed files with 924 additions and 924 deletions

View file

@ -52,9 +52,9 @@
((SCM_CELL_TYPE (x) & (0x7f | SCM_F_BITVECTOR_IMMUTABLE)) \
== scm_tc7_bitvector))
#define BITVECTOR_LENGTH(obj) ((size_t)SCM_CELL_WORD_1(obj))
#define BITVECTOR_BITS(obj) ((scm_t_uint32 *)SCM_CELL_WORD_2(obj))
#define BITVECTOR_BITS(obj) ((uint32_t *)SCM_CELL_WORD_2(obj))
scm_t_uint32 *
uint32_t *
scm_i_bitvector_bits (SCM vec)
{
if (!IS_BITVECTOR (vec))
@ -73,13 +73,13 @@ scm_i_print_bitvector (SCM vec, SCM port, scm_print_state *pstate)
{
size_t bit_len = BITVECTOR_LENGTH (vec);
size_t word_len = (bit_len+31)/32;
scm_t_uint32 *bits = BITVECTOR_BITS (vec);
uint32_t *bits = BITVECTOR_BITS (vec);
size_t i, j;
scm_puts ("#*", port);
for (i = 0; i < word_len; i++, bit_len -= 32)
{
scm_t_uint32 mask = 1;
uint32_t mask = 1;
for (j = 0; j < 32 && j < bit_len; j++, mask <<= 1)
scm_putc ((bits[i] & mask)? '1' : '0', port);
}
@ -92,9 +92,9 @@ scm_i_bitvector_equal_p (SCM vec1, SCM vec2)
{
size_t bit_len = BITVECTOR_LENGTH (vec1);
size_t word_len = (bit_len + 31) / 32;
scm_t_uint32 last_mask = ((scm_t_uint32)-1) >> (32*word_len - bit_len);
scm_t_uint32 *bits1 = BITVECTOR_BITS (vec1);
scm_t_uint32 *bits2 = BITVECTOR_BITS (vec2);
uint32_t last_mask = ((uint32_t)-1) >> (32*word_len - bit_len);
uint32_t *bits1 = BITVECTOR_BITS (vec1);
uint32_t *bits2 = BITVECTOR_BITS (vec2);
/* compare lengths */
if (BITVECTOR_LENGTH (vec2) != bit_len)
@ -103,7 +103,7 @@ scm_i_bitvector_equal_p (SCM vec1, SCM vec2)
if (bit_len == 0)
return SCM_BOOL_T;
/* compare full words */
if (memcmp (bits1, bits2, sizeof (scm_t_uint32) * (word_len-1)))
if (memcmp (bits1, bits2, sizeof (uint32_t) * (word_len-1)))
return SCM_BOOL_F;
/* compare partial last words */
if ((bits1[word_len-1] & last_mask) != (bits2[word_len-1] & last_mask))
@ -131,17 +131,17 @@ SCM
scm_c_make_bitvector (size_t len, SCM fill)
{
size_t word_len = (len + 31) / 32;
scm_t_uint32 *bits;
uint32_t *bits;
SCM res;
bits = scm_gc_malloc_pointerless (sizeof (scm_t_uint32) * word_len,
bits = scm_gc_malloc_pointerless (sizeof (uint32_t) * word_len,
"bitvector");
res = scm_double_cell (scm_tc7_bitvector, len, (scm_t_bits)bits, 0);
if (!SCM_UNBNDP (fill))
scm_bitvector_fill_x (res, fill);
else
memset (bits, 0, sizeof (scm_t_uint32) * word_len);
memset (bits, 0, sizeof (uint32_t) * word_len);
return res;
}
@ -182,20 +182,20 @@ SCM_DEFINE (scm_bitvector_length, "bitvector-length", 1, 0, 0,
}
#undef FUNC_NAME
const scm_t_uint32 *
const uint32_t *
scm_array_handle_bit_elements (scm_t_array_handle *h)
{
if (h->element_type != SCM_ARRAY_ELEMENT_TYPE_BIT)
scm_wrong_type_arg_msg (NULL, 0, h->array, "bit array");
return ((const scm_t_uint32 *) h->elements) + h->base/32;
return ((const uint32_t *) h->elements) + h->base/32;
}
scm_t_uint32 *
uint32_t *
scm_array_handle_bit_writable_elements (scm_t_array_handle *h)
{
if (h->writable_elements != h->elements)
scm_wrong_type_arg_msg (NULL, 0, h->array, "mutable bit array");
return (scm_t_uint32 *) scm_array_handle_bit_elements (h);
return (uint32_t *) scm_array_handle_bit_elements (h);
}
size_t
@ -204,7 +204,7 @@ scm_array_handle_bit_elements_offset (scm_t_array_handle *h)
return h->base % 32;
}
const scm_t_uint32 *
const uint32_t *
scm_bitvector_elements (SCM vec,
scm_t_array_handle *h,
size_t *offp,
@ -228,26 +228,26 @@ scm_bitvector_elements (SCM vec,
}
scm_t_uint32 *
uint32_t *
scm_bitvector_writable_elements (SCM vec,
scm_t_array_handle *h,
size_t *offp,
size_t *lenp,
ssize_t *incp)
{
const scm_t_uint32 *ret = scm_bitvector_elements (vec, h, offp, lenp, incp);
const uint32_t *ret = scm_bitvector_elements (vec, h, offp, lenp, incp);
if (h->writable_elements != h->elements)
scm_wrong_type_arg_msg (NULL, 0, h->array, "mutable bit array");
return (scm_t_uint32 *) ret;
return (uint32_t *) ret;
}
SCM
scm_c_bitvector_ref (SCM vec, size_t idx)
{
scm_t_array_handle handle;
const scm_t_uint32 *bits;
const uint32_t *bits;
if (IS_BITVECTOR (vec))
{
@ -286,7 +286,7 @@ void
scm_c_bitvector_set_x (SCM vec, size_t idx, SCM val)
{
scm_t_array_handle handle;
scm_t_uint32 *bits, mask;
uint32_t *bits, mask;
if (IS_MUTABLE_BITVECTOR (vec))
{
@ -335,7 +335,7 @@ SCM_DEFINE (scm_bitvector_fill_x, "bitvector-fill!", 2, 0, 0,
scm_t_array_handle handle;
size_t off, len;
ssize_t inc;
scm_t_uint32 *bits;
uint32_t *bits;
bits = scm_bitvector_writable_elements (vec, &handle,
&off, &len, &inc);
@ -345,16 +345,16 @@ SCM_DEFINE (scm_bitvector_fill_x, "bitvector-fill!", 2, 0, 0,
/* the usual case
*/
size_t word_len = (len + 31) / 32;
scm_t_uint32 last_mask = ((scm_t_uint32)-1) >> (32*word_len - len);
uint32_t last_mask = ((uint32_t)-1) >> (32*word_len - len);
if (scm_is_true (val))
{
memset (bits, 0xFF, sizeof(scm_t_uint32)*(word_len-1));
memset (bits, 0xFF, sizeof(uint32_t)*(word_len-1));
bits[word_len-1] |= last_mask;
}
else
{
memset (bits, 0x00, sizeof(scm_t_uint32)*(word_len-1));
memset (bits, 0x00, sizeof(uint32_t)*(word_len-1));
bits[word_len-1] &= ~last_mask;
}
}
@ -381,13 +381,13 @@ SCM_DEFINE (scm_list_to_bitvector, "list->bitvector", 1, 0, 0,
SCM vec = scm_c_make_bitvector (bit_len, SCM_UNDEFINED);
size_t word_len = (bit_len+31)/32;
scm_t_array_handle handle;
scm_t_uint32 *bits = scm_bitvector_writable_elements (vec, &handle,
uint32_t *bits = scm_bitvector_writable_elements (vec, &handle,
NULL, NULL, NULL);
size_t i, j;
for (i = 0; i < word_len && scm_is_pair (list); i++, bit_len -= 32)
{
scm_t_uint32 mask = 1;
uint32_t mask = 1;
bits[i] = 0;
for (j = 0; j < 32 && j < bit_len;
j++, mask <<= 1, list = SCM_CDR (list))
@ -410,7 +410,7 @@ SCM_DEFINE (scm_bitvector_to_list, "bitvector->list", 1, 0, 0,
scm_t_array_handle handle;
size_t off, len;
ssize_t inc;
const scm_t_uint32 *bits;
const uint32_t *bits;
SCM res = SCM_EOL;
bits = scm_bitvector_elements (vec, &handle, &off, &len, &inc);
@ -424,7 +424,7 @@ SCM_DEFINE (scm_bitvector_to_list, "bitvector->list", 1, 0, 0,
for (i = 0; i < word_len; i++, len -= 32)
{
scm_t_uint32 mask = 1;
uint32_t mask = 1;
for (j = 0; j < 32 && j < len; j++, mask <<= 1)
res = scm_cons ((bits[i] & mask)? SCM_BOOL_T : SCM_BOOL_F, res);
}
@ -455,7 +455,7 @@ SCM_DEFINE (scm_bitvector_to_list, "bitvector->list", 1, 0, 0,
*/
static size_t
count_ones (scm_t_uint32 x)
count_ones (uint32_t x)
{
x=x-((x>>1)&0x55555555);
x=(x&0x33333333)+((x>>2)&0x33333333);
@ -473,7 +473,7 @@ SCM_DEFINE (scm_bit_count, "bit-count", 2, 0, 0,
scm_t_array_handle handle;
size_t off, len;
ssize_t inc;
const scm_t_uint32 *bits;
const uint32_t *bits;
int bit = scm_to_bool (b);
size_t count = 0;
@ -484,7 +484,7 @@ SCM_DEFINE (scm_bit_count, "bit-count", 2, 0, 0,
/* the usual case
*/
size_t word_len = (len + 31) / 32;
scm_t_uint32 last_mask = ((scm_t_uint32)-1) >> (32*word_len - len);
uint32_t last_mask = ((uint32_t)-1) >> (32*word_len - len);
size_t i;
for (i = 0; i < word_len-1; i++)
@ -508,7 +508,7 @@ SCM_DEFINE (scm_bit_count, "bit-count", 2, 0, 0,
/* returns 32 for x == 0.
*/
static size_t
find_first_one (scm_t_uint32 x)
find_first_one (uint32_t x)
{
size_t pos = 0;
/* do a binary search in x. */
@ -541,7 +541,7 @@ SCM_DEFINE (scm_bit_position, "bit-position", 3, 0, 0,
scm_t_array_handle handle;
size_t off, len, first_bit;
ssize_t inc;
const scm_t_uint32 *bits;
const uint32_t *bits;
int bit = scm_to_bool (item);
SCM res = SCM_BOOL_F;
@ -551,11 +551,11 @@ SCM_DEFINE (scm_bit_position, "bit-position", 3, 0, 0,
if (off == 0 && inc == 1 && len > 0)
{
size_t i, word_len = (len + 31) / 32;
scm_t_uint32 last_mask = ((scm_t_uint32)-1) >> (32*word_len - len);
uint32_t last_mask = ((uint32_t)-1) >> (32*word_len - len);
size_t first_word = first_bit / 32;
scm_t_uint32 first_mask =
((scm_t_uint32)-1) << (first_bit - 32*first_word);
scm_t_uint32 w;
uint32_t first_mask =
((uint32_t)-1) << (first_bit - 32*first_word);
uint32_t w;
for (i = first_word; i < word_len; i++)
{
@ -624,7 +624,7 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0,
scm_t_array_handle v_handle;
size_t v_off, v_len;
ssize_t v_inc;
scm_t_uint32 *v_bits;
uint32_t *v_bits;
int bit;
/* Validate that OBJ is a boolean so this is done even if we don't
@ -640,7 +640,7 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0,
scm_t_array_handle kv_handle;
size_t kv_off, kv_len;
ssize_t kv_inc;
const scm_t_uint32 *kv_bits;
const uint32_t *kv_bits;
kv_bits = scm_bitvector_elements (kv, &kv_handle,
&kv_off, &kv_len, &kv_inc);
@ -653,7 +653,7 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0,
if (v_off == 0 && v_inc == 1 && kv_off == 0 && kv_inc == 1 && kv_len > 0)
{
size_t word_len = (kv_len + 31) / 32;
scm_t_uint32 last_mask = ((scm_t_uint32)-1) >> (32*word_len - kv_len);
uint32_t last_mask = ((uint32_t)-1) >> (32*word_len - kv_len);
size_t i;
if (bit == 0)
@ -685,7 +685,7 @@ SCM_DEFINE (scm_bit_set_star_x, "bit-set*!", 3, 0, 0,
scm_t_array_handle kv_handle;
size_t i, kv_len;
ssize_t kv_inc;
const scm_t_uint32 *kv_elts;
const uint32_t *kv_elts;
kv_elts = scm_u32vector_elements (kv, &kv_handle, &kv_len, &kv_inc);
for (i = 0; i < kv_len; i++, kv_elts += kv_inc)
@ -727,7 +727,7 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0,
scm_t_array_handle v_handle;
size_t v_off, v_len;
ssize_t v_inc;
const scm_t_uint32 *v_bits;
const uint32_t *v_bits;
size_t count = 0;
int bit;
@ -744,7 +744,7 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0,
scm_t_array_handle kv_handle;
size_t kv_off, kv_len;
ssize_t kv_inc;
const scm_t_uint32 *kv_bits;
const uint32_t *kv_bits;
kv_bits = scm_bitvector_elements (kv, &kv_handle,
&kv_off, &kv_len, &kv_inc);
@ -757,8 +757,8 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0,
if (v_off == 0 && v_inc == 1 && kv_off == 0 && kv_inc == 1 && kv_len > 0)
{
size_t i, word_len = (kv_len + 31) / 32;
scm_t_uint32 last_mask = ((scm_t_uint32)-1) >> (32*word_len - kv_len);
scm_t_uint32 xor_mask = bit? 0 : ((scm_t_uint32)-1);
uint32_t last_mask = ((uint32_t)-1) >> (32*word_len - kv_len);
uint32_t xor_mask = bit? 0 : ((uint32_t)-1);
for (i = 0; i < word_len-1; i++)
count += count_ones ((v_bits[i]^xor_mask) & kv_bits[i]);
@ -784,7 +784,7 @@ SCM_DEFINE (scm_bit_count_star, "bit-count*", 3, 0, 0,
scm_t_array_handle kv_handle;
size_t i, kv_len;
ssize_t kv_inc;
const scm_t_uint32 *kv_elts;
const uint32_t *kv_elts;
kv_elts = scm_u32vector_elements (kv, &kv_handle, &kv_len, &kv_inc);
for (i = 0; i < kv_len; i++, kv_elts += kv_inc)
@ -814,14 +814,14 @@ SCM_DEFINE (scm_bit_invert_x, "bit-invert!", 1, 0, 0,
scm_t_array_handle handle;
size_t off, len;
ssize_t inc;
scm_t_uint32 *bits;
uint32_t *bits;
bits = scm_bitvector_writable_elements (v, &handle, &off, &len, &inc);
if (off == 0 && inc == 1 && len > 0)
{
size_t word_len = (len + 31) / 32;
scm_t_uint32 last_mask = ((scm_t_uint32)-1) >> (32*word_len - len);
uint32_t last_mask = ((uint32_t)-1) >> (32*word_len - len);
size_t i;
for (i = 0; i < word_len-1; i++)
@ -851,10 +851,10 @@ scm_istr2bve (SCM str)
SCM vec = scm_c_make_bitvector (len, SCM_UNDEFINED);
SCM res = vec;
scm_t_uint32 mask;
uint32_t mask;
size_t k, j;
const char *c_str;
scm_t_uint32 *data;
uint32_t *data;
data = scm_bitvector_writable_elements (vec, &handle, NULL, NULL, NULL);
c_str = scm_i_string_chars (str);

View file

@ -54,21 +54,21 @@ SCM_API SCM scm_c_make_bitvector (size_t len, SCM fill);
SCM_API size_t scm_c_bitvector_length (SCM vec);
SCM_API SCM scm_c_bitvector_ref (SCM vec, size_t idx);
SCM_API void scm_c_bitvector_set_x (SCM vec, size_t idx, SCM val);
SCM_API const scm_t_uint32 *scm_array_handle_bit_elements (scm_t_array_handle *h);
SCM_API scm_t_uint32 *scm_array_handle_bit_writable_elements (scm_t_array_handle *h);
SCM_API const uint32_t *scm_array_handle_bit_elements (scm_t_array_handle *h);
SCM_API uint32_t *scm_array_handle_bit_writable_elements (scm_t_array_handle *h);
SCM_API size_t scm_array_handle_bit_elements_offset (scm_t_array_handle *h);
SCM_API const scm_t_uint32 *scm_bitvector_elements (SCM vec,
SCM_API const uint32_t *scm_bitvector_elements (SCM vec,
scm_t_array_handle *h,
size_t *offp,
size_t *lenp,
ssize_t *incp);
SCM_API scm_t_uint32 *scm_bitvector_writable_elements (SCM vec,
SCM_API uint32_t *scm_bitvector_writable_elements (SCM vec,
scm_t_array_handle *h,
size_t *offp,
size_t *lenp,
ssize_t *incp);
SCM_INTERNAL scm_t_uint32 *scm_i_bitvector_bits (SCM vec);
SCM_INTERNAL uint32_t *scm_i_bitvector_bits (SCM vec);
SCM_INTERNAL int scm_i_is_mutable_bitvector (SCM vec);
SCM_INTERNAL int scm_i_print_bitvector (SCM vec, SCM port, scm_print_state *pstate);
SCM_INTERNAL SCM scm_i_bitvector_equal_p (SCM vec1, SCM vec2);

View file

@ -61,12 +61,12 @@
/* Convenience macros. These are used by the various templates (macros) that
are parameterized by integer signedness. */
#define INT8_T_signed scm_t_int8
#define INT8_T_unsigned scm_t_uint8
#define INT16_T_signed scm_t_int16
#define INT16_T_unsigned scm_t_uint16
#define INT32_T_signed scm_t_int32
#define INT32_T_unsigned scm_t_uint32
#define INT8_T_signed int8_t
#define INT8_T_unsigned uint8_t
#define INT16_T_signed int16_t
#define INT16_T_unsigned uint16_t
#define INT32_T_signed int32_t
#define INT32_T_unsigned uint32_t
#define is_signed_int8(_x) (((_x) >= -128L) && ((_x) <= 127L))
#define is_unsigned_int8(_x) ((_x) <= 255UL)
#define is_signed_int16(_x) (((_x) >= -32768L) && ((_x) <= 32767L))
@ -374,17 +374,17 @@ scm_c_bytevector_length (SCM bv)
}
#undef FUNC_NAME
scm_t_uint8
uint8_t
scm_c_bytevector_ref (SCM bv, size_t index)
#define FUNC_NAME "scm_c_bytevector_ref"
{
size_t c_len;
const scm_t_uint8 *c_bv;
const uint8_t *c_bv;
SCM_VALIDATE_BYTEVECTOR (1, bv);
c_len = SCM_BYTEVECTOR_LENGTH (bv);
c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
c_bv = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv);
if (SCM_UNLIKELY (index >= c_len))
scm_out_of_range (FUNC_NAME, scm_from_size_t (index));
@ -394,16 +394,16 @@ scm_c_bytevector_ref (SCM bv, size_t index)
#undef FUNC_NAME
void
scm_c_bytevector_set_x (SCM bv, size_t index, scm_t_uint8 value)
scm_c_bytevector_set_x (SCM bv, size_t index, uint8_t value)
#define FUNC_NAME "scm_c_bytevector_set_x"
{
size_t c_len;
scm_t_uint8 *c_bv;
uint8_t *c_bv;
SCM_VALIDATE_MUTABLE_BYTEVECTOR (1, bv);
c_len = SCM_BYTEVECTOR_LENGTH (bv);
c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
c_bv = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv);
if (SCM_UNLIKELY (index >= c_len))
scm_out_of_range (FUNC_NAME, scm_from_size_t (index));
@ -483,7 +483,7 @@ SCM_DEFINE (scm_make_bytevector, "make-bytevector", 1, 1, 0,
{
SCM bv;
size_t c_len;
scm_t_uint8 c_fill = 0;
uint8_t c_fill = 0;
SCM_VALIDATE_SIZE_COPY (1, len, c_len);
if (!scm_is_eq (fill, SCM_UNDEFINED))
@ -493,16 +493,16 @@ SCM_DEFINE (scm_make_bytevector, "make-bytevector", 1, 1, 0,
value = scm_to_int (fill);
if (SCM_UNLIKELY ((value < -128) || (value > 255)))
scm_out_of_range (FUNC_NAME, fill);
c_fill = (scm_t_uint8) value;
c_fill = (uint8_t) value;
}
bv = make_bytevector (c_len, SCM_ARRAY_ELEMENT_TYPE_VU8);
if (!scm_is_eq (fill, SCM_UNDEFINED))
{
size_t i;
scm_t_uint8 *contents;
uint8_t *contents;
contents = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
contents = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv);
for (i = 0; i < c_len; i++)
contents[i] = c_fill;
}
@ -558,7 +558,7 @@ SCM_DEFINE (scm_bytevector_fill_x, "bytevector-fill!", 2, 0, 0,
#define FUNC_NAME s_scm_bytevector_fill_x
{
size_t c_len, i;
scm_t_uint8 *c_bv, c_fill;
uint8_t *c_bv, c_fill;
int value;
SCM_VALIDATE_MUTABLE_BYTEVECTOR (1, bv);
@ -566,10 +566,10 @@ SCM_DEFINE (scm_bytevector_fill_x, "bytevector-fill!", 2, 0, 0,
value = scm_to_int (fill);
if (SCM_UNLIKELY ((value < -128) || (value > 255)))
scm_out_of_range (FUNC_NAME, fill);
c_fill = (scm_t_uint8) value;
c_fill = (uint8_t) value;
c_len = SCM_BYTEVECTOR_LENGTH (bv);
c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
c_bv = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv);
for (i = 0; i < c_len; i++)
c_bv[i] = c_fill;
@ -726,12 +726,12 @@ SCM_DEFINE (scm_bytevector_to_u8_list, "bytevector->u8-list", 1, 0, 0,
{
SCM lst, pair;
size_t c_len, i;
scm_t_uint8 *c_bv;
uint8_t *c_bv;
SCM_VALIDATE_BYTEVECTOR (1, bv);
c_len = SCM_BYTEVECTOR_LENGTH (bv);
c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
c_bv = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv);
lst = scm_make_list (scm_from_size_t (c_len), SCM_UNSPECIFIED);
for (i = 0, pair = lst;
@ -752,12 +752,12 @@ SCM_DEFINE (scm_u8_list_to_bytevector, "u8-list->bytevector", 1, 0, 0,
{
SCM bv, item;
size_t c_len, i;
scm_t_uint8 *c_bv;
uint8_t *c_bv;
SCM_VALIDATE_LIST_COPYLEN (1, lst, c_len);
bv = make_bytevector (c_len, SCM_ARRAY_ELEMENT_TYPE_VU8);
c_bv = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv);
c_bv = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv);
for (i = 0; i < c_len; lst = SCM_CDR (lst), i++)
{
@ -769,7 +769,7 @@ SCM_DEFINE (scm_u8_list_to_bytevector, "u8-list->bytevector", 1, 0, 0,
c_item = SCM_I_INUM (item);
if (SCM_LIKELY ((c_item >= 0) && (c_item < 256)))
c_bv[i] = (scm_t_uint8) c_item;
c_bv[i] = (uint8_t) c_item;
else
goto type_error;
}
@ -1605,13 +1605,13 @@ SCM_DEFINE (scm_bytevector_s64_native_set_x, "bytevector-s64-native-set!",
union scm_ieee754_float
{
float f;
scm_t_uint32 i;
uint32_t i;
};
union scm_ieee754_double
{
double d;
scm_t_uint64 i;
uint64_t i;
};
@ -1916,7 +1916,7 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness)
\
SCM_VALIDATE_STRING (1, str); \
if (scm_is_eq (endianness, SCM_UNDEFINED)) \
endianness = sym_big; \
endianness = sym_big; \
else \
SCM_VALIDATE_SYMBOL (2, endianness); \
\
@ -1938,7 +1938,7 @@ utf_encoding_name (char *name, size_t utf_width, SCM endianness)
const scm_t_wchar *wbuf = scm_i_string_wide_chars (str); \
c_utf = u32_conv_to_encoding (c_utf_name, \
iconveh_question_mark, \
(scm_t_uint32 *) wbuf, \
(uint32_t *) wbuf, \
c_strlen, NULL, NULL, &c_utf_len); \
if (SCM_UNLIKELY (c_utf == NULL)) \
scm_syserror_msg (FUNC_NAME, "failed to convert string: ~A", \
@ -1962,12 +1962,12 @@ SCM_DEFINE (scm_string_to_utf8, "string->utf8",
#define FUNC_NAME s_scm_string_to_utf8
{
SCM utf;
scm_t_uint8 *c_utf;
uint8_t *c_utf;
size_t c_utf_len = 0;
SCM_VALIDATE_STRING (1, str);
c_utf = (scm_t_uint8 *) scm_to_utf8_stringn (str, &c_utf_len);
c_utf = (uint8_t *) scm_to_utf8_stringn (str, &c_utf_len);
utf = make_bytevector (c_utf_len, SCM_ARRAY_ELEMENT_TYPE_VU8);
memcpy (SCM_BYTEVECTOR_CONTENTS (utf), c_utf, c_utf_len);
free (c_utf);

View file

@ -48,8 +48,8 @@ SCM_API SCM scm_endianness_little;
SCM_API SCM scm_c_make_bytevector (size_t);
SCM_API int scm_is_bytevector (SCM);
SCM_API size_t scm_c_bytevector_length (SCM);
SCM_API scm_t_uint8 scm_c_bytevector_ref (SCM, size_t);
SCM_API void scm_c_bytevector_set_x (SCM, size_t, scm_t_uint8);
SCM_API uint8_t scm_c_bytevector_ref (SCM, size_t);
SCM_API void scm_c_bytevector_set_x (SCM, size_t, uint8_t);
SCM_API SCM scm_make_bytevector (SCM, SCM);
SCM_API SCM scm_native_endianness (void);

View file

@ -542,7 +542,7 @@ static const char *const scm_r5rs_charnames[] = {
"space", "newline"
};
static const scm_t_uint32 scm_r5rs_charnums[] = {
static const uint32_t scm_r5rs_charnums[] = {
0x20, 0x0a
};
@ -554,7 +554,7 @@ static const char *const scm_r6rs_charnames[] = {
/* 'space' and 'newline' are already included from the R5RS list. */
};
static const scm_t_uint32 scm_r6rs_charnums[] = {
static const uint32_t scm_r6rs_charnums[] = {
0x00, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c,
0x0d, 0x1b, 0x7f
};
@ -565,7 +565,7 @@ static const char *const scm_r7rs_charnames[] = {
"escape"
};
static const scm_t_uint32 scm_r7rs_charnums[] = {
static const uint32_t scm_r7rs_charnums[] = {
0x1b
};
@ -581,7 +581,7 @@ static const char *const scm_C0_control_charnames[] = {
"sp", "del"
};
static const scm_t_uint32 scm_C0_control_charnums[] = {
static const uint32_t scm_C0_control_charnums[] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@ -595,7 +595,7 @@ static const char *const scm_alt_charnames[] = {
"null", "nl", "np"
};
static const scm_t_uint32 scm_alt_charnums[] = {
static const uint32_t scm_alt_charnums[] = {
0x00, 0x0a, 0x0c
};
@ -607,7 +607,7 @@ const char *
scm_i_charname (SCM chr)
{
size_t c;
scm_t_uint32 i = SCM_CHAR (chr);
uint32_t i = SCM_CHAR (chr);
for (c = 0; c < SCM_N_R5RS_CHARNAMES; c++)
if (scm_r5rs_charnums[c] == i)

View file

@ -75,7 +75,7 @@ static scm_t_bits tc16_continuation;
of that trampoline function.
*/
static const scm_t_uint32 continuation_stub_code[] =
static const uint32_t continuation_stub_code[] =
{
SCM_PACK_OP_24 (continuation_call, 0)
};

View file

@ -67,7 +67,7 @@ scm_i_prompt_pop_abort_args_x (struct scm_vm *vp,
}
static const scm_t_uint32 compose_continuation_code[] =
static const uint32_t compose_continuation_code[] =
{
SCM_PACK_OP_24 (compose_continuation, 0)
};
@ -91,13 +91,13 @@ static SCM
reify_partial_continuation (struct scm_vm *vp,
union scm_vm_stack_element *saved_fp,
union scm_vm_stack_element *saved_sp,
scm_t_uint32 *saved_ip,
uint32_t *saved_ip,
jmp_buf *saved_registers,
scm_t_dynstack *dynstack,
jmp_buf *current_registers)
{
SCM vm_cont;
scm_t_uint32 flags;
uint32_t flags;
union scm_vm_stack_element *base_fp;
flags = SCM_F_VM_CONT_PARTIAL;
@ -139,7 +139,7 @@ scm_c_abort (struct scm_vm *vp, SCM tag, size_t n, SCM *argv,
scm_t_dynstack_prompt_flags flags;
scm_t_ptrdiff fp_offset, sp_offset;
union scm_vm_stack_element *fp, *sp;
scm_t_uint32 *ip;
uint32_t *ip;
jmp_buf *registers;
size_t i;

View file

@ -64,15 +64,15 @@ SCM_TO_TYPE_PROTO (SCM val)
}
else
{
scm_t_uintmax abs_n;
uintmax_t abs_n;
TYPE n;
size_t count;
if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
> CHAR_BIT*sizeof (scm_t_uintmax))
> CHAR_BIT*sizeof (uintmax_t))
goto out_of_range;
mpz_export (&abs_n, &count, 1, sizeof (scm_t_uintmax), 0, 0,
mpz_export (&abs_n, &count, 1, sizeof (uintmax_t), 0, 0,
SCM_I_BIG_MPZ (val));
if (mpz_sgn (SCM_I_BIG_MPZ (val)) >= 0)

View file

@ -30,7 +30,7 @@ SCM_TO_TYPE_PROTO (SCM val)
{
scm_t_signed_bits n = SCM_I_INUM (val);
if (n >= 0
&& ((scm_t_uintmax)n) >= TYPE_MIN && ((scm_t_uintmax)n) <= TYPE_MAX)
&& ((uintmax_t)n) >= TYPE_MIN && ((uintmax_t)n) <= TYPE_MAX)
return n;
else
{
@ -66,7 +66,7 @@ SCM_TO_TYPE_PROTO (SCM val)
}
else
{
scm_t_uintmax n;
uintmax_t n;
size_t count;
if (mpz_sgn (SCM_I_BIG_MPZ (val)) < 0)

View file

@ -43,7 +43,7 @@
#define SET_PROMPT_FP(top, fp) do { top[1] = (scm_t_bits)(fp); } while (0)
#define PROMPT_SP(top) ((scm_t_ptrdiff) ((top)[2]))
#define SET_PROMPT_SP(top, sp) do { top[2] = (scm_t_bits)(sp); } while (0)
#define PROMPT_IP(top) ((scm_t_uint32 *) ((top)[3]))
#define PROMPT_IP(top) ((uint32_t *) ((top)[3]))
#define PROMPT_JMPBUF(top) ((jmp_buf *) ((top)[4]))
#define WINDER_WORDS 2
@ -196,7 +196,7 @@ scm_dynstack_push_prompt (scm_t_dynstack *dynstack,
scm_t_dynstack_prompt_flags flags,
SCM key,
scm_t_ptrdiff fp_offset, scm_t_ptrdiff sp_offset,
scm_t_uint32 *ip, jmp_buf *registers)
uint32_t *ip, jmp_buf *registers)
{
scm_t_bits *words;
@ -499,7 +499,7 @@ scm_t_bits*
scm_dynstack_find_prompt (scm_t_dynstack *dynstack, SCM key,
scm_t_dynstack_prompt_flags *flags,
scm_t_ptrdiff *fp_offset, scm_t_ptrdiff *sp_offset,
scm_t_uint32 **ip, jmp_buf **registers)
uint32_t **ip, jmp_buf **registers)
{
scm_t_bits *walk;

View file

@ -160,7 +160,7 @@ SCM_INTERNAL void scm_dynstack_push_prompt (scm_t_dynstack *,
SCM key,
scm_t_ptrdiff fp_offset,
scm_t_ptrdiff sp_offset,
scm_t_uint32 *ip,
uint32_t *ip,
jmp_buf *registers);
SCM_INTERNAL void scm_dynstack_push_dynwind (scm_t_dynstack *,
SCM enter, SCM leave);
@ -200,7 +200,7 @@ SCM_INTERNAL scm_t_bits* scm_dynstack_find_prompt (scm_t_dynstack *, SCM,
scm_t_dynstack_prompt_flags *,
scm_t_ptrdiff *,
scm_t_ptrdiff *,
scm_t_uint32 **,
uint32_t **,
jmp_buf **);
SCM_INTERNAL SCM scm_dynstack_find_old_fluid_value (scm_t_dynstack *,

View file

@ -138,7 +138,7 @@ SCM_DEFINE (scm_make_pointer, "make-pointer", 1, 1, 0,
#define FUNC_NAME s_scm_make_pointer
{
void *c_finalizer;
scm_t_uintptr c_address;
uintptr_t c_address;
c_address = scm_to_uintptr_t (address);
if (SCM_UNBNDP (finalizer))
@ -188,7 +188,7 @@ SCM_DEFINE (scm_pointer_address, "pointer-address", 1, 0, 0,
{
SCM_VALIDATE_POINTER (1, pointer);
return scm_from_uintptr_t ((scm_t_uintptr) SCM_POINTER_VALUE (pointer));
return scm_from_uintptr_t ((uintptr_t) SCM_POINTER_VALUE (pointer));
}
#undef FUNC_NAME
@ -236,7 +236,7 @@ SCM_DEFINE (scm_pointer_to_bytevector, "pointer->bytevector", 2, 2, 0,
#define FUNC_NAME s_scm_pointer_to_bytevector
{
SCM ret;
scm_t_int8 *ptr;
int8_t *ptr;
size_t boffset, blen;
scm_t_array_element_type btype;
@ -469,21 +469,21 @@ SCM_DEFINE (scm_alignof, "alignof", 1, 0, 0, (SCM type),
case SCM_FOREIGN_TYPE_DOUBLE:
return scm_from_size_t (alignof_type (double));
case SCM_FOREIGN_TYPE_UINT8:
return scm_from_size_t (alignof_type (scm_t_uint8));
return scm_from_size_t (alignof_type (uint8_t));
case SCM_FOREIGN_TYPE_INT8:
return scm_from_size_t (alignof_type (scm_t_int8));
return scm_from_size_t (alignof_type (int8_t));
case SCM_FOREIGN_TYPE_UINT16:
return scm_from_size_t (alignof_type (scm_t_uint16));
return scm_from_size_t (alignof_type (uint16_t));
case SCM_FOREIGN_TYPE_INT16:
return scm_from_size_t (alignof_type (scm_t_int16));
return scm_from_size_t (alignof_type (int16_t));
case SCM_FOREIGN_TYPE_UINT32:
return scm_from_size_t (alignof_type (scm_t_uint32));
return scm_from_size_t (alignof_type (uint32_t));
case SCM_FOREIGN_TYPE_INT32:
return scm_from_size_t (alignof_type (scm_t_int32));
return scm_from_size_t (alignof_type (int32_t));
case SCM_FOREIGN_TYPE_UINT64:
return scm_from_size_t (alignof_type (scm_t_uint64));
return scm_from_size_t (alignof_type (uint64_t));
case SCM_FOREIGN_TYPE_INT64:
return scm_from_size_t (alignof_type (scm_t_int64));
return scm_from_size_t (alignof_type (int64_t));
default:
scm_wrong_type_arg (FUNC_NAME, 1, type);
}
@ -533,21 +533,21 @@ SCM_DEFINE (scm_sizeof, "sizeof", 1, 0, 0, (SCM type),
case SCM_FOREIGN_TYPE_DOUBLE:
return scm_from_size_t (sizeof (double));
case SCM_FOREIGN_TYPE_UINT8:
return scm_from_size_t (sizeof (scm_t_uint8));
return scm_from_size_t (sizeof (uint8_t));
case SCM_FOREIGN_TYPE_INT8:
return scm_from_size_t (sizeof (scm_t_int8));
return scm_from_size_t (sizeof (int8_t));
case SCM_FOREIGN_TYPE_UINT16:
return scm_from_size_t (sizeof (scm_t_uint16));
return scm_from_size_t (sizeof (uint16_t));
case SCM_FOREIGN_TYPE_INT16:
return scm_from_size_t (sizeof (scm_t_int16));
return scm_from_size_t (sizeof (int16_t));
case SCM_FOREIGN_TYPE_UINT32:
return scm_from_size_t (sizeof (scm_t_uint32));
return scm_from_size_t (sizeof (uint32_t));
case SCM_FOREIGN_TYPE_INT32:
return scm_from_size_t (sizeof (scm_t_int32));
return scm_from_size_t (sizeof (int32_t));
case SCM_FOREIGN_TYPE_UINT64:
return scm_from_size_t (sizeof (scm_t_uint64));
return scm_from_size_t (sizeof (uint64_t));
case SCM_FOREIGN_TYPE_INT64:
return scm_from_size_t (sizeof (scm_t_int64));
return scm_from_size_t (sizeof (int64_t));
default:
scm_wrong_type_arg (FUNC_NAME, 1, type);
}
@ -824,14 +824,14 @@ SCM_DEFINE (scm_i_pointer_to_procedure, "pointer->procedure", 3, 0, 1,
static const scm_t_uint32 *
static const uint32_t *
get_foreign_stub_code (unsigned int nargs, int with_errno)
{
size_t i;
size_t code_len = with_errno ? 4 : 5;
scm_t_uint32 *code;
uint32_t *code;
code = scm_gc_malloc_pointerless (code_len * sizeof (scm_t_uint32),
code = scm_gc_malloc_pointerless (code_len * sizeof (uint32_t),
"foreign code");
if (nargs >= (1 << 24) + 1)
@ -888,43 +888,43 @@ unpack (const ffi_type *type, void *loc, SCM x, int return_value_p)
if (return_value_p)
*(ffi_arg *) loc = scm_to_uint8 (x);
else
*(scm_t_uint8 *) loc = scm_to_uint8 (x);
*(uint8_t *) loc = scm_to_uint8 (x);
break;
case FFI_TYPE_SINT8:
if (return_value_p)
*(ffi_arg *) loc = scm_to_int8 (x);
else
*(scm_t_int8 *) loc = scm_to_int8 (x);
*(int8_t *) loc = scm_to_int8 (x);
break;
case FFI_TYPE_UINT16:
if (return_value_p)
*(ffi_arg *) loc = scm_to_uint16 (x);
else
*(scm_t_uint16 *) loc = scm_to_uint16 (x);
*(uint16_t *) loc = scm_to_uint16 (x);
break;
case FFI_TYPE_SINT16:
if (return_value_p)
*(ffi_arg *) loc = scm_to_int16 (x);
else
*(scm_t_int16 *) loc = scm_to_int16 (x);
*(int16_t *) loc = scm_to_int16 (x);
break;
case FFI_TYPE_UINT32:
if (return_value_p)
*(ffi_arg *) loc = scm_to_uint32 (x);
else
*(scm_t_uint32 *) loc = scm_to_uint32 (x);
*(uint32_t *) loc = scm_to_uint32 (x);
break;
case FFI_TYPE_SINT32:
if (return_value_p)
*(ffi_arg *) loc = scm_to_int32 (x);
else
*(scm_t_int32 *) loc = scm_to_int32 (x);
*(int32_t *) loc = scm_to_int32 (x);
break;
case FFI_TYPE_UINT64:
*(scm_t_uint64 *) loc = scm_to_uint64 (x);
*(uint64_t *) loc = scm_to_uint64 (x);
break;
case FFI_TYPE_SINT64:
*(scm_t_int64 *) loc = scm_to_int64 (x);
*(int64_t *) loc = scm_to_int64 (x);
break;
case FFI_TYPE_STRUCT:
SCM_VALIDATE_POINTER (1, x);
@ -967,38 +967,38 @@ pack (const ffi_type * type, const void *loc, int return_value_p)
case FFI_TYPE_UINT8:
if (return_value_p)
return scm_from_uint8 ((scm_t_uint8) *(ffi_arg *) loc);
return scm_from_uint8 ((uint8_t) *(ffi_arg *) loc);
else
return scm_from_uint8 (* (scm_t_uint8 *) loc);
return scm_from_uint8 (* (uint8_t *) loc);
case FFI_TYPE_SINT8:
if (return_value_p)
return scm_from_int8 ((scm_t_int8) *(ffi_arg *) loc);
return scm_from_int8 ((int8_t) *(ffi_arg *) loc);
else
return scm_from_int8 (* (scm_t_int8 *) loc);
return scm_from_int8 (* (int8_t *) loc);
case FFI_TYPE_UINT16:
if (return_value_p)
return scm_from_uint16 ((scm_t_uint16) *(ffi_arg *) loc);
return scm_from_uint16 ((uint16_t) *(ffi_arg *) loc);
else
return scm_from_uint16 (* (scm_t_uint16 *) loc);
return scm_from_uint16 (* (uint16_t *) loc);
case FFI_TYPE_SINT16:
if (return_value_p)
return scm_from_int16 ((scm_t_int16) *(ffi_arg *) loc);
return scm_from_int16 ((int16_t) *(ffi_arg *) loc);
else
return scm_from_int16 (* (scm_t_int16 *) loc);
return scm_from_int16 (* (int16_t *) loc);
case FFI_TYPE_UINT32:
if (return_value_p)
return scm_from_uint32 ((scm_t_uint32) *(ffi_arg *) loc);
return scm_from_uint32 ((uint32_t) *(ffi_arg *) loc);
else
return scm_from_uint32 (* (scm_t_uint32 *) loc);
return scm_from_uint32 (* (uint32_t *) loc);
case FFI_TYPE_SINT32:
if (return_value_p)
return scm_from_int32 ((scm_t_int32) *(ffi_arg *) loc);
return scm_from_int32 ((int32_t) *(ffi_arg *) loc);
else
return scm_from_int32 (* (scm_t_int32 *) loc);
return scm_from_int32 (* (int32_t *) loc);
case FFI_TYPE_UINT64:
return scm_from_uint64 (*(scm_t_uint64 *) loc);
return scm_from_uint64 (*(uint64_t *) loc);
case FFI_TYPE_SINT64:
return scm_from_int64 (*(scm_t_int64 *) loc);
return scm_from_int64 (*(int64_t *) loc);
case FFI_TYPE_STRUCT:
{
@ -1024,7 +1024,7 @@ scm_i_foreign_call (SCM cif_scm, SCM pointer_scm, int *errno_ret,
objtable. */
ffi_cif *cif;
void (*func) (void);
scm_t_uint8 *data;
uint8_t *data;
void *rvalue;
void **args;
unsigned i;
@ -1050,13 +1050,13 @@ scm_i_foreign_call (SCM cif_scm, SCM pointer_scm, int *errno_ret,
/* Unpack ARGV to native values, setting ARGV pointers. */
for (i = 0, off = 0;
i < cif->nargs;
off = (scm_t_uint8 *) args[i] - data + cif->arg_types[i]->size,
off = (uint8_t *) args[i] - data + cif->arg_types[i]->size,
i++)
{
/* Suitably align the storage area for argument I. */
args[i] = (void *) ROUND_UP ((scm_t_uintptr) data + off,
args[i] = (void *) ROUND_UP ((uintptr_t) data + off,
cif->arg_types[i]->alignment);
assert ((scm_t_uintptr) args[i] % cif->arg_types[i]->alignment == 0);
assert ((uintptr_t) args[i] % cif->arg_types[i]->alignment == 0);
unpack (cif->arg_types[i], args[i], argv[cif->nargs - i - 1].as_scm, 0);
}
@ -1064,7 +1064,7 @@ scm_i_foreign_call (SCM cif_scm, SCM pointer_scm, int *errno_ret,
`armv5tel-*-linux-gnueabi', the return value has to be at least
word-aligned, even if its type doesn't have any alignment requirement as is
the case with `char'. */
rvalue = (void *) ROUND_UP ((scm_t_uintptr) data + off,
rvalue = (void *) ROUND_UP ((uintptr_t) data + off,
MAX (sizeof (void *), cif->rtype->alignment));
/* off we go! */
@ -1280,7 +1280,7 @@ scm_init_foreign (void)
#elif SCM_SIZEOF_INTPTR_T == 4
scm_from_uint8 (SCM_FOREIGN_TYPE_INT32)
#else
# error unsupported sizeof (scm_t_intptr)
# error unsupported sizeof (intptr_t)
#endif
);
@ -1290,7 +1290,7 @@ scm_init_foreign (void)
#elif SCM_SIZEOF_UINTPTR_T == 4
scm_from_uint8 (SCM_FOREIGN_TYPE_UINT32)
#else
# error unsupported sizeof (scm_t_uintptr)
# error unsupported sizeof (uintptr_t)
#endif
);

View file

@ -356,7 +356,7 @@ SCM_DEFINE (scm_frame_instruction_pointer, "frame-instruction-pointer", 1, 0, 0,
{
SCM_VALIDATE_VM_FRAME (1, frame);
return scm_from_uintptr_t ((scm_t_uintptr) SCM_VM_FRAME_IP (frame));
return scm_from_uintptr_t ((uintptr_t) SCM_VM_FRAME_IP (frame));
}
#undef FUNC_NAME
@ -366,7 +366,7 @@ SCM_DEFINE (scm_frame_return_address, "frame-return-address", 1, 0, 0,
#define FUNC_NAME s_scm_frame_return_address
{
SCM_VALIDATE_VM_FRAME (1, frame);
return scm_from_uintptr_t ((scm_t_uintptr) (SCM_FRAME_RETURN_ADDRESS
return scm_from_uintptr_t ((uintptr_t) (SCM_FRAME_RETURN_ADDRESS
(SCM_VM_FRAME_FP (frame))));
}
#undef FUNC_NAME
@ -379,7 +379,7 @@ SCM_DEFINE (scm_frame_dynamic_link, "frame-dynamic-link", 1, 0, 0,
SCM_VALIDATE_VM_FRAME (1, frame);
/* fixme: munge fp if holder is a continuation */
return scm_from_uintptr_t
((scm_t_uintptr)
((uintptr_t)
SCM_FRAME_DYNAMIC_LINK (SCM_VM_FRAME_FP (frame)));
}
#undef FUNC_NAME

View file

@ -89,12 +89,12 @@
/* Each element on the stack occupies the same amount of space. */
union scm_vm_stack_element
{
scm_t_uintptr as_uint;
scm_t_uint32 *as_ip;
uintptr_t as_uint;
uint32_t *as_ip;
SCM as_scm;
double as_f64;
scm_t_uint64 as_u64;
scm_t_int64 as_s64;
uint64_t as_u64;
int64_t as_s64;
/* For GC purposes. */
void *as_ptr;
@ -122,7 +122,7 @@ struct scm_frame
void *stack_holder;
scm_t_ptrdiff fp_offset;
scm_t_ptrdiff sp_offset;
scm_t_uint32 *ip;
uint32_t *ip;
};
enum scm_vm_frame_kind

View file

@ -154,7 +154,7 @@ scm_inline_double_cell (scm_i_thread *thread, scm_t_bits car, scm_t_bits cbr,
}
static inline SCM
scm_inline_words (scm_i_thread *thread, scm_t_bits car, scm_t_uint32 n_words)
scm_inline_words (scm_i_thread *thread, scm_t_bits car, uint32_t n_words)
{
SCM obj = SCM_PACK_POINTER (scm_inline_gc_malloc_words (thread, n_words));

View file

@ -150,8 +150,8 @@ SCM_API char *scm_gc_strndup (const char *str, size_t n, const char *what)
SCM_INLINE SCM scm_cell (scm_t_bits car, scm_t_bits cdr);
SCM_INLINE SCM scm_double_cell (scm_t_bits car, scm_t_bits cbr,
scm_t_bits ccr, scm_t_bits cdr);
SCM_INLINE SCM scm_words (scm_t_bits car, scm_t_uint32 n_words);
scm_t_bits ccr, scm_t_bits cdr);
SCM_INLINE SCM scm_words (scm_t_bits car, uint32_t n_words);
#if SCM_CAN_INLINE || defined SCM_INLINE_C_IMPLEMENTING_INLINES
@ -211,7 +211,7 @@ scm_double_cell (scm_t_bits car, scm_t_bits cbr,
}
SCM_INLINE_IMPLEMENTATION SCM
scm_words (scm_t_bits car, scm_t_uint32 n_words)
scm_words (scm_t_bits car, uint32_t n_words)
{
SCM z;

View file

@ -175,7 +175,7 @@
(generate-bytecode i)
(setq i (1+ i)))))
*/
static const scm_t_uint32 subr_stub_code[] = {
static const uint32_t subr_stub_code[] = {
/* C-u 1 0 M-x generate-bytecodes RET */
/* 0 arguments */
A(0),
@ -234,7 +234,7 @@ static const scm_t_uint32 subr_stub_code[] = {
&subr_stub_code[((nreq + nopt + rest) * (nreq + nopt + rest) \
+ nopt + rest * (nreq + nopt + rest + 1)) * 6]
static const scm_t_uint32*
static const uint32_t*
get_subr_stub_code (unsigned int nreq, unsigned int nopt, unsigned int rest)
{
if (SCM_UNLIKELY (rest > 1 || nreq + nopt + rest > 10))
@ -272,28 +272,28 @@ create_subr (int define, const char *name,
}
int
scm_i_primitive_code_p (const scm_t_uint32 *code)
scm_i_primitive_code_p (const uint32_t *code)
{
if (code < subr_stub_code)
return 0;
if (code > subr_stub_code + (sizeof(subr_stub_code) / sizeof(scm_t_uint32)))
if (code > subr_stub_code + (sizeof(subr_stub_code) / sizeof(uint32_t)))
return 0;
return 1;
}
scm_t_uintptr
uintptr_t
scm_i_primitive_call_ip (SCM subr)
{
size_t i;
const scm_t_uint32 *code = SCM_PROGRAM_CODE (subr);
const uint32_t *code = SCM_PROGRAM_CODE (subr);
/* A stub is 6 32-bit words long, or 24 bytes. The call will be one
instruction, in either the fourth, third, or second word. Return a
byte offset from the entry. */
for (i = 1; i < 4; i++)
if ((code[i] & 0xff) == scm_op_subr_call)
return (scm_t_uintptr) (code + i);
return (uintptr_t) (code + i);
abort ();
}

View file

@ -52,8 +52,8 @@
SCM_INTERNAL int scm_i_primitive_code_p (const scm_t_uint32 *code);
SCM_INTERNAL scm_t_uintptr scm_i_primitive_call_ip (SCM subr);
SCM_INTERNAL int scm_i_primitive_code_p (const uint32_t *code);
SCM_INTERNAL uintptr_t scm_i_primitive_call_ip (SCM subr);
union scm_vm_stack_element;
SCM_INTERNAL SCM scm_apply_subr (union scm_vm_stack_element *sp,

View file

@ -82,10 +82,10 @@ extern double floor();
#define JENKINS_LOOKUP3_HASHWORD2(k, length, ret) \
do { \
scm_t_uint32 a, b, c; \
uint32_t a, b, c; \
\
/* Set up the internal state. */ \
a = b = c = 0xdeadbeef + ((scm_t_uint32)(length<<2)) + 47; \
a = b = c = 0xdeadbeef + ((uint32_t)(length<<2)) + 47; \
\
/* Handle most of the key. */ \
while (length > 3) \
@ -117,7 +117,7 @@ extern double floor();
static unsigned long
narrow_string_hash (const scm_t_uint8 *str, size_t len)
narrow_string_hash (const uint8_t *str, size_t len)
{
unsigned long ret;
JENKINS_LOOKUP3_HASHWORD2 (str, len, ret);
@ -140,7 +140,7 @@ scm_i_string_hash (SCM str)
size_t len = scm_i_string_length (str);
if (scm_i_is_narrow_string (str))
return narrow_string_hash ((const scm_t_uint8 *) scm_i_string_chars (str),
return narrow_string_hash ((const uint8_t *) scm_i_string_chars (str),
len);
else
return wide_string_hash (scm_i_string_wide_chars (str), len);
@ -158,21 +158,21 @@ scm_i_latin1_string_hash (const char *str, size_t len)
if (len == (size_t) -1)
len = strlen (str);
return narrow_string_hash ((const scm_t_uint8 *) str, len);
return narrow_string_hash ((const uint8_t *) str, len);
}
/* A tricky optimization, but probably worth it. */
unsigned long
scm_i_utf8_string_hash (const char *str, size_t len)
{
const scm_t_uint8 *end, *ustr = (const scm_t_uint8 *) str;
const uint8_t *end, *ustr = (const uint8_t *) str;
unsigned long ret;
/* The length of the string in characters. This name corresponds to
Jenkins' original name. */
size_t length;
scm_t_uint32 a, b, c, u32;
uint32_t a, b, c, u32;
if (len == (size_t) -1)
len = strlen (str);
@ -186,7 +186,7 @@ scm_i_utf8_string_hash (const char *str, size_t len)
length = u8_strnlen (ustr, len);
/* Set up the internal state. */
a = b = c = 0xdeadbeef + ((scm_t_uint32)(length<<2)) + 47;
a = b = c = 0xdeadbeef + ((uint32_t)(length<<2)) + 47;
/* Handle most of the key. */
while (length > 3)
@ -308,7 +308,7 @@ scm_raw_ihash (SCM obj, size_t depth)
case scm_tc7_symbol:
return scm_i_symbol_hash (obj);
case scm_tc7_pointer:
return scm_raw_ihashq ((scm_t_uintptr) SCM_POINTER_VALUE (obj));
return scm_raw_ihashq ((uintptr_t) SCM_POINTER_VALUE (obj));
case scm_tc7_wvect:
case scm_tc7_vector:
{

View file

@ -763,11 +763,11 @@ compare_u32_strings (SCM s1, SCM s2, SCM locale, const char *func_name)
if (c_locale)
RUN_IN_LOCALE_SECTION (c_locale,
result = u32_strcoll ((const scm_t_uint32 *) c_s1,
(const scm_t_uint32 *) c_s2));
result = u32_strcoll ((const uint32_t *) c_s1,
(const uint32_t *) c_s2));
else
result = u32_strcoll ((const scm_t_uint32 *) c_s1,
(const scm_t_uint32 *) c_s2);
result = u32_strcoll ((const uint32_t *) c_s1,
(const uint32_t *) c_s2);
scm_remember_upto_here_2 (s1, s2);
scm_remember_upto_here (locale);
@ -787,8 +787,8 @@ locale_language ()
}
static inline int
u32_locale_casecoll (const char *func_name, const scm_t_uint32 *c_s1,
const scm_t_uint32 *c_s2,
u32_locale_casecoll (const char *func_name, const uint32_t *c_s1,
const uint32_t *c_s2,
int *result)
{
/* Note: Since this is called from `RUN_IN_LOCALE_SECTION', it must note
@ -820,13 +820,13 @@ compare_u32_strings_ci (SCM s1, SCM s2, SCM locale, const char *func_name)
RUN_IN_LOCALE_SECTION
(c_locale,
ret = u32_locale_casecoll (func_name,
(const scm_t_uint32 *) c_s1,
(const scm_t_uint32 *) c_s2,
(const uint32_t *) c_s1,
(const uint32_t *) c_s2,
&result));
else
ret = u32_locale_casecoll (func_name,
(const scm_t_uint32 *) c_s1,
(const scm_t_uint32 *) c_s2,
(const uint32_t *) c_s1,
(const uint32_t *) c_s2,
&result);
if (SCM_UNLIKELY (ret != 0))
@ -1044,16 +1044,16 @@ SCM_DEFINE (scm_char_locale_ci_eq, "char-locale-ci=?", 2, 1, 0,
/* Locale-dependent alphabetic character mapping. */
static inline int
u32_locale_tocase (const scm_t_uint32 *c_s1, size_t len,
scm_t_uint32 **p_c_s2, size_t * p_len2,
scm_t_uint32 *(*func) (const scm_t_uint32 *, size_t,
u32_locale_tocase (const uint32_t *c_s1, size_t len,
uint32_t **p_c_s2, size_t * p_len2,
uint32_t *(*func) (const uint32_t *, size_t,
const char *, uninorm_t,
scm_t_uint32 *, size_t *))
uint32_t *, size_t *))
{
/* Note: Since this is called from `RUN_IN_LOCALE_SECTION', it must not
make any non-local exit. */
scm_t_uint32 *ret;
uint32_t *ret;
const char *loc = locale_language ();
/* The first NULL here indicates that no NFC or NFKC normalization
@ -1063,7 +1063,7 @@ u32_locale_tocase (const scm_t_uint32 *c_s1, size_t len,
if (ret == NULL)
{
*p_c_s2 = (scm_t_uint32 *) NULL;
*p_c_s2 = (uint32_t *) NULL;
*p_len2 = 0;
return errno;
}
@ -1075,15 +1075,15 @@ u32_locale_tocase (const scm_t_uint32 *c_s1, size_t len,
static SCM
chr_to_case (SCM chr, scm_t_locale c_locale,
scm_t_uint32 *(*func) (const scm_t_uint32 *, size_t, const char *,
uninorm_t, scm_t_uint32 *, size_t *),
uint32_t *(*func) (const uint32_t *, size_t, const char *,
uninorm_t, uint32_t *, size_t *),
const char *func_name,
int *err)
#define FUNC_NAME func_name
{
int ret;
scm_t_uint32 c;
scm_t_uint32 *convbuf;
uint32_t c;
uint32_t *convbuf;
size_t convlen;
SCM convchar;
@ -1186,14 +1186,14 @@ SCM_DEFINE (scm_char_locale_titlecase, "char-locale-titlecase", 1, 1, 0,
static SCM
str_to_case (SCM str, scm_t_locale c_locale,
scm_t_uint32 *(*func) (const scm_t_uint32 *, size_t, const char *,
uninorm_t, scm_t_uint32 *, size_t *),
uint32_t *(*func) (const uint32_t *, size_t, const char *,
uninorm_t, uint32_t *, size_t *),
const char *func_name,
int *err)
#define FUNC_NAME func_name
{
scm_t_wchar *c_str, *c_buf;
scm_t_uint32 *c_convstr;
uint32_t *c_convstr;
size_t len, convlen;
int ret;
SCM convstr;
@ -1205,12 +1205,12 @@ str_to_case (SCM str, scm_t_locale c_locale,
if (c_locale)
RUN_IN_LOCALE_SECTION (c_locale, ret =
u32_locale_tocase ((scm_t_uint32 *) c_str, len,
u32_locale_tocase ((uint32_t *) c_str, len,
&c_convstr,
&convlen, func));
else
ret =
u32_locale_tocase ((scm_t_uint32 *) c_str, len,
u32_locale_tocase ((uint32_t *) c_str, len,
&c_convstr, &convlen, func);
scm_remember_upto_here (str);

View file

@ -127,7 +127,7 @@ static SCM word_type_symbols[] =
/* Scheme interface */
static SCM
parse_instruction (scm_t_uint8 opcode, const char *name, scm_t_uint64 meta)
parse_instruction (uint8_t opcode, const char *name, uint64_t meta)
{
SCM tail = SCM_EOL;
int len;

View file

@ -58,19 +58,19 @@ SCM_DEFINE (scm_intrinsic_list, "intrinsic-list", 0, 0, 0,
#undef FUNC_NAME
static SCM
add_immediate (SCM a, scm_t_uint8 b)
add_immediate (SCM a, uint8_t b)
{
return scm_sum (a, scm_from_uint8 (b));
}
static SCM
sub_immediate (SCM a, scm_t_uint8 b)
sub_immediate (SCM a, uint8_t b)
{
return scm_difference (a, scm_from_uint8 (b));
}
static void
string_set_x (SCM str, scm_t_uint64 idx, scm_t_uint64 ch)
string_set_x (SCM str, uint64_t idx, uint64_t ch)
{
str = scm_i_string_start_writing (str);
scm_i_string_set_x (str, idx, ch);
@ -83,13 +83,13 @@ string_to_number (SCM str)
return scm_string_to_number (str, SCM_UNDEFINED /* radix = 10 */);
}
static scm_t_uint64
static uint64_t
scm_to_uint64_truncate (SCM x)
{
if (SCM_I_INUMP (x))
return (scm_t_uint64) SCM_I_INUM (x);
return (uint64_t) SCM_I_INUM (x);
else
return scm_to_uint64 (scm_logand (x, scm_from_uint64 ((scm_t_uint64) -1)));
return scm_to_uint64 (scm_logand (x, scm_from_uint64 ((uint64_t) -1)));
}
static SCM
@ -175,10 +175,10 @@ pop_dynamic_state (scm_i_thread *thread)
}
static SCM
lsh (SCM a, scm_t_uint64 b)
lsh (SCM a, uint64_t b)
{
if (SCM_LIKELY (SCM_I_INUMP (a))
&& b < (scm_t_uint64) (SCM_I_FIXNUM_BIT - 1)
&& b < (uint64_t) (SCM_I_FIXNUM_BIT - 1)
&& ((scm_t_bits)
(SCM_SRS (SCM_I_INUM (a), (SCM_I_FIXNUM_BIT-1 - b)) + 1)
<= 1))
@ -191,11 +191,11 @@ lsh (SCM a, scm_t_uint64 b)
}
static SCM
rsh (SCM a, scm_t_uint64 b)
rsh (SCM a, uint64_t b)
{
if (SCM_LIKELY (SCM_I_INUMP (a)))
{
if (b > (scm_t_uint64) (SCM_I_FIXNUM_BIT - 1))
if (b > (uint64_t) (SCM_I_FIXNUM_BIT - 1))
b = SCM_I_FIXNUM_BIT - 1;
return SCM_I_MAKINUM (SCM_SRS (SCM_I_INUM (a), b));
}
@ -204,13 +204,13 @@ rsh (SCM a, scm_t_uint64 b)
}
static SCM
lsh_immediate (SCM a, scm_t_uint8 b)
lsh_immediate (SCM a, uint8_t b)
{
return lsh (a, b);
}
static SCM
rsh_immediate (SCM a, scm_t_uint8 b)
rsh_immediate (SCM a, uint8_t b)
{
return rsh (a, b);
}
@ -233,7 +233,7 @@ numerically_equal_p (SCM a, SCM b)
}
static SCM
resolve_module (SCM name, scm_t_uint8 public_p)
resolve_module (SCM name, uint8_t public_p)
{
SCM mod;

View file

@ -26,19 +26,19 @@
#include <libguile/vm.h>
typedef SCM (*scm_t_scm_from_scm_scm_intrinsic) (SCM, SCM);
typedef SCM (*scm_t_scm_from_scm_uimm_intrinsic) (SCM, scm_t_uint8);
typedef void (*scm_t_scm_u64_u64_intrinsic) (SCM, scm_t_uint64, scm_t_uint64);
typedef SCM (*scm_t_scm_from_scm_uimm_intrinsic) (SCM, uint8_t);
typedef void (*scm_t_scm_u64_u64_intrinsic) (SCM, uint64_t, uint64_t);
typedef SCM (*scm_t_scm_from_scm_intrinsic) (SCM);
typedef double (*scm_t_f64_from_scm_intrinsic) (SCM);
typedef scm_t_uint64 (*scm_t_u64_from_scm_intrinsic) (SCM);
typedef scm_t_int64 (*scm_t_s64_from_scm_intrinsic) (SCM);
typedef SCM (*scm_t_scm_from_u64_intrinsic) (scm_t_uint64);
typedef SCM (*scm_t_scm_from_s64_intrinsic) (scm_t_int64);
typedef uint64_t (*scm_t_u64_from_scm_intrinsic) (SCM);
typedef int64_t (*scm_t_s64_from_scm_intrinsic) (SCM);
typedef SCM (*scm_t_scm_from_u64_intrinsic) (uint64_t);
typedef SCM (*scm_t_scm_from_s64_intrinsic) (int64_t);
typedef void (*scm_t_thread_intrinsic) (scm_i_thread*);
typedef void (*scm_t_thread_scm_intrinsic) (scm_i_thread*, SCM);
typedef void (*scm_t_thread_scm_scm_intrinsic) (scm_i_thread*, SCM, SCM);
typedef SCM (*scm_t_scm_from_thread_scm_intrinsic) (scm_i_thread*, SCM);
typedef SCM (*scm_t_scm_from_scm_u64_intrinsic) (SCM, scm_t_uint64);
typedef SCM (*scm_t_scm_from_scm_u64_intrinsic) (SCM, uint64_t);
typedef int (*scm_t_bool_from_scm_scm_intrinsic) (SCM, SCM);
typedef enum scm_compare (*scm_t_compare_from_scm_scm_intrinsic) (SCM, SCM);
typedef void (*scm_t_vp_sp_intrinsic) (struct scm_vm*, union scm_vm_stack_element*);

View file

@ -105,7 +105,7 @@ pointer_to_procedure (enum bytecode_kind bytecode_kind, char *ptr)
{
case BYTECODE_KIND_GUILE_3_0:
{
return scm_i_make_program ((scm_t_uint32 *) ptr);
return scm_i_make_program ((uint32_t *) ptr);
}
case BYTECODE_KIND_NONE:
default:
@ -178,7 +178,7 @@ elf_alignment (const char *data, size_t len)
Elf_Phdr *phdr;
const char *phdr_addr = data + header->e_phoff + i * header->e_phentsize;
if (!IS_ALIGNED ((scm_t_uintptr) phdr_addr, alignof_type (Elf_Phdr)))
if (!IS_ALIGNED ((uintptr_t) phdr_addr, alignof_type (Elf_Phdr)))
return alignment;
phdr = (Elf_Phdr *) phdr_addr;
@ -220,7 +220,7 @@ alloc_aligned (size_t len, unsigned alignment)
ret = malloc (len + alignment - 1);
if (!ret)
abort ();
ret = (char *) ALIGN ((scm_t_uintptr) ret, (scm_t_uintptr) alignment);
ret = (char *) ALIGN ((uintptr_t) ret, (uintptr_t) alignment);
}
return ret;
@ -298,8 +298,8 @@ process_dynamic_segment (char *base, Elf_Phdr *dyn_phdr,
if (bytecode_kind != BYTECODE_KIND_NONE)
return "duplicate DT_GUILE_VM_VERSION";
{
scm_t_uint16 major = dyn[i].d_un.d_val >> 16;
scm_t_uint16 minor = dyn[i].d_un.d_val & 0xffff;
uint16_t major = dyn[i].d_un.d_val >> 16;
uint16_t minor = dyn[i].d_un.d_val & 0xffff;
switch (major)
{
case 0x0300:
@ -328,9 +328,9 @@ process_dynamic_segment (char *base, Elf_Phdr *dyn_phdr,
switch (bytecode_kind)
{
case BYTECODE_KIND_GUILE_3_0:
if ((scm_t_uintptr) init % 4)
if ((uintptr_t) init % 4)
return "unaligned DT_INIT";
if ((scm_t_uintptr) entry % 4)
if ((uintptr_t) entry % 4)
return "unaligned DT_GUILE_ENTRY";
break;
case BYTECODE_KIND_NONE:
@ -437,7 +437,7 @@ load_thunk_from_memory (char *data, size_t len, int is_read_only)
(for the mmap path) that the base _is_ page-aligned, we proceed
ahead even if the image alignment is greater than the page
size. */
if (!IS_ALIGNED ((scm_t_uintptr) data, alignment)
if (!IS_ALIGNED ((uintptr_t) data, alignment)
&& !IS_ALIGNED (alignment, page_size))
ABORT ("incorrectly aligned base");
@ -754,27 +754,27 @@ scm_all_mapped_elf_images (void)
struct frame_map_prefix
{
scm_t_uint32 text_offset;
scm_t_uint32 maps_offset;
uint32_t text_offset;
uint32_t maps_offset;
};
struct frame_map_header
{
scm_t_uint32 addr;
scm_t_uint32 map_offset;
uint32_t addr;
uint32_t map_offset;
};
verify (sizeof (struct frame_map_prefix) == 8);
verify (sizeof (struct frame_map_header) == 8);
const scm_t_uint8 *
scm_find_slot_map_unlocked (const scm_t_uint32 *ip)
const uint8_t *
scm_find_slot_map_unlocked (const uint32_t *ip)
{
struct mapped_elf_image *image;
char *base;
struct frame_map_prefix *prefix;
struct frame_map_header *headers;
scm_t_uintptr addr = (scm_t_uintptr) ip;
uintptr_t addr = (uintptr_t) ip;
size_t start, end;
image = find_mapped_elf_image_unlocked ((char *) ip);
@ -785,9 +785,9 @@ scm_find_slot_map_unlocked (const scm_t_uint32 *ip)
prefix = (struct frame_map_prefix *) base;
headers = (struct frame_map_header *) (base + sizeof (*prefix));
if (addr < ((scm_t_uintptr) image->start) + prefix->text_offset)
if (addr < ((uintptr_t) image->start) + prefix->text_offset)
return NULL;
addr -= ((scm_t_uintptr) image->start) + prefix->text_offset;
addr -= ((uintptr_t) image->start) + prefix->text_offset;
start = 0;
end = (prefix->maps_offset - sizeof (*prefix)) / sizeof (*headers);
@ -800,7 +800,7 @@ scm_find_slot_map_unlocked (const scm_t_uint32 *ip)
size_t n = start + (end - start) / 2;
if (addr == headers[n].addr)
return (const scm_t_uint8*) (base + headers[n].map_offset);
return (const uint8_t*) (base + headers[n].map_offset);
else if (addr < headers[n].addr)
end = n;
else

View file

@ -55,8 +55,8 @@
SCM_API SCM scm_load_thunk_from_file (SCM filename);
SCM_API SCM scm_load_thunk_from_memory (SCM bv);
SCM_INTERNAL const scm_t_uint8 *
scm_find_slot_map_unlocked (const scm_t_uint32 *ip);
SCM_INTERNAL const uint8_t *
scm_find_slot_map_unlocked (const uint32_t *ip);
SCM_INTERNAL void scm_bootstrap_loader (void);
SCM_INTERNAL void scm_init_loader (void);

View file

@ -5557,12 +5557,12 @@ iflo2str (SCM flt, char *str, int radix)
return i;
}
/* convert a scm_t_intmax to a string (unterminated). returns the number of
/* convert a intmax_t to a string (unterminated). returns the number of
characters in the result.
rad is output base
p is destination: worst case (base 2) is SCM_INTBUFLEN */
size_t
scm_iint2str (scm_t_intmax num, int rad, char *p)
scm_iint2str (intmax_t num, int rad, char *p)
{
if (num < 0)
{
@ -5573,16 +5573,16 @@ scm_iint2str (scm_t_intmax num, int rad, char *p)
return scm_iuint2str (num, rad, p);
}
/* convert a scm_t_intmax to a string (unterminated). returns the number of
/* convert a intmax_t to a string (unterminated). returns the number of
characters in the result.
rad is output base
p is destination: worst case (base 2) is SCM_INTBUFLEN */
size_t
scm_iuint2str (scm_t_uintmax num, int rad, char *p)
scm_iuint2str (uintmax_t num, int rad, char *p)
{
size_t j = 1;
size_t i;
scm_t_uintmax n = num;
uintmax_t n = num;
if (rad < 2 || rad > 36)
scm_out_of_range ("scm_iuint2str", scm_from_int (rad));
@ -5771,10 +5771,10 @@ enum t_exactness {NO_EXACTNESS, INEXACT, EXACT};
/* Caller is responsible for checking that the return value is in range
for the given radix, which should be <= 36. */
static unsigned int
char_decimal_value (scm_t_uint32 c)
char_decimal_value (uint32_t c)
{
if (c >= (scm_t_uint32) '0' && c <= (scm_t_uint32) '9')
return c - (scm_t_uint32) '0';
if (c >= (uint32_t) '0' && c <= (uint32_t) '9')
return c - (uint32_t) '0';
else
{
/* uc_decimal_value returns -1 on error. When cast to an unsigned int,
@ -5787,8 +5787,8 @@ char_decimal_value (scm_t_uint32 c)
if (d >= 10U)
{
c = uc_tolower (c);
if (c >= (scm_t_uint32) 'a')
d = c - (scm_t_uint32)'a' + 10U;
if (c >= (uint32_t) 'a')
d = c - (uint32_t)'a' + 10U;
}
return d;
}
@ -5900,7 +5900,7 @@ mem2decimal_from_point (SCM result, SCM mem,
while (idx != len)
{
scm_t_wchar c = scm_i_string_ref (mem, idx);
if (uc_is_property_decimal_digit ((scm_t_uint32) c))
if (uc_is_property_decimal_digit ((uint32_t) c))
{
if (x == INEXACT)
return SCM_BOOL_F;
@ -5990,7 +5990,7 @@ mem2decimal_from_point (SCM result, SCM mem,
else
sign = 1;
if (!uc_is_property_decimal_digit ((scm_t_uint32) c))
if (!uc_is_property_decimal_digit ((uint32_t) c))
return SCM_BOOL_F;
idx++;
@ -5998,7 +5998,7 @@ mem2decimal_from_point (SCM result, SCM mem,
while (idx != len)
{
scm_t_wchar c = scm_i_string_ref (mem, idx);
if (uc_is_property_decimal_digit ((scm_t_uint32) c))
if (uc_is_property_decimal_digit ((uint32_t) c))
{
idx++;
if (exponent <= SCM_MAXEXP)
@ -6105,7 +6105,7 @@ mem2ureal (SCM mem, unsigned int *p_idx,
return SCM_BOOL_F;
else if (idx + 1 == len)
return SCM_BOOL_F;
else if (!uc_is_property_decimal_digit ((scm_t_uint32) scm_i_string_ref (mem, idx+1)))
else if (!uc_is_property_decimal_digit ((uint32_t) scm_i_string_ref (mem, idx+1)))
return SCM_BOOL_F;
else
result = mem2decimal_from_point (SCM_INUM0, mem,
@ -8017,7 +8017,7 @@ scm_product (SCM x, SCM y)
{
scm_t_inum yy = SCM_I_INUM (y);
#if SCM_I_FIXNUM_BIT < 32 && SCM_HAVE_T_INT64
scm_t_int64 kk = xx * (scm_t_int64) yy;
int64_t kk = xx * (int64_t) yy;
if (SCM_FIXABLE (kk))
return SCM_I_MAKINUM (kk);
#else
@ -9608,7 +9608,7 @@ scm_is_exact_integer (SCM val)
}
int
scm_is_signed_integer (SCM val, scm_t_intmax min, scm_t_intmax max)
scm_is_signed_integer (SCM val, intmax_t min, intmax_t max)
{
if (SCM_I_INUMP (val))
{
@ -9631,15 +9631,15 @@ scm_is_signed_integer (SCM val, scm_t_intmax min, scm_t_intmax max)
}
else
{
scm_t_uintmax abs_n;
scm_t_intmax n;
uintmax_t abs_n;
intmax_t n;
size_t count;
if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
> CHAR_BIT*sizeof (scm_t_uintmax))
> CHAR_BIT*sizeof (uintmax_t))
return 0;
mpz_export (&abs_n, &count, 1, sizeof (scm_t_uintmax), 0, 0,
mpz_export (&abs_n, &count, 1, sizeof (uintmax_t), 0, 0,
SCM_I_BIG_MPZ (val));
if (mpz_sgn (SCM_I_BIG_MPZ (val)) >= 0)
@ -9653,7 +9653,7 @@ scm_is_signed_integer (SCM val, scm_t_intmax min, scm_t_intmax max)
{
/* Carefully avoid signed integer overflow. */
if (min < 0 && abs_n - 1 <= -(min + 1))
n = -1 - (scm_t_intmax)(abs_n - 1);
n = -1 - (intmax_t)(abs_n - 1);
else
return 0;
}
@ -9666,12 +9666,12 @@ scm_is_signed_integer (SCM val, scm_t_intmax min, scm_t_intmax max)
}
int
scm_is_unsigned_integer (SCM val, scm_t_uintmax min, scm_t_uintmax max)
scm_is_unsigned_integer (SCM val, uintmax_t min, uintmax_t max)
{
if (SCM_I_INUMP (val))
{
scm_t_signed_bits n = SCM_I_INUM (val);
return n >= 0 && ((scm_t_uintmax)n) >= min && ((scm_t_uintmax)n) <= max;
return n >= 0 && ((uintmax_t)n) >= min && ((uintmax_t)n) <= max;
}
else if (SCM_BIGP (val))
{
@ -9689,17 +9689,17 @@ scm_is_unsigned_integer (SCM val, scm_t_uintmax min, scm_t_uintmax max)
}
else
{
scm_t_uintmax n;
uintmax_t n;
size_t count;
if (mpz_sgn (SCM_I_BIG_MPZ (val)) < 0)
return 0;
if (mpz_sizeinbase (SCM_I_BIG_MPZ (val), 2)
> CHAR_BIT*sizeof (scm_t_uintmax))
> CHAR_BIT*sizeof (uintmax_t))
return 0;
mpz_export (&n, &count, 1, sizeof (scm_t_uintmax), 0, 0,
mpz_export (&n, &count, 1, sizeof (uintmax_t), 0, 0,
SCM_I_BIG_MPZ (val));
return n >= min && n <= max;
@ -9719,23 +9719,23 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
scm_list_1 (bad_val));
}
#define TYPE scm_t_intmax
#define TYPE intmax_t
#define TYPE_MIN min
#define TYPE_MAX max
#define SIZEOF_TYPE 0
#define SCM_TO_TYPE_PROTO(arg) scm_to_signed_integer (arg, scm_t_intmax min, scm_t_intmax max)
#define SCM_TO_TYPE_PROTO(arg) scm_to_signed_integer (arg, intmax_t min, intmax_t max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_signed_integer (arg)
#include "conv-integer.i.c"
#define TYPE scm_t_uintmax
#define TYPE uintmax_t
#define TYPE_MIN min
#define TYPE_MAX max
#define SIZEOF_TYPE 0
#define SCM_TO_TYPE_PROTO(arg) scm_to_unsigned_integer (arg, scm_t_uintmax min, scm_t_uintmax max)
#define SCM_TO_TYPE_PROTO(arg) scm_to_unsigned_integer (arg, uintmax_t min, uintmax_t max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_unsigned_integer (arg)
#include "conv-uinteger.i.c"
#define TYPE scm_t_int8
#define TYPE int8_t
#define TYPE_MIN INT8_MIN
#define TYPE_MAX INT8_MAX
#define SIZEOF_TYPE 1
@ -9743,7 +9743,7 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_int8 (arg)
#include "conv-integer.i.c"
#define TYPE scm_t_uint8
#define TYPE uint8_t
#define TYPE_MIN 0
#define TYPE_MAX UINT8_MAX
#define SIZEOF_TYPE 1
@ -9751,7 +9751,7 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_uint8 (arg)
#include "conv-uinteger.i.c"
#define TYPE scm_t_int16
#define TYPE int16_t
#define TYPE_MIN INT16_MIN
#define TYPE_MAX INT16_MAX
#define SIZEOF_TYPE 2
@ -9759,7 +9759,7 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_int16 (arg)
#include "conv-integer.i.c"
#define TYPE scm_t_uint16
#define TYPE uint16_t
#define TYPE_MIN 0
#define TYPE_MAX UINT16_MAX
#define SIZEOF_TYPE 2
@ -9767,7 +9767,7 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_uint16 (arg)
#include "conv-uinteger.i.c"
#define TYPE scm_t_int32
#define TYPE int32_t
#define TYPE_MIN INT32_MIN
#define TYPE_MAX INT32_MAX
#define SIZEOF_TYPE 4
@ -9775,7 +9775,7 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_int32 (arg)
#include "conv-integer.i.c"
#define TYPE scm_t_uint32
#define TYPE uint32_t
#define TYPE_MIN 0
#define TYPE_MAX UINT32_MAX
#define SIZEOF_TYPE 4
@ -9784,14 +9784,14 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#include "conv-uinteger.i.c"
#define TYPE scm_t_wchar
#define TYPE_MIN (scm_t_int32)-1
#define TYPE_MAX (scm_t_int32)0x10ffff
#define TYPE_MIN (int32_t)-1
#define TYPE_MAX (int32_t)0x10ffff
#define SIZEOF_TYPE 4
#define SCM_TO_TYPE_PROTO(arg) scm_to_wchar (arg)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_wchar (arg)
#include "conv-integer.i.c"
#define TYPE scm_t_int64
#define TYPE int64_t
#define TYPE_MIN INT64_MIN
#define TYPE_MAX INT64_MAX
#define SIZEOF_TYPE 8
@ -9799,7 +9799,7 @@ scm_i_range_error (SCM bad_val, SCM min, SCM max)
#define SCM_FROM_TYPE_PROTO(arg) scm_from_int64 (arg)
#include "conv-integer.i.c"
#define TYPE scm_t_uint64
#define TYPE uint64_t
#define TYPE_MIN 0
#define TYPE_MAX UINT64_MAX
#define SIZEOF_TYPE 8

View file

@ -118,11 +118,11 @@ typedef long scm_t_inum;
/* SCM_INTBUFLEN is the maximum number of characters neccessary for
* the printed or scm_string representation of an scm_t_intmax in
* the printed or scm_string representation of an intmax_t in
* radix 2. The buffer passed to scm_iint2str and scm_iuint2str must
* be of this size, for example.
*/
#define SCM_INTBUFLEN (5 + SCM_CHAR_BIT*sizeof(scm_t_intmax))
#define SCM_INTBUFLEN (5 + SCM_CHAR_BIT*sizeof(intmax_t))
@ -245,8 +245,8 @@ SCM_INTERNAL SCM scm_i_logand (SCM x, SCM y, SCM rest);
SCM_INTERNAL SCM scm_i_logior (SCM x, SCM y, SCM rest);
SCM_INTERNAL SCM scm_i_logxor (SCM x, SCM y, SCM rest);
SCM_API size_t scm_iint2str (scm_t_intmax num, int rad, char *p);
SCM_API size_t scm_iuint2str (scm_t_uintmax num, int rad, char *p);
SCM_API size_t scm_iint2str (intmax_t num, int rad, char *p);
SCM_API size_t scm_iuint2str (uintmax_t num, int rad, char *p);
SCM_API SCM scm_number_to_string (SCM x, SCM radix);
SCM_API int scm_print_real (SCM sexp, SCM port, scm_print_state *pstate);
SCM_API int scm_print_complex (SCM sexp, SCM port, scm_print_state *pstate);
@ -355,46 +355,46 @@ SCM_INTERNAL void scm_i_print_complex (double real, double imag, SCM port);
SCM_API int scm_is_integer (SCM val);
SCM_API int scm_is_exact_integer (SCM val);
SCM_API int scm_is_signed_integer (SCM val,
scm_t_intmax min, scm_t_intmax max);
intmax_t min, intmax_t max);
SCM_API int scm_is_unsigned_integer (SCM val,
scm_t_uintmax min, scm_t_uintmax max);
uintmax_t min, uintmax_t max);
SCM_API SCM scm_from_signed_integer (scm_t_intmax val);
SCM_API SCM scm_from_unsigned_integer (scm_t_uintmax val);
SCM_API SCM scm_from_signed_integer (intmax_t val);
SCM_API SCM scm_from_unsigned_integer (uintmax_t val);
SCM_API scm_t_intmax scm_to_signed_integer (SCM val,
scm_t_intmax min,
scm_t_intmax max);
SCM_API scm_t_uintmax scm_to_unsigned_integer (SCM val,
scm_t_uintmax min,
scm_t_uintmax max);
SCM_API intmax_t scm_to_signed_integer (SCM val,
intmax_t min,
intmax_t max);
SCM_API uintmax_t scm_to_unsigned_integer (SCM val,
uintmax_t min,
uintmax_t max);
SCM_API scm_t_int8 scm_to_int8 (SCM x);
SCM_API SCM scm_from_int8 (scm_t_int8 x);
SCM_API int8_t scm_to_int8 (SCM x);
SCM_API SCM scm_from_int8 (int8_t x);
SCM_API scm_t_uint8 scm_to_uint8 (SCM x);
SCM_API SCM scm_from_uint8 (scm_t_uint8 x);
SCM_API uint8_t scm_to_uint8 (SCM x);
SCM_API SCM scm_from_uint8 (uint8_t x);
SCM_API scm_t_int16 scm_to_int16 (SCM x);
SCM_API SCM scm_from_int16 (scm_t_int16 x);
SCM_API int16_t scm_to_int16 (SCM x);
SCM_API SCM scm_from_int16 (int16_t x);
SCM_API scm_t_uint16 scm_to_uint16 (SCM x);
SCM_API SCM scm_from_uint16 (scm_t_uint16 x);
SCM_API uint16_t scm_to_uint16 (SCM x);
SCM_API SCM scm_from_uint16 (uint16_t x);
SCM_API scm_t_int32 scm_to_int32 (SCM x);
SCM_API SCM scm_from_int32 (scm_t_int32 x);
SCM_API int32_t scm_to_int32 (SCM x);
SCM_API SCM scm_from_int32 (int32_t x);
SCM_API scm_t_uint32 scm_to_uint32 (SCM x);
SCM_API SCM scm_from_uint32 (scm_t_uint32 x);
SCM_API uint32_t scm_to_uint32 (SCM x);
SCM_API SCM scm_from_uint32 (uint32_t x);
SCM_API scm_t_wchar scm_to_wchar (SCM x);
SCM_API SCM scm_from_wchar (scm_t_wchar x);
SCM_API scm_t_int64 scm_to_int64 (SCM x);
SCM_API SCM scm_from_int64 (scm_t_int64 x);
SCM_API int64_t scm_to_int64 (SCM x);
SCM_API SCM scm_from_int64 (int64_t x);
SCM_API scm_t_uint64 scm_to_uint64 (SCM x);
SCM_API SCM scm_from_uint64 (scm_t_uint64 x);
SCM_API uint64_t scm_to_uint64 (SCM x);
SCM_API SCM scm_from_uint64 (uint64_t x);
SCM_API void scm_to_mpz (SCM x, mpz_t rop);
SCM_API SCM scm_from_mpz (mpz_t rop);
@ -494,7 +494,7 @@ SCM_API SCM scm_from_mpz (mpz_t rop);
#define scm_to_uintmax scm_to_uint64
#define scm_from_uintmax scm_from_uint64
#else
#error sizeof(scm_t_intmax) is not 4 or 8.
#error sizeof(intmax_t) is not 4 or 8.
#endif
#endif

View file

@ -120,7 +120,7 @@ SCM_DEFINE (scm_set_cdr_x, "set-cdr!", 2, 0, 0,
/* The compiler should unroll this. */
#define CHASE_PAIRS(tree, FUNC_NAME, pattern) \
scm_t_uint32 pattern_var = pattern; \
uint32_t pattern_var = pattern; \
do \
{ \
if (!scm_is_pair (tree)) \

View file

@ -260,22 +260,22 @@ scm_port_buffer_did_put (SCM buf, size_t prev_end, size_t count)
scm_port_buffer_set_end (buf, SCM_I_MAKINUM (prev_end + count));
}
static inline const scm_t_uint8 *
static inline const uint8_t *
scm_port_buffer_take_pointer (SCM buf, size_t cur)
{
signed char *ret = SCM_BYTEVECTOR_CONTENTS (scm_port_buffer_bytevector (buf));
return ((scm_t_uint8 *) ret) + cur;
return ((uint8_t *) ret) + cur;
}
static inline scm_t_uint8 *
static inline uint8_t *
scm_port_buffer_put_pointer (SCM buf, size_t end)
{
signed char *ret = SCM_BYTEVECTOR_CONTENTS (scm_port_buffer_bytevector (buf));
return ((scm_t_uint8 *) ret) + end;
return ((uint8_t *) ret) + end;
}
static inline size_t
scm_port_buffer_take (SCM buf, scm_t_uint8 *dst, size_t count,
scm_port_buffer_take (SCM buf, uint8_t *dst, size_t count,
size_t cur, size_t avail)
{
if (avail < count)
@ -287,7 +287,7 @@ scm_port_buffer_take (SCM buf, scm_t_uint8 *dst, size_t count,
}
static inline size_t
scm_port_buffer_put (SCM buf, const scm_t_uint8 *src, size_t count,
scm_port_buffer_put (SCM buf, const uint8_t *src, size_t count,
size_t end, size_t avail)
{
if (avail < count)
@ -299,7 +299,7 @@ scm_port_buffer_put (SCM buf, const scm_t_uint8 *src, size_t count,
}
static inline void
scm_port_buffer_putback (SCM buf, const scm_t_uint8 *src, size_t count,
scm_port_buffer_putback (SCM buf, const uint8_t *src, size_t count,
size_t cur)
{
assert (count <= cur);
@ -337,14 +337,14 @@ struct scm_t_port
a refcount which is positive if close has not yet been called.
Reading, writing, and the like temporarily increments this
refcount, provided it was nonzero to start with. */
scm_t_uint32 refcount;
uint32_t refcount;
/* True if the port is random access. Implies that the buffers must
be flushed before switching between reading and writing, seeking,
and so on. */
scm_t_uint32 rw_random : 1;
scm_t_uint32 at_stream_start_for_bom_read : 1;
scm_t_uint32 at_stream_start_for_bom_write : 1;
uint32_t rw_random : 1;
uint32_t at_stream_start_for_bom_read : 1;
uint32_t at_stream_start_for_bom_write : 1;
/* Character encoding support. */
SCM encoding; /* A symbol of upper-case ASCII. */

View file

@ -148,7 +148,7 @@ release_port (SCM port)
Otherwise if the refcount is higher we just subtract 1 and we're
done. However if the current refcount is 0 then the port has been
closed or is closing and we just return. */
scm_t_uint32 cur = 1, next = 0;
uint32_t cur = 1, next = 0;
while (!scm_atomic_compare_and_swap_uint32 (&pt->refcount, &cur, next))
{
if (cur == 0)
@ -187,7 +187,7 @@ scm_dynwind_acquire_port (SCM port)
there is someone else using it; that's fine, we just add our
refcount. However if the current refcount is 0 then the port has
been closed or is closing and we must throw an error. */
scm_t_uint32 cur = 1, next = 2;
uint32_t cur = 1, next = 2;
while (!scm_atomic_compare_and_swap_uint32 (&pt->refcount, &cur, next))
{
if (cur == 0)
@ -1479,7 +1479,7 @@ get_byte_or_eof (SCM port)
&& SCM_LIKELY (cur < SCM_I_INUM (buf_end))
&& SCM_LIKELY (cur < SCM_BYTEVECTOR_LENGTH (buf_bv)))
{
scm_t_uint8 ret = SCM_BYTEVECTOR_CONTENTS (buf_bv)[cur];
uint8_t ret = SCM_BYTEVECTOR_CONTENTS (buf_bv)[cur];
scm_port_buffer_set_cur (buf, SCM_I_MAKINUM (cur + 1));
return ret;
}
@ -1488,7 +1488,7 @@ get_byte_or_eof (SCM port)
buf_bv = scm_port_buffer_bytevector (buf);
if (avail > 0)
{
scm_t_uint8 ret = SCM_BYTEVECTOR_CONTENTS (buf_bv)[cur];
uint8_t ret = SCM_BYTEVECTOR_CONTENTS (buf_bv)[cur];
scm_port_buffer_set_cur (buf, SCM_I_MAKINUM (cur + 1));
return ret;
}
@ -1516,7 +1516,7 @@ peek_byte_or_eof (SCM port, SCM *buf_out, size_t *cur_out)
&& SCM_LIKELY (cur < SCM_I_INUM (buf_end))
&& SCM_LIKELY (cur < SCM_BYTEVECTOR_LENGTH (buf_bv)))
{
scm_t_uint8 ret = SCM_BYTEVECTOR_CONTENTS (buf_bv)[cur];
uint8_t ret = SCM_BYTEVECTOR_CONTENTS (buf_bv)[cur];
*buf_out = buf;
*cur_out = cur;
return ret;
@ -1528,7 +1528,7 @@ peek_byte_or_eof (SCM port, SCM *buf_out, size_t *cur_out)
*cur_out = cur;
if (avail > 0)
{
scm_t_uint8 ret = SCM_BYTEVECTOR_CONTENTS (buf_bv)[cur];
uint8_t ret = SCM_BYTEVECTOR_CONTENTS (buf_bv)[cur];
return ret;
}
@ -1596,7 +1596,7 @@ scm_c_read_bytes (SCM port, SCM dst, size_t start, size_t count)
size_t to_read = count;
scm_t_port *pt;
SCM read_buf;
scm_t_uint8 *dst_ptr = (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (dst) + start;
uint8_t *dst_ptr = (uint8_t *) SCM_BYTEVECTOR_CONTENTS (dst) + start;
SCM_VALIDATE_OPINPORT (1, port);
@ -1666,7 +1666,7 @@ scm_c_read (SCM port, void *buffer, size_t size)
size_t copied = 0;
scm_t_port *pt;
SCM read_buf;
scm_t_uint8 *dst = buffer;
uint8_t *dst = buffer;
SCM_VALIDATE_OPINPORT (1, port);
@ -1733,7 +1733,7 @@ update_port_position (SCM position, scm_t_wchar c)
/* Convert the SIZE-byte UTF-8 sequence in UTF8_BUF to a codepoint.
UTF8_BUF is assumed to contain a valid UTF-8 sequence. */
static scm_t_wchar
utf8_to_codepoint (const scm_t_uint8 *utf8_buf, size_t size)
utf8_to_codepoint (const uint8_t *utf8_buf, size_t size)
{
scm_t_wchar codepoint;
@ -1784,7 +1784,7 @@ peek_utf8_codepoint (SCM port, SCM *buf_out, size_t *cur_out, size_t *len_out)
SCM buf;
size_t cur, avail;
int first_byte;
const scm_t_uint8 *ptr;
const uint8_t *ptr;
first_byte = peek_byte_or_eof (port, &buf, &cur);
if (first_byte == EOF)
@ -1875,7 +1875,7 @@ SCM_DEFINE (scm_port_decode_char, "port-decode-char", 4, 0, 0,
#define FUNC_NAME s_scm_port_decode_char
{
char *input, *output;
scm_t_uint8 utf8_buf[UTF8_BUFFER_SIZE];
uint8_t utf8_buf[UTF8_BUFFER_SIZE];
iconv_t input_cd;
size_t c_start, c_count;
size_t input_left, output_left, done;
@ -2044,7 +2044,7 @@ SCM_DEFINE (scm_read_char, "read-char", 0, 1, 0,
void
scm_unget_bytes (const scm_t_uint8 *buf, size_t len, SCM port)
scm_unget_bytes (const uint8_t *buf, size_t len, SCM port)
#define FUNC_NAME "scm_unget_bytes"
{
scm_t_port *pt = SCM_PORT (port);
@ -2068,7 +2068,7 @@ scm_unget_bytes (const scm_t_uint8 *buf, size_t len, SCM port)
{
/* But they would fit if we shift the not-yet-read bytes from
the read_buf right. Let's do that. */
const scm_t_uint8 *to_shift = scm_port_buffer_take_pointer (read_buf, cur);
const uint8_t *to_shift = scm_port_buffer_take_pointer (read_buf, cur);
scm_port_buffer_reset_end (read_buf);
scm_port_buffer_putback (read_buf, to_shift, buffered, size);
}
@ -2366,7 +2366,7 @@ scm_take_from_input_buffers (SCM port, char *dest, size_t read_len)
SCM read_buf = SCM_PORT (port)->read_buf;
size_t cur, avail;
avail = scm_port_buffer_can_take (read_buf, &cur);
return scm_port_buffer_take (read_buf, (scm_t_uint8 *) dest, read_len,
return scm_port_buffer_take (read_buf, (uint8_t *) dest, read_len,
cur, avail);
}
@ -2397,7 +2397,7 @@ SCM_DEFINE (scm_drain_input, "drain-input", 1, 0, 0,
if (avail)
{
const scm_t_uint8 *ptr = scm_port_buffer_take_pointer (read_buf, cur);
const uint8_t *ptr = scm_port_buffer_take_pointer (read_buf, cur);
result = scm_from_port_stringn ((const char *) ptr, avail, port);
scm_port_buffer_did_take (read_buf, cur, avail);
}
@ -2467,7 +2467,7 @@ static size_t
maybe_consume_bom (SCM port, const unsigned char *bom, size_t bom_len)
{
SCM read_buf;
const scm_t_uint8 *buf;
const uint8_t *buf;
size_t cur, avail;
if (peek_byte_or_eof (port, &read_buf, &cur) != bom[0])
@ -2677,7 +2677,7 @@ scm_fill_input (SCM port, size_t minimum_size, size_t *cur_out,
scm_port_buffer_reset (read_buf);
else
{
const scm_t_uint8 *to_shift;
const uint8_t *to_shift;
to_shift = scm_port_buffer_take_pointer (read_buf, cur);
scm_port_buffer_reset (read_buf);
memmove (scm_port_buffer_put_pointer (read_buf, 0), to_shift, buffered);
@ -2962,7 +2962,7 @@ scm_c_write_bytes (SCM port, SCM src, size_t start, size_t count)
{
signed char *src_ptr = SCM_BYTEVECTOR_CONTENTS (src) + start;
scm_port_buffer_put (write_buf, (scm_t_uint8 *) src_ptr, count,
scm_port_buffer_put (write_buf, (uint8_t *) src_ptr, count,
end, count);
}
@ -2994,7 +2994,7 @@ scm_c_write (SCM port, const void *ptr, size_t size)
SCM write_buf;
size_t end, avail, written = 0;
int using_aux_buffer = 0;
const scm_t_uint8 *src = ptr;
const uint8_t *src = ptr;
SCM_VALIDATE_OPOUTPORT (1, port);
@ -3054,7 +3054,7 @@ scm_c_write (SCM port, const void *ptr, size_t size)
ASCII (so also valid ISO-8859-1 and UTF-8). Return the number of
bytes written. */
static size_t
encode_escape_sequence (scm_t_wchar ch, scm_t_uint8 buf[ESCAPE_BUFFER_SIZE])
encode_escape_sequence (scm_t_wchar ch, uint8_t buf[ESCAPE_BUFFER_SIZE])
{
/* Represent CH using the in-string escape syntax. */
static const char hex[] = "0123456789abcdef";
@ -3111,7 +3111,7 @@ encode_escape_sequence (scm_t_wchar ch, scm_t_uint8 buf[ESCAPE_BUFFER_SIZE])
void
scm_c_put_escaped_char (SCM port, scm_t_wchar ch)
{
scm_t_uint8 escape[ESCAPE_BUFFER_SIZE];
uint8_t escape[ESCAPE_BUFFER_SIZE];
size_t len = encode_escape_sequence (ch, escape);
scm_c_put_latin1_chars (port, escape, len);
}
@ -3119,7 +3119,7 @@ scm_c_put_escaped_char (SCM port, scm_t_wchar ch)
/* Convert CODEPOINT to UTF-8 and store the result in UTF8. Return the
number of bytes of the UTF-8-encoded string. */
static size_t
codepoint_to_utf8 (scm_t_uint32 codepoint, scm_t_uint8 utf8[UTF8_BUFFER_SIZE])
codepoint_to_utf8 (uint32_t codepoint, uint8_t utf8[UTF8_BUFFER_SIZE])
{
size_t len;
@ -3154,13 +3154,13 @@ codepoint_to_utf8 (scm_t_uint32 codepoint, scm_t_uint8 utf8[UTF8_BUFFER_SIZE])
}
static size_t
try_encode_char_to_iconv_buf (SCM port, SCM buf, scm_t_uint32 ch)
try_encode_char_to_iconv_buf (SCM port, SCM buf, uint32_t ch)
{
scm_t_uint8 utf8[UTF8_BUFFER_SIZE];
uint8_t utf8[UTF8_BUFFER_SIZE];
size_t utf8_len = codepoint_to_utf8 (ch, utf8);
size_t end;
size_t can_put = scm_port_buffer_can_put (buf, &end);
scm_t_uint8 *aux = scm_port_buffer_put_pointer (buf, end);
uint8_t *aux = scm_port_buffer_put_pointer (buf, end);
iconv_t output_cd;
int saved_errno;
@ -3202,7 +3202,7 @@ try_encode_char_to_iconv_buf (SCM port, SCM buf, scm_t_uint32 ch)
if (scm_is_eq (SCM_PORT (port)->conversion_strategy, sym_escape))
{
scm_t_uint8 escape[ESCAPE_BUFFER_SIZE];
uint8_t escape[ESCAPE_BUFFER_SIZE];
input = (char *) escape;
input_left = encode_escape_sequence (ch, escape);
scm_port_acquire_iconv_descriptors (port, NULL, &output_cd);
@ -3213,7 +3213,7 @@ try_encode_char_to_iconv_buf (SCM port, SCM buf, scm_t_uint32 ch)
}
else if (scm_is_eq (SCM_PORT (port)->conversion_strategy, sym_substitute))
{
scm_t_uint8 substitute[2] = "?";
uint8_t substitute[2] = "?";
input = (char *) substitute;
input_left = 1;
scm_port_acquire_iconv_descriptors (port, NULL, &output_cd);
@ -3237,7 +3237,7 @@ try_encode_char_to_iconv_buf (SCM port, SCM buf, scm_t_uint32 ch)
static size_t
encode_latin1_chars_to_latin1_buf (SCM port, SCM buf,
const scm_t_uint8 *chars, size_t count)
const uint8_t *chars, size_t count)
{
size_t end;
size_t avail = scm_port_buffer_can_put (buf, &end);
@ -3246,11 +3246,11 @@ encode_latin1_chars_to_latin1_buf (SCM port, SCM buf,
static size_t
encode_latin1_chars_to_utf8_buf (SCM port, SCM buf,
const scm_t_uint8 *chars, size_t count)
const uint8_t *chars, size_t count)
{
size_t end;
size_t buf_size = scm_port_buffer_can_put (buf, &end);
scm_t_uint8 *dst = scm_port_buffer_put_pointer (buf, end);
uint8_t *dst = scm_port_buffer_put_pointer (buf, end);
size_t read, written;
for (read = 0, written = 0;
read < count && written + UTF8_BUFFER_SIZE < buf_size;
@ -3262,7 +3262,7 @@ encode_latin1_chars_to_utf8_buf (SCM port, SCM buf,
static size_t
encode_latin1_chars_to_iconv_buf (SCM port, SCM buf,
const scm_t_uint8 *chars, size_t count)
const uint8_t *chars, size_t count)
{
size_t read;
for (read = 0; read < count; read++)
@ -3272,7 +3272,7 @@ encode_latin1_chars_to_iconv_buf (SCM port, SCM buf,
}
static size_t
encode_latin1_chars (SCM port, SCM buf, const scm_t_uint8 *chars, size_t count)
encode_latin1_chars (SCM port, SCM buf, const uint8_t *chars, size_t count)
{
scm_t_port *pt = SCM_PORT (port);
SCM position;
@ -3299,23 +3299,23 @@ encode_latin1_chars (SCM port, SCM buf, const scm_t_uint8 *chars, size_t count)
static size_t
encode_utf32_chars_to_latin1_buf (SCM port, SCM buf,
const scm_t_uint32 *chars, size_t count)
const uint32_t *chars, size_t count)
{
scm_t_port *pt = SCM_PORT (port);
size_t end;
size_t buf_size = scm_port_buffer_can_put (buf, &end);
scm_t_uint8 *dst = scm_port_buffer_put_pointer (buf, end);
uint8_t *dst = scm_port_buffer_put_pointer (buf, end);
size_t read, written;
for (read = 0, written = 0; read < count && written < buf_size; read++)
{
scm_t_uint32 ch = chars[read];
uint32_t ch = chars[read];
if (ch <= 0xff)
dst[written++] = ch;
else if (scm_is_eq (pt->conversion_strategy, sym_substitute))
dst[written++] = '?';
else if (scm_is_eq (pt->conversion_strategy, sym_escape))
{
scm_t_uint8 escape[ESCAPE_BUFFER_SIZE];
uint8_t escape[ESCAPE_BUFFER_SIZE];
size_t escape_len = encode_escape_sequence (ch, escape);
if (escape_len > buf_size - written)
break;
@ -3330,12 +3330,12 @@ encode_utf32_chars_to_latin1_buf (SCM port, SCM buf,
}
static size_t
encode_utf32_chars_to_utf8_buf (SCM port, SCM buf, const scm_t_uint32 *chars,
encode_utf32_chars_to_utf8_buf (SCM port, SCM buf, const uint32_t *chars,
size_t count)
{
size_t end;
size_t buf_size = scm_port_buffer_can_put (buf, &end);
scm_t_uint8 *dst = scm_port_buffer_put_pointer (buf, end);
uint8_t *dst = scm_port_buffer_put_pointer (buf, end);
size_t read, written;
for (read = 0, written = 0;
read < count && written + UTF8_BUFFER_SIZE < buf_size;
@ -3346,7 +3346,7 @@ encode_utf32_chars_to_utf8_buf (SCM port, SCM buf, const scm_t_uint32 *chars,
}
static size_t
encode_utf32_chars_to_iconv_buf (SCM port, SCM buf, const scm_t_uint32 *chars,
encode_utf32_chars_to_iconv_buf (SCM port, SCM buf, const uint32_t *chars,
size_t count)
{
size_t read;
@ -3357,7 +3357,7 @@ encode_utf32_chars_to_iconv_buf (SCM port, SCM buf, const scm_t_uint32 *chars,
}
static size_t
encode_utf32_chars (SCM port, SCM buf, const scm_t_uint32 *chars, size_t count)
encode_utf32_chars (SCM port, SCM buf, const uint32_t *chars, size_t count)
{
scm_t_port *pt = SCM_PORT (port);
SCM position;
@ -3392,14 +3392,14 @@ port_encode_chars (SCM port, SCM buf, SCM str, size_t start, size_t count)
{
const char *chars = scm_i_string_chars (str);
return encode_latin1_chars (port, buf,
((const scm_t_uint8 *) chars) + start,
((const uint8_t *) chars) + start,
count);
}
else
{
const scm_t_wchar *chars = scm_i_string_wide_chars (str);
return encode_utf32_chars (port, buf,
((const scm_t_uint32 *) chars) + start,
((const uint32_t *) chars) + start,
count);
}
}
@ -3433,7 +3433,7 @@ SCM_DEFINE (scm_port_encode_char, "port-encode-char", 3, 0, 0,
"")
#define FUNC_NAME s_scm_port_encode_char
{
scm_t_uint32 codepoint;
uint32_t codepoint;
SCM_VALIDATE_OPOUTPORT (1, port);
SCM_VALIDATE_VECTOR (2, buf);
@ -3447,7 +3447,7 @@ SCM_DEFINE (scm_port_encode_char, "port-encode-char", 3, 0, 0,
#undef FUNC_NAME
void
scm_c_put_latin1_chars (SCM port, const scm_t_uint8 *chars, size_t len)
scm_c_put_latin1_chars (SCM port, const uint8_t *chars, size_t len)
{
SCM aux_buf = scm_port_auxiliary_write_buffer (port);
SCM aux_bv = scm_port_buffer_bytevector (aux_buf);
@ -3474,7 +3474,7 @@ scm_c_put_latin1_chars (SCM port, const scm_t_uint8 *chars, size_t len)
}
void
scm_c_put_utf32_chars (SCM port, const scm_t_uint32 *chars, size_t len)
scm_c_put_utf32_chars (SCM port, const uint32_t *chars, size_t len)
{
SCM aux_buf = scm_port_auxiliary_write_buffer (port);
SCM aux_bv = scm_port_buffer_bytevector (aux_buf);
@ -3505,12 +3505,12 @@ scm_c_put_char (SCM port, scm_t_wchar ch)
{
if (ch <= 0xff)
{
scm_t_uint8 narrow_ch = ch;
uint8_t narrow_ch = ch;
scm_c_put_latin1_chars (port, &narrow_ch, 1);
}
else
{
scm_t_uint32 wide_ch = ch;
uint32_t wide_ch = ch;
scm_c_put_utf32_chars (port, &wide_ch, 1);
}
}
@ -3534,7 +3534,7 @@ scm_c_can_put_char (SCM port, scm_t_wchar ch)
{
SCM bv = scm_port_buffer_bytevector (scm_port_auxiliary_write_buffer (port));
scm_t_uint8 buf[UTF8_BUFFER_SIZE];
uint8_t buf[UTF8_BUFFER_SIZE];
char *input = (char *) buf;
size_t input_len;
char *output = (char *) SCM_BYTEVECTOR_CONTENTS (bv);
@ -3560,12 +3560,12 @@ scm_c_put_string (SCM port, SCM string, size_t start, size_t count)
if (scm_i_is_narrow_string (string))
{
const char *ptr = scm_i_string_chars (string);
scm_c_put_latin1_chars (port, ((const scm_t_uint8 *) ptr) + start, count);
scm_c_put_latin1_chars (port, ((const uint8_t *) ptr) + start, count);
}
else
{
const scm_t_wchar *ptr = scm_i_string_wide_chars (string);
scm_c_put_utf32_chars (port, ((const scm_t_uint32 *) ptr) + start, count);
scm_c_put_utf32_chars (port, ((const uint32_t *) ptr) + start, count);
}
}
@ -3614,14 +3614,14 @@ void
scm_putc (char c, SCM port)
{
SCM_ASSERT_TYPE (SCM_OPOUTPORTP (port), port, 0, NULL, "output port");
scm_c_put_char (port, (scm_t_uint8) c);
scm_c_put_char (port, (uint8_t) c);
}
void
scm_puts (const char *s, SCM port)
{
SCM_ASSERT_TYPE (SCM_OPOUTPORTP (port), port, 0, NULL, "output port");
scm_c_put_latin1_chars (port, (const scm_t_uint8 *) s, strlen (s));
scm_c_put_latin1_chars (port, (const uint8_t *) s, strlen (s));
}
/* scm_lfwrite
@ -3631,7 +3631,7 @@ scm_puts (const char *s, SCM port)
void
scm_lfwrite (const char *ptr, size_t size, SCM port)
{
scm_c_put_latin1_chars (port, (const scm_t_uint8 *) ptr, size);
scm_c_put_latin1_chars (port, (const uint8_t *) ptr, size);
}
/* Write STR to PORT from START inclusive to END exclusive. */

View file

@ -232,9 +232,9 @@ SCM_INTERNAL SCM scm_port_auxiliary_write_buffer (SCM port);
/* Output. */
SCM_API void scm_c_write (SCM port, const void *buffer, size_t size);
SCM_API void scm_c_write_bytes (SCM port, SCM src, size_t start, size_t count);
SCM_API void scm_c_put_latin1_chars (SCM port, const scm_t_uint8 *buf,
SCM_API void scm_c_put_latin1_chars (SCM port, const uint8_t *buf,
size_t len);
SCM_API void scm_c_put_utf32_chars (SCM port, const scm_t_uint32 *buf,
SCM_API void scm_c_put_utf32_chars (SCM port, const uint32_t *buf,
size_t len);
SCM_API void scm_c_put_string (SCM port, SCM str, size_t start, size_t count);
SCM_API SCM scm_put_string (SCM port, SCM str, SCM start, SCM count);

View file

@ -1493,11 +1493,11 @@ SCM_DEFINE (scm_system_star, "system*", 0, 0, 1,
scm_dynwind_begin (0);
/* Make sure the child can't kill us (as per normal system call). */
scm_dynwind_sigaction (SIGINT,
scm_from_uintptr_t ((scm_t_uintptr) SIG_IGN),
scm_from_uintptr_t ((uintptr_t) SIG_IGN),
SCM_UNDEFINED);
#ifdef SIGQUIT
scm_dynwind_sigaction (SIGQUIT,
scm_from_uintptr_t ((scm_t_uintptr) SIG_IGN),
scm_from_uintptr_t ((uintptr_t) SIG_IGN),
SCM_UNDEFINED);
#endif
@ -2113,7 +2113,7 @@ SCM_DEFINE (scm_setaffinity, "setaffinity", 2, 0, 0,
{
cpu_set_t cs;
scm_t_array_handle handle;
const scm_t_uint32 *c_mask;
const uint32_t *c_mask;
size_t len, off, cpu;
ssize_t inc;
int err;

View file

@ -437,12 +437,12 @@ print_normal_symbol (SCM sym, SCM port)
if (scm_i_is_narrow_symbol (sym))
{
const char *ptr = scm_i_symbol_chars (sym);
scm_c_put_latin1_chars (port, (const scm_t_uint8 *) ptr, len);
scm_c_put_latin1_chars (port, (const uint8_t *) ptr, len);
}
else
{
const scm_t_wchar *ptr = scm_i_symbol_wide_chars (sym);
scm_c_put_utf32_chars (port, (const scm_t_uint32 *) ptr, len);
scm_c_put_utf32_chars (port, (const uint32_t *) ptr, len);
}
}
@ -848,7 +848,7 @@ write_string (const void *str, int narrow_p, size_t len, SCM port)
{
size_t i;
scm_c_put_char (port, (scm_t_uint8) '"');
scm_c_put_char (port, (uint8_t) '"');
for (i = 0; i < len; ++i)
{
@ -862,11 +862,11 @@ write_string (const void *str, int narrow_p, size_t len, SCM port)
representable in PORT's encoding. If CH needs to be escaped,
it is escaped using the in-string escape syntax. */
if (ch == '"')
scm_c_put_latin1_chars (port, (const scm_t_uint8 *) "\\\"", 2);
scm_c_put_latin1_chars (port, (const uint8_t *) "\\\"", 2);
else if (ch == '\\')
scm_c_put_latin1_chars (port, (const scm_t_uint8 *) "\\\\", 2);
scm_c_put_latin1_chars (port, (const uint8_t *) "\\\\", 2);
else if (ch == '\n' && SCM_PRINT_ESCAPE_NEWLINES_P)
scm_c_put_latin1_chars (port, (const scm_t_uint8 *) "\\n", 2);
scm_c_put_latin1_chars (port, (const uint8_t *) "\\n", 2);
else if (ch == ' ' || ch == '\n'
|| (uc_is_general_category_withtable (ch,
UC_CATEGORY_MASK_L |
@ -880,7 +880,7 @@ write_string (const void *str, int narrow_p, size_t len, SCM port)
scm_c_put_escaped_char (port, ch);
}
scm_c_put_char (port, (scm_t_uint8) '"');
scm_c_put_char (port, (uint8_t) '"');
}
/* Write CH to PORT, escaping it if it's non-graphic or not
@ -933,14 +933,14 @@ write_character (scm_t_wchar ch, SCM port)
*/
void
scm_intprint (scm_t_intmax n, int radix, SCM port)
scm_intprint (intmax_t n, int radix, SCM port)
{
char num_buf[SCM_INTBUFLEN];
scm_lfwrite (num_buf, scm_iint2str (n, radix, num_buf), port);
}
void
scm_uintprint (scm_t_uintmax n, int radix, SCM port)
scm_uintprint (uintmax_t n, int radix, SCM port)
{
char num_buf[SCM_INTBUFLEN];
scm_lfwrite (num_buf, scm_iuint2str (n, radix, num_buf), port);

View file

@ -86,8 +86,8 @@ SCM_API SCM scm_print_options (SCM setting);
SCM_API SCM scm_make_print_state (void);
SCM_API void scm_free_print_state (SCM print_state);
SCM_INTERNAL SCM scm_i_port_with_print_state (SCM port, SCM print_state);
SCM_API void scm_intprint (scm_t_intmax n, int radix, SCM port);
SCM_API void scm_uintprint (scm_t_uintmax n, int radix, SCM port);
SCM_API void scm_intprint (intmax_t n, int radix, SCM port);
SCM_API void scm_uintprint (uintmax_t n, int radix, SCM port);
SCM_API void scm_ipruk (char *hdr, SCM ptr, SCM port);
SCM_API void scm_iprlist (char *hdr, SCM exp, int tlr, SCM port, scm_print_state *pstate);
SCM_API void scm_print_symbol_name (const char *str, size_t len, SCM port);

View file

@ -49,7 +49,7 @@ SCM_DEFINE (scm_program_code, "program-code", 1, 0, 0,
{
SCM_VALIDATE_PROGRAM (1, program);
return scm_from_uintptr_t ((scm_t_uintptr) SCM_PROGRAM_CODE (program));
return scm_from_uintptr_t ((uintptr_t) SCM_PROGRAM_CODE (program));
}
#undef FUNC_NAME
@ -131,7 +131,7 @@ scm_i_program_print (SCM program, SCM port, scm_print_state *pstate)
scm_puts ("#<program ", port);
scm_uintprint (SCM_UNPACK (program), 16, port);
scm_putc (' ', port);
scm_uintprint ((scm_t_uintptr) SCM_PROGRAM_CODE (program), 16, port);
scm_uintprint ((uintptr_t) SCM_PROGRAM_CODE (program), 16, port);
scm_putc ('>', port);
}
else
@ -161,7 +161,7 @@ SCM_DEFINE (scm_primitive_code_p, "primitive-code?", 1, 0, 0,
"")
#define FUNC_NAME s_scm_primitive_code_p
{
const scm_t_uint32 * ptr = (const scm_t_uint32 *) scm_to_uintptr_t (code);
const uint32_t * ptr = (const uint32_t *) scm_to_uintptr_t (code);
return scm_from_bool (scm_i_primitive_code_p (ptr));
}
@ -252,8 +252,8 @@ SCM_DEFINE (scm_program_free_variable_set_x, "program-free-variable-set!", 3, 0,
static int
try_parse_arity (SCM program, int *req, int *opt, int *rest)
{
scm_t_uint32 *code = SCM_PROGRAM_CODE (program);
scm_t_uint32 slots, min;
uint32_t *code = SCM_PROGRAM_CODE (program);
uint32_t slots, min;
switch (code[0] & 0xff) {
case scm_op_assert_nargs_ee:

View file

@ -27,7 +27,7 @@
*/
#define SCM_PROGRAM_P(x) (SCM_HAS_TYP7 (x, scm_tc7_program))
#define SCM_PROGRAM_CODE(x) ((scm_t_uint32 *) SCM_CELL_WORD_1 (x))
#define SCM_PROGRAM_CODE(x) ((uint32_t *) SCM_CELL_WORD_1 (x))
#define SCM_PROGRAM_FREE_VARIABLES(x) (SCM_CELL_OBJECT_LOC (x, 2))
#define SCM_PROGRAM_FREE_VARIABLE_REF(x,i) (SCM_PROGRAM_FREE_VARIABLES (x)[i])
#define SCM_PROGRAM_FREE_VARIABLE_SET(x,i,v) (SCM_PROGRAM_FREE_VARIABLES (x)[i]=(v))
@ -50,7 +50,7 @@
#ifdef BUILDING_LIBGUILE
static inline SCM
scm_i_make_program (const scm_t_uint32 *code)
scm_i_make_program (const uint32_t *code)
{
return scm_cell (scm_tc7_program, (scm_t_bits)code);
}

View file

@ -399,7 +399,7 @@ SCM_DEFINE (scm_lookahead_u8, "lookahead-u8", 1, 0, 0,
if (u8 == EOF)
result = SCM_EOF_VAL;
else
result = SCM_I_MAKINUM ((scm_t_uint8) u8);
result = SCM_I_MAKINUM ((uint8_t) u8);
return result;
}
@ -501,7 +501,7 @@ SCM_DEFINE (scm_get_bytevector_some, "get-bytevector-some", 1, 0, 0,
}
bv = scm_c_make_bytevector (avail);
scm_port_buffer_take (buf, (scm_t_uint8 *) SCM_BYTEVECTOR_CONTENTS (bv),
scm_port_buffer_take (buf, (uint8_t *) SCM_BYTEVECTOR_CONTENTS (bv),
avail, cur, avail);
return bv;
@ -571,7 +571,7 @@ SCM_DEFINE (scm_put_u8, "put-u8", 2, 0, 0,
"Write @var{octet} to binary port @var{port}.")
#define FUNC_NAME s_scm_put_u8
{
scm_t_uint8 c_octet;
uint8_t c_octet;
SCM_VALIDATE_BINARY_OUTPUT_PORT (1, port);
c_octet = scm_to_uint8 (octet);

View file

@ -85,8 +85,8 @@ scm_t_rng scm_the_rng;
typedef struct scm_t_i_rstate {
scm_t_rstate rstate;
scm_t_uint32 w;
scm_t_uint32 c;
uint32_t w;
uint32_t c;
} scm_t_i_rstate;
@ -96,12 +96,12 @@ typedef struct scm_t_i_rstate {
#define M_PI 3.14159265359
#endif
static scm_t_uint32
static uint32_t
scm_i_uniform32 (scm_t_rstate *state)
{
scm_t_i_rstate *istate = (scm_t_i_rstate*) state;
scm_t_uint64 x = (scm_t_uint64) A * istate->w + istate->c;
scm_t_uint32 w = x & 0xffffffffUL;
uint64_t x = (uint64_t) A * istate->w + istate->c;
uint32_t w = x & 0xffffffffUL;
istate->w = w;
istate->c = x >> 32L;
return w;
@ -111,8 +111,8 @@ static void
scm_i_init_rstate (scm_t_rstate *state, const char *seed, int n)
{
scm_t_i_rstate *istate = (scm_t_i_rstate*) state;
scm_t_uint32 w = 0L;
scm_t_uint32 c = 0L;
uint32_t w = 0L;
uint32_t c = 0L;
int i, m;
for (i = 0; i < n; ++i)
{
@ -145,7 +145,7 @@ scm_i_rstate_from_datum (scm_t_rstate *state, SCM value)
#define FUNC_NAME "scm_i_rstate_from_datum"
{
scm_t_i_rstate *istate = (scm_t_i_rstate*) state;
scm_t_uint32 w, c;
uint32_t w, c;
long length;
SCM_VALIDATE_LIST_COPYLEN (SCM_ARG1, value, length);
@ -253,8 +253,8 @@ scm_c_exp1 (scm_t_rstate *state)
unsigned char scm_masktab[256];
static inline scm_t_uint32
scm_i_mask32 (scm_t_uint32 m)
static inline uint32_t
scm_i_mask32 (uint32_t m)
{
return (m < 0x100
? scm_masktab[m]
@ -262,28 +262,28 @@ scm_i_mask32 (scm_t_uint32 m)
? scm_masktab[m >> 8] << 8 | 0xff
: (m < 0x1000000
? scm_masktab[m >> 16] << 16 | 0xffff
: ((scm_t_uint32) scm_masktab[m >> 24]) << 24 | 0xffffff)));
: ((uint32_t) scm_masktab[m >> 24]) << 24 | 0xffffff)));
}
scm_t_uint32
scm_c_random (scm_t_rstate *state, scm_t_uint32 m)
uint32_t
scm_c_random (scm_t_rstate *state, uint32_t m)
{
scm_t_uint32 r, mask = scm_i_mask32 (m);
uint32_t r, mask = scm_i_mask32 (m);
while ((r = state->rng->random_bits (state) & mask) >= m);
return r;
}
scm_t_uint64
scm_c_random64 (scm_t_rstate *state, scm_t_uint64 m)
uint64_t
scm_c_random64 (scm_t_rstate *state, uint64_t m)
{
scm_t_uint64 r;
scm_t_uint32 mask;
uint64_t r;
uint32_t mask;
if (m <= UINT32_MAX)
return scm_c_random (state, (scm_t_uint32) m);
return scm_c_random (state, (uint32_t) m);
mask = scm_i_mask32 (m >> 32);
while ((r = ((scm_t_uint64) (state->rng->random_bits (state) & mask) << 32)
while ((r = ((uint64_t) (state->rng->random_bits (state) & mask) << 32)
| state->rng->random_bits (state)) >= m)
;
return r;
@ -309,24 +309,24 @@ scm_c_random_bignum (scm_t_rstate *state, SCM m)
{
SCM result = scm_i_mkbig ();
const size_t m_bits = mpz_sizeinbase (SCM_I_BIG_MPZ (m), 2);
/* how many bits would only partially fill the last scm_t_uint32? */
const size_t end_bits = m_bits % (sizeof (scm_t_uint32) * SCM_CHAR_BIT);
scm_t_uint32 *random_chunks = NULL;
const scm_t_uint32 num_full_chunks =
m_bits / (sizeof (scm_t_uint32) * SCM_CHAR_BIT);
const scm_t_uint32 num_chunks = num_full_chunks + ((end_bits) ? 1 : 0);
/* how many bits would only partially fill the last uint32_t? */
const size_t end_bits = m_bits % (sizeof (uint32_t) * SCM_CHAR_BIT);
uint32_t *random_chunks = NULL;
const uint32_t num_full_chunks =
m_bits / (sizeof (uint32_t) * SCM_CHAR_BIT);
const uint32_t num_chunks = num_full_chunks + ((end_bits) ? 1 : 0);
/* we know the result will be this big */
mpz_realloc2 (SCM_I_BIG_MPZ (result), m_bits);
random_chunks =
(scm_t_uint32 *) scm_gc_calloc (num_chunks * sizeof (scm_t_uint32),
(uint32_t *) scm_gc_calloc (num_chunks * sizeof (uint32_t),
"random bignum chunks");
do
{
scm_t_uint32 *current_chunk = random_chunks + (num_chunks - 1);
scm_t_uint32 chunks_left = num_chunks;
uint32_t *current_chunk = random_chunks + (num_chunks - 1);
uint32_t chunks_left = num_chunks;
mpz_set_ui (SCM_I_BIG_MPZ (result), 0);
@ -334,24 +334,24 @@ scm_c_random_bignum (scm_t_rstate *state, SCM m)
{
/* generate a mask with ones in the end_bits position, i.e. if
end_bits is 3, then we'd have a mask of ...0000000111 */
const scm_t_uint32 rndbits = state->rng->random_bits (state);
int rshift = (sizeof (scm_t_uint32) * SCM_CHAR_BIT) - end_bits;
scm_t_uint32 mask = ((scm_t_uint32)-1) >> rshift;
scm_t_uint32 highest_bits = rndbits & mask;
const uint32_t rndbits = state->rng->random_bits (state);
int rshift = (sizeof (uint32_t) * SCM_CHAR_BIT) - end_bits;
uint32_t mask = ((uint32_t)-1) >> rshift;
uint32_t highest_bits = rndbits & mask;
*current_chunk-- = highest_bits;
chunks_left--;
}
while (chunks_left)
{
/* now fill in the remaining scm_t_uint32 sized chunks */
/* now fill in the remaining uint32_t sized chunks */
*current_chunk-- = state->rng->random_bits (state);
chunks_left--;
}
mpz_import (SCM_I_BIG_MPZ (result),
num_chunks,
-1,
sizeof (scm_t_uint32),
sizeof (uint32_t),
0,
0,
random_chunks);
@ -359,7 +359,7 @@ scm_c_random_bignum (scm_t_rstate *state, SCM m)
all bits in order not to get a distorted distribution) */
} while (mpz_cmp (SCM_I_BIG_MPZ (result), SCM_I_BIG_MPZ (m)) >= 0);
scm_gc_free (random_chunks,
num_chunks * sizeof (scm_t_uint32),
num_chunks * sizeof (uint32_t),
"random bignum chunks");
return scm_i_normbig (result);
}
@ -408,10 +408,10 @@ SCM_DEFINE (scm_random, "random", 1, 1, 0,
SCM_ASSERT_RANGE (1, n, SCM_I_INUM (n) > 0);
#if SCM_SIZEOF_UINTPTR_T <= 4
return scm_from_uint32 (scm_c_random (SCM_RSTATE (state),
(scm_t_uint32) m));
(uint32_t) m));
#elif SCM_SIZEOF_UINTPTR_T <= 8
return scm_from_uint64 (scm_c_random64 (SCM_RSTATE (state),
(scm_t_uint64) m));
(uint64_t) m));
#else
#error "Cannot deal with this platform's scm_t_bits size"
#endif

View file

@ -45,7 +45,7 @@ typedef struct scm_t_rstate {
typedef struct scm_t_rng {
size_t rstate_size; /* size of random state */
scm_t_uint32 (*random_bits) (scm_t_rstate *state); /* gives 32 random bits */
uint32_t (*random_bits) (scm_t_rstate *state); /* gives 32 random bits */
void (*init_rstate) (scm_t_rstate *state, const char *seed, int n);
scm_t_rstate *(*copy_rstate) (scm_t_rstate *state);
void (*from_datum) (scm_t_rstate *state, SCM datum);
@ -65,8 +65,8 @@ SCM_API scm_t_rstate *scm_c_default_rstate (void);
SCM_API double scm_c_uniform01 (scm_t_rstate *);
SCM_API double scm_c_normal01 (scm_t_rstate *);
SCM_API double scm_c_exp1 (scm_t_rstate *);
SCM_API scm_t_uint32 scm_c_random (scm_t_rstate *, scm_t_uint32 m);
SCM_API scm_t_uint64 scm_c_random64 (scm_t_rstate *state, scm_t_uint64 m);
SCM_API uint32_t scm_c_random (scm_t_rstate *, uint32_t m);
SCM_API uint64_t scm_c_random64 (scm_t_rstate *state, uint64_t m);
SCM_API SCM scm_c_random_bignum (scm_t_rstate *, SCM m);

View file

@ -138,8 +138,8 @@
/* For dealing with the bit level representation of scheme objects we
define scm_t_bits. */
typedef scm_t_intptr scm_t_signed_bits;
typedef scm_t_uintptr scm_t_bits;
typedef intptr_t scm_t_signed_bits;
typedef uintptr_t scm_t_bits;
#define SCM_T_SIGNED_BITS_MAX INTPTR_MAX
#define SCM_T_SIGNED_BITS_MIN INTPTR_MIN
@ -823,7 +823,7 @@ typedef void *scm_t_subr;
typedef struct scm_dynamic_state scm_t_dynamic_state;
typedef struct scm_print_state scm_print_state;
typedef struct scm_dynstack scm_t_dynstack;
typedef scm_t_int32 scm_t_wchar;
typedef int32_t scm_t_wchar;

View file

@ -163,7 +163,7 @@ SCM_DEFINE (scm_inet_makeaddr, "inet-makeaddr", 2, 0, 0,
\
for (i = 0; i < 8; i++)\
{\
scm_t_uint8 c = (addr)[i];\
uint8_t c = (addr)[i];\
\
(addr)[i] = (addr)[15 - i];\
(addr)[15 - i] = c;\
@ -176,8 +176,8 @@ SCM_DEFINE (scm_inet_makeaddr, "inet-makeaddr", 2, 0, 0,
#else
#define FLIPCPY_NET_HOST_128(dest, src) \
{ \
const scm_t_uint8 *tmp_srcp = (src) + 15; \
scm_t_uint8 *tmp_destp = (dest); \
const uint8_t *tmp_srcp = (src) + 15; \
uint8_t *tmp_destp = (dest); \
\
do { \
*tmp_destp++ = *tmp_srcp--; \
@ -201,7 +201,7 @@ SCM_DEFINE (scm_inet_makeaddr, "inet-makeaddr", 2, 0, 0,
/* convert a 128 bit IPv6 address in network order to a host ordered
SCM integer. */
static SCM
scm_from_ipv6 (const scm_t_uint8 *src)
scm_from_ipv6 (const uint8_t *src)
{
SCM result = scm_i_mkbig ();
mpz_import (SCM_I_BIG_MPZ (result),
@ -217,7 +217,7 @@ scm_from_ipv6 (const scm_t_uint8 *src)
/* convert a host ordered SCM integer to a 128 bit IPv6 address in
network order. */
static void
scm_to_ipv6 (scm_t_uint8 dst[16], SCM src)
scm_to_ipv6 (uint8_t dst[16], SCM src)
{
if (SCM_I_INUMP (src))
{
@ -295,7 +295,7 @@ SCM_DEFINE (scm_inet_ntop, "inet-ntop", 2, 0, 0,
);
if (af == AF_INET)
{
scm_t_uint32 addr4;
uint32_t addr4;
addr4 = htonl (SCM_NUM2ULONG (2, address));
result = inet_ntop (af, &addr4, dst, sizeof (dst));
@ -305,7 +305,7 @@ SCM_DEFINE (scm_inet_ntop, "inet-ntop", 2, 0, 0,
{
char addr6[16];
scm_to_ipv6 ((scm_t_uint8 *) addr6, address);
scm_to_ipv6 ((uint8_t *) addr6, address);
result = inet_ntop (af, &addr6, dst, sizeof (dst));
}
#endif
@ -334,7 +334,7 @@ SCM_DEFINE (scm_inet_pton, "inet-pton", 2, 0, 0,
{
int af;
char *src;
scm_t_uint32 dst[4];
uint32_t dst[4];
int rv, eno;
af = scm_to_int (family);
@ -359,7 +359,7 @@ SCM_DEFINE (scm_inet_pton, "inet-pton", 2, 0, 0,
return scm_from_ulong (ntohl (*dst));
#ifdef HAVE_IPV6
else if (af == AF_INET6)
return scm_from_ipv6 ((scm_t_uint8 *) dst);
return scm_from_ipv6 ((uint8_t *) dst);
#endif
else
SCM_MISC_ERROR ("unsupported address family", family);

View file

@ -119,7 +119,7 @@
#define DEFINE_SRFI_4_C_FUNCS(TAG, tag, ctype, width) \
SCM scm_take_##tag##vector (ctype *data, size_t n) \
{ \
return scm_c_take_typed_bytevector ((scm_t_int8*)data, n, ETYPE (TAG), \
return scm_c_take_typed_bytevector ((int8_t*)data, n, ETYPE (TAG), \
SCM_BOOL_F); \
} \
const ctype* scm_array_handle_##tag##_elements (scm_t_array_handle *h) \
@ -163,28 +163,28 @@
#define MOD "srfi srfi-4"
DEFINE_SRFI_4_PROXIES (u8);
DEFINE_SRFI_4_C_FUNCS (U8, u8, scm_t_uint8, 1);
DEFINE_SRFI_4_C_FUNCS (U8, u8, uint8_t, 1);
DEFINE_SRFI_4_PROXIES (s8);
DEFINE_SRFI_4_C_FUNCS (S8, s8, scm_t_int8, 1);
DEFINE_SRFI_4_C_FUNCS (S8, s8, int8_t, 1);
DEFINE_SRFI_4_PROXIES (u16);
DEFINE_SRFI_4_C_FUNCS (U16, u16, scm_t_uint16, 1);
DEFINE_SRFI_4_C_FUNCS (U16, u16, uint16_t, 1);
DEFINE_SRFI_4_PROXIES (s16);
DEFINE_SRFI_4_C_FUNCS (S16, s16, scm_t_int16, 1);
DEFINE_SRFI_4_C_FUNCS (S16, s16, int16_t, 1);
DEFINE_SRFI_4_PROXIES (u32);
DEFINE_SRFI_4_C_FUNCS (U32, u32, scm_t_uint32, 1);
DEFINE_SRFI_4_C_FUNCS (U32, u32, uint32_t, 1);
DEFINE_SRFI_4_PROXIES (s32);
DEFINE_SRFI_4_C_FUNCS (S32, s32, scm_t_int32, 1);
DEFINE_SRFI_4_C_FUNCS (S32, s32, int32_t, 1);
DEFINE_SRFI_4_PROXIES (u64);
DEFINE_SRFI_4_C_FUNCS (U64, u64, scm_t_uint64, 1);
DEFINE_SRFI_4_C_FUNCS (U64, u64, uint64_t, 1);
DEFINE_SRFI_4_PROXIES (s64);
DEFINE_SRFI_4_C_FUNCS (S64, s64, scm_t_int64, 1);
DEFINE_SRFI_4_C_FUNCS (S64, s64, int64_t, 1);
DEFINE_SRFI_4_PROXIES (f32);
DEFINE_SRFI_4_C_FUNCS (F32, f32, float, 1);

View file

@ -32,7 +32,7 @@ SCM_API SCM scm_make_srfi_4_vector (SCM type, SCM len, SCM fill);
SCM_API SCM scm_u8vector_p (SCM obj);
SCM_API SCM scm_make_u8vector (SCM n, SCM fill);
SCM_API SCM scm_take_u8vector (scm_t_uint8 *data, size_t n);
SCM_API SCM scm_take_u8vector (uint8_t *data, size_t n);
SCM_API SCM scm_u8vector (SCM l);
SCM_API SCM scm_u8vector_length (SCM uvec);
SCM_API SCM scm_u8vector_ref (SCM uvec, SCM index);
@ -40,19 +40,19 @@ SCM_API SCM scm_u8vector_set_x (SCM uvec, SCM index, SCM value);
SCM_API SCM scm_u8vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_u8vector (SCM l);
SCM_API SCM scm_any_to_u8vector (SCM obj);
SCM_API const scm_t_uint8 *scm_array_handle_u8_elements (scm_t_array_handle *h);
SCM_API scm_t_uint8 *scm_array_handle_u8_writable_elements (scm_t_array_handle *h);
SCM_API const scm_t_uint8 *scm_u8vector_elements (SCM uvec,
SCM_API const uint8_t *scm_array_handle_u8_elements (scm_t_array_handle *h);
SCM_API uint8_t *scm_array_handle_u8_writable_elements (scm_t_array_handle *h);
SCM_API const uint8_t *scm_u8vector_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp, ssize_t *incp);
SCM_API scm_t_uint8 *scm_u8vector_writable_elements (SCM uvec,
SCM_API uint8_t *scm_u8vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
SCM_API SCM scm_s8vector_p (SCM obj);
SCM_API SCM scm_make_s8vector (SCM n, SCM fill);
SCM_API SCM scm_take_s8vector (scm_t_int8 *data, size_t n);
SCM_API SCM scm_take_s8vector (int8_t *data, size_t n);
SCM_API SCM scm_s8vector (SCM l);
SCM_API SCM scm_s8vector_length (SCM uvec);
SCM_API SCM scm_s8vector_ref (SCM uvec, SCM index);
@ -60,19 +60,19 @@ SCM_API SCM scm_s8vector_set_x (SCM uvec, SCM index, SCM value);
SCM_API SCM scm_s8vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_s8vector (SCM l);
SCM_API SCM scm_any_to_s8vector (SCM obj);
SCM_API const scm_t_int8 *scm_array_handle_s8_elements (scm_t_array_handle *h);
SCM_API scm_t_int8 *scm_array_handle_s8_writable_elements (scm_t_array_handle *h);
SCM_API const scm_t_int8 *scm_s8vector_elements (SCM uvec,
SCM_API const int8_t *scm_array_handle_s8_elements (scm_t_array_handle *h);
SCM_API int8_t *scm_array_handle_s8_writable_elements (scm_t_array_handle *h);
SCM_API const int8_t *scm_s8vector_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp, ssize_t *incp);
SCM_API scm_t_int8 *scm_s8vector_writable_elements (SCM uvec,
SCM_API int8_t *scm_s8vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
SCM_API SCM scm_u16vector_p (SCM obj);
SCM_API SCM scm_make_u16vector (SCM n, SCM fill);
SCM_API SCM scm_take_u16vector (scm_t_uint16 *data, size_t n);
SCM_API SCM scm_take_u16vector (uint16_t *data, size_t n);
SCM_API SCM scm_u16vector (SCM l);
SCM_API SCM scm_u16vector_length (SCM uvec);
SCM_API SCM scm_u16vector_ref (SCM uvec, SCM index);
@ -80,20 +80,20 @@ SCM_API SCM scm_u16vector_set_x (SCM uvec, SCM index, SCM value);
SCM_API SCM scm_u16vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_u16vector (SCM l);
SCM_API SCM scm_any_to_u16vector (SCM obj);
SCM_API const scm_t_uint16 *scm_array_handle_u16_elements (scm_t_array_handle *h);
SCM_API scm_t_uint16 *scm_array_handle_u16_writable_elements (scm_t_array_handle *h);
SCM_API const scm_t_uint16 *scm_u16vector_elements (SCM uvec,
SCM_API const uint16_t *scm_array_handle_u16_elements (scm_t_array_handle *h);
SCM_API uint16_t *scm_array_handle_u16_writable_elements (scm_t_array_handle *h);
SCM_API const uint16_t *scm_u16vector_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
SCM_API scm_t_uint16 *scm_u16vector_writable_elements (SCM uvec,
SCM_API uint16_t *scm_u16vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
SCM_API SCM scm_s16vector_p (SCM obj);
SCM_API SCM scm_make_s16vector (SCM n, SCM fill);
SCM_API SCM scm_take_s16vector (scm_t_int16 *data, size_t n);
SCM_API SCM scm_take_s16vector (int16_t *data, size_t n);
SCM_API SCM scm_s16vector (SCM l);
SCM_API SCM scm_s16vector_length (SCM uvec);
SCM_API SCM scm_s16vector_ref (SCM uvec, SCM index);
@ -101,19 +101,19 @@ SCM_API SCM scm_s16vector_set_x (SCM uvec, SCM index, SCM value);
SCM_API SCM scm_s16vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_s16vector (SCM l);
SCM_API SCM scm_any_to_s16vector (SCM obj);
SCM_API const scm_t_int16 *scm_array_handle_s16_elements (scm_t_array_handle *h);
SCM_API scm_t_int16 *scm_array_handle_s16_writable_elements (scm_t_array_handle *h);
SCM_API const scm_t_int16 *scm_s16vector_elements (SCM uvec,
SCM_API const int16_t *scm_array_handle_s16_elements (scm_t_array_handle *h);
SCM_API int16_t *scm_array_handle_s16_writable_elements (scm_t_array_handle *h);
SCM_API const int16_t *scm_s16vector_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp, ssize_t *incp);
SCM_API scm_t_int16 *scm_s16vector_writable_elements (SCM uvec,
SCM_API int16_t *scm_s16vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
SCM_API SCM scm_u32vector_p (SCM obj);
SCM_API SCM scm_make_u32vector (SCM n, SCM fill);
SCM_API SCM scm_take_u32vector (scm_t_uint32 *data, size_t n);
SCM_API SCM scm_take_u32vector (uint32_t *data, size_t n);
SCM_API SCM scm_u32vector (SCM l);
SCM_API SCM scm_u32vector_length (SCM uvec);
SCM_API SCM scm_u32vector_ref (SCM uvec, SCM index);
@ -121,20 +121,20 @@ SCM_API SCM scm_u32vector_set_x (SCM uvec, SCM index, SCM value);
SCM_API SCM scm_u32vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_u32vector (SCM l);
SCM_API SCM scm_any_to_u32vector (SCM obj);
SCM_API const scm_t_uint32 *scm_array_handle_u32_elements (scm_t_array_handle *h);
SCM_API scm_t_uint32 *scm_array_handle_u32_writable_elements (scm_t_array_handle *h);
SCM_API const scm_t_uint32 *scm_u32vector_elements (SCM uvec,
SCM_API const uint32_t *scm_array_handle_u32_elements (scm_t_array_handle *h);
SCM_API uint32_t *scm_array_handle_u32_writable_elements (scm_t_array_handle *h);
SCM_API const uint32_t *scm_u32vector_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
SCM_API scm_t_uint32 *scm_u32vector_writable_elements (SCM uvec,
SCM_API uint32_t *scm_u32vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
SCM_API SCM scm_s32vector_p (SCM obj);
SCM_API SCM scm_make_s32vector (SCM n, SCM fill);
SCM_API SCM scm_take_s32vector (scm_t_int32 *data, size_t n);
SCM_API SCM scm_take_s32vector (int32_t *data, size_t n);
SCM_API SCM scm_s32vector (SCM l);
SCM_API SCM scm_s32vector_length (SCM uvec);
SCM_API SCM scm_s32vector_ref (SCM uvec, SCM index);
@ -142,12 +142,12 @@ SCM_API SCM scm_s32vector_set_x (SCM uvec, SCM index, SCM value);
SCM_API SCM scm_s32vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_s32vector (SCM l);
SCM_API SCM scm_any_to_s32vector (SCM obj);
SCM_API const scm_t_int32 *scm_array_handle_s32_elements (scm_t_array_handle *h);
SCM_API scm_t_int32 *scm_array_handle_s32_writable_elements (scm_t_array_handle *h);
SCM_API const scm_t_int32 *scm_s32vector_elements (SCM uvec,
SCM_API const int32_t *scm_array_handle_s32_elements (scm_t_array_handle *h);
SCM_API int32_t *scm_array_handle_s32_writable_elements (scm_t_array_handle *h);
SCM_API const int32_t *scm_s32vector_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp, ssize_t *incp);
SCM_API scm_t_int32 *scm_s32vector_writable_elements (SCM uvec,
SCM_API int32_t *scm_s32vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
@ -162,14 +162,14 @@ SCM_API SCM scm_u64vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_u64vector (SCM l);
SCM_API SCM scm_any_to_u64vector (SCM obj);
SCM_API SCM scm_take_u64vector (scm_t_uint64 *data, size_t n);
SCM_API const scm_t_uint64 *scm_array_handle_u64_elements (scm_t_array_handle *h);
SCM_API scm_t_uint64 *scm_array_handle_u64_writable_elements (scm_t_array_handle *h);
SCM_API const scm_t_uint64 *scm_u64vector_elements (SCM uvec,
SCM_API SCM scm_take_u64vector (uint64_t *data, size_t n);
SCM_API const uint64_t *scm_array_handle_u64_elements (scm_t_array_handle *h);
SCM_API uint64_t *scm_array_handle_u64_writable_elements (scm_t_array_handle *h);
SCM_API const uint64_t *scm_u64vector_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
SCM_API scm_t_uint64 *scm_u64vector_writable_elements (SCM uvec,
SCM_API uint64_t *scm_u64vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);
@ -184,13 +184,13 @@ SCM_API SCM scm_s64vector_to_list (SCM uvec);
SCM_API SCM scm_list_to_s64vector (SCM l);
SCM_API SCM scm_any_to_s64vector (SCM obj);
SCM_API SCM scm_take_s64vector (scm_t_int64 *data, size_t n);
SCM_API const scm_t_int64 *scm_array_handle_s64_elements (scm_t_array_handle *h);
SCM_API scm_t_int64 *scm_array_handle_s64_writable_elements (scm_t_array_handle *h);
SCM_API const scm_t_int64 *scm_s64vector_elements (SCM uvec,
SCM_API SCM scm_take_s64vector (int64_t *data, size_t n);
SCM_API const int64_t *scm_array_handle_s64_elements (scm_t_array_handle *h);
SCM_API int64_t *scm_array_handle_s64_writable_elements (scm_t_array_handle *h);
SCM_API const int64_t *scm_s64vector_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp, ssize_t *incp);
SCM_API scm_t_int64 *scm_s64vector_writable_elements (SCM uvec,
SCM_API int64_t *scm_s64vector_writable_elements (SCM uvec,
scm_t_array_handle *h,
size_t *lenp,
ssize_t *incp);

View file

@ -152,14 +152,14 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame,
&& scm_is_integer (scm_cdr (inner_cut)))
{
/* Cut until an IP within the given range is found. */
scm_t_uintptr low_pc, high_pc, pc;
uintptr_t low_pc, high_pc, pc;
low_pc = scm_to_uintptr_t (scm_car (inner_cut));
high_pc = scm_to_uintptr_t (scm_cdr (inner_cut));
for (; len ;)
{
pc = (scm_t_uintptr) frame->ip;
pc = (uintptr_t) frame->ip;
len--;
scm_c_frame_previous (kind, frame);
if (low_pc <= pc && pc < high_pc)
@ -206,7 +206,7 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame,
&& scm_is_integer (scm_cdr (outer_cut)))
{
/* Cut until an IP within the given range is found. */
scm_t_uintptr low_pc, high_pc, pc;
uintptr_t low_pc, high_pc, pc;
long i, new_len;
struct scm_frame tmp;
@ -218,7 +218,7 @@ narrow_stack (long len, enum scm_vm_frame_kind kind, struct scm_frame *frame,
/* Cut until the given procedure is seen. */
for (new_len = i = 0; i < len; i++, scm_c_frame_previous (kind, &tmp))
{
pc = (scm_t_uintptr) tmp.ip;
pc = (uintptr_t) tmp.ip;
if (low_pc <= pc && pc < high_pc)
new_len = i;
}

View file

@ -673,7 +673,7 @@ SCM_DEFINE (scm_strftime, "strftime", 2, 0, 0,
character to the format string, so that valid returns are always
nonzero. */
myfmt = scm_malloc (len+2);
*myfmt = (scm_t_uint8) 'x';
*myfmt = (uint8_t) 'x';
strncpy (myfmt + 1, fmt, len);
myfmt[len + 1] = 0;
scm_remember_upto_here_1 (format);
@ -809,7 +809,7 @@ SCM_DEFINE (scm_strptime, "strptime", 2, 0, 0,
#endif
/* Compute the number of UTF-8 characters. */
used_len = u8_strnlen ((scm_t_uint8*) str, rest-str);
used_len = u8_strnlen ((uint8_t*) str, rest-str);
scm_remember_upto_here_2 (format, string);
free (str);
free (fmt);

View file

@ -365,8 +365,8 @@ substring_with_immutable_stringbuf (SCM str, size_t start, size_t end,
if (STRINGBUF_WIDE (buf))
{
new_buf = make_wide_stringbuf (len);
u32_cpy ((scm_t_uint32 *) STRINGBUF_WIDE_CHARS (new_buf),
(scm_t_uint32 *) (STRINGBUF_WIDE_CHARS (buf) + start), len);
u32_cpy ((uint32_t *) STRINGBUF_WIDE_CHARS (new_buf),
(uint32_t *) (STRINGBUF_WIDE_CHARS (buf) + start), len);
new_str = scm_double_cell (tag, SCM_UNPACK (new_buf), 0, len);
scm_i_try_narrow_string (new_str);
}
@ -433,8 +433,8 @@ scm_i_string_ensure_mutable_x (SCM str)
if (STRINGBUF_WIDE (buf))
{
new_buf = make_wide_stringbuf (len);
u32_cpy ((scm_t_uint32 *) STRINGBUF_WIDE_CHARS (new_buf),
(scm_t_uint32 *) STRINGBUF_WIDE_CHARS (buf), len);
u32_cpy ((uint32_t *) STRINGBUF_WIDE_CHARS (new_buf),
(uint32_t *) STRINGBUF_WIDE_CHARS (buf), len);
}
else
{
@ -920,8 +920,8 @@ SCM_DEFINE (scm_sys_string_dump, "%string-dump", 1, 0, 0, (SCM str),
size_t len = STRINGBUF_LENGTH (buf);
scm_t_wchar *cbuf;
SCM sbc = scm_i_make_wide_string (len, &cbuf, 0);
u32_cpy ((scm_t_uint32 *) cbuf,
(scm_t_uint32 *) STRINGBUF_WIDE_CHARS (buf), len);
u32_cpy ((uint32_t *) cbuf,
(uint32_t *) STRINGBUF_WIDE_CHARS (buf), len);
e6 = scm_cons (scm_from_latin1_symbol ("stringbuf-chars"),
sbc);
}
@ -993,8 +993,8 @@ SCM_DEFINE (scm_sys_symbol_dump, "%symbol-dump", 1, 0, 0, (SCM sym),
size_t len = STRINGBUF_LENGTH (buf);
scm_t_wchar *cbuf;
SCM sbc = scm_i_make_wide_string (len, &cbuf, 0);
u32_cpy ((scm_t_uint32 *) cbuf,
(scm_t_uint32 *) STRINGBUF_WIDE_CHARS (buf), len);
u32_cpy ((uint32_t *) cbuf,
(uint32_t *) STRINGBUF_WIDE_CHARS (buf), len);
e4 = scm_cons (scm_from_latin1_symbol ("stringbuf-chars"),
sbc);
}
@ -1423,8 +1423,8 @@ SCM_DEFINE (scm_string_append, "string-append", 0, 0, 1,
data.wide[i] = (unsigned char) src[i];
}
else
u32_cpy ((scm_t_uint32 *) data.wide,
(scm_t_uint32 *) scm_i_string_wide_chars (s), len);
u32_cpy ((uint32_t *) data.wide,
(uint32_t *) scm_i_string_wide_chars (s), len);
data.wide += len;
}
total -= len;
@ -1542,7 +1542,7 @@ scm_from_stringn (const char *str, size_t len, const char *encoding,
{
scm_t_wchar *wdst;
res = scm_i_make_wide_string (u32len, &wdst, 0);
u32_cpy ((scm_t_uint32 *) wdst, (scm_t_uint32 *) u32, u32len);
u32_cpy ((uint32_t *) wdst, (uint32_t *) u32, u32len);
wdst[u32len] = 0;
}
@ -1602,7 +1602,7 @@ SCM
scm_from_utf8_stringn (const char *str, size_t len)
{
size_t i, char_len;
const scm_t_uint8 *ustr = (const scm_t_uint8 *) str;
const uint8_t *ustr = (const uint8_t *) str;
int ascii = 1, narrow = 1;
SCM res;
@ -1932,7 +1932,7 @@ scm_to_utf8_string (SCM str)
}
static size_t
latin1_u8_strlen (const scm_t_uint8 *str, size_t len)
latin1_u8_strlen (const uint8_t *str, size_t len)
{
size_t ret, i;
for (i = 0, ret = 0; i < len; i++)
@ -1940,9 +1940,9 @@ latin1_u8_strlen (const scm_t_uint8 *str, size_t len)
return ret;
}
static scm_t_uint8*
latin1_to_u8 (const scm_t_uint8 *str, size_t latin_len,
scm_t_uint8 *u8_result, size_t *u8_lenp)
static uint8_t*
latin1_to_u8 (const uint8_t *str, size_t latin_len,
uint8_t *u8_result, size_t *u8_lenp)
{
size_t i, n;
size_t u8_len = latin1_u8_strlen (str, latin_len);
@ -1982,13 +1982,13 @@ latin1_to_u8 (const scm_t_uint8 *str, size_t latin_len,
*/
static size_t
u32_u8_length_in_bytes (const scm_t_uint32 *str, size_t len)
u32_u8_length_in_bytes (const uint32_t *str, size_t len)
{
size_t ret, i;
for (i = 0, ret = 0; i < len; i++)
{
scm_t_uint32 c = str[i];
uint32_t c = str[i];
if (c <= 0x7f)
ret += 1;
@ -2011,11 +2011,11 @@ static size_t
utf8_length (SCM str)
{
if (scm_i_is_narrow_string (str))
return latin1_u8_strlen ((scm_t_uint8 *) scm_i_string_chars (str),
return latin1_u8_strlen ((uint8_t *) scm_i_string_chars (str),
scm_i_string_length (str));
else
return u32_u8_length_in_bytes
((scm_t_uint32 *) scm_i_string_wide_chars (str),
((uint32_t *) scm_i_string_wide_chars (str),
scm_i_string_length (str));
}
@ -2046,13 +2046,13 @@ scm_to_utf8_stringn (SCM str, size_t *lenp)
SCM_VALIDATE_STRING (1, str);
if (scm_i_is_narrow_string (str))
return (char *) latin1_to_u8 ((scm_t_uint8 *) scm_i_string_chars (str),
return (char *) latin1_to_u8 ((uint8_t *) scm_i_string_chars (str),
scm_i_string_length (str),
NULL, lenp);
else
{
scm_t_uint32 *chars = (scm_t_uint32 *) scm_i_string_wide_chars (str);
scm_t_uint8 *buf, *ret;
uint32_t *chars = (uint32_t *) scm_i_string_wide_chars (str);
uint8_t *buf, *ret;
size_t num_chars = scm_i_string_length (str);
size_t num_bytes_predicted, num_bytes_actual;
@ -2109,10 +2109,10 @@ scm_to_utf32_stringn (SCM str, size_t *lenp)
if (scm_i_is_narrow_string (str))
{
scm_t_uint8 *codepoints;
uint8_t *codepoints;
size_t i, len;
codepoints = (scm_t_uint8*) scm_i_string_chars (str);
codepoints = (uint8_t*) scm_i_string_chars (str);
len = scm_i_string_length (str);
if (lenp)
*lenp = len;
@ -2240,7 +2240,7 @@ scm_to_stringn (SCM str, size_t *lenp, const char *encoding,
{
buf = u32_conv_to_encoding (enc,
(enum iconv_ilseq_handler) handler,
(scm_t_uint32 *) scm_i_string_wide_chars (str),
(uint32_t *) scm_i_string_wide_chars (str),
ilen,
NULL,
NULL, &len);
@ -2306,7 +2306,7 @@ static SCM
normalize_str (SCM string, uninorm_t form)
{
SCM ret;
scm_t_uint32 *w_str;
uint32_t *w_str;
scm_t_wchar *cbuf;
size_t rlen, len = scm_i_string_length (string);
@ -2322,12 +2322,12 @@ normalize_str (SCM string, uninorm_t form)
w_str[len] = 0;
}
else
w_str = (scm_t_uint32 *) scm_i_string_wide_chars (string);
w_str = (uint32_t *) scm_i_string_wide_chars (string);
w_str = u32_normalize (form, w_str, len, NULL, &rlen);
ret = scm_i_make_wide_string (rlen, &cbuf, 0);
u32_cpy ((scm_t_uint32 *) cbuf, w_str, rlen);
u32_cpy ((uint32_t *) cbuf, w_str, rlen);
free (w_str);
scm_i_try_narrow_string (ret);

View file

@ -129,7 +129,7 @@ set_vtable_access_fields (SCM vtable)
size_t len, nfields, bitmask_size, field;
SCM layout;
const char *c_layout;
scm_t_uint32 *unboxed_fields;
uint32_t *unboxed_fields;
layout = SCM_VTABLE_LAYOUT (vtable);
c_layout = scm_i_symbol_chars (layout);
@ -151,7 +151,7 @@ set_vtable_access_fields (SCM vtable)
SCM_SET_VTABLE_FLAGS (vtable, 0);
SCM_STRUCT_DATA_SET (vtable, scm_vtable_index_size, len / 2);
SCM_STRUCT_DATA_SET (vtable, scm_vtable_index_unboxed_fields,
(scm_t_uintptr) unboxed_fields);
(uintptr_t) unboxed_fields);
}
static int

View file

@ -70,7 +70,7 @@
#define scm_vtable_index_instance_printer 3 /* A printer for this struct type. */
#define scm_vtable_index_name 4 /* Name of this vtable. */
#define scm_vtable_index_size 5 /* Number of fields, for simple structs. */
#define scm_vtable_index_unboxed_fields 6 /* Raw scm_t_uint32* bitmask indicating unboxed fields. */
#define scm_vtable_index_unboxed_fields 6 /* Raw uint32_t* bitmask indicating unboxed fields. */
#define scm_vtable_index_reserved_7 7
#define scm_vtable_offset_user 8 /* Where do user fields start in the vtable? */
@ -139,7 +139,7 @@ typedef void (*scm_t_struct_finalize) (SCM obj);
#define SCM_VTABLE_NAME(X) (SCM_STRUCT_SLOT_REF (X, scm_vtable_index_name))
#define SCM_SET_VTABLE_NAME(X,V) (SCM_STRUCT_SLOT_SET (X, scm_vtable_index_name, V))
#define SCM_VTABLE_SIZE(X) (SCM_STRUCT_DATA_REF (X, scm_vtable_index_size))
#define SCM_VTABLE_UNBOXED_FIELDS(X) ((scm_t_uint32*) SCM_STRUCT_DATA_REF (X, scm_vtable_index_unboxed_fields))
#define SCM_VTABLE_UNBOXED_FIELDS(X) ((uint32_t*) SCM_STRUCT_DATA_REF (X, scm_vtable_index_unboxed_fields))
#define SCM_VTABLE_FIELD_IS_UNBOXED(X,F) (SCM_VTABLE_UNBOXED_FIELDS (X)[(F)>>5]&(1U<<((F)&31)))
#define SCM_STRUCT_VTABLE(X) (SCM_PACK (SCM_CELL_WORD_0 (X) - scm_tc3_struct))

View file

@ -154,7 +154,7 @@ struct utf8_lookup_data
};
static int
utf8_string_equals_wide_string (const scm_t_uint8 *narrow, size_t nlen,
utf8_string_equals_wide_string (const uint8_t *narrow, size_t nlen,
const scm_t_wchar *wide, size_t wlen)
{
size_t byte_idx = 0, char_idx = 0;
@ -192,7 +192,7 @@ utf8_lookup_predicate_fn (SCM sym, void *closure)
return (scm_i_symbol_length (sym) == data->len
&& strncmp (scm_i_symbol_chars (sym), data->str, data->len) == 0);
else
return utf8_string_equals_wide_string ((const scm_t_uint8 *) data->str,
return utf8_string_equals_wide_string ((const uint8_t *) data->str,
data->len,
scm_i_symbol_wide_chars (sym),
scm_i_symbol_length (sym));

View file

@ -80,7 +80,7 @@ thread_mark (GC_word *addr, struct GC_ms_entry *mark_stack_ptr,
struct GC_ms_entry *mark_stack_limit, GC_word env)
{
int word;
const struct scm_i_thread *t = (struct scm_i_thread *) addr;
struct scm_i_thread *t = (struct scm_i_thread *) addr;
if (SCM_UNPACK (t->handle) == 0)
/* T must be on the free-list; ignore. (See warning in
@ -250,11 +250,11 @@ thread_print (SCM exp, SCM port, scm_print_state *pstate SCM_UNUSED)
unsigned short us;
unsigned int ui;
unsigned long ul;
scm_t_uintmax um;
uintmax_t um;
} u;
scm_i_thread *t = SCM_I_THREAD_DATA (exp);
scm_i_pthread_t p = t->pthread;
scm_t_uintmax id;
uintmax_t id;
u.p = p;
if (sizeof (p) == sizeof (unsigned short))
id = u.us;

View file

@ -66,10 +66,10 @@ const void *
scm_array_handle_uniform_elements (scm_t_array_handle *h)
{
size_t esize;
const scm_t_uint8 *ret;
const uint8_t *ret;
esize = scm_array_handle_uniform_element_size (h);
ret = ((const scm_t_uint8 *) h->elements) + h->base * esize;
ret = ((const uint8_t *) h->elements) + h->base * esize;
return ret;
}

File diff suppressed because it is too large Load diff

View file

@ -164,8 +164,8 @@ scm_i_vm_cont_to_frame (SCM cont, struct scm_frame *frame)
SCM
scm_i_vm_capture_stack (union scm_vm_stack_element *stack_top,
union scm_vm_stack_element *fp,
union scm_vm_stack_element *sp, scm_t_uint32 *ra,
scm_t_dynstack *dynstack, scm_t_uint32 flags)
union scm_vm_stack_element *sp, uint32_t *ra,
scm_t_dynstack *dynstack, uint32_t flags)
{
struct scm_vm_cont *p;
@ -273,7 +273,7 @@ vm_dispatch_hook (struct scm_vm *vp, int hook_num,
struct scm_frame c_frame;
scm_t_cell *frame;
int saved_trace_level;
scm_t_uint8 saved_compare_result;
uint8_t saved_compare_result;
hook = vp->hooks[hook_num];
@ -301,7 +301,7 @@ vm_dispatch_hook (struct scm_vm *vp, int hook_num,
/* Arrange for FRAME to be 8-byte aligned, like any other cell. */
frame = alloca (sizeof (*frame) + 8);
frame = (scm_t_cell *) ROUND_UP ((scm_t_uintptr) frame, 8UL);
frame = (scm_t_cell *) ROUND_UP ((uintptr_t) frame, 8UL);
frame->word_0 = SCM_PACK (scm_tc7_frame | (SCM_VM_FRAME_KIND_VM << 8));
frame->word_1 = SCM_PACK_POINTER (&c_frame);
@ -462,7 +462,7 @@ static void vm_throw_with_value (SCM val, SCM key_subr_and_message) SCM_NORETURN
static void vm_throw_with_value_and_data (SCM val, SCM key_subr_and_message) SCM_NORETURN SCM_NOINLINE;
static void vm_error (const char *msg, SCM arg) SCM_NORETURN;
static void vm_error_bad_instruction (scm_t_uint32 inst) SCM_NORETURN SCM_NOINLINE;
static void vm_error_bad_instruction (uint32_t inst) SCM_NORETURN SCM_NOINLINE;
static void vm_error_apply_to_non_list (SCM x) SCM_NORETURN SCM_NOINLINE;
static void vm_error_kwargs_missing_value (SCM proc, SCM kw) SCM_NORETURN SCM_NOINLINE;
static void vm_error_kwargs_invalid_keyword (SCM proc, SCM obj) SCM_NORETURN SCM_NOINLINE;
@ -471,7 +471,7 @@ static void vm_error_wrong_num_args (SCM proc) SCM_NORETURN SCM_NOINLINE;
static void vm_error_wrong_type_apply (SCM proc) SCM_NORETURN SCM_NOINLINE;
static void vm_error_no_values (void) SCM_NORETURN SCM_NOINLINE;
static void vm_error_not_enough_values (void) SCM_NORETURN SCM_NOINLINE;
static void vm_error_wrong_number_of_values (scm_t_uint32 expected) SCM_NORETURN SCM_NOINLINE;
static void vm_error_wrong_number_of_values (uint32_t expected) SCM_NORETURN SCM_NOINLINE;
static void vm_error_continuation_not_rewindable (SCM cont) SCM_NORETURN SCM_NOINLINE;
static void
@ -518,7 +518,7 @@ vm_error (const char *msg, SCM arg)
}
static void
vm_error_bad_instruction (scm_t_uint32 inst)
vm_error_bad_instruction (uint32_t inst)
{
vm_error ("VM: Bad instruction: ~s", scm_from_uint32 (inst));
}
@ -581,7 +581,7 @@ vm_error_not_enough_values (void)
}
static void
vm_error_wrong_number_of_values (scm_t_uint32 expected)
vm_error_wrong_number_of_values (uint32_t expected)
{
vm_error ("Wrong number of values returned to continuation (expected ~a)",
scm_from_uint32 (expected));
@ -603,31 +603,31 @@ static SCM vm_builtin_abort_to_prompt;
static SCM vm_builtin_call_with_values;
static SCM vm_builtin_call_with_current_continuation;
static const scm_t_uint32 vm_boot_continuation_code[] = {
static const uint32_t vm_boot_continuation_code[] = {
SCM_PACK_OP_24 (halt, 0)
};
static const scm_t_uint32 vm_apply_non_program_code[] = {
static const uint32_t vm_apply_non_program_code[] = {
SCM_PACK_OP_24 (apply_non_program, 0)
};
static const scm_t_uint32 vm_builtin_apply_code[] = {
static const uint32_t vm_builtin_apply_code[] = {
SCM_PACK_OP_24 (assert_nargs_ge, 3),
SCM_PACK_OP_24 (tail_apply, 0), /* proc in r1, args from r2 */
};
static const scm_t_uint32 vm_builtin_values_code[] = {
static const uint32_t vm_builtin_values_code[] = {
SCM_PACK_OP_24 (return_values, 0) /* vals from r1 */
};
static const scm_t_uint32 vm_builtin_abort_to_prompt_code[] = {
static const uint32_t vm_builtin_abort_to_prompt_code[] = {
SCM_PACK_OP_24 (assert_nargs_ge, 2),
SCM_PACK_OP_24 (abort, 0), /* tag in r1, vals from r2 */
/* FIXME: Partial continuation should capture caller regs. */
SCM_PACK_OP_24 (return_values, 0) /* vals from r1 */
};
static const scm_t_uint32 vm_builtin_call_with_values_code[] = {
static const uint32_t vm_builtin_call_with_values_code[] = {
SCM_PACK_OP_24 (assert_nargs_ee, 3),
SCM_PACK_OP_24 (alloc_frame, 7),
SCM_PACK_OP_12_12 (mov, 0, 5),
@ -636,12 +636,12 @@ static const scm_t_uint32 vm_builtin_call_with_values_code[] = {
SCM_PACK_OP_24 (tail_call_shuffle, 7)
};
static const scm_t_uint32 vm_builtin_call_with_current_continuation_code[] = {
static const uint32_t vm_builtin_call_with_current_continuation_code[] = {
SCM_PACK_OP_24 (assert_nargs_ee, 2),
SCM_PACK_OP_24 (call_cc, 0)
};
static const scm_t_uint32 vm_handle_interrupt_code[] = {
static const uint32_t vm_handle_interrupt_code[] = {
SCM_PACK_OP_24 (alloc_frame, 3),
SCM_PACK_OP_12_12 (mov, 0, 2),
SCM_PACK_OP_24 (call, 2), SCM_PACK_OP_ARG_8_24 (0, 1),
@ -650,7 +650,7 @@ static const scm_t_uint32 vm_handle_interrupt_code[] = {
int
scm_i_vm_is_boot_continuation_code (scm_t_uint32 *ip)
scm_i_vm_is_boot_continuation_code (uint32_t *ip)
{
return ip == vm_boot_continuation_code;
}
@ -863,11 +863,11 @@ static void
return_unused_stack_to_os (struct scm_vm *vp)
{
#if HAVE_SYS_MMAN_H
scm_t_uintptr lo = (scm_t_uintptr) vp->stack_bottom;
scm_t_uintptr hi = (scm_t_uintptr) vp->sp;
uintptr_t lo = (uintptr_t) vp->stack_bottom;
uintptr_t hi = (uintptr_t) vp->sp;
/* The second condition is needed to protect against wrap-around. */
if (vp->sp_min_since_gc >= vp->stack_bottom && vp->sp >= vp->sp_min_since_gc)
lo = (scm_t_uintptr) vp->sp_min_since_gc;
lo = (uintptr_t) vp->sp_min_since_gc;
lo &= ~(page_size - 1U); /* round down */
hi &= ~(page_size - 1U); /* round down */
@ -893,8 +893,8 @@ return_unused_stack_to_os (struct scm_vm *vp)
#define SLOT_MAP_CACHE_SIZE 32U
struct slot_map_cache_entry
{
scm_t_uint32 *ip;
const scm_t_uint8 *map;
uint32_t *ip;
const uint8_t *map;
};
struct slot_map_cache
@ -902,13 +902,13 @@ struct slot_map_cache
struct slot_map_cache_entry entries[SLOT_MAP_CACHE_SIZE];
};
static const scm_t_uint8 *
find_slot_map (scm_t_uint32 *ip, struct slot_map_cache *cache)
static const uint8_t *
find_slot_map (uint32_t *ip, struct slot_map_cache *cache)
{
/* The lower two bits should be zero. FIXME: Use a better hash
function; we don't expose scm_raw_hashq currently. */
size_t slot = (((scm_t_uintptr) ip) >> 2) % SLOT_MAP_CACHE_SIZE;
const scm_t_uint8 *map;
size_t slot = (((uintptr_t) ip) >> 2) % SLOT_MAP_CACHE_SIZE;
const uint8_t *map;
if (cache->entries[slot].ip == ip)
map = cache->entries[slot].map;
@ -941,7 +941,7 @@ scm_i_vm_mark_stack (struct scm_vm *vp, struct GC_ms_entry *mark_stack_ptr,
activation, due to multiple threads or per-instruction hooks, and
providing slot maps for all points in a program would take a
prohibitive amount of space. */
const scm_t_uint8 *slot_map = NULL;
const uint8_t *slot_map = NULL;
void *upper = (void *) GC_greatest_plausible_heap_addr;
void *lower = (void *) GC_least_plausible_heap_addr;
struct slot_map_cache cache;
@ -1208,7 +1208,7 @@ scm_call_n (SCM proc, SCM *argv, size_t nargs)
SCM_FRAME_SET_DYNAMIC_LINK (return_fp, vp->fp);
SCM_FRAME_LOCAL (return_fp, 0) = vm_boot_continuation;
vp->ip = (scm_t_uint32 *) vm_boot_continuation_code;
vp->ip = (uint32_t *) vm_boot_continuation_code;
vp->fp = call_fp;
SCM_FRAME_SET_RETURN_ADDRESS (call_fp, vp->ip);

View file

@ -45,10 +45,10 @@ enum scm_compare {
};
struct scm_vm {
scm_t_uint32 *ip; /* instruction pointer */
uint32_t *ip; /* instruction pointer */
union scm_vm_stack_element *sp; /* stack pointer */
union scm_vm_stack_element *fp; /* frame pointer */
scm_t_uint8 compare_result; /* flags register: a value from scm_compare */
uint8_t compare_result; /* flags register: a value from scm_compare */
union scm_vm_stack_element *stack_limit; /* stack limit address */
int trace_level; /* traces enabled if trace_level > 0 */
union scm_vm_stack_element *sp_min_since_gc; /* deepest sp since last gc */
@ -91,7 +91,7 @@ SCM_INTERNAL void scm_i_vm_free_stack (struct scm_vm *vp);
struct scm_vm_cont {
/* IP of newest frame. */
scm_t_uint32 *ra;
uint32_t *ra;
/* Offset of FP of newest frame, relative to stack top. */
scm_t_ptrdiff fp_offset;
/* Besides being the stack size, this is also the offset of the SP of
@ -103,7 +103,7 @@ struct scm_vm_cont {
offsets from the stack top of this scm_vm_cont. */
scm_t_dynstack *dynstack;
/* See the continuation is partial and/or rewindable. */
scm_t_uint32 flags;
uint32_t flags;
};
#define SCM_VM_CONT_P(OBJ) (SCM_HAS_TYP7 (OBJ, scm_tc7_vm_cont))
@ -118,13 +118,13 @@ SCM_INTERNAL SCM scm_i_capture_current_stack (void);
SCM_INTERNAL SCM scm_i_vm_capture_stack (union scm_vm_stack_element *stack_top,
union scm_vm_stack_element *fp,
union scm_vm_stack_element *sp,
scm_t_uint32 *ra,
uint32_t *ra,
scm_t_dynstack *dynstack,
scm_t_uint32 flags);
uint32_t flags);
SCM_INTERNAL int scm_i_vm_cont_to_frame (SCM cont, struct scm_frame *frame);
SCM_INTERNAL void scm_i_vm_cont_print (SCM x, SCM port,
scm_print_state *pstate);
SCM_INTERNAL int scm_i_vm_is_boot_continuation_code (scm_t_uint32 *ip);
SCM_INTERNAL int scm_i_vm_is_boot_continuation_code (uint32_t *ip);
SCM_INTERNAL void scm_bootstrap_vm (void);
SCM_INTERNAL void scm_init_vm (void);

View file

@ -60,7 +60,7 @@ struct soft_port {
SCM read_char;
SCM close;
SCM input_waiting;
scm_t_uint8 encode_buf[ENCODE_BUF_SIZE];
uint8_t encode_buf[ENCODE_BUF_SIZE];
size_t encode_cur;
size_t encode_end;
};

View file

@ -43,7 +43,7 @@
static void
test_1 (const char *str, scm_t_intmax min, scm_t_intmax max,
test_1 (const char *str, intmax_t min, intmax_t max,
int result)
{
int r = scm_is_signed_integer (scm_c_eval_string (str), min, max);
@ -83,7 +83,7 @@ test_is_signed_integer ()
test_1 ("(- most-negative-fixnum 1)",
INTMAX_MIN, INTMAX_MAX,
1);
if (sizeof (scm_t_intmax) == 8)
if (sizeof (intmax_t) == 8)
{
test_1 ("(- (expt 2 63) 1)",
INTMAX_MIN, INTMAX_MAX,
@ -98,7 +98,7 @@ test_is_signed_integer ()
INTMAX_MIN, INTMAX_MAX,
0);
}
else if (sizeof (scm_t_intmax) == 4)
else if (sizeof (intmax_t) == 4)
{
test_1 ("(- (expt 2 31) 1)",
INTMAX_MIN, INTMAX_MAX,
@ -129,7 +129,7 @@ test_is_signed_integer ()
}
static void
test_2 (const char *str, scm_t_uintmax min, scm_t_uintmax max,
test_2 (const char *str, uintmax_t min, uintmax_t max,
int result)
{
int r = scm_is_unsigned_integer (scm_c_eval_string (str), min, max);
@ -169,7 +169,7 @@ test_is_unsigned_integer ()
test_2 ("(- most-negative-fixnum 1)",
0, UINTMAX_MAX,
0);
if (sizeof (scm_t_intmax) == 8)
if (sizeof (intmax_t) == 8)
{
test_2 ("(- (expt 2 64) 1)",
0, UINTMAX_MAX,
@ -178,7 +178,7 @@ test_is_unsigned_integer ()
0, UINTMAX_MAX,
0);
}
else if (sizeof (scm_t_intmax) == 4)
else if (sizeof (intmax_t) == 4)
{
test_2 ("(- (expt 2 32) 1)",
0, UINTMAX_MAX,
@ -204,8 +204,8 @@ test_is_unsigned_integer ()
typedef struct {
SCM val;
scm_t_intmax min, max;
scm_t_intmax result;
intmax_t min, max;
intmax_t result;
} to_signed_data;
static SCM
@ -241,8 +241,8 @@ to_signed_integer_body (void *data)
}
static void
test_3 (const char *str, scm_t_intmax min, scm_t_intmax max,
scm_t_intmax result, int range_error, int type_error)
test_3 (const char *str, intmax_t min, intmax_t max,
intmax_t result, int range_error, int type_error)
{
to_signed_data data;
data.val = scm_c_eval_string (str);
@ -321,7 +321,7 @@ test_to_signed_integer ()
test_3 ("(- most-negative-fixnum 1)",
INTMAX_MIN, INTMAX_MAX,
SCM_MOST_NEGATIVE_FIXNUM-1, 0, 0);
if (sizeof (scm_t_intmax) == 8)
if (sizeof (intmax_t) == 8)
{
test_3 ("(- (expt 2 63) 1)",
INTMAX_MIN, INTMAX_MAX,
@ -339,7 +339,7 @@ test_to_signed_integer ()
INTMAX_MIN, INTMAX_MAX,
0, 1, 0);
}
else if (sizeof (scm_t_intmax) == 4)
else if (sizeof (intmax_t) == 4)
{
test_3 ("(- (expt 2 31) 1)",
INTMAX_MIN, INTMAX_MAX,
@ -363,8 +363,8 @@ test_to_signed_integer ()
typedef struct {
SCM val;
scm_t_uintmax min, max;
scm_t_uintmax result;
uintmax_t min, max;
uintmax_t result;
} to_unsigned_data;
static SCM
@ -376,8 +376,8 @@ to_unsigned_integer_body (void *data)
}
static void
test_4 (const char *str, scm_t_uintmax min, scm_t_uintmax max,
scm_t_uintmax result, int range_error, int type_error)
test_4 (const char *str, uintmax_t min, uintmax_t max,
uintmax_t result, int range_error, int type_error)
{
to_unsigned_data data;
data.val = scm_c_eval_string (str);
@ -447,7 +447,7 @@ test_to_unsigned_integer ()
test_4 ("(+ most-positive-fixnum 1)",
0, UINTMAX_MAX,
SCM_MOST_POSITIVE_FIXNUM+1, 0, 0);
if (sizeof (scm_t_intmax) == 8)
if (sizeof (intmax_t) == 8)
{
test_4 ("(- (expt 2 64) 1)",
0, UINTMAX_MAX,
@ -456,7 +456,7 @@ test_to_unsigned_integer ()
0, UINTMAX_MAX,
0, 1, 0);
}
else if (sizeof (scm_t_intmax) == 4)
else if (sizeof (intmax_t) == 4)
{
test_4 ("(- (expt 2 32) 1)",
0, UINTMAX_MAX,
@ -470,7 +470,7 @@ test_to_unsigned_integer ()
}
static void
test_5 (scm_t_intmax val, const char *result)
test_5 (intmax_t val, const char *result)
{
SCM res = scm_c_eval_string (result);
if (scm_is_false (scm_equal_p (scm_from_signed_integer (val), res)))
@ -485,12 +485,12 @@ static void
test_from_signed_integer ()
{
test_5 (12, "12");
if (sizeof (scm_t_intmax) == 8)
if (sizeof (intmax_t) == 8)
{
test_5 (INTMAX_MAX, "(- (expt 2 63) 1)");
test_5 (INTMAX_MIN, "(- (expt 2 63))");
}
else if (sizeof (scm_t_intmax) == 4)
else if (sizeof (intmax_t) == 4)
{
test_5 (INTMAX_MAX, "(- (expt 2 31) 1)");
test_5 (INTMAX_MIN, "(- (expt 2 31))");
@ -502,7 +502,7 @@ test_from_signed_integer ()
}
static void
test_6 (scm_t_uintmax val, const char *result)
test_6 (uintmax_t val, const char *result)
{
SCM res = scm_c_eval_string (result);
if (scm_is_false (scm_equal_p (scm_from_unsigned_integer (val), res)))
@ -518,11 +518,11 @@ static void
test_from_unsigned_integer ()
{
test_6 (12, "12");
if (sizeof (scm_t_intmax) == 8)
if (sizeof (intmax_t) == 8)
{
test_6 (UINTMAX_MAX, "(- (expt 2 64) 1)");
}
else if (sizeof (scm_t_intmax) == 4)
else if (sizeof (intmax_t) == 4)
{
test_6 (UINTMAX_MAX, "(- (expt 2 32) 1)");
}
@ -531,7 +531,7 @@ test_from_unsigned_integer ()
}
static void
test_7s (SCM n, scm_t_intmax c_n, const char *result, const char *func)
test_7s (SCM n, intmax_t c_n, const char *result, const char *func)
{
SCM r = scm_c_eval_string (result);
@ -545,7 +545,7 @@ test_7s (SCM n, scm_t_intmax c_n, const char *result, const char *func)
#define TEST_7S(func,arg,res) test_7s (func(arg), arg, res, #func)
static void
test_7u (SCM n, scm_t_uintmax c_n, const char *result, const char *func)
test_7u (SCM n, uintmax_t c_n, const char *result, const char *func)
{
SCM r = scm_c_eval_string (result);
@ -560,8 +560,8 @@ test_7u (SCM n, scm_t_uintmax c_n, const char *result, const char *func)
typedef struct {
SCM val;
scm_t_intmax (*func) (SCM);
scm_t_intmax result;
intmax_t (*func) (SCM);
intmax_t result;
} to_signed_func_data;
static SCM
@ -573,8 +573,8 @@ to_signed_func_body (void *data)
}
static void
test_8s (const char *str, scm_t_intmax (*func) (SCM), const char *func_name,
scm_t_intmax result, int range_error, int type_error)
test_8s (const char *str, intmax_t (*func) (SCM), const char *func_name,
intmax_t result, int range_error, int type_error)
{
to_signed_func_data data;
data.val = scm_c_eval_string (str);
@ -618,8 +618,8 @@ test_8s (const char *str, scm_t_intmax (*func) (SCM), const char *func_name,
typedef struct {
SCM val;
scm_t_uintmax (*func) (SCM);
scm_t_uintmax result;
uintmax_t (*func) (SCM);
uintmax_t result;
} to_unsigned_func_data;
static SCM
@ -631,8 +631,8 @@ to_unsigned_func_body (void *data)
}
static void
test_8u (const char *str, scm_t_uintmax (*func) (SCM), const char *func_name,
scm_t_uintmax result, int range_error, int type_error)
test_8u (const char *str, uintmax_t (*func) (SCM), const char *func_name,
uintmax_t result, int range_error, int type_error)
{
to_unsigned_func_data data;
data.val = scm_c_eval_string (str);
@ -679,8 +679,8 @@ test_8u (const char *str, scm_t_uintmax (*func) (SCM), const char *func_name,
need to give them a common return type.
*/
#define DEFSTST(f) static scm_t_intmax tst_##f (SCM x) { return f(x); }
#define DEFUTST(f) static scm_t_uintmax tst_##f (SCM x) { return f(x); }
#define DEFSTST(f) static intmax_t tst_##f (SCM x) { return f(x); }
#define DEFUTST(f) static uintmax_t tst_##f (SCM x) { return f(x); }
DEFSTST (scm_to_schar)
DEFUTST (scm_to_uchar)

View file

@ -31,184 +31,184 @@ void test_ffi_v_ (void)
return;
}
void test_ffi_v_u8 (scm_t_uint8 a);
void test_ffi_v_u8 (scm_t_uint8 a)
void test_ffi_v_u8 (uint8_t a);
void test_ffi_v_u8 (uint8_t a)
{
return;
}
void test_ffi_v_s64 (scm_t_int64 a);
void test_ffi_v_s64 (scm_t_int64 a)
void test_ffi_v_s64 (int64_t a);
void test_ffi_v_s64 (int64_t a)
{
return;
}
scm_t_int8 test_ffi_s8_ (void);
scm_t_int8 test_ffi_s8_ (void)
int8_t test_ffi_s8_ (void);
int8_t test_ffi_s8_ (void)
{
return -100;
}
scm_t_int8 test_ffi_s8_u8 (scm_t_uint8 a);
scm_t_int8 test_ffi_s8_u8 (scm_t_uint8 a)
int8_t test_ffi_s8_u8 (uint8_t a);
int8_t test_ffi_s8_u8 (uint8_t a)
{
return -100 + a;
}
scm_t_int8 test_ffi_s8_s64 (scm_t_int64 a);
scm_t_int8 test_ffi_s8_s64 (scm_t_int64 a)
int8_t test_ffi_s8_s64 (int64_t a);
int8_t test_ffi_s8_s64 (int64_t a)
{
return -100 + a;
}
scm_t_uint8 test_ffi_u8_ (void);
scm_t_uint8 test_ffi_u8_ (void)
uint8_t test_ffi_u8_ (void);
uint8_t test_ffi_u8_ (void)
{
return 200;
}
scm_t_uint8 test_ffi_u8_u8 (scm_t_uint8 a);
scm_t_uint8 test_ffi_u8_u8 (scm_t_uint8 a)
uint8_t test_ffi_u8_u8 (uint8_t a);
uint8_t test_ffi_u8_u8 (uint8_t a)
{
return 200 + a;
}
scm_t_uint8 test_ffi_u8_s64 (scm_t_int64 a);
scm_t_uint8 test_ffi_u8_s64 (scm_t_int64 a)
uint8_t test_ffi_u8_s64 (int64_t a);
uint8_t test_ffi_u8_s64 (int64_t a)
{
return 200 + a;
}
scm_t_int16 test_ffi_s16_ (void);
scm_t_int16 test_ffi_s16_ (void)
int16_t test_ffi_s16_ (void);
int16_t test_ffi_s16_ (void)
{
return -20000;
}
scm_t_int16 test_ffi_s16_u8 (scm_t_uint8 a);
scm_t_int16 test_ffi_s16_u8 (scm_t_uint8 a)
int16_t test_ffi_s16_u8 (uint8_t a);
int16_t test_ffi_s16_u8 (uint8_t a)
{
return -20000 + a;
}
scm_t_int16 test_ffi_s16_s64 (scm_t_int64 a);
scm_t_int16 test_ffi_s16_s64 (scm_t_int64 a)
int16_t test_ffi_s16_s64 (int64_t a);
int16_t test_ffi_s16_s64 (int64_t a)
{
return -20000 + a;
}
scm_t_uint16 test_ffi_u16_ (void);
scm_t_uint16 test_ffi_u16_ (void)
uint16_t test_ffi_u16_ (void);
uint16_t test_ffi_u16_ (void)
{
return 40000;
}
scm_t_uint16 test_ffi_u16_u8 (scm_t_uint8 a);
scm_t_uint16 test_ffi_u16_u8 (scm_t_uint8 a)
uint16_t test_ffi_u16_u8 (uint8_t a);
uint16_t test_ffi_u16_u8 (uint8_t a)
{
return 40000 + a;
}
scm_t_uint16 test_ffi_u16_s64 (scm_t_int64 a);
scm_t_uint16 test_ffi_u16_s64 (scm_t_int64 a)
uint16_t test_ffi_u16_s64 (int64_t a);
uint16_t test_ffi_u16_s64 (int64_t a)
{
return 40000 + a;
}
scm_t_int32 test_ffi_s32_ (void);
scm_t_int32 test_ffi_s32_ (void)
int32_t test_ffi_s32_ (void);
int32_t test_ffi_s32_ (void)
{
return -2000000000;
}
scm_t_int32 test_ffi_s32_u8 (scm_t_uint8 a);
scm_t_int32 test_ffi_s32_u8 (scm_t_uint8 a)
int32_t test_ffi_s32_u8 (uint8_t a);
int32_t test_ffi_s32_u8 (uint8_t a)
{
return -2000000000 + a;
}
scm_t_int32 test_ffi_s32_s64 (scm_t_int64 a);
scm_t_int32 test_ffi_s32_s64 (scm_t_int64 a)
int32_t test_ffi_s32_s64 (int64_t a);
int32_t test_ffi_s32_s64 (int64_t a)
{
return -2000000000 + a;
}
scm_t_uint32 test_ffi_u32_ (void);
scm_t_uint32 test_ffi_u32_ (void)
uint32_t test_ffi_u32_ (void);
uint32_t test_ffi_u32_ (void)
{
return 4000000000U;
}
scm_t_uint32 test_ffi_u32_u8 (scm_t_uint8 a);
scm_t_uint32 test_ffi_u32_u8 (scm_t_uint8 a)
uint32_t test_ffi_u32_u8 (uint8_t a);
uint32_t test_ffi_u32_u8 (uint8_t a)
{
return 4000000000U + a;
}
scm_t_uint32 test_ffi_u32_s64 (scm_t_int64 a);
scm_t_uint32 test_ffi_u32_s64 (scm_t_int64 a)
uint32_t test_ffi_u32_s64 (int64_t a);
uint32_t test_ffi_u32_s64 (int64_t a)
{
return 4000000000U + a;
}
/* FIXME: use 64-bit literals */
scm_t_int64 test_ffi_s64_ (void);
scm_t_int64 test_ffi_s64_ (void)
int64_t test_ffi_s64_ (void);
int64_t test_ffi_s64_ (void)
{
return -2000000000;
}
scm_t_int64 test_ffi_s64_u8 (scm_t_uint8 a);
scm_t_int64 test_ffi_s64_u8 (scm_t_uint8 a)
int64_t test_ffi_s64_u8 (uint8_t a);
int64_t test_ffi_s64_u8 (uint8_t a)
{
return -2000000000 + a;
}
scm_t_int64 test_ffi_s64_s64 (scm_t_int64 a);
scm_t_int64 test_ffi_s64_s64 (scm_t_int64 a)
int64_t test_ffi_s64_s64 (int64_t a);
int64_t test_ffi_s64_s64 (int64_t a)
{
return -2000000000 + a;
}
scm_t_uint64 test_ffi_u64_ (void);
scm_t_uint64 test_ffi_u64_ (void)
uint64_t test_ffi_u64_ (void);
uint64_t test_ffi_u64_ (void)
{
return 4000000000UL;
}
scm_t_uint64 test_ffi_u64_u8 (scm_t_uint8 a);
scm_t_uint64 test_ffi_u64_u8 (scm_t_uint8 a)
uint64_t test_ffi_u64_u8 (uint8_t a);
uint64_t test_ffi_u64_u8 (uint8_t a)
{
return 4000000000UL + a;
}
scm_t_uint64 test_ffi_u64_s64 (scm_t_int64 a);
scm_t_uint64 test_ffi_u64_s64 (scm_t_int64 a)
uint64_t test_ffi_u64_s64 (int64_t a);
uint64_t test_ffi_u64_s64 (int64_t a)
{
return 4000000000UL + a;
}
scm_t_int64 test_ffi_sum (scm_t_int8 a, scm_t_int16 b,
scm_t_int32 c, scm_t_int64 d);
scm_t_int64 test_ffi_sum (scm_t_int8 a, scm_t_int16 b,
scm_t_int32 c, scm_t_int64 d)
int64_t test_ffi_sum (int8_t a, int16_t b,
int32_t c, int64_t d);
int64_t test_ffi_sum (int8_t a, int16_t b,
int32_t c, int64_t d)
{
return d + c + b + a;
}
scm_t_int64 test_ffi_sum_many (scm_t_uint8 a, scm_t_uint16 b,
scm_t_uint32 c, scm_t_uint64 d,
scm_t_int8 e, scm_t_int16 f,
scm_t_int32 g, scm_t_int64 h,
scm_t_int8 i, scm_t_int16 j,
scm_t_int32 k, scm_t_int64 l);
scm_t_int64 test_ffi_sum_many (scm_t_uint8 a, scm_t_uint16 b,
scm_t_uint32 c, scm_t_uint64 d,
scm_t_int8 e, scm_t_int16 f,
scm_t_int32 g, scm_t_int64 h,
scm_t_int8 i, scm_t_int16 j,
scm_t_int32 k, scm_t_int64 l)
int64_t test_ffi_sum_many (uint8_t a, uint16_t b,
uint32_t c, uint64_t d,
int8_t e, int16_t f,
int32_t g, int64_t h,
int8_t i, int16_t j,
int32_t k, int64_t l);
int64_t test_ffi_sum_many (uint8_t a, uint16_t b,
uint32_t c, uint64_t d,
int8_t e, int16_t f,
int32_t g, int64_t h,
int8_t i, int16_t j,
int32_t k, int64_t l)
{
return l + k + j + i + h + g + f + e + d + c + b + a;
}
@ -216,20 +216,20 @@ scm_t_int64 test_ffi_sum_many (scm_t_uint8 a, scm_t_uint16 b,
struct foo
{
scm_t_int8 a;
scm_t_int16 b;
scm_t_int32 c;
scm_t_int64 d;
int8_t a;
int16_t b;
int32_t c;
int64_t d;
};
scm_t_int64 test_ffi_sum_struct (struct foo foo);
scm_t_int64 test_ffi_sum_struct (struct foo foo)
int64_t test_ffi_sum_struct (struct foo foo);
int64_t test_ffi_sum_struct (struct foo foo)
{
return foo.d + foo.c + foo.b + foo.a;
}
void* test_ffi_memcpy (void *dest, void *src, scm_t_int32 n);
void* test_ffi_memcpy (void *dest, void *src, scm_t_int32 n)
void* test_ffi_memcpy (void *dest, void *src, int32_t n);
void* test_ffi_memcpy (void *dest, void *src, int32_t n)
{
return memcpy (dest, src, n);
}

View file

@ -35,7 +35,7 @@ do_test (void *result)
{
#define LEN 123
SCM u8v;
scm_t_uint8 *data;
uint8_t *data;
scm_t_array_handle handle;
data = scm_malloc (LEN);

View file

@ -40,7 +40,7 @@ test_writable_elements ()
size_t len;
ssize_t inc;
scm_t_array_handle h;
scm_t_uint32 *elts = scm_u32vector_writable_elements (v, &h, &len, &inc);
uint32_t *elts = scm_u32vector_writable_elements (v, &h, &len, &inc);
assert (len == 4);
assert (inc == 1);
assert (elts[0] == 1);