]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - parse.c
Cleanups
[xonotic/gmqcc.git] / parse.c
diff --git a/parse.c b/parse.c
index cc228ed1b9c268970de55f072a89d8c9e0352a5a..3cbde9ef5009df31a33d2a76d2e539d38963ee39 100644 (file)
--- a/parse.c
+++ b/parse.c
@@ -35,6 +35,19 @@ typedef struct {
 } constant;
 VECTOR_MAKE(constant, compile_constants);
 
+void compile_constant_debug() {
+       int iter = 0;
+       for(; iter < compile_constants_elements; iter++) {
+               constant *c = &compile_constants_data[iter];
+               switch(c->type) {
+                       case TYPE_FLOAT:  printf("constant: %s FLOAT   %f\n",       c->name, c->value[0]);                           break;
+                       case TYPE_VECTOR: printf("constant: %s VECTOR {%f,%f,%f}\n",c->name, c->value[0], c->value[1], c->value[2]); break;
+                       case TYPE_STRING: printf("constant: %s STRING  %s\n",       c->name, c->string); break;
+                       case TYPE_VOID:   printf("constant: %s VOID    %s\n",       c->name, c->string); break;
+               }
+       }
+}
+
 /*
  * Generates a parse tree out of the lexees generated by the lexer.  This
  * is where the tree is built.  This is where valid check is performed.
@@ -264,6 +277,12 @@ int parse_gen(struct lex_file *file) {
                                                error(ERROR_INTERNAL, "Include subsystem failure\n");
                                                exit (-1);
                                        }
+                                       compile_constants_add((constant) {
+                                                       .name   = "#include",
+                                                       .type   = TYPE_VOID,
+                                                       .value  = {0,0,0},
+                                                       .string = copy
+                                       });
                                        parse_gen(next);
                                        mem_d    (copy);
                                        lex_close(next);
@@ -278,6 +297,7 @@ int parse_gen(struct lex_file *file) {
                                break;
                }
        }
+       compile_constant_debug();
        lex_reset(file);
        return 1;
 }