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
commit 16879cabed
59 changed files with 924 additions and 924 deletions

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);