ref: 91da922a22ed83f60bbc33d48e31de47349ac467
parent: 76a63ca19379f4b594159756723ac8739b05b9f9
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Mar 10 14:57:14 EST 2023
reduce the amount of awkward typenames
--- a/builtins.c
+++ b/builtins.c
@@ -44,7 +44,7 @@
return n;
}
-static value_t fl_nconc(value_t *args, u_int32_t nargs)
+static value_t fl_nconc(value_t *args, uint32_t nargs)
{
if (nargs == 0)
return FL_NIL;
@@ -70,7 +70,7 @@
return first;
}
-static value_t fl_assq(value_t *args, u_int32_t nargs)
+static value_t fl_assq(value_t *args, uint32_t nargs)
{
argcount("assq", nargs, 2);
value_t item = args[0];
@@ -86,7 +86,7 @@
return FL_F;
}
-static value_t fl_memq(value_t *args, u_int32_t nargs)
+static value_t fl_memq(value_t *args, uint32_t nargs)
{
argcount("memq", nargs, 2);
while (iscons(args[1])) {
@@ -98,7 +98,7 @@
return FL_F;
}
-static value_t fl_length(value_t *args, u_int32_t nargs)
+static value_t fl_length(value_t *args, uint32_t nargs)
{
argcount("length", nargs, 1);
value_t a = args[0];
@@ -128,7 +128,7 @@
return -1;
}
-static value_t fl_f_raise(value_t *args, u_int32_t nargs)
+static value_t fl_f_raise(value_t *args, uint32_t nargs)
{
argcount("raise", nargs, 1);
fl_raise(args[0]);
@@ -135,7 +135,7 @@
return -1;
}
-static value_t fl_exit(value_t *args, u_int32_t nargs)
+static value_t fl_exit(value_t *args, uint32_t nargs)
{
if (nargs > 0)
exit(tofixnum(args[0], "exit"));
@@ -143,7 +143,7 @@
return FL_NIL;
}
-static value_t fl_symbol(value_t *args, u_int32_t nargs)
+static value_t fl_symbol(value_t *args, uint32_t nargs)
{
argcount("symbol", nargs, 1);
if (!fl_isstring(args[0]))
@@ -151,7 +151,7 @@
return symbol(cvalue_data(args[0]));
}
-static value_t fl_keywordp(value_t *args, u_int32_t nargs)
+static value_t fl_keywordp(value_t *args, uint32_t nargs)
{
argcount("keyword?", nargs, 1);
return (issymbol(args[0]) &&
@@ -158,7 +158,7 @@
iskeyword((symbol_t*)ptr(args[0]))) ? FL_T : FL_F;
}
-static value_t fl_top_level_value(value_t *args, u_int32_t nargs)
+static value_t fl_top_level_value(value_t *args, uint32_t nargs)
{
argcount("top-level-value", nargs, 1);
symbol_t *sym = tosymbol(args[0], "top-level-value");
@@ -167,7 +167,7 @@
return sym->binding;
}
-static value_t fl_set_top_level_value(value_t *args, u_int32_t nargs)
+static value_t fl_set_top_level_value(value_t *args, uint32_t nargs)
{
argcount("set-top-level-value!", nargs, 2);
symbol_t *sym = tosymbol(args[0], "set-top-level-value!");
@@ -189,7 +189,7 @@
extern symbol_t *symtab;
-value_t fl_global_env(value_t *args, u_int32_t nargs)
+value_t fl_global_env(value_t *args, uint32_t nargs)
{
USED(args);
argcount("environment", nargs, 0);
@@ -202,7 +202,7 @@
extern value_t QUOTE;
-static value_t fl_constantp(value_t *args, u_int32_t nargs)
+static value_t fl_constantp(value_t *args, uint32_t nargs)
{
argcount("constant?", nargs, 1);
if (issymbol(args[0]))
@@ -215,7 +215,7 @@
return FL_T;
}
-static value_t fl_integer_valuedp(value_t *args, u_int32_t nargs)
+static value_t fl_integer_valuedp(value_t *args, uint32_t nargs)
{
argcount("integer-valued?", nargs, 1);
value_t v = args[0];
@@ -244,7 +244,7 @@
return FL_F;
}
-static value_t fl_integerp(value_t *args, u_int32_t nargs)
+static value_t fl_integerp(value_t *args, uint32_t nargs)
{
argcount("integer?", nargs, 1);
value_t v = args[0];
@@ -253,7 +253,7 @@
FL_T : FL_F;
}
-static value_t fl_fixnum(value_t *args, u_int32_t nargs)
+static value_t fl_fixnum(value_t *args, uint32_t nargs)
{
argcount("fixnum", nargs, 1);
if (isfixnum(args[0])) {
@@ -269,7 +269,7 @@
double trunc(double x);
-static value_t fl_truncate(value_t *args, u_int32_t nargs)
+static value_t fl_truncate(value_t *args, uint32_t nargs)
{
argcount("truncate", nargs, 1);
if (isfixnum(args[0]))
@@ -299,7 +299,7 @@
return -1;
}
-static value_t fl_vector_alloc(value_t *args, u_int32_t nargs)
+static value_t fl_vector_alloc(value_t *args, uint32_t nargs)
{
fixnum_t i;
value_t f, v;
@@ -319,7 +319,7 @@
return v;
}
-static value_t fl_time_now(value_t *args, u_int32_t nargs)
+static value_t fl_time_now(value_t *args, uint32_t nargs)
{
argcount("time.now", nargs, 0);
USED(args);
@@ -428,7 +428,7 @@
return FL_T;
}
-static value_t fl_rand(value_t *args, u_int32_t nargs)
+static value_t fl_rand(value_t *args, uint32_t nargs)
{
USED(args); USED(nargs);
fixnum_t r;
@@ -439,7 +439,7 @@
#endif
return fixnum(r);
}
-static value_t fl_rand32(value_t *args, u_int32_t nargs)
+static value_t fl_rand32(value_t *args, uint32_t nargs)
{
USED(args); USED(nargs);
uint32_t r = random();
@@ -449,18 +449,18 @@
return mk_uint32(r);
#endif
}
-static value_t fl_rand64(value_t *args, u_int32_t nargs)
+static value_t fl_rand64(value_t *args, uint32_t nargs)
{
USED(args); USED(nargs);
uint64_t r = (((uint64_t)random())<<32) | random();
return mk_uint64(r);
}
-static value_t fl_randd(value_t *args, u_int32_t nargs)
+static value_t fl_randd(value_t *args, uint32_t nargs)
{
USED(args); USED(nargs);
return mk_double(rand_double());
}
-static value_t fl_randf(value_t *args, u_int32_t nargs)
+static value_t fl_randf(value_t *args, uint32_t nargs)
{
USED(args); USED(nargs);
return mk_float(rand_float());
@@ -467,7 +467,7 @@
}
#define MATH_FUNC_1ARG(name) \
-static value_t fl_##name(value_t *args, u_int32_t nargs) \
+static value_t fl_##name(value_t *args, uint32_t nargs) \
{ \
argcount(#name, nargs, 1); \
if (iscprim(args[0])) { \
--- a/cvalues.c
+++ b/cvalues.c
@@ -33,9 +33,9 @@
static void cvalue_init(fltype_t *type, value_t v, void *dest);
// cvalues-specific builtins
-value_t cvalue_new(value_t *args, u_int32_t nargs);
-value_t cvalue_sizeof(value_t *args, u_int32_t nargs);
-value_t cvalue_typeof(value_t *args, u_int32_t nargs);
+value_t cvalue_new(value_t *args, uint32_t nargs);
+value_t cvalue_sizeof(value_t *args, uint32_t nargs);
+value_t cvalue_typeof(value_t *args, uint32_t nargs);
// trigger unconditional GC after this many bytes are allocated
#define ALLOC_LIMIT_TRIGGER 67108864
@@ -247,7 +247,7 @@
static int cvalue_##ctype##_init(fltype_t *type, value_t arg, \
void *dest) \
{ \
- fl_##ctype##_t n; \
+ ctype n; \
USED(type); \
if (isfixnum(arg)) { \
n = numval(arg); \
@@ -255,30 +255,30 @@
else if (iscprim(arg)) { \
cprim_t *cp = (cprim_t*)ptr(arg); \
void *p = cp_data(cp); \
- n = (fl_##ctype##_t)conv_to_##cnvt(p, cp_numtype(cp)); \
+ n = (ctype)conv_to_##cnvt(p, cp_numtype(cp)); \
} \
else { \
return 1; \
} \
- *((fl_##ctype##_t*)dest) = n; \
+ *((ctype*)dest) = n; \
return 0; \
}
-num_init(int8, int32, T_INT8)
-num_init(uint8, uint32, T_UINT8)
-num_init(int16, int32, T_INT16)
-num_init(uint16, uint32, T_UINT16)
-num_init(int32, int32, T_INT32)
-num_init(uint32, uint32, T_UINT32)
-num_init(int64, int64, T_INT64)
-num_init(uint64, uint64, T_UINT64)
+num_init(int8_t, int32, T_INT8)
+num_init(uint8_t, uint32, T_UINT8)
+num_init(int16_t, int32, T_INT16)
+num_init(uint16_t, uint32, T_UINT16)
+num_init(int32_t, int32, T_INT32)
+num_init(uint32_t, uint32, T_UINT32)
+num_init(int64_t, int64, T_INT64)
+num_init(uint64_t, uint64, T_UINT64)
num_init(float, double, T_FLOAT)
num_init(double, double, T_DOUBLE)
#define num_ctor_init(typenam, ctype, tag) \
-value_t cvalue_##typenam(value_t *args, u_int32_t nargs) \
+value_t cvalue_##typenam(value_t *args, uint32_t nargs) \
{ \
if (nargs==0) { PUSH(fixnum(0)); args = &Stack[SP-1]; } \
- value_t cp = cprim(typenam##type, sizeof(fl_##ctype##_t)); \
+ value_t cp = cprim(typenam##type, sizeof(ctype)); \
if (cvalue_##ctype##_init(typenam##type, \
args[0], cp_data((cprim_t*)ptr(cp)))) \
type_error(#typenam, "number", args[0]); \
@@ -286,10 +286,10 @@
}
#define num_ctor_ctor(typenam, ctype, tag) \
-value_t mk_##typenam(fl_##ctype##_t n) \
+value_t mk_##typenam(ctype n) \
{ \
- value_t cp = cprim(typenam##type, sizeof(fl_##ctype##_t)); \
- *(fl_##ctype##_t*)cp_data((cprim_t*)ptr(cp)) = n; \
+ value_t cp = cprim(typenam##type, sizeof(ctype)); \
+ *(ctype*)cp_data((cprim_t*)ptr(cp)) = n; \
return cp; \
}
@@ -297,22 +297,22 @@
num_ctor_init(typenam, ctype, tag) \
num_ctor_ctor(typenam, ctype, tag)
-num_ctor(int8, int8, T_INT8)
-num_ctor(uint8, uint8, T_UINT8)
-num_ctor(int16, int16, T_INT16)
-num_ctor(uint16, uint16, T_UINT16)
-num_ctor(int32, int32, T_INT32)
-num_ctor(uint32, uint32, T_UINT32)
-num_ctor(int64, int64, T_INT64)
-num_ctor(uint64, uint64, T_UINT64)
-num_ctor(byte, uint8, T_UINT8)
-num_ctor(wchar, int32, T_INT32)
+num_ctor(int8, int8_t, T_INT8)
+num_ctor(uint8, uint8_t, T_UINT8)
+num_ctor(int16, int16_t, T_INT16)
+num_ctor(uint16, uint16_t, T_UINT16)
+num_ctor(int32, int32_t, T_INT32)
+num_ctor(uint32, uint32_t, T_UINT32)
+num_ctor(int64, int64_t, T_INT64)
+num_ctor(uint64, uint64_t, T_UINT64)
+num_ctor(byte, uint8_t, T_UINT8)
+num_ctor(wchar, int32_t, T_INT32)
#if defined(ULONG64)
-num_ctor(long, int64, T_INT64)
-num_ctor(ulong, uint64, T_UINT64)
+num_ctor(long, int64_t, T_INT64)
+num_ctor(ulong, uint64_t, T_UINT64)
#else
-num_ctor(long, int32, T_INT32)
-num_ctor(ulong, uint32, T_UINT32)
+num_ctor(long, int32_t, T_INT32)
+num_ctor(ulong, uint32_t, T_UINT32)
#endif
num_ctor(float, float, T_FLOAT)
num_ctor(double, double, T_DOUBLE)
@@ -371,7 +371,7 @@
return 0;
}
-value_t cvalue_enum(value_t *args, u_int32_t nargs)
+value_t cvalue_enum(value_t *args, uint32_t nargs)
{
argcount("enum", nargs, 2);
value_t type = fl_list2(enumsym, args[0]);
@@ -461,7 +461,7 @@
return 0;
}
-value_t cvalue_array(value_t *args, u_int32_t nargs)
+value_t cvalue_array(value_t *args, uint32_t nargs)
{
size_t elsize, cnt, sz, i;
value_t arg;
@@ -618,7 +618,7 @@
type_error(fname, "plain-old-data", v);
}
-value_t cvalue_sizeof(value_t *args, u_int32_t nargs)
+value_t cvalue_sizeof(value_t *args, uint32_t nargs)
{
argcount("sizeof", nargs, 1);
if (issymbol(args[0]) || iscons(args[0])) {
@@ -630,7 +630,7 @@
return size_wrap(n);
}
-value_t cvalue_typeof(value_t *args, u_int32_t nargs)
+value_t cvalue_typeof(value_t *args, uint32_t nargs)
{
argcount("typeof", nargs, 1);
switch(tag(args[0])) {
@@ -700,7 +700,7 @@
return tagptr(ncv, TAG_CVALUE);
}
-value_t fl_copy(value_t *args, u_int32_t nargs)
+value_t fl_copy(value_t *args, uint32_t nargs)
{
argcount("copy", nargs, 1);
if (iscons(args[0]) || isvector(args[0]))
@@ -712,7 +712,7 @@
return cvalue_copy(args[0]);
}
-value_t fl_podp(value_t *args, u_int32_t nargs)
+value_t fl_podp(value_t *args, uint32_t nargs)
{
argcount("plain-old-data?", nargs, 1);
return (iscprim(args[0]) ||
@@ -775,7 +775,7 @@
// this provides (1) a way to allocate values with a shared type for
// efficiency, (2) a uniform interface for allocating cvalues of any
// type, including user-defined.
-value_t cvalue_new(value_t *args, u_int32_t nargs)
+value_t cvalue_new(value_t *args, uint32_t nargs)
{
if (nargs < 1 || nargs > 2)
argcount("c-value", nargs, 2);
@@ -826,9 +826,9 @@
}
static void check_addr_args(char *fname, value_t arr, value_t ind,
- char **data, ulong_t *index)
+ char **data, int *index)
{
- size_t numel;
+ int numel;
cvalue_t *cv = (cvalue_t*)ptr(arr);
*data = cv_data(cv);
numel = cv_len(cv)/(cv_class(cv)->elsz);
@@ -839,7 +839,7 @@
static value_t cvalue_array_aref(value_t *args)
{
- char *data; ulong_t index;
+ char *data; int index;
fltype_t *eltype = cv_class((cvalue_t*)ptr(args[0]))->eltype;
value_t el = 0;
numerictype_t nt = eltype->numtype;
@@ -872,7 +872,7 @@
static value_t cvalue_array_aset(value_t *args)
{
- char *data; ulong_t index;
+ char *data; int index;
fltype_t *eltype = cv_class((cvalue_t*)ptr(args[0]))->eltype;
check_addr_args("aset!", args[0], args[1], &data, &index);
char *dest = data + index*eltype->size;
@@ -880,7 +880,7 @@
return args[2];
}
-value_t fl_builtin(value_t *args, u_int32_t nargs)
+value_t fl_builtin(value_t *args, uint32_t nargs)
{
argcount("builtin", nargs, 1);
symbol_t *name = tosymbol(args[0], "builtin");
@@ -907,11 +907,11 @@
return tagptr(cv, TAG_CVALUE);
}
-static value_t fl_logand(value_t *args, u_int32_t nargs);
-static value_t fl_logior(value_t *args, u_int32_t nargs);
-static value_t fl_logxor(value_t *args, u_int32_t nargs);
-static value_t fl_lognot(value_t *args, u_int32_t nargs);
-static value_t fl_ash(value_t *args, u_int32_t nargs);
+static value_t fl_logand(value_t *args, uint32_t nargs);
+static value_t fl_logior(value_t *args, uint32_t nargs);
+static value_t fl_logxor(value_t *args, uint32_t nargs);
+static value_t fl_lognot(value_t *args, uint32_t nargs);
+static value_t fl_ash(value_t *args, uint32_t nargs);
static builtinspec_t cvalues_builtin_info[] = {
{ "c-value", cvalue_new },
@@ -934,10 +934,7 @@
#define ctor_cv_intern(tok) \
cv_intern(tok);set(tok##sym, cbuiltin(#tok, cvalue_##tok))
-#define mk_primtype(name) \
- name##type=get_type(name##sym);name##type->init = cvalue_##name##_init
-
-#define mk_primtype_(name,ctype) \
+#define mk_primtype(name,ctype) \
name##type=get_type(name##sym);name##type->init = cvalue_##ctype##_init
static void cvalues_init(void)
@@ -984,25 +981,25 @@
wcstringtypesym = symbol("*wcstring-type*");
setc(wcstringtypesym, fl_list2(arraysym, wcharsym));
- mk_primtype(int8);
- mk_primtype(uint8);
- mk_primtype(int16);
- mk_primtype(uint16);
- mk_primtype(int32);
- mk_primtype(uint32);
- mk_primtype(int64);
- mk_primtype(uint64);
+ mk_primtype(int8, int8_t);
+ mk_primtype(uint8, uint8_t);
+ mk_primtype(int16, int16_t);
+ mk_primtype(uint16, uint16_t);
+ mk_primtype(int32, int32_t);
+ mk_primtype(uint32, uint32_t);
+ mk_primtype(int64, int64_t);
+ mk_primtype(uint64, uint64_t);
#if defined(ULONG64)
- mk_primtype_(long,int64);
- mk_primtype_(ulong,uint64);
+ mk_primtype(long, int64_t);
+ mk_primtype(ulong, uint64_t);
#else
- mk_primtype_(long,int32);
- mk_primtype_(ulong,uint32);
+ mk_primtype(long, int32_t);
+ mk_primtype(ulong, uint32_t);
#endif
- mk_primtype_(byte,uint8);
- mk_primtype_(wchar,int32);
- mk_primtype(float);
- mk_primtype(double);
+ mk_primtype(byte, uint8_t);
+ mk_primtype(wchar, int32_t);
+ mk_primtype(float, float);
+ mk_primtype(double, double);
stringtype = get_type(symbol_value(stringtypesym));
wcstringtype = get_type(symbol_value(wcstringtypesym));
@@ -1011,7 +1008,7 @@
setc(emptystringsym, cvalue_static_cstring(""));
}
-#define RETURN_NUM_AS(var, type) return(mk_##type((fl_##type##_t)var))
+#define RETURN_NUM_AS(var, type) return(mk_##type(var))
value_t return_from_uint64(uint64_t Uaccum)
{
@@ -1044,7 +1041,7 @@
RETURN_NUM_AS(Saccum, int32);
}
-static value_t fl_add_any(value_t *args, u_int32_t nargs, fixnum_t carryIn)
+static value_t fl_add_any(value_t *args, uint32_t nargs, fixnum_t carryIn)
{
uint64_t Uaccum=0;
int64_t Saccum = carryIn;
@@ -1158,7 +1155,7 @@
return NIL;
}
-static value_t fl_mul_any(value_t *args, u_int32_t nargs, int64_t Saccum)
+static value_t fl_mul_any(value_t *args, uint32_t nargs, int64_t Saccum)
{
uint64_t Uaccum=1;
double Faccum=1;
@@ -1416,7 +1413,7 @@
return NIL;
}
-static value_t fl_logand(value_t *args, u_int32_t nargs)
+static value_t fl_logand(value_t *args, uint32_t nargs)
{
value_t v, e;
int i;
@@ -1432,7 +1429,7 @@
return v;
}
-static value_t fl_logior(value_t *args, u_int32_t nargs)
+static value_t fl_logior(value_t *args, uint32_t nargs)
{
value_t v, e;
int i;
@@ -1448,7 +1445,7 @@
return v;
}
-static value_t fl_logxor(value_t *args, u_int32_t nargs)
+static value_t fl_logxor(value_t *args, uint32_t nargs)
{
value_t v, e;
int i;
@@ -1464,7 +1461,7 @@
return v;
}
-static value_t fl_lognot(value_t *args, u_int32_t nargs)
+static value_t fl_lognot(value_t *args, uint32_t nargs)
{
argcount("lognot", nargs, 1);
value_t a = args[0];
@@ -1493,7 +1490,7 @@
return NIL;
}
-static value_t fl_ash(value_t *args, u_int32_t nargs)
+static value_t fl_ash(value_t *args, uint32_t nargs)
{
fixnum_t n;
int64_t accum;
--- a/equal.c
+++ b/equal.c
@@ -378,7 +378,7 @@
return n;
}
-value_t fl_hash(value_t *args, u_int32_t nargs)
+value_t fl_hash(value_t *args, uint32_t nargs)
{
argcount("hash", nargs, 1);
return fixnum(hash_lispvalue(args[0]));
--- a/flisp.c
+++ b/flisp.c
@@ -329,7 +329,7 @@
return isgensym(v);
}
-static value_t fl_gensymp(value_t *args, u_int32_t nargs)
+static value_t fl_gensymp(value_t *args, uint32_t nargs)
{
argcount("gensym?", nargs, 1);
return isgensym(args[0]) ? FL_T : FL_F;
@@ -1163,56 +1163,56 @@
type_error("apply", "function", func);
OP(OP_TCALLL) n = GET_INT32(ip); ip+=4; goto do_tcall;
OP(OP_CALLL) n = GET_INT32(ip); ip+=4; goto do_call;
- OP(OP_JMP) ip += (ptrint_t)GET_INT16(ip); NEXT_OP;
+ OP(OP_JMP) ip += (intptr_t)GET_INT16(ip); NEXT_OP;
OP(OP_BRF)
v = POP();
- if (v == FL_F) ip += (ptrint_t)GET_INT16(ip);
+ if (v == FL_F) ip += (intptr_t)GET_INT16(ip);
else ip += 2;
NEXT_OP;
OP(OP_BRT)
v = POP();
- if (v != FL_F) ip += (ptrint_t)GET_INT16(ip);
+ if (v != FL_F) ip += (intptr_t)GET_INT16(ip);
else ip += 2;
NEXT_OP;
- OP(OP_JMPL) ip += (ptrint_t)GET_INT32(ip); NEXT_OP;
+ OP(OP_JMPL) ip += (intptr_t)GET_INT32(ip); NEXT_OP;
OP(OP_BRFL)
v = POP();
- if (v == FL_F) ip += (ptrint_t)GET_INT32(ip);
+ if (v == FL_F) ip += (intptr_t)GET_INT32(ip);
else ip += 4;
NEXT_OP;
OP(OP_BRTL)
v = POP();
- if (v != FL_F) ip += (ptrint_t)GET_INT32(ip);
+ if (v != FL_F) ip += (intptr_t)GET_INT32(ip);
else ip += 4;
NEXT_OP;
OP(OP_BRNE)
- if (Stack[SP-2] != Stack[SP-1]) ip += (ptrint_t)GET_INT16(ip);
+ if (Stack[SP-2] != Stack[SP-1]) ip += (intptr_t)GET_INT16(ip);
else ip += 2;
POPN(2);
NEXT_OP;
OP(OP_BRNEL)
- if (Stack[SP-2] != Stack[SP-1]) ip += (ptrint_t)GET_INT32(ip);
+ if (Stack[SP-2] != Stack[SP-1]) ip += (intptr_t)GET_INT32(ip);
else ip += 4;
POPN(2);
NEXT_OP;
OP(OP_BRNN)
v = POP();
- if (v != NIL) ip += (ptrint_t)GET_INT16(ip);
+ if (v != NIL) ip += (intptr_t)GET_INT16(ip);
else ip += 2;
NEXT_OP;
OP(OP_BRNNL)
v = POP();
- if (v != NIL) ip += (ptrint_t)GET_INT32(ip);
+ if (v != NIL) ip += (intptr_t)GET_INT32(ip);
else ip += 4;
NEXT_OP;
OP(OP_BRN)
v = POP();
- if (v == NIL) ip += (ptrint_t)GET_INT16(ip);
+ if (v == NIL) ip += (intptr_t)GET_INT16(ip);
else ip += 2;
NEXT_OP;
OP(OP_BRNL)
v = POP();
- if (v == NIL) ip += (ptrint_t)GET_INT32(ip);
+ if (v == NIL) ip += (intptr_t)GET_INT32(ip);
else ip += 4;
NEXT_OP;
OP(OP_RET)
@@ -2115,13 +2115,13 @@
return fn_name(v);
}
-value_t fl_copylist(value_t *args, u_int32_t nargs)
+value_t fl_copylist(value_t *args, uint32_t nargs)
{
argcount("copy-list", nargs, 1);
return copy_list(args[0]);
}
-value_t fl_append(value_t *args, u_int32_t nargs)
+value_t fl_append(value_t *args, uint32_t nargs)
{
if (nargs == 0)
return NIL;
@@ -2152,7 +2152,7 @@
return first;
}
-value_t fl_liststar(value_t *args, u_int32_t nargs)
+value_t fl_liststar(value_t *args, uint32_t nargs)
{
if (nargs == 1) return args[0];
else if (nargs == 0) argcount("list*", nargs, 1);
@@ -2159,7 +2159,7 @@
return _list(args, nargs, 1);
}
-value_t fl_stacktrace(value_t *args, u_int32_t nargs)
+value_t fl_stacktrace(value_t *args, uint32_t nargs)
{
USED(args);
argcount("stacktrace", nargs, 0);
@@ -2166,7 +2166,7 @@
return _stacktrace(fl_throwing_frame ? fl_throwing_frame : curr_frame);
}
-value_t fl_map1(value_t *args, u_int32_t nargs)
+value_t fl_map1(value_t *args, uint32_t nargs)
{
if (nargs < 2)
lerror(ArgError, "map: too few arguments");
--- a/flisp.h
+++ b/flisp.h
@@ -303,24 +303,6 @@
#define cptr(v) \
(iscprim(v) ? cp_data((cprim_t*)ptr(v)) : cv_data((cvalue_t*)ptr(v)))
-/* C type names corresponding to cvalues type names */
-typedef int8_t fl_int8_t;
-typedef uint8_t fl_uint8_t;
-typedef int16_t fl_int16_t;
-typedef uint16_t fl_uint16_t;
-typedef int32_t fl_int32_t;
-typedef uint32_t fl_uint32_t;
-typedef int64_t fl_int64_t;
-typedef uint64_t fl_uint64_t;
-typedef char fl_char_t;
-typedef char char_t;
-typedef long fl_long_t;
-typedef long long_t;
-typedef unsigned long fl_ulong_t;
-typedef unsigned long ulong_t;
-typedef double fl_double_t;
-typedef float fl_float_t;
-
typedef value_t (*builtin_t)(value_t*, uint32_t);
extern value_t QUOTE;
@@ -365,8 +347,8 @@
fltype_t *define_opaque_type(value_t sym, size_t sz, cvtable_t *vtab,
cvinitfunc_t init);
-value_t mk_double(fl_double_t n);
-value_t mk_float(fl_float_t n);
+value_t mk_double(double n);
+value_t mk_float(float n);
value_t mk_uint32(uint32_t n);
value_t mk_uint64(uint64_t n);
value_t mk_wchar(int32_t n);
@@ -402,7 +384,7 @@
void assign_global_builtins(builtinspec_t *b);
/* builtins */
-value_t fl_hash(value_t *args, u_int32_t nargs);
+value_t fl_hash(value_t *args, uint32_t nargs);
value_t cvalue_byte(value_t *args, uint32_t nargs);
value_t cvalue_wchar(value_t *args, uint32_t nargs);
--- a/iostream.c
+++ b/iostream.c
@@ -99,7 +99,7 @@
return f;
}
-value_t fl_buffer(value_t *args, u_int32_t nargs)
+value_t fl_buffer(value_t *args, uint32_t nargs)
{
argcount("buffer", nargs, 0);
USED(args);
@@ -110,7 +110,7 @@
return f;
}
-value_t fl_read(value_t *args, u_int32_t nargs)
+value_t fl_read(value_t *args, uint32_t nargs)
{
value_t arg = 0;
if (nargs > 1) {
@@ -131,7 +131,7 @@
return v;
}
-value_t fl_iogetc(value_t *args, u_int32_t nargs)
+value_t fl_iogetc(value_t *args, uint32_t nargs)
{
argcount("io.getc", nargs, 1);
ios_t *s = toiostream(args[0], "io.getc");
@@ -142,7 +142,7 @@
return mk_wchar(wc);
}
-value_t fl_iopeekc(value_t *args, u_int32_t nargs)
+value_t fl_iopeekc(value_t *args, uint32_t nargs)
{
argcount("io.peekc", nargs, 1);
ios_t *s = toiostream(args[0], "io.peekc");
@@ -152,7 +152,7 @@
return mk_wchar(wc);
}
-value_t fl_ioputc(value_t *args, u_int32_t nargs)
+value_t fl_ioputc(value_t *args, uint32_t nargs)
{
argcount("io.putc", nargs, 2);
ios_t *s = toiostream(args[0], "io.putc");
@@ -162,7 +162,7 @@
return fixnum(ios_pututf8(s, wc));
}
-value_t fl_ioungetc(value_t *args, u_int32_t nargs)
+value_t fl_ioungetc(value_t *args, uint32_t nargs)
{
argcount("io.ungetc", nargs, 2);
ios_t *s = toiostream(args[0], "io.ungetc");
@@ -175,7 +175,7 @@
return fixnum(ios_ungetc((int)wc,s));
}
-value_t fl_ioflush(value_t *args, u_int32_t nargs)
+value_t fl_ioflush(value_t *args, uint32_t nargs)
{
argcount("io.flush", nargs, 1);
ios_t *s = toiostream(args[0], "io.flush");
@@ -184,7 +184,7 @@
return FL_T;
}
-value_t fl_ioclose(value_t *args, u_int32_t nargs)
+value_t fl_ioclose(value_t *args, uint32_t nargs)
{
argcount("io.close", nargs, 1);
ios_t *s = toiostream(args[0], "io.close");
@@ -192,7 +192,7 @@
return FL_T;
}
-value_t fl_iopurge(value_t *args, u_int32_t nargs)
+value_t fl_iopurge(value_t *args, uint32_t nargs)
{
argcount("io.discardbuffer", nargs, 1);
ios_t *s = toiostream(args[0], "io.discardbuffer");
@@ -200,7 +200,7 @@
return FL_T;
}
-value_t fl_ioeof(value_t *args, u_int32_t nargs)
+value_t fl_ioeof(value_t *args, uint32_t nargs)
{
argcount("io.eof?", nargs, 1);
ios_t *s = toiostream(args[0], "io.eof?");
@@ -207,7 +207,7 @@
return (ios_eof(s) ? FL_T : FL_F);
}
-value_t fl_ioseek(value_t *args, u_int32_t nargs)
+value_t fl_ioseek(value_t *args, uint32_t nargs)
{
argcount("io.seek", nargs, 2);
ios_t *s = toiostream(args[0], "io.seek");
@@ -218,7 +218,7 @@
return FL_T;
}
-value_t fl_iopos(value_t *args, u_int32_t nargs)
+value_t fl_iopos(value_t *args, uint32_t nargs)
{
argcount("io.pos", nargs, 1);
ios_t *s = toiostream(args[0], "io.pos");
@@ -228,7 +228,7 @@
return size_wrap((size_t)res);
}
-value_t fl_write(value_t *args, u_int32_t nargs)
+value_t fl_write(value_t *args, uint32_t nargs)
{
if (nargs < 1 || nargs > 2)
argcount("write", nargs, 1);
@@ -241,7 +241,7 @@
return args[0];
}
-value_t fl_ioread(value_t *args, u_int32_t nargs)
+value_t fl_ioread(value_t *args, uint32_t nargs)
{
if (nargs != 3)
argcount("io.read", nargs, 2);
@@ -285,7 +285,7 @@
}
}
-value_t fl_iowrite(value_t *args, u_int32_t nargs)
+value_t fl_iowrite(value_t *args, uint32_t nargs)
{
if (nargs < 2 || nargs > 4)
argcount("io.write", nargs, 2);
@@ -308,7 +308,7 @@
return size_wrap(ios_write(s, data, nb));
}
-value_t fl_dump(value_t *args, u_int32_t nargs)
+value_t fl_dump(value_t *args, uint32_t nargs)
{
if (nargs < 1 || nargs > 3)
argcount("dump", nargs, 1);
@@ -337,7 +337,7 @@
return (char)uldelim;
}
-value_t fl_ioreaduntil(value_t *args, u_int32_t nargs)
+value_t fl_ioreaduntil(value_t *args, uint32_t nargs)
{
argcount("io.readuntil", nargs, 2);
value_t str = cvalue_string(80);
@@ -363,7 +363,7 @@
return str;
}
-value_t fl_iocopyuntil(value_t *args, u_int32_t nargs)
+value_t fl_iocopyuntil(value_t *args, uint32_t nargs)
{
argcount("io.copyuntil", nargs, 3);
ios_t *dest = toiostream(args[0], "io.copyuntil");
@@ -372,7 +372,7 @@
return size_wrap(ios_copyuntil(dest, src, delim));
}
-value_t fl_iocopy(value_t *args, u_int32_t nargs)
+value_t fl_iocopy(value_t *args, uint32_t nargs)
{
if (nargs < 2 || nargs > 3)
argcount("io.copy", nargs, 2);
@@ -407,7 +407,7 @@
return str;
}
-value_t fl_iotostring(value_t *args, u_int32_t nargs)
+value_t fl_iotostring(value_t *args, uint32_t nargs)
{
argcount("io.tostring!", nargs, 1);
ios_t *src = toiostream(args[0], "io.tostring!");
--- a/llt/bitvector-ops.c
+++ b/llt/bitvector-ops.c
@@ -13,9 +13,9 @@
// greater than this # of words we use malloc instead of alloca
#define MALLOC_CUTOFF 2000
-u_int32_t bitreverse(u_int32_t x)
+uint32_t bitreverse(uint32_t x)
{
- u_int32_t m;
+ uint32_t m;
#ifdef __INTEL_COMPILER
x = _bswap(x);
@@ -35,9 +35,9 @@
// n is # of int32s to consider, s is shift distance
// lowest bit-index is bit 0 of word 0
// TODO: handle boundary case of shift distance >= data size?
-void bitvector_shr(u_int32_t *b, size_t n, u_int32_t s)
+void bitvector_shr(uint32_t *b, size_t n, uint32_t s)
{
- u_int32_t i;
+ uint32_t i;
if (s == 0 || n == 0) return;
i = (s>>5);
if (i) {
@@ -56,9 +56,9 @@
// linear representation when a copy is needed
// assumes that dest has the same amount of space as source, even if it
// wouldn't have been necessary to hold the shifted bits
-void bitvector_shr_to(u_int32_t *dest, u_int32_t *b, size_t n, u_int32_t s)
+void bitvector_shr_to(uint32_t *dest, uint32_t *b, size_t n, uint32_t s)
{
- u_int32_t i, j;
+ uint32_t i, j;
if (n == 0) return;
if (s == 0) {
memcpy(dest, b, n*4);
@@ -77,9 +77,9 @@
dest[i] = b[i]>>s;
}
-void bitvector_shl(u_int32_t *b, size_t n, u_int32_t s)
+void bitvector_shl(uint32_t *b, size_t n, uint32_t s)
{
- u_int32_t i, scrap=0, temp;
+ uint32_t i, scrap=0, temp;
if (s == 0 || n == 0) return;
i = (s>>5);
if (i) {
@@ -98,10 +98,10 @@
// if dest has more space than source, set scrap to true to keep the
// top bits that would otherwise be shifted out
-void bitvector_shl_to(u_int32_t *dest, u_int32_t *b, size_t n, u_int32_t s,
+void bitvector_shl_to(uint32_t *dest, uint32_t *b, size_t n, uint32_t s,
bool_t scrap)
{
- u_int32_t i, j, sc=0;
+ uint32_t i, j, sc=0;
if (n == 0) return;
if (s == 0) {
memcpy(dest, b, n*4);
@@ -124,11 +124,11 @@
// set nbits to c, starting at given bit offset
// assumes offs < 32
-void bitvector_fill(u_int32_t *b, u_int32_t offs, u_int32_t c, u_int32_t nbits)
+void bitvector_fill(uint32_t *b, uint32_t offs, uint32_t c, uint32_t nbits)
{
index_t i;
- u_int32_t nw, tail;
- u_int32_t mask;
+ uint32_t nw, tail;
+ uint32_t mask;
if (nbits == 0) return;
nw = (offs+nbits+31)>>5;
@@ -156,11 +156,11 @@
}
}
-void bitvector_not(u_int32_t *b, u_int32_t offs, u_int32_t nbits)
+void bitvector_not(uint32_t *b, uint32_t offs, uint32_t nbits)
{
index_t i;
- u_int32_t nw, tail;
- u_int32_t mask;
+ uint32_t nw, tail;
+ uint32_t mask;
if (nbits == 0) return;
nw = (offs+nbits+31)>>5;
@@ -190,12 +190,12 @@
// constant-space bit vector copy in a single pass, with arbitrary
// offsets and lengths. to get this right, there are 16 cases to handle!
#define BITVECTOR_COPY_OP(name, OP) \
-void bitvector_##name(u_int32_t *dest, u_int32_t doffs, \
- u_int32_t *src, u_int32_t soffs, u_int32_t nbits) \
+void bitvector_##name(uint32_t *dest, uint32_t doffs, \
+ uint32_t *src, uint32_t soffs, uint32_t nbits) \
{ \
index_t i; \
- u_int32_t s, nw, tail, snw; \
- u_int32_t mask, scrap; \
+ uint32_t s, nw, tail, snw; \
+ uint32_t mask, scrap; \
\
if (nbits == 0) return; \
nw = (doffs+nbits+31)>>5; \
@@ -287,7 +287,7 @@
// right-shift the bits in one logical "row" of a long 2d bit vector
/*
-void bitvector_shr_row(u_int32_t *b, u_int32_t offs, size_t nbits, u_int32_t s)
+void bitvector_shr_row(uint32_t *b, uint32_t offs, size_t nbits, uint32_t s)
{
}
*/
@@ -296,11 +296,11 @@
// assumes dest offset == 0
// assumes source and dest don't overlap
// assumes offset < 32
-void bitvector_reverse_to(u_int32_t *dest, u_int32_t *src, u_int32_t soffs,
- u_int32_t nbits)
+void bitvector_reverse_to(uint32_t *dest, uint32_t *src, uint32_t soffs,
+ uint32_t nbits)
{
index_t i;
- u_int32_t nw, tail;
+ uint32_t nw, tail;
if (nbits == 0) return;
@@ -318,12 +318,12 @@
bitvector_shr(dest, nw, 32-tail);
}
-void bitvector_reverse(u_int32_t *b, u_int32_t offs, u_int32_t nbits)
+void bitvector_reverse(uint32_t *b, uint32_t offs, uint32_t nbits)
{
index_t i;
- u_int32_t nw, tail;
- u_int32_t *temp;
- u_int32_t a[MALLOC_CUTOFF];
+ uint32_t nw, tail;
+ uint32_t *temp;
+ uint32_t a[MALLOC_CUTOFF];
if (nbits == 0) return;
@@ -341,14 +341,14 @@
if (nw > MALLOC_CUTOFF) free(temp);
}
-u_int64_t bitvector_count(u_int32_t *b, u_int32_t offs, u_int64_t nbits)
+uint64_t bitvector_count(uint32_t *b, uint32_t offs, uint64_t nbits)
{
size_t i, nw;
- u_int32_t ntail;
- u_int64_t ans;
+ uint32_t ntail;
+ uint64_t ans;
if (nbits == 0) return 0;
- nw = ((u_int64_t)offs+nbits+31)>>5;
+ nw = ((uint64_t)offs+nbits+31)>>5;
if (nw == 1) {
return count_bits(b[0] & (lomask(nbits)<<offs));
@@ -370,17 +370,17 @@
ans += count_bits(b[i]);
}
- ntail = (offs+(u_int32_t)nbits)&31;
+ ntail = (offs+(uint32_t)nbits)&31;
ans += count_bits(b[i]&(ntail>0?lomask(ntail):ONES32)); // last end cap
return ans;
}
-u_int32_t bitvector_any0(u_int32_t *b, u_int32_t offs, u_int32_t nbits)
+uint32_t bitvector_any0(uint32_t *b, uint32_t offs, uint32_t nbits)
{
index_t i;
- u_int32_t nw, tail;
- u_int32_t mask;
+ uint32_t nw, tail;
+ uint32_t mask;
if (nbits == 0) return 0;
nw = (offs+nbits+31)>>5;
@@ -409,11 +409,11 @@
return 0;
}
-u_int32_t bitvector_any1(u_int32_t *b, u_int32_t offs, u_int32_t nbits)
+uint32_t bitvector_any1(uint32_t *b, uint32_t offs, uint32_t nbits)
{
index_t i;
- u_int32_t nw, tail;
- u_int32_t mask;
+ uint32_t nw, tail;
+ uint32_t mask;
if (nbits == 0) return 0;
nw = (offs+nbits+31)>>5;
@@ -442,8 +442,8 @@
return 0;
}
-static void adjust_offset_to(u_int32_t *dest, u_int32_t *src, u_int32_t nw,
- u_int32_t soffs, u_int32_t newoffs)
+static void adjust_offset_to(uint32_t *dest, uint32_t *src, uint32_t nw,
+ uint32_t soffs, uint32_t newoffs)
{
if (newoffs > soffs)
bitvector_shl_to(dest, src, nw, newoffs-soffs, 1);
@@ -452,14 +452,14 @@
}
#define BITVECTOR_BINARY_OP_TO(opname, OP) \
-void bitvector_##opname##_to(u_int32_t *dest, u_int32_t doffs, \
- u_int32_t *a, u_int32_t aoffs, \
- u_int32_t *b, u_int32_t boffs, u_int32_t nbits) \
+void bitvector_##opname##_to(uint32_t *dest, uint32_t doffs, \
+ uint32_t *a, uint32_t aoffs, \
+ uint32_t *b, uint32_t boffs, uint32_t nbits) \
{ \
- u_int32_t nw = (doffs+nbits+31)>>5; \
- u_int32_t atmp[MALLOC_CUTOFF+1]; \
- u_int32_t *temp = nw>MALLOC_CUTOFF ? malloc((nw+1)*4) : atmp; \
- u_int32_t i, anw, bnw; \
+ uint32_t nw = (doffs+nbits+31)>>5; \
+ uint32_t atmp[MALLOC_CUTOFF+1]; \
+ uint32_t *temp = nw>MALLOC_CUTOFF ? malloc((nw+1)*4) : atmp; \
+ uint32_t i, anw, bnw; \
if (aoffs == boffs) { \
anw = (aoffs+nbits+31)>>5; \
} \
--- a/llt/bitvector.c
+++ b/llt/bitvector.c
@@ -41,10 +41,10 @@
#include "dtypes.h"
#include "bitvector.h"
-u_int32_t *bitvector_resize(u_int32_t *b, uint64_t oldsz, uint64_t newsz,
+uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz,
int initzero)
{
- u_int32_t *p;
+ uint32_t *p;
size_t sz = ((newsz+31)>>5) * sizeof(uint32_t);
p = LLT_REALLOC(b, sz);
if (p == NULL) return NULL;
@@ -55,17 +55,17 @@
return p;
}
-u_int32_t *bitvector_new(u_int64_t n, int initzero)
+uint32_t *bitvector_new(uint64_t n, int initzero)
{
return bitvector_resize(NULL, 0, n, initzero);
}
-size_t bitvector_nwords(u_int64_t nbits)
+size_t bitvector_nwords(uint64_t nbits)
{
return ((nbits+31)>>5);
}
-void bitvector_set(u_int32_t *b, u_int64_t n, u_int32_t c)
+void bitvector_set(uint32_t *b, uint64_t n, uint32_t c)
{
if (c)
b[n>>5] |= (1<<(n&31));
@@ -73,7 +73,7 @@
b[n>>5] &= ~(1<<(n&31));
}
-u_int32_t bitvector_get(u_int32_t *b, u_int64_t n)
+uint32_t bitvector_get(uint32_t *b, uint64_t n)
{
return b[n>>5] & (1<<(n&31));
}
--- a/llt/bitvector.h
+++ b/llt/bitvector.h
@@ -2,14 +2,14 @@
#define __BITVECTOR_H_
// a mask with n set lo or hi bits
-#define lomask(n) (u_int32_t)((((u_int32_t)1)<<(n))-1)
+#define lomask(n) (uint32_t)((((uint32_t)1)<<(n))-1)
#define himask(n) (~lomask(32-n))
-#define ONES32 ((u_int32_t)0xffffffff)
+#define ONES32 ((uint32_t)0xffffffff)
#ifdef __INTEL_COMPILER
#define count_bits(b) _popcnt32(b)
#else
-static inline u_int32_t count_bits(u_int32_t b)
+static inline uint32_t count_bits(uint32_t b)
{
b = b - ((b>>1)&0x55555555);
b = ((b>>2)&0x33333333) + (b&0x33333333);
@@ -29,42 +29,42 @@
}
#endif
-u_int32_t bitreverse(u_int32_t x);
+uint32_t bitreverse(uint32_t x);
-u_int32_t *bitvector_new(u_int64_t n, int initzero);
-u_int32_t *bitvector_resize(u_int32_t *b, uint64_t oldsz, uint64_t newsz,
+uint32_t *bitvector_new(uint64_t n, int initzero);
+uint32_t *bitvector_resize(uint32_t *b, uint64_t oldsz, uint64_t newsz,
int initzero);
-size_t bitvector_nwords(u_int64_t nbits);
-void bitvector_set(u_int32_t *b, u_int64_t n, u_int32_t c);
-u_int32_t bitvector_get(u_int32_t *b, u_int64_t n);
+size_t bitvector_nwords(uint64_t nbits);
+void bitvector_set(uint32_t *b, uint64_t n, uint32_t c);
+uint32_t bitvector_get(uint32_t *b, uint64_t n);
uint32_t bitvector_next(uint32_t *b, uint64_t n0, uint64_t n);
-void bitvector_shr(u_int32_t *b, size_t n, u_int32_t s);
-void bitvector_shr_to(u_int32_t *dest, u_int32_t *b, size_t n, u_int32_t s);
-void bitvector_shl(u_int32_t *b, size_t n, u_int32_t s);
-void bitvector_shl_to(u_int32_t *dest, u_int32_t *b, size_t n, u_int32_t s,
+void bitvector_shr(uint32_t *b, size_t n, uint32_t s);
+void bitvector_shr_to(uint32_t *dest, uint32_t *b, size_t n, uint32_t s);
+void bitvector_shl(uint32_t *b, size_t n, uint32_t s);
+void bitvector_shl_to(uint32_t *dest, uint32_t *b, size_t n, uint32_t s,
bool_t scrap);
-void bitvector_fill(u_int32_t *b,u_int32_t offs, u_int32_t c, u_int32_t nbits);
-void bitvector_copy(u_int32_t *dest, u_int32_t doffs,
- u_int32_t *a, u_int32_t aoffs, u_int32_t nbits);
-void bitvector_not(u_int32_t *b, u_int32_t offs, u_int32_t nbits);
-void bitvector_not_to(u_int32_t *dest, u_int32_t doffs,
- u_int32_t *a, u_int32_t aoffs, u_int32_t nbits);
-void bitvector_reverse(u_int32_t *b, u_int32_t offs, u_int32_t nbits);
-void bitvector_reverse_to(u_int32_t *dest, u_int32_t *src, u_int32_t soffs,
- u_int32_t nbits);
-void bitvector_and_to(u_int32_t *dest, u_int32_t doffs,
- u_int32_t *a, u_int32_t aoffs,
- u_int32_t *b, u_int32_t boffs, u_int32_t nbits);
-void bitvector_or_to(u_int32_t *dest, u_int32_t doffs,
- u_int32_t *a, u_int32_t aoffs,
- u_int32_t *b, u_int32_t boffs, u_int32_t nbits);
-void bitvector_xor_to(u_int32_t *dest, u_int32_t doffs,
- u_int32_t *a, u_int32_t aoffs,
- u_int32_t *b, u_int32_t boffs, u_int32_t nbits);
-u_int64_t bitvector_count(u_int32_t *b, u_int32_t offs, u_int64_t nbits);
-u_int32_t bitvector_any0(u_int32_t *b, u_int32_t offs, u_int32_t nbits);
-u_int32_t bitvector_any1(u_int32_t *b, u_int32_t offs, u_int32_t nbits);
+void bitvector_fill(uint32_t *b,uint32_t offs, uint32_t c, uint32_t nbits);
+void bitvector_copy(uint32_t *dest, uint32_t doffs,
+ uint32_t *a, uint32_t aoffs, uint32_t nbits);
+void bitvector_not(uint32_t *b, uint32_t offs, uint32_t nbits);
+void bitvector_not_to(uint32_t *dest, uint32_t doffs,
+ uint32_t *a, uint32_t aoffs, uint32_t nbits);
+void bitvector_reverse(uint32_t *b, uint32_t offs, uint32_t nbits);
+void bitvector_reverse_to(uint32_t *dest, uint32_t *src, uint32_t soffs,
+ uint32_t nbits);
+void bitvector_and_to(uint32_t *dest, uint32_t doffs,
+ uint32_t *a, uint32_t aoffs,
+ uint32_t *b, uint32_t boffs, uint32_t nbits);
+void bitvector_or_to(uint32_t *dest, uint32_t doffs,
+ uint32_t *a, uint32_t aoffs,
+ uint32_t *b, uint32_t boffs, uint32_t nbits);
+void bitvector_xor_to(uint32_t *dest, uint32_t doffs,
+ uint32_t *a, uint32_t aoffs,
+ uint32_t *b, uint32_t boffs, uint32_t nbits);
+uint64_t bitvector_count(uint32_t *b, uint32_t offs, uint64_t nbits);
+uint32_t bitvector_any0(uint32_t *b, uint32_t offs, uint32_t nbits);
+uint32_t bitvector_any1(uint32_t *b, uint32_t offs, uint32_t nbits);
#endif
--- a/llt/dtypes.h
+++ b/llt/dtypes.h
@@ -120,10 +120,6 @@
typedef s16int int16_t;
typedef s32int int32_t;
typedef s64int int64_t;
-typedef u8int u_int8_t;
-typedef u16int u_int16_t;
-typedef u32int u_int32_t;
-typedef u64int u_int64_t;
typedef u8int uint8_t;
typedef u16int uint16_t;
typedef u32int uint32_t;
@@ -135,7 +131,6 @@
#include <sys/types.h>
#include <stdint.h>
#endif
-typedef u_int8_t byte_t; /* 1 byte */
#ifdef BITS64
#define TOP_BIT 0x8000000000000000ULL
@@ -143,18 +138,14 @@
typedef uint64_t uint_t; // preferred int type on platform
typedef int64_t int_t;
typedef int64_t offset_t;
-typedef u_int64_t index_t;
-typedef intptr_t ptrint_t; // pointer-size int
-typedef uintptr_t u_ptrint_t;
+typedef uint64_t index_t;
#else
#define TOP_BIT 0x80000000UL
#define NBITS 32
-typedef unsigned long uint_t;
-typedef long int_t;
+typedef uint32_t uint_t;
+typedef int32_t int_t;
typedef int32_t offset_t;
-typedef u_int32_t index_t;
-typedef int32_t ptrint_t;
-typedef u_int32_t u_ptrint_t;
+typedef uint32_t index_t;
#endif
#define LLT_ALIGN(x, sz) (((x) + (sz-1)) & (-sz))
--- a/llt/hashing.c
+++ b/llt/hashing.c
@@ -29,7 +29,7 @@
return i<<1;
}
-u_int32_t int32hash(u_int32_t a)
+uint32_t int32hash(uint32_t a)
{
a = (a+0x7ed55d16) + (a<<12);
a = (a^0xc761c23c) ^ (a>>19);
@@ -40,7 +40,7 @@
return a;
}
-u_int64_t int64hash(u_int64_t key)
+uint64_t int64hash(uint64_t key)
{
key = (~key) + (key << 21); // key = (key << 21) - key - 1;
key = key ^ (key >> 24);
@@ -52,7 +52,7 @@
return key;
}
-u_int32_t int64to32hash(u_int64_t key)
+uint32_t int64to32hash(uint64_t key)
{
key = (~key) + (key << 18); // key = (key << 18) - key - 1;
key = key ^ (key >> 31);
@@ -60,22 +60,22 @@
key = key ^ (key >> 11);
key = key + (key << 6);
key = key ^ (key >> 22);
- return (u_int32_t)key;
+ return (uint32_t)key;
}
#include "lookup3.c"
-u_int64_t memhash(const char* buf, size_t n)
+uint64_t memhash(const char* buf, size_t n)
{
- u_int32_t c=0xcafe8881, b=0x4d6a087c;
+ uint32_t c=0xcafe8881, b=0x4d6a087c;
hashlittle2(buf, n, &c, &b);
- return (u_int64_t)c | (((u_int64_t)b)<<32);
+ return (uint64_t)c | (((uint64_t)b)<<32);
}
-u_int32_t memhash32(const char* buf, size_t n)
+uint32_t memhash32(const char* buf, size_t n)
{
- u_int32_t c=0xcafe8881, b=0x4d6a087c;
+ uint32_t c=0xcafe8881, b=0x4d6a087c;
hashlittle2(buf, n, &c, &b);
return c;
--- a/llt/hashing.h
+++ b/llt/hashing.h
@@ -2,15 +2,15 @@
#define __HASHING_H_
uint_t nextipow2(uint_t i);
-u_int32_t int32hash(u_int32_t a);
-u_int64_t int64hash(u_int64_t key);
-u_int32_t int64to32hash(u_int64_t key);
+uint32_t int32hash(uint32_t a);
+uint64_t int64hash(uint64_t key);
+uint32_t int64to32hash(uint64_t key);
#ifdef BITS64
#define inthash int64hash
#else
#define inthash int32hash
#endif
-u_int64_t memhash(const char* buf, size_t n);
-u_int32_t memhash32(const char* buf, size_t n);
+uint64_t memhash(const char* buf, size_t n);
+uint32_t memhash32(const char* buf, size_t n);
#endif
--- a/llt/ptrhash.c
+++ b/llt/ptrhash.c
@@ -20,7 +20,7 @@
#define OP_EQ(x,y) ((x)==(y))
#ifdef BITS64
-static u_int64_t _pinthash(u_int64_t key)
+static uint64_t _pinthash(uint64_t key)
{
key = (~key) + (key << 21); // key = (key << 21) - key - 1;
key = key ^ (key >> 24);
@@ -32,7 +32,7 @@
return key;
}
#else
-static u_int32_t _pinthash(u_int32_t a)
+static uint32_t _pinthash(uint32_t a)
{
a = (a+0x7ed55d16) + (a<<12);
a = (a^0xc761c23c) ^ (a>>19);
--- a/llt/random.c
+++ b/llt/random.c
@@ -62,6 +62,6 @@
void randomize(void)
{
- u_int64_t tm = i64time();
+ uint64_t tm = i64time();
init_by_array((uint32_t*)&tm, 2);
}
--- a/llt/random.h
+++ b/llt/random.h
@@ -9,6 +9,6 @@
void randomize(void);
uint32_t genrand_int32(void);
void init_genrand(uint32_t s);
-u_int64_t i64time(void);
+uint64_t i64time(void);
#endif
--- a/llt/timefuncs.c
+++ b/llt/timefuncs.c
@@ -37,15 +37,15 @@
#endif
// return as many bits of system randomness as we can get our hands on
-u_int64_t i64time(void)
+uint64_t i64time(void)
{
- u_int64_t a;
+ uint64_t a;
#if defined(PLAN9)
a = nsec();
#else
struct timeval now;
gettimeofday(&now, NULL);
- a = (((u_int64_t)now.tv_sec)<<32) + (u_int64_t)now.tv_usec;
+ a = (((uint64_t)now.tv_sec)<<32) + (uint64_t)now.tv_usec;
#endif
return a;
--- a/llt/timefuncs.h
+++ b/llt/timefuncs.h
@@ -1,7 +1,7 @@
#ifndef __TIMEFUNCS_H_
#define __TIMEFUNCS_H_
-u_int64_t i64time(void);
+uint64_t i64time(void);
double clock_now(void);
void timestring(double seconds, char *buffer, size_t len);
double parsetime(const char *str);
--- a/llt/utf8.c
+++ b/llt/utf8.c
@@ -42,7 +42,7 @@
#include "dtypes.h"
#include "utf8.h"
-static const u_int32_t offsetsFromUTF8[6] = {
+static const uint32_t offsetsFromUTF8[6] = {
0x00000000UL, 0x00003080UL, 0x000E2080UL,
0x03C82080UL, 0xFA082080UL, 0x82082080UL
};
@@ -66,7 +66,7 @@
/* returns the # of bytes needed to encode a certain character
0 means the character cannot (or should not) be encoded. */
-size_t u8_charlen(u_int32_t ch)
+size_t u8_charlen(uint32_t ch)
{
if (ch < 0x80)
return 1;
@@ -79,7 +79,7 @@
return 0;
}
-size_t u8_codingsize(u_int32_t *wcstr, size_t n)
+size_t u8_codingsize(uint32_t *wcstr, size_t n)
{
size_t i, c=0;
@@ -96,9 +96,9 @@
returns # characters converted
if sz == srcsz+1 (i.e. 4*srcsz+4 bytes), there will always be enough space.
*/
-size_t u8_toucs(u_int32_t *dest, size_t sz, const char *src, size_t srcsz)
+size_t u8_toucs(uint32_t *dest, size_t sz, const char *src, size_t srcsz)
{
- u_int32_t ch;
+ uint32_t ch;
const char *src_end = src + srcsz;
size_t nb;
size_t i=0;
@@ -137,9 +137,9 @@
returns # bytes stored in dest
the destination string will never be bigger than the source string.
*/
-size_t u8_toutf8(char *dest, size_t sz, const u_int32_t *src, size_t srcsz)
+size_t u8_toutf8(char *dest, size_t sz, const uint32_t *src, size_t srcsz)
{
- u_int32_t ch;
+ uint32_t ch;
size_t i = 0;
char *dest0 = dest;
char *dest_end = dest + sz;
@@ -177,7 +177,7 @@
return (dest-dest0);
}
-size_t u8_wc_toutf8(char *dest, u_int32_t ch)
+size_t u8_wc_toutf8(char *dest, uint32_t ch)
{
if (ch < 0x80) {
dest[0] = (char)ch;
@@ -256,7 +256,7 @@
size_t u8_strwidth(const char *s)
{
- u_int32_t ch;
+ uint32_t ch;
size_t nb, tot=0;
int w;
signed char sc;
@@ -287,9 +287,9 @@
}
/* reads the next utf-8 sequence out of a string, updating an index */
-u_int32_t u8_nextchar(const char *s, size_t *i)
+uint32_t u8_nextchar(const char *s, size_t *i)
{
- u_int32_t ch = 0;
+ uint32_t ch = 0;
size_t sz = 0;
do {
@@ -303,9 +303,9 @@
}
/* next character without NUL character terminator */
-u_int32_t u8_nextmemchar(const char *s, size_t *i)
+uint32_t u8_nextmemchar(const char *s, size_t *i)
{
- u_int32_t ch = 0;
+ uint32_t ch = 0;
size_t sz = 0;
do {
@@ -363,10 +363,10 @@
/* assumes that src points to the character after a backslash
returns number of input characters processed, 0 if error */
-size_t u8_read_escape_sequence(const char *str, size_t ssz, u_int32_t *dest)
+size_t u8_read_escape_sequence(const char *str, size_t ssz, uint32_t *dest)
{
assert(ssz > 0);
- u_int32_t ch;
+ uint32_t ch;
char digs[10];
int dno=0, ndig;
size_t i=1;
@@ -391,7 +391,7 @@
ch = strtol(digs, NULL, 16);
}
else {
- ch = (u_int32_t)read_escape_control_char(c0);
+ ch = (uint32_t)read_escape_control_char(c0);
}
*dest = ch;
@@ -404,7 +404,7 @@
size_t u8_unescape(char *buf, size_t sz, const char *src)
{
size_t c=0, amt;
- u_int32_t ch;
+ uint32_t ch;
char temp[4];
while (*src && c < sz) {
@@ -413,7 +413,7 @@
amt = u8_read_escape_sequence(src, 1000, &ch);
}
else {
- ch = (u_int32_t)*src;
+ ch = (uint32_t)*src;
amt = 1;
}
src += amt;
@@ -436,7 +436,7 @@
return 2;
}
-int u8_escape_wchar(char *buf, size_t sz, u_int32_t ch)
+int u8_escape_wchar(char *buf, size_t sz, uint32_t ch)
{
assert(sz > 2);
if (ch == L'\n')
@@ -460,7 +460,7 @@
else if (ch < 32 || ch == 0x7f)
return snprintf(buf, sz, "\\x%.2hhx", (unsigned char)ch);
else if (ch > 0xFFFF)
- return snprintf(buf, sz, "\\U%.8x", (u_int32_t)ch);
+ return snprintf(buf, sz, "\\U%.8x", (uint32_t)ch);
else if (ch >= 0x80)
return snprintf(buf, sz, "\\u%.4hx", (unsigned short)ch);
@@ -473,7 +473,7 @@
int escape_quotes, int ascii)
{
size_t i = *pi, i0;
- u_int32_t ch;
+ uint32_t ch;
char *start = buf;
char *blim = start + sz-11;
assert(sz > 11);
@@ -507,10 +507,10 @@
return (buf-start);
}
-char *u8_strchr(const char *s, u_int32_t ch, size_t *charn)
+char *u8_strchr(const char *s, uint32_t ch, size_t *charn)
{
size_t i = 0, lasti=0;
- u_int32_t c;
+ uint32_t c;
*charn = 0;
while (s[i]) {
@@ -525,10 +525,10 @@
return NULL;
}
-char *u8_memchr(const char *s, u_int32_t ch, size_t sz, size_t *charn)
+char *u8_memchr(const char *s, uint32_t ch, size_t sz, size_t *charn)
{
size_t i = 0, lasti=0;
- u_int32_t c;
+ uint32_t c;
int csz;
*charn = 0;
@@ -550,10 +550,10 @@
return NULL;
}
-char *u8_memrchr(const char *s, u_int32_t ch, size_t sz)
+char *u8_memrchr(const char *s, uint32_t ch, size_t sz)
{
size_t i = sz-1, tempi=0;
- u_int32_t c;
+ uint32_t c;
if (sz == 0) return NULL;
@@ -579,7 +579,7 @@
{
size_t cnt, sz, nc, needfree=0;
char *buf, tmp[512];
- u_int32_t *wcs;
+ uint32_t *wcs;
sz = 512;
buf = tmp;
@@ -591,7 +591,7 @@
needfree = 1;
vsnprintf(buf, cnt+1, fmt, ap);
}
- wcs = (u_int32_t*)malloc((cnt+1) * sizeof(u_int32_t));
+ wcs = (uint32_t*)malloc((cnt+1) * sizeof(uint32_t));
nc = u8_toucs(wcs, cnt+1, buf, cnt);
wcs[nc] = 0;
#ifdef PLAN9
--- a/llt/utf8.h
+++ b/llt/utf8.h
@@ -1,30 +1,19 @@
#ifndef __UTF8_H_
#define __UTF8_H_
-#if !defined(__DTYPES_H_) && !defined(_SYS_TYPES_H)
-typedef char int8_t;
-typedef short int16_t;
-typedef int int32_t;
-typedef long long int64_t;
-typedef unsigned char u_int8_t;
-typedef unsigned short u_int16_t;
-typedef unsigned int u_int32_t;
-typedef unsigned long long u_int64_t;
-#endif
-
/* is c the start of a utf8 sequence? */
#define isutf(c) (((c)&0xC0)!=0x80)
-#define UEOF ((u_int32_t)-1)
+#define UEOF ((uint32_t)-1)
/* convert UTF-8 data to wide character */
-size_t u8_toucs(u_int32_t *dest, size_t sz, const char *src, size_t srcsz);
+size_t u8_toucs(uint32_t *dest, size_t sz, const char *src, size_t srcsz);
/* the opposite conversion */
-size_t u8_toutf8(char *dest, size_t sz, const u_int32_t *src, size_t srcsz);
+size_t u8_toutf8(char *dest, size_t sz, const uint32_t *src, size_t srcsz);
/* single character to UTF-8, returns # bytes written */
-size_t u8_wc_toutf8(char *dest, u_int32_t ch);
+size_t u8_wc_toutf8(char *dest, uint32_t ch);
/* character number to byte offset */
size_t u8_offset(const char *str, size_t charnum);
@@ -33,10 +22,10 @@
size_t u8_charnum(const char *s, size_t offset);
/* return next character, updating an index variable */
-u_int32_t u8_nextchar(const char *s, size_t *i);
+uint32_t u8_nextchar(const char *s, size_t *i);
/* next character without NUL character terminator */
-u_int32_t u8_nextmemchar(const char *s, size_t *i);
+uint32_t u8_nextmemchar(const char *s, size_t *i);
/* move to next character */
void u8_inc(const char *s, size_t *i);
@@ -48,10 +37,10 @@
size_t u8_seqlen(const char *s);
/* returns the # of bytes needed to encode a certain character */
-size_t u8_charlen(u_int32_t ch);
+size_t u8_charlen(uint32_t ch);
/* computes the # of bytes needed to encode a WC string as UTF-8 */
-size_t u8_codingsize(u_int32_t *wcstr, size_t n);
+size_t u8_codingsize(uint32_t *wcstr, size_t n);
char read_escape_control_char(char c);
@@ -58,12 +47,12 @@
/* assuming src points to the character after a backslash, read an
escape sequence, storing the result in dest and returning the number of
input characters processed */
-size_t u8_read_escape_sequence(const char *src, size_t ssz, u_int32_t *dest);
+size_t u8_read_escape_sequence(const char *src, size_t ssz, uint32_t *dest);
/* given a wide character, convert it to an ASCII escape sequence stored in
buf, where buf is "sz" bytes. returns the number of characters output.
sz must be at least 3. */
-int u8_escape_wchar(char *buf, size_t sz, u_int32_t ch);
+int u8_escape_wchar(char *buf, size_t sz, uint32_t ch);
/* convert a string "src" containing escape sequences to UTF-8 */
size_t u8_unescape(char *buf, size_t sz, const char *src);
@@ -92,13 +81,13 @@
/* return a pointer to the first occurrence of ch in s, or NULL if not
found. character index of found character returned in *charn. */
-char *u8_strchr(const char *s, u_int32_t ch, size_t *charn);
+char *u8_strchr(const char *s, uint32_t ch, size_t *charn);
/* same as the above, but searches a buffer of a given size instead of
a NUL-terminated string. */
-char *u8_memchr(const char *s, u_int32_t ch, size_t sz, size_t *charn);
+char *u8_memchr(const char *s, uint32_t ch, size_t sz, size_t *charn);
-char *u8_memrchr(const char *s, u_int32_t ch, size_t sz);
+char *u8_memrchr(const char *s, uint32_t ch, size_t sz);
/* count the number of characters in a UTF-8 string */
size_t u8_strlen(const char *s);
--- a/llt/utils.h
+++ b/llt/utils.h
@@ -42,7 +42,7 @@
#endif
#if !defined(PLAN9) && !defined(__INTEL_COMPILER) && (defined(ARCH_X86) || defined(ARCH_X86_64))
-STATIC_INLINE u_int16_t ByteSwap16(u_int16_t x)
+STATIC_INLINE uint16_t ByteSwap16(uint16_t x)
{
__asm("xchgb %b0,%h0" :
LEGACY_REGS (x) :
@@ -51,7 +51,7 @@
}
#define bswap_16(x) ByteSwap16(x)
-STATIC_INLINE u_int32_t ByteSwap32(u_int32_t x)
+STATIC_INLINE uint32_t ByteSwap32(uint32_t x)
{
#if __CPU__ > 386
__asm("bswap %0":
@@ -68,7 +68,7 @@
#define bswap_32(x) ByteSwap32(x)
-STATIC_INLINE u_int64_t ByteSwap64(u_int64_t x)
+STATIC_INLINE uint64_t ByteSwap64(uint64_t x)
{
#ifdef ARCH_X86_64
__asm("bswap %0":
@@ -76,8 +76,8 @@
"0" (x));
return x;
#else
- register union { __extension__ u_int64_t __ll;
- u_int32_t __l[2]; } __x;
+ register union { __extension__ uint64_t __ll;
+ uint32_t __l[2]; } __x;
asm("xchgl %0,%1":
"=r"(__x.__l[0]),"=r"(__x.__l[1]):
"0"(bswap_32((unsigned long)x)),"1"(bswap_32((unsigned long)(x>>32))));
@@ -98,11 +98,11 @@
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))
#endif
-STATIC_INLINE u_int64_t ByteSwap64(u_int64_t x)
+STATIC_INLINE uint64_t ByteSwap64(uint64_t x)
{
union {
- u_int64_t ll;
- u_int32_t l[2];
+ uint64_t ll;
+ uint32_t l[2];
} w, r;
w.ll = x;
r.l[0] = bswap_32 (w.l[1]);
--- a/operators.c
+++ b/operators.c
@@ -112,28 +112,27 @@
}
}
-#define CONV_TO_INTTYPE(type) \
-type##_t conv_to_##type(void *data, numerictype_t tag) \
-{ \
- type##_t i=0; \
- switch (tag) { \
- case T_INT8: i = (type##_t)*(int8_t*)data; break; \
- case T_UINT8: i = (type##_t)*(uint8_t*)data; break; \
- case T_INT16: i = (type##_t)*(int16_t*)data; break; \
- case T_UINT16: i = (type##_t)*(uint16_t*)data; break; \
- case T_INT32: i = (type##_t)*(int32_t*)data; break; \
- case T_UINT32: i = (type##_t)*(uint32_t*)data; break; \
- case T_INT64: i = (type##_t)*(int64_t*)data; break; \
- case T_UINT64: i = (type##_t)*(uint64_t*)data; break; \
- case T_FLOAT: i = (type##_t)*(float*)data; break; \
- case T_DOUBLE: i = (type##_t)*(double*)data; break; \
- } \
- return i; \
+#define CONV_TO_INTTYPE(name, ctype) \
+ctype conv_to_##name(void *data, numerictype_t tag) \
+{ \
+ switch (tag) { \
+ case T_INT8: return *(int8_t*)data; \
+ case T_UINT8: return *(uint8_t*)data; \
+ case T_INT16: return *(int16_t*)data; \
+ case T_UINT16: return *(uint16_t*)data; \
+ case T_INT32: return *(int32_t*)data; \
+ case T_UINT32: return *(uint32_t*)data; \
+ case T_INT64: return *(int64_t*)data; \
+ case T_UINT64: return *(uint64_t*)data; \
+ case T_FLOAT: return *(float*)data; \
+ case T_DOUBLE: return *(double*)data; \
+ } \
+ return 0; \
}
-CONV_TO_INTTYPE(int64)
-CONV_TO_INTTYPE(int32)
-CONV_TO_INTTYPE(uint32)
+CONV_TO_INTTYPE(int64, int64_t)
+CONV_TO_INTTYPE(int32, int32_t)
+CONV_TO_INTTYPE(uint32, uint32_t)
// this is needed to work around a possible compiler bug
// casting negative floats and doubles to uint64. you need
@@ -140,32 +139,28 @@
// to cast to int64 first.
uint64_t conv_to_uint64(void *data, numerictype_t tag)
{
- uint64_t i=0;
- int64_t s=0;
+ int64_t s;
switch (tag) {
- case T_INT8: i = (uint64_t)*(int8_t*)data; break;
- case T_UINT8: i = (uint64_t)*(uint8_t*)data; break;
- case T_INT16: i = (uint64_t)*(int16_t*)data; break;
- case T_UINT16: i = (uint64_t)*(uint16_t*)data; break;
- case T_INT32: i = (uint64_t)*(int32_t*)data; break;
- case T_UINT32: i = (uint64_t)*(uint32_t*)data; break;
- case T_INT64: i = (uint64_t)*(int64_t*)data; break;
- case T_UINT64: i = (uint64_t)*(uint64_t*)data; break;
+ case T_INT8: return *(int8_t*)data; break;
+ case T_UINT8: return *(uint8_t*)data; break;
+ case T_INT16: return *(int16_t*)data; break;
+ case T_UINT16: return *(uint16_t*)data; break;
+ case T_INT32: return *(int32_t*)data; break;
+ case T_UINT32: return *(uint32_t*)data; break;
+ case T_INT64: return *(int64_t*)data; break;
+ case T_UINT64: return *(uint64_t*)data; break;
case T_FLOAT:
if (*(float*)data >= 0)
- i = (uint64_t)*(float*)data;
- else
- i = s = (int64_t)*(float*)data;
- break;
+ return *(float*)data;
+ s = *(float*)data;
+ return s;
case T_DOUBLE:
if (*(double*)data >= 0)
- i = (uint64_t)*(double*)data;
- else
- i = s = (int64_t)*(double*)data;
- break;
+ return *(double*)data;
+ s = *(double*)data;
+ return s;
}
- USED(s);
- return i;
+ return 0;
}
int cmp_same_lt(void *a, void *b, numerictype_t tag)
--- a/print.c
+++ b/print.c
@@ -7,7 +7,7 @@
extern void *memrchr(const void *s, int c, size_t n);
static htable_t printconses;
-static u_int32_t printlabel;
+static uint32_t printlabel;
static int print_pretty;
static int print_princ;
static fixnum_t print_length;
--- a/read.c
+++ b/read.c
@@ -97,7 +97,7 @@
return result;
}
-static u_int32_t toktype = TOK_NONE;
+static uint32_t toktype = TOK_NONE;
static value_t tokval;
static char buf[256];
@@ -181,7 +181,7 @@
static value_t do_read_sexpr(value_t label);
-static u_int32_t peek(void)
+static uint32_t peek(void)
{
char c, *end;
fixnum_t x;
@@ -405,10 +405,10 @@
return POP();
}
-static value_t read_vector(value_t label, u_int32_t closer)
+static value_t read_vector(value_t label, uint32_t closer)
{
value_t v=the_empty_vector, elt;
- u_int32_t i=0;
+ uint32_t i=0;
PUSH(v);
if (label != UNBOUND)
ptrhash_put(&readstate->backrefs, (void*)label, (void*)v);
@@ -439,7 +439,7 @@
size_t i=0, j, sz = 64, ndig;
int c;
value_t s;
- u_int32_t wc=0;
+ uint32_t wc=0;
buf = malloc(sz);
while (1) {
@@ -517,7 +517,7 @@
static void read_list(value_t *pval, value_t label)
{
value_t c, *pc;
- u_int32_t t;
+ uint32_t t;
PUSH(NIL);
pc = &Stack[SP-1]; // to keep track of current cons cell
@@ -562,7 +562,7 @@
{
value_t v, sym, oldtokval, *head;
value_t *pv;
- u_int32_t t;
+ uint32_t t;
char c;
t = peek();
--- a/string.c
+++ b/string.c
@@ -24,13 +24,13 @@
#include "llt.h"
#include "flisp.h"
-value_t fl_stringp(value_t *args, u_int32_t nargs)
+value_t fl_stringp(value_t *args, uint32_t nargs)
{
argcount("string?", nargs, 1);
return fl_isstring(args[0]) ? FL_T : FL_F;
}
-value_t fl_string_count(value_t *args, u_int32_t nargs)
+value_t fl_string_count(value_t *args, uint32_t nargs)
{
size_t start = 0;
if (nargs < 1 || nargs > 3)
@@ -55,7 +55,7 @@
return size_wrap(u8_charnum(str+start, stop-start));
}
-value_t fl_string_width(value_t *args, u_int32_t nargs)
+value_t fl_string_width(value_t *args, uint32_t nargs)
{
argcount("string.width", nargs, 1);
if (iscprim(args[0])) {
@@ -76,7 +76,7 @@
return size_wrap(u8_strwidth(s));
}
-value_t fl_string_reverse(value_t *args, u_int32_t nargs)
+value_t fl_string_reverse(value_t *args, uint32_t nargs)
{
argcount("string.reverse", nargs, 1);
if (!fl_isstring(args[0]))
@@ -87,7 +87,7 @@
return ns;
}
-value_t fl_string_encode(value_t *args, u_int32_t nargs)
+value_t fl_string_encode(value_t *args, uint32_t nargs)
{
argcount("string.encode", nargs, 1);
if (iscvalue(args[0])) {
@@ -107,7 +107,7 @@
return -1;
}
-value_t fl_string_decode(value_t *args, u_int32_t nargs)
+value_t fl_string_decode(value_t *args, uint32_t nargs)
{
int term=0;
if (nargs == 2) {
@@ -132,10 +132,10 @@
return wcstr;
}
-extern value_t fl_buffer(value_t *args, u_int32_t nargs);
+extern value_t fl_buffer(value_t *args, uint32_t nargs);
extern value_t stream_to_string(value_t *ps);
-value_t fl_string(value_t *args, u_int32_t nargs)
+value_t fl_string(value_t *args, uint32_t nargs)
{
if (nargs == 1 && fl_isstring(args[0]))
return args[0];
@@ -158,7 +158,7 @@
return outp;
}
-value_t fl_string_split(value_t *args, u_int32_t nargs)
+value_t fl_string_split(value_t *args, uint32_t nargs)
{
argcount("string.split", nargs, 2);
char *s = tostring(args[0], "string.split");
@@ -201,7 +201,7 @@
return first;
}
-value_t fl_string_sub(value_t *args, u_int32_t nargs)
+value_t fl_string_sub(value_t *args, uint32_t nargs)
{
if (nargs != 2)
argcount("string.sub", nargs, 3);
@@ -226,7 +226,7 @@
return ns;
}
-value_t fl_string_char(value_t *args, u_int32_t nargs)
+value_t fl_string_char(value_t *args, uint32_t nargs)
{
argcount("string.char", nargs, 2);
char *s = tostring(args[0], "string.char");
@@ -240,7 +240,7 @@
return mk_wchar(u8_nextchar(s, &i));
}
-value_t fl_char_upcase(value_t *args, u_int32_t nargs)
+value_t fl_char_upcase(value_t *args, uint32_t nargs)
{
argcount("char.upcase", nargs, 1);
cprim_t *cp = (cprim_t*)ptr(args[0]);
@@ -248,7 +248,7 @@
type_error("char.upcase", "wchar", args[0]);
return mk_wchar(towupper(*(int32_t*)cp_data(cp)));
}
-value_t fl_char_downcase(value_t *args, u_int32_t nargs)
+value_t fl_char_downcase(value_t *args, uint32_t nargs)
{
argcount("char.downcase", nargs, 1);
cprim_t *cp = (cprim_t*)ptr(args[0]);
@@ -257,7 +257,7 @@
return mk_wchar(towlower(*(int32_t*)cp_data(cp)));
}
-value_t fl_char_alpha(value_t *args, u_int32_t nargs)
+value_t fl_char_alpha(value_t *args, uint32_t nargs)
{
argcount("char-alphabetic?", nargs, 1);
cprim_t *cp = (cprim_t*)ptr(args[0]);
@@ -274,7 +274,7 @@
return size_wrap((size_t)(p - s));
}
-value_t fl_string_find(value_t *args, u_int32_t nargs)
+value_t fl_string_find(value_t *args, uint32_t nargs)
{
char cbuf[8];
size_t start = 0;
@@ -324,7 +324,7 @@
return FL_F;
}
-value_t fl_string_inc(value_t *args, u_int32_t nargs)
+value_t fl_string_inc(value_t *args, uint32_t nargs)
{
if (nargs < 2 || nargs > 3)
argcount("string.inc", nargs, 2);
@@ -342,7 +342,7 @@
return size_wrap(i);
}
-value_t fl_string_dec(value_t *args, u_int32_t nargs)
+value_t fl_string_dec(value_t *args, uint32_t nargs)
{
if (nargs < 2 || nargs > 3)
argcount("string.dec", nargs, 2);
@@ -371,7 +371,7 @@
return radix;
}
-value_t fl_numbertostring(value_t *args, u_int32_t nargs)
+value_t fl_numbertostring(value_t *args, uint32_t nargs)
{
if (nargs < 1 || nargs > 2)
argcount("number->string", nargs, 2);
@@ -410,7 +410,7 @@
return n;
}
-value_t fl_string_isutf8(value_t *args, u_int32_t nargs)
+value_t fl_string_isutf8(value_t *args, uint32_t nargs)
{
argcount("string.isutf8", nargs, 1);
char *s = tostring(args[0], "string.isutf8");