Replace builtinspec_t with struct

This commit is contained in:
Lassi Kortela 2019-08-09 19:20:18 +03:00
parent e54797e4eb
commit 428e7a3825
7 changed files with 32 additions and 30 deletions

View File

@ -477,7 +477,7 @@ extern void stringfuncs_init(void);
extern void table_init(void);
extern void iostream_init(void);
static builtinspec_t builtin_info[] = {
static struct builtinspec builtin_info[] = {
{ "environment", fl_global_env },
{ "constant?", fl_constantp },
{ "top-level-value", fl_top_level_value },

View File

@ -895,13 +895,13 @@ 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 builtinspec_t cvalues_builtin_info[] = { { "c-value", cvalue_new },
static struct builtinspec cvalues_builtin_info[] = {
{ "c-value", cvalue_new },
{ "typeof", cvalue_typeof },
{ "sizeof", cvalue_sizeof },
{ "builtin", fl_builtin },
{ "copy", fl_copy },
{ "plain-old-data?",
fl_podp },
{ "plain-old-data?", fl_podp },
{ "logand", fl_logand },
{ "logior", fl_logior },
@ -909,7 +909,8 @@ static builtinspec_t cvalues_builtin_info[] = { { "c-value", cvalue_new },
{ "lognot", fl_lognot },
{ "ash", fl_ash },
// todo: autorelease
{ NULL, NULL } };
{ NULL, NULL }
};
#define cv_intern(tok) tok##sym = symbol(#tok)
#define ctor_cv_intern(tok) \

View File

@ -2217,7 +2217,7 @@ static value_t _stacktrace(uint32_t top)
// builtins
// -------------------------------------------------------------------
void assign_global_builtins(builtinspec_t *b)
void assign_global_builtins(struct builtinspec *b)
{
while (b->name != NULL) {
setc(symbol(b->name), cbuiltin(b->name, b->fptr));
@ -2437,7 +2437,7 @@ value_t fl_map1(value_t *args, u_int32_t nargs)
return first;
}
static builtinspec_t core_builtin_info[] = {
static struct builtinspec core_builtin_info[] = {
{ "function", fl_function },
{ "function:code", fl_function_code },
{ "function:vals", fl_function_vals },

View File

@ -401,12 +401,12 @@ uint32_t conv_to_uint32(void *data, numerictype_t tag);
#define conv_to_ulong conv_to_uint32
#endif
typedef struct {
struct builtinspec {
char *name;
builtin_t fptr;
} builtinspec_t;
};
void assign_global_builtins(builtinspec_t *b);
void assign_global_builtins(struct builtinspec *b);
/* builtins */
value_t fl_hash(value_t *args, u_int32_t nargs);

View File

@ -435,7 +435,7 @@ value_t fl_iotostring(value_t *args, u_int32_t nargs)
return stream_to_string(&args[0]);
}
static builtinspec_t iostreamfunc_info[] = {
static struct builtinspec iostreamfunc_info[] = {
{ "iostream?", fl_iostreamp },
{ "eof-object", fl_eof_object },
{ "eof-object?", fl_eof_objectp },

View File

@ -419,7 +419,7 @@ value_t fl_string_isutf8(value_t *args, u_int32_t nargs)
return u8_isvalid(s, len) ? FL_T : FL_F;
}
static builtinspec_t stringfunc_info[] = {
static struct builtinspec stringfunc_info[] = {
{ "string", fl_string },
{ "string?", fl_stringp },
{ "string.count", fl_string_count },

View File

@ -205,13 +205,14 @@ value_t fl_table_foldl(value_t *args, uint32_t nargs)
return zero;
}
static builtinspec_t tablefunc_info[] = { { "table", fl_table },
static struct builtinspec tablefunc_info[] = { { "table", fl_table },
{ "table?", fl_tablep },
{ "put!", fl_table_put },
{ "get", fl_table_get },
{ "has?", fl_table_has },
{ "del!", fl_table_del },
{ "table.foldl", fl_table_foldl },
{ "table.foldl",
fl_table_foldl },
{ NULL, NULL } };
void table_init(void)