mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-23 20:33:05 +00:00
lex_ctx_t -> lex_ctx, vector_t -> vector
This commit is contained in:
parent
72053e16d2
commit
75b78720fd
5 changed files with 22 additions and 22 deletions
12
ast.c
12
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);
|
||||
|
||||
|
|
14
ast.h
14
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);
|
||||
|
|
4
gmqcc.h
4
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
|
||||
|
|
2
ir.c
2
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;
|
||||
|
|
12
ir.h
12
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;
|
||||
|
|
Loading…
Reference in a new issue