mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-30 15:41:12 +00:00
Building the output - global variables for now
This commit is contained in:
parent
d6cd3b6dc9
commit
5b7dfb7e4b
1 changed files with 17 additions and 0 deletions
17
parser.c
17
parser.c
|
@ -125,6 +125,7 @@ bool parser_compile(const char *filename)
|
||||||
{
|
{
|
||||||
size_t i;
|
size_t i;
|
||||||
parser_t *parser;
|
parser_t *parser;
|
||||||
|
ir_builder *ir;
|
||||||
|
|
||||||
parser = (parser_t*)mem_a(sizeof(parser_t));
|
parser = (parser_t*)mem_a(sizeof(parser_t));
|
||||||
if (!parser)
|
if (!parser)
|
||||||
|
@ -157,6 +158,22 @@ bool parser_compile(const char *filename)
|
||||||
}
|
}
|
||||||
|
|
||||||
lex_close(parser->lex);
|
lex_close(parser->lex);
|
||||||
|
|
||||||
|
ir = ir_builder_new("gmqcc_out");
|
||||||
|
if (!ir) {
|
||||||
|
printf("failed to allocate builder\n");
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < parser->globals_count; ++i) {
|
||||||
|
if (!ast_global_codegen(parser->globals[i], ir)) {
|
||||||
|
printf("failed to generate global %s\n", parser->globals[i]->name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ir_builder_dump(ir, printf);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
for (i = 0; i < parser->globals_count; ++i) {
|
for (i = 0; i < parser->globals_count; ++i) {
|
||||||
ast_value_delete(parser->globals[i]);
|
ast_value_delete(parser->globals[i]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue