mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 14:21:36 +00:00
ftepp_out can now output to a string buffer
This commit is contained in:
parent
b8a5c87360
commit
03f0e39f7f
1 changed files with 12 additions and 1 deletions
13
ftepp.c
13
ftepp.c
|
@ -61,6 +61,9 @@ typedef struct {
|
|||
bool output_on;
|
||||
ppcondition *conditions;
|
||||
ppmacro **macros;
|
||||
|
||||
bool output_string;
|
||||
char *output;
|
||||
} ftepp_t;
|
||||
|
||||
#define ftepp_tokval(f) ((f)->lex->tok.value)
|
||||
|
@ -154,7 +157,15 @@ static void ftepp_out(ftepp_t *ftepp, const char *str, bool ignore_cond)
|
|||
{
|
||||
if (ignore_cond || ftepp->output_on)
|
||||
{
|
||||
printf("%s", str);
|
||||
size_t len;
|
||||
char *data;
|
||||
if (!ftepp->output_string) {
|
||||
printf("%s", str);
|
||||
return;
|
||||
}
|
||||
len = strlen(str);
|
||||
data = vec_add(ftepp->output, len);
|
||||
memcpy(data, str, len);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue