prefer type alias to types with 'struct'

This commit is contained in:
Yuichi Nishiwaki 2014-02-07 01:15:17 +09:00
parent 1901a7ab30
commit 53979bf848
6 changed files with 18 additions and 18 deletions

View File

@ -94,12 +94,12 @@ typedef struct {
pic_sym sADD, sSUB, sMUL, sDIV, sMINUS; pic_sym sADD, sSUB, sMUL, sDIV, sMINUS;
pic_sym sEQ, sLT, sLE, sGT, sGE, sNOT; pic_sym sEQ, sLT, sLE, sGT, sGE, sNOT;
struct xhash *sym_tbl; xhash *sym_tbl;
const char **sym_pool; const char **sym_pool;
size_t slen, scapa; size_t slen, scapa;
int uniq_sym_count; int uniq_sym_count;
struct xhash *global_tbl; xhash *global_tbl;
pic_value *globals; pic_value *globals;
size_t glen, gcapa; size_t glen, gcapa;

View File

@ -13,7 +13,7 @@ struct pic_lib {
PIC_OBJECT_HEADER PIC_OBJECT_HEADER
pic_value name; pic_value name;
struct pic_senv *senv; struct pic_senv *senv;
struct xhash *exports; xhash *exports;
}; };
#define pic_lib_ptr(o) ((struct pic_lib *)pic_ptr(o)) #define pic_lib_ptr(o) ((struct pic_lib *)pic_ptr(o))

View File

@ -13,7 +13,7 @@ struct pic_senv {
PIC_OBJECT_HEADER PIC_OBJECT_HEADER
struct pic_senv *up; struct pic_senv *up;
/* positive for variables, negative for macros (bitwise-not) */ /* positive for variables, negative for macros (bitwise-not) */
struct xhash *tbl; xhash *tbl;
struct pic_syntax **stx; struct pic_syntax **stx;
size_t xlen, xcapa; size_t xlen, xcapa;
}; };

View File

@ -80,7 +80,7 @@ typedef struct analyze_scope {
bool varg; bool varg;
int argc, localc; int argc, localc;
/* if variable v is captured, then xh_get(var_tbl, v) == 1 */ /* if variable v is captured, then xh_get(var_tbl, v) == 1 */
struct xhash *var_tbl; xhash *var_tbl;
pic_sym *vars; pic_sym *vars;
struct analyze_scope *up; struct analyze_scope *up;
@ -103,7 +103,7 @@ static void pop_scope(analyze_state *);
} while (0) } while (0)
#define register_renamed_symbol(pic, state, slot, lib, name) do { \ #define register_renamed_symbol(pic, state, slot, lib, name) do { \
struct xh_entry *e; \ xh_entry *e; \
if (! (e = xh_get_int(lib->senv->tbl, pic_intern_cstr(pic, name)))) \ if (! (e = xh_get_int(lib->senv->tbl, pic_intern_cstr(pic, name)))) \
pic_error(pic, "internal error! native VM procedure not found"); \ pic_error(pic, "internal error! native VM procedure not found"); \
state->slot = e->val; \ state->slot = e->val; \
@ -113,8 +113,8 @@ static analyze_state *
new_analyze_state(pic_state *pic) new_analyze_state(pic_state *pic)
{ {
analyze_state *state; analyze_state *state;
struct xhash *global_tbl; xhash *global_tbl;
struct xh_iter it; xh_iter it;
struct pic_lib *stdlib; struct pic_lib *stdlib;
state = (analyze_state *)pic_alloc(pic, sizeof(analyze_state)); state = (analyze_state *)pic_alloc(pic, sizeof(analyze_state));
@ -204,7 +204,7 @@ static int
lookup_var(analyze_state *state, pic_sym sym) lookup_var(analyze_state *state, pic_sym sym)
{ {
analyze_scope *scope = state->scope; analyze_scope *scope = state->scope;
struct xh_entry *e; xh_entry *e;
int depth = 0; int depth = 0;
enter: enter:
@ -667,7 +667,7 @@ typedef struct resolver_scope {
int depth; int depth;
bool varg; bool varg;
int argc, localc; int argc, localc;
struct xhash *cvs, *lvs; xhash *cvs, *lvs;
unsigned cv_num; unsigned cv_num;
struct resolver_scope *up; struct resolver_scope *up;
@ -768,7 +768,7 @@ static pic_value
resolve_gref(resolver_state *state, pic_sym sym) resolve_gref(resolver_state *state, pic_sym sym)
{ {
pic_state *pic = state->pic; pic_state *pic = state->pic;
struct xh_entry *e; xh_entry *e;
size_t i; size_t i;
if ((e = xh_get_int(pic->global_tbl, sym))) { if ((e = xh_get_int(pic->global_tbl, sym))) {
@ -981,7 +981,7 @@ push_codegen_context(codegen_state *state, pic_value args, pic_value locals, boo
pic_state *pic = state->pic; pic_state *pic = state->pic;
codegen_context *cxt; codegen_context *cxt;
int i, c; int i, c;
struct xhash *vars; xhash *vars;
cxt = (codegen_context *)pic_alloc(pic, sizeof(codegen_context)); cxt = (codegen_context *)pic_alloc(pic, sizeof(codegen_context));
cxt->up = state->cxt; cxt->up = state->cxt;
@ -1438,7 +1438,7 @@ pic_compile(pic_state *pic, pic_value obj)
static int static int
scope_global_define(pic_state *pic, pic_sym sym) scope_global_define(pic_state *pic, pic_sym sym)
{ {
struct xh_entry *e; xh_entry *e;
if ((e = xh_get_int(pic->global_tbl, sym))) { if ((e = xh_get_int(pic->global_tbl, sym))) {
pic_warn(pic, "redefining global"); pic_warn(pic, "redefining global");
@ -1474,7 +1474,7 @@ pic_define(pic_state *pic, const char *name, pic_value val)
static int static int
global_ref(pic_state *pic, const char *name) global_ref(pic_state *pic, const char *name)
{ {
struct xh_entry *e; xh_entry *e;
pic_sym sym; pic_sym sym;
sym = pic_intern_cstr(pic, name); sym = pic_intern_cstr(pic, name);

View File

@ -181,7 +181,7 @@ void
pic_import(pic_state *pic, pic_value spec) pic_import(pic_state *pic, pic_value spec)
{ {
struct pic_lib *lib; struct pic_lib *lib;
struct xh_iter it; xh_iter it;
lib = pic_find_library(pic, spec); lib = pic_find_library(pic, spec);
if (! lib) { if (! lib) {
@ -218,7 +218,7 @@ pic_import(pic_state *pic, pic_value spec)
void void
pic_export(pic_state *pic, pic_sym sym) pic_export(pic_state *pic, pic_sym sym)
{ {
struct xh_entry *e; xh_entry *e;
e = xh_get_int(pic->lib->senv->tbl, sym); e = xh_get_int(pic->lib->senv->tbl, sym);
if (! e) { if (! e) {
@ -272,7 +272,7 @@ macroexpand(pic_state *pic, pic_value expr, struct pic_senv *senv)
return macroexpand(pic, sc->expr, sc->senv); return macroexpand(pic, sc->expr, sc->senv);
} }
case PIC_TT_SYMBOL: { case PIC_TT_SYMBOL: {
struct xh_entry *e; xh_entry *e;
pic_sym uniq; pic_sym uniq;
if (! pic_interned_p(pic, pic_sym(expr))) { if (! pic_interned_p(pic, pic_sym(expr))) {

View File

@ -13,7 +13,7 @@
pic_sym pic_sym
pic_intern_cstr(pic_state *pic, const char *str) pic_intern_cstr(pic_state *pic, const char *str)
{ {
struct xh_entry *e; xh_entry *e;
pic_sym id; pic_sym id;
e = xh_get(pic->sym_tbl, str); e = xh_get(pic->sym_tbl, str);