X-Git-Url: https://git.xonotic.org/?p=xonotic%2Fgmqcc.git;a=blobdiff_plain;f=ftepp.c;h=44c1ebb1b5392bde5f5842a0a1d23ff8955d23f4;hp=82495b44e3c2353ebe101af7b43dd84359882c2e;hb=a140b749ff5aaa6fe0af7432e9a9be420a8d2ce4;hpb=b20e2a9d34ce6f062b502631507286e2227e97eb diff --git a/ftepp.c b/ftepp.c index 82495b4..44c1ebb 100644 --- a/ftepp.c +++ b/ftepp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012, 2013 + * Copyright (C) 2012, 2013, 2014 * Wolfgang Bumiller * Dale Weiler * @@ -530,19 +530,23 @@ static bool ftepp_define(ftepp_t *ftepp) case TOKEN_IDENT: case TOKEN_TYPENAME: case TOKEN_KEYWORD: - for (i = 0; i < GMQCC_ARRAY_COUNT(ftepp_math_constants); i++) { - if (!strcmp(ftepp_math_constants[i][0], ftepp_tokval(ftepp))) { - mathconstant = true; - break; + if (OPTS_FLAG(FTEPP_MATHDEFS)) { + for (i = 0; i < GMQCC_ARRAY_COUNT(ftepp_math_constants); i++) { + if (!strcmp(ftepp_math_constants[i][0], ftepp_tokval(ftepp))) { + mathconstant = true; + break; + } } } macro = ftepp_macro_find(ftepp, ftepp_tokval(ftepp)); - /* user defined ones take precedence */ - if (macro && mathconstant) { - ftepp_macro_delete(ftepp, ftepp_tokval(ftepp)); - macro = NULL; + if (OPTS_FLAG(FTEPP_MATHDEFS)) { + /* user defined ones take precedence */ + if (macro && mathconstant) { + ftepp_macro_delete(ftepp, ftepp_tokval(ftepp)); + macro = NULL; + } } if (macro && ftepp->output_on) { @@ -1900,9 +1904,11 @@ ftepp_t *ftepp_create() ftepp_add_macro(ftepp, "__NULL__", "nil"); /* add all the math constants if they can be */ - for (i = 0; i < GMQCC_ARRAY_COUNT(ftepp_math_constants); i++) - if (!ftepp_macro_find(ftepp, ftepp_math_constants[i][0])) - ftepp_add_macro(ftepp, ftepp_math_constants[i][0], ftepp_math_constants[i][1]); + if (OPTS_FLAG(FTEPP_MATHDEFS)) { + for (i = 0; i < GMQCC_ARRAY_COUNT(ftepp_math_constants); i++) + if (!ftepp_macro_find(ftepp, ftepp_math_constants[i][0])) + ftepp_add_macro(ftepp, ftepp_math_constants[i][0], ftepp_math_constants[i][1]); + } return ftepp; }