]> de.git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - error.c
updated README
[xonotic/gmqcc.git] / error.c
diff --git a/error.c b/error.c
index 1bd792ea2e4f2efd9978f456b895925a23d8e0d1..c0df2072ecd73f05b3be5f81657cded4610dfcd4 100644 (file)
--- a/error.c
+++ b/error.c
@@ -21,9 +21,7 @@
  * SOFTWARE.
  */
 #include <stdarg.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <limits.h>
+#include "gmqcc.h"
 
 /*
  * Compiler error system, this handles the error printing, and managing
@@ -55,10 +53,11 @@ static const char *const error_list[] = {
        "Parsing Error:",
        "Lexing Error:",
        "Internal Error:",
-       "Compilation Error:"
+       "Compilation Error:",
+       "Preprocessor Error:"
 };
 
-int error(int status, const char *msg, ...) {
+int error(struct lex_file *file, int status, const char *msg, ...) {
        char      bu[1024*4]; /* enough? */
        char      fu[1024*4]; /* enough? */
        va_list   va;
@@ -70,7 +69,7 @@ int error(int status, const char *msg, ...) {
        error_total ++;
 /* color */
 #      ifndef WIN32
-       sprintf  (bu, "\033[0;%dm%s \033[0;%dm", error_color[status-SHRT_MAX], error_list[status-SHRT_MAX], error_color[(status-1)-SHRT_MAX]);
+       sprintf  (bu, "\033[0;%dm%s \033[0;%dm %s:%d ", error_color[status-SHRT_MAX], error_list[status-SHRT_MAX], error_color[(status-1)-SHRT_MAX], file->name, file->line);
 #else
        sprintf  (bu, "%s ", error_list[status-SHRT_MAX]);
 #endif