]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
moving ftepp_out further up, using it in ftepp_macro_call, generating output of param...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 16 Nov 2012 19:49:37 +0000 (20:49 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Fri, 16 Nov 2012 19:49:37 +0000 (20:49 +0100)
ftepp.c

diff --git a/ftepp.c b/ftepp.c
index cd42217857e32671395d717e53cabc821fceea7f..fcdaea7a86a17d6abded8e446f3329d63871e10e 100644 (file)
--- a/ftepp.c
+++ b/ftepp.c
@@ -147,6 +147,16 @@ void ftepp_delete(ftepp_t *self)
     mem_d(self);
 }
 
+static void ftepp_out(ftepp_t *ftepp, const char *str, bool ignore_cond)
+{
+    if (ignore_cond ||
+        !vec_size(ftepp->conditions) ||
+        vec_last(ftepp->conditions).on)
+    {
+        printf("%s", str);
+    }
+}
+
 ppmacro* ftepp_macro_find(ftepp_t *ftepp, const char *name)
 {
     size_t i;
@@ -280,7 +290,16 @@ static bool ftepp_define(ftepp_t *ftepp)
 
 static bool ftepp_macro_call(ftepp_t *ftepp, ppmacro *macro)
 {
+    size_t o;
     ftepp_next(ftepp);
+
+    if (!macro->has_params) {
+        for (o = 0; o < vec_size(macro->output); ++o) {
+            ftepp_out(ftepp, macro->output[o]->value, false);
+        }
+        return true;
+    }
+
     if (!ftepp_skipallwhite(ftepp))
         return false;
     return true;
@@ -611,16 +630,6 @@ static bool ftepp_hash(ftepp_t *ftepp)
     return true;
 }
 
-static void ftepp_out(ftepp_t *ftepp, const char *str, bool ignore_cond)
-{
-    if (ignore_cond ||
-        !vec_size(ftepp->conditions) ||
-        vec_last(ftepp->conditions).on)
-    {
-        printf("%s", str);
-    }
-}
-
 static bool ftepp_preprocess(ftepp_t *ftepp)
 {
     ppmacro *macro;