Replace cvtable_t with struct
This commit is contained in:
parent
428e7a3825
commit
ece07d2e1a
10
c/flisp.h
10
c/flisp.h
|
@ -211,14 +211,14 @@ static inline void argcount(char *fname, uint32_t nargs, uint32_t c)
|
||||||
nargs < c ? "few" : "many");
|
nargs < c ? "few" : "many");
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
struct cvtable {
|
||||||
void (*print)(value_t self, struct ios *f);
|
void (*print)(value_t self, struct ios *f);
|
||||||
void (*relocate)(value_t oldv, value_t newv);
|
void (*relocate)(value_t oldv, value_t newv);
|
||||||
void (*finalize)(value_t self);
|
void (*finalize)(value_t self);
|
||||||
void (*print_traverse)(value_t self);
|
void (*print_traverse)(value_t self);
|
||||||
} cvtable_t;
|
};
|
||||||
|
|
||||||
/* functions needed to implement the value interface (cvtable_t) */
|
/* functions needed to implement the value interface (struct cvtable) */
|
||||||
typedef enum {
|
typedef enum {
|
||||||
T_INT8,
|
T_INT8,
|
||||||
T_UINT8,
|
T_UINT8,
|
||||||
|
@ -255,7 +255,7 @@ typedef struct _fltype_t {
|
||||||
numerictype_t numtype;
|
numerictype_t numtype;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t elsz;
|
size_t elsz;
|
||||||
cvtable_t *vtable;
|
struct cvtable *vtable;
|
||||||
struct _fltype_t *eltype; // for arrays
|
struct _fltype_t *eltype; // for arrays
|
||||||
struct _fltype_t *artype; // (array this)
|
struct _fltype_t *artype; // (array this)
|
||||||
int marked;
|
int marked;
|
||||||
|
@ -375,7 +375,7 @@ void to_sized_ptr(value_t v, char *fname, char **pdata, size_t *psz);
|
||||||
|
|
||||||
fltype_t *get_type(value_t t);
|
fltype_t *get_type(value_t t);
|
||||||
fltype_t *get_array_type(value_t eltype);
|
fltype_t *get_array_type(value_t eltype);
|
||||||
fltype_t *define_opaque_type(value_t sym, size_t sz, cvtable_t *vtab,
|
fltype_t *define_opaque_type(value_t sym, size_t sz, struct cvtable *vtab,
|
||||||
cvinitfunc_t init);
|
cvinitfunc_t init);
|
||||||
|
|
||||||
value_t mk_double(fl_double_t n);
|
value_t mk_double(fl_double_t n);
|
||||||
|
|
|
@ -48,8 +48,8 @@ void relocate_iostream(value_t oldv, value_t newv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cvtable_t iostream_vtable = { print_iostream, relocate_iostream,
|
struct cvtable iostream_vtable = { print_iostream, relocate_iostream,
|
||||||
free_iostream, NULL };
|
free_iostream, NULL };
|
||||||
|
|
||||||
int fl_isiostream(value_t v)
|
int fl_isiostream(value_t v)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,8 +77,8 @@ void relocate_htable(value_t oldv, value_t newv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cvtable_t table_vtable = { print_htable, relocate_htable, free_htable,
|
struct cvtable table_vtable = { print_htable, relocate_htable, free_htable,
|
||||||
print_traverse_htable };
|
print_traverse_htable };
|
||||||
|
|
||||||
int ishashtable(value_t v)
|
int ishashtable(value_t v)
|
||||||
{
|
{
|
||||||
|
|
|
@ -64,7 +64,7 @@ fltype_t *get_array_type(value_t eltype)
|
||||||
return et->artype;
|
return et->artype;
|
||||||
}
|
}
|
||||||
|
|
||||||
fltype_t *define_opaque_type(value_t sym, size_t sz, cvtable_t *vtab,
|
fltype_t *define_opaque_type(value_t sym, size_t sz, struct cvtable *vtab,
|
||||||
cvinitfunc_t init)
|
cvinitfunc_t init)
|
||||||
{
|
{
|
||||||
fltype_t *ft = (fltype_t *)malloc(sizeof(fltype_t));
|
fltype_t *ft = (fltype_t *)malloc(sizeof(fltype_t));
|
||||||
|
|
Loading…
Reference in New Issue