mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-12-18 00:11:06 +00:00
Some printf/con_out/con_err conversions, guarded some outputs with not-opts_pp_only so the -E switch can print to stdout normally
This commit is contained in:
parent
79abe3fb6d
commit
2b65ea599f
3 changed files with 22 additions and 15 deletions
3
ir.c
3
ir.c
|
@ -2972,7 +2972,8 @@ bool ir_builder_generate(ir_builder *self, const char *filename)
|
||||||
stmt.o3.u1 = 0;
|
stmt.o3.u1 = 0;
|
||||||
vec_push(code_statements, stmt);
|
vec_push(code_statements, stmt);
|
||||||
|
|
||||||
printf("writing '%s'...\n", filename);
|
if (!opts_pp_only)
|
||||||
|
con_out("writing '%s'...\n", filename);
|
||||||
return code_write(filename);
|
return code_write(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
30
main.c
30
main.c
|
@ -473,15 +473,19 @@ int main(int argc, char **argv) {
|
||||||
util_debug("COM", "starting ...\n");
|
util_debug("COM", "starting ...\n");
|
||||||
|
|
||||||
if (vec_size(items)) {
|
if (vec_size(items)) {
|
||||||
con_out("Mode: manual\n");
|
if (!opts_pp_only) {
|
||||||
con_out("There are %lu items to compile:\n", (unsigned long)vec_size(items));
|
con_out("Mode: manual\n");
|
||||||
|
con_out("There are %lu items to compile:\n", (unsigned long)vec_size(items));
|
||||||
|
}
|
||||||
for (itr = 0; itr < vec_size(items); ++itr) {
|
for (itr = 0; itr < vec_size(items); ++itr) {
|
||||||
con_out(" item: %s (%s)\n",
|
if (!opts_pp_only) {
|
||||||
items[itr].filename,
|
con_out(" item: %s (%s)\n",
|
||||||
( (items[itr].type == TYPE_QC ? "qc" :
|
items[itr].filename,
|
||||||
(items[itr].type == TYPE_ASM ? "asm" :
|
( (items[itr].type == TYPE_QC ? "qc" :
|
||||||
(items[itr].type == TYPE_SRC ? "progs.src" :
|
(items[itr].type == TYPE_ASM ? "asm" :
|
||||||
("unknown"))))));
|
(items[itr].type == TYPE_SRC ? "progs.src" :
|
||||||
|
("unknown"))))));
|
||||||
|
}
|
||||||
|
|
||||||
if (opts_pp_only) {
|
if (opts_pp_only) {
|
||||||
if (!ftepp_preprocess_file(items[itr].filename)) {
|
if (!ftepp_preprocess_file(items[itr].filename)) {
|
||||||
|
@ -505,17 +509,18 @@ int main(int argc, char **argv) {
|
||||||
char *line;
|
char *line;
|
||||||
size_t linelen = 0;
|
size_t linelen = 0;
|
||||||
|
|
||||||
con_out("Mode: progs.src\n");
|
if (!opts_pp_only)
|
||||||
|
con_out("Mode: progs.src\n");
|
||||||
src = util_fopen("progs.src", "rb");
|
src = util_fopen("progs.src", "rb");
|
||||||
if (!src) {
|
if (!src) {
|
||||||
con_out("failed to open `progs.src` for reading\n");
|
con_err("failed to open `progs.src` for reading\n");
|
||||||
retval = 1;
|
retval = 1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
line = NULL;
|
line = NULL;
|
||||||
if (!progs_nextline(&line, &linelen, src) || !line[0]) {
|
if (!progs_nextline(&line, &linelen, src) || !line[0]) {
|
||||||
con_out("illformatted progs.src file: expected output filename in first line\n");
|
con_err("illformatted progs.src file: expected output filename in first line\n");
|
||||||
retval = 1;
|
retval = 1;
|
||||||
goto srcdone;
|
goto srcdone;
|
||||||
}
|
}
|
||||||
|
@ -528,7 +533,8 @@ int main(int argc, char **argv) {
|
||||||
while (progs_nextline(&line, &linelen, src)) {
|
while (progs_nextline(&line, &linelen, src)) {
|
||||||
if (!line[0] || (line[0] == '/' && line[1] == '/'))
|
if (!line[0] || (line[0] == '/' && line[1] == '/'))
|
||||||
continue;
|
continue;
|
||||||
con_out(" src: %s\n", line);
|
if (!opts_pp_only)
|
||||||
|
con_out(" src: %s\n", line);
|
||||||
if (!parser_compile_file(line)) {
|
if (!parser_compile_file(line)) {
|
||||||
retval = 1;
|
retval = 1;
|
||||||
goto srcdone;
|
goto srcdone;
|
||||||
|
|
4
parser.c
4
parser.c
|
@ -3431,7 +3431,7 @@ bool parser_compile_file(const char *filename)
|
||||||
{
|
{
|
||||||
parser->lex = lex_open(filename);
|
parser->lex = lex_open(filename);
|
||||||
if (!parser->lex) {
|
if (!parser->lex) {
|
||||||
con_out("failed to open file \"%s\"\n", filename);
|
con_err("failed to open file \"%s\"\n", filename);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return parser_compile();
|
return parser_compile();
|
||||||
|
@ -3441,7 +3441,7 @@ bool parser_compile_string(const char *name, const char *str)
|
||||||
{
|
{
|
||||||
parser->lex = lex_open_string(str, strlen(str), name);
|
parser->lex = lex_open_string(str, strlen(str), name);
|
||||||
if (!parser->lex) {
|
if (!parser->lex) {
|
||||||
con_out("failed to create lexer for string \"%s\"\n", name);
|
con_err("failed to create lexer for string \"%s\"\n", name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return parser_compile();
|
return parser_compile();
|
||||||
|
|
Loading…
Reference in a new issue