diff --git a/ast.c b/ast.c index 3639168..b296bac 100644 --- a/ast.c +++ b/ast.c @@ -42,7 +42,7 @@ static void _ast_node_destroy(ast_node *self) } /* Initialize main ast node aprts */ -static void ast_node_init(ast_node *self, lex_ctx_t ctx) +static void ast_node_init(ast_node *self, lex_ctx ctx) { self->node.context = ctx; self->node.destroy = &_ast_node_destroy; @@ -56,7 +56,7 @@ static void ast_expression_init(ast_expression *self, ast_setfunc(&self->expression, codegen, codegen); } -ast_value* ast_value_new(lex_ctx_t ctx, const char *name, int t, bool keep) +ast_value* ast_value_new(lex_ctx ctx, const char *name, int t, bool keep) { ast_instantiate(ast_value, ctx, ast_value_delete); ast_expression_init((ast_expression*)self, @@ -110,7 +110,7 @@ bool ast_value_set_name(ast_value *self, const char *name) return !!self->name; } -ast_binary* ast_binary_new(lex_ctx_t ctx, int op, +ast_binary* ast_binary_new(lex_ctx ctx, int op, ast_value* left, ast_value* right) { ast_instantiate(ast_binary, ctx, ast_binary_delete); @@ -130,7 +130,7 @@ void ast_binary_delete(ast_binary *self) mem_d(self); } -ast_store* ast_store_new(lex_ctx_t ctx, int op, +ast_store* ast_store_new(lex_ctx ctx, int op, ast_value *dest, ast_value *source) { ast_instantiate(ast_store, ctx, ast_store_delete); @@ -150,7 +150,7 @@ void ast_store_delete(ast_store *self) mem_d(self); } -ast_block* ast_block_new(lex_ctx_t ctx) +ast_block* ast_block_new(lex_ctx ctx) { ast_instantiate(ast_block, ctx, ast_block_delete); ast_expression_init((ast_expression*)self, @@ -176,7 +176,7 @@ void ast_block_delete(ast_block *self) mem_d(self); } -ast_function* ast_function_new(lex_ctx_t ctx, const char *name, ast_value *vtype) +ast_function* ast_function_new(lex_ctx ctx, const char *name, ast_value *vtype) { ast_instantiate(ast_function, ctx, ast_function_delete); diff --git a/ast.h b/ast.h index a617a8c..382190c 100644 --- a/ast.h +++ b/ast.h @@ -42,7 +42,7 @@ typedef struct ast_store_s ast_store; typedef void ast_node_delete(ast_node*); typedef struct { - lex_ctx_t context; + lex_ctx context; /* I don't feel comfortable using keywords like 'delete' as names... */ ast_node_delete *destroy; /* keep: if a node contains this node, 'keep' @@ -93,7 +93,7 @@ struct ast_value_s union { double vfloat; int vint; - vector_t vvec; + vector vvec; const char *vstring; int ventity; ast_function *vfunc; @@ -106,7 +106,7 @@ struct ast_value_s */ MEM_VECTOR_MAKE(ast_value*, params); }; -ast_value* ast_value_new(lex_ctx_t ctx, const char *name, int qctype, bool keep); +ast_value* ast_value_new(lex_ctx ctx, const char *name, int qctype, bool keep); void ast_value_delete(ast_value*); bool ast_value_set_name(ast_value*, const char *name); @@ -125,7 +125,7 @@ struct ast_binary_s ast_value *left; ast_value *right; }; -ast_binary* ast_binary_new(lex_ctx_t ctx, +ast_binary* ast_binary_new(lex_ctx ctx, int op, ast_value *left, ast_value *right); @@ -148,7 +148,7 @@ struct ast_store_s ast_value *dest; ast_value *source; }; -ast_store* ast_store_new(lex_ctx_t ctx, int op, +ast_store* ast_store_new(lex_ctx ctx, int op, ast_value *d, ast_value *s); void ast_store_delete(ast_store*); @@ -164,7 +164,7 @@ struct ast_block_s MEM_VECTOR_MAKE(ast_value*, locals); MEM_VECTOR_MAKE(ast_expression*, exprs); }; -ast_block* ast_block_new(lex_ctx_t ctx); +ast_block* ast_block_new(lex_ctx ctx); void ast_block_delete(ast_block*); MEM_VECTOR_PROTO(ast_block, ast_value*, locals); @@ -191,7 +191,7 @@ struct ast_function_s MEM_VECTOR_MAKE(ast_block*, blocks); }; -ast_function* ast_function_new(lex_ctx_t ctx, const char *name, ast_value *vtype); +ast_function* ast_function_new(lex_ctx ctx, const char *name, ast_value *vtype); void ast_function_delete(ast_function*); MEM_VECTOR_PROTO(ast_function, ast_block*, blocks); diff --git a/gmqcc.h b/gmqcc.h index 7199a63..764ac52 100644 --- a/gmqcc.h +++ b/gmqcc.h @@ -689,7 +689,7 @@ enum store_types { typedef struct { float x, y, z; -} vector_t; +} vector; /* * A shallow copy of a lex_file to remember where which ast node @@ -698,5 +698,5 @@ typedef struct { typedef struct lex_ctx { const char *file; size_t line; -} lex_ctx_t; +} lex_ctx; #endif diff --git a/ir.c b/ir.c index 0bfa8d7..8c467ad 100644 --- a/ir.c +++ b/ir.c @@ -439,7 +439,7 @@ bool ir_value_set_float(ir_value *self, float f) return true; } -bool ir_value_set_vector(ir_value *self, vector_t v) +bool ir_value_set_vector(ir_value *self, vector v) { if (self->vtype != TYPE_VECTOR) return false; diff --git a/ir.h b/ir.h index 6172fd3..1a39c3d 100644 --- a/ir.h +++ b/ir.h @@ -37,7 +37,7 @@ typedef struct ir_value_s { char *name; int vtype; int store; - lex_ctx_t context; + lex_ctx context; MEM_VECTOR_MAKE(struct ir_instr_s*, reads); MEM_VECTOR_MAKE(struct ir_instr_s*, writes); @@ -47,7 +47,7 @@ typedef struct ir_value_s { union { float vfloat; int vint; - vector_t vvec; + vector vvec; char *vstring; struct ir_value_s *vpointer; } constval; @@ -73,7 +73,7 @@ bool GMQCC_WARN ir_value_set_float(ir_value*, float f); bool GMQCC_WARN ir_value_set_int(ir_value*, int i); #endif bool GMQCC_WARN ir_value_set_string(ir_value*, const char *s); -bool GMQCC_WARN ir_value_set_vector(ir_value*, vector_t v); +bool GMQCC_WARN ir_value_set_vector(ir_value*, vector v); /*bool ir_value_set_pointer_v(ir_value*, ir_value* p); */ /*bool ir_value_set_pointer_i(ir_value*, int i); */ @@ -97,7 +97,7 @@ typedef struct ir_phi_entry_s typedef struct ir_instr_s { int opcode; - lex_ctx_t context; + lex_ctx context; ir_value* (_ops[3]); struct ir_block_s* (bops[2]); @@ -121,7 +121,7 @@ void ir_instr_dump(ir_instr* in, char *ind, int (*oprintf)(const char*,...)); typedef struct ir_block_s { char *label; - lex_ctx_t context; + lex_ctx context; bool final; /* once a jump is added we're done */ MEM_VECTOR_MAKE(ir_instr*, instr); @@ -197,7 +197,7 @@ typedef struct ir_function_s ir_block* first; ir_block* last; - lex_ctx_t context; + lex_ctx context; /* for temp allocation */ size_t run_id;