]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
error-print functions which take lex_ctx
authorWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 14 Aug 2012 10:06:28 +0000 (12:06 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 14 Aug 2012 10:06:28 +0000 (12:06 +0200)
error.c
gmqcc.h

diff --git a/error.c b/error.c
index 125ed962fcad3dd11a921cbf601589a807a2fcb5..889af6bd2ca6c3994c7bea9b618b4dd18d66dc93 100644 (file)
--- a/error.c
+++ b/error.c
@@ -37,7 +37,7 @@ int levelcolor[] = {
 };
 #endif
 
-void vprintmsg(int level, const char *name, size_t line, char *errtype, const char *msg, va_list ap)
+void vprintmsg(int level, const char *name, size_t line, const char *msgtype, const char *msg, va_list ap);
 {
 #ifndef WIN32
     fprintf (stderr, "\033[0;%dm%s:%d: \033[0;%dm%s: \033[0m", CON_CYAN, name, (int)line, levelcolor[level], errtype);
@@ -48,10 +48,23 @@ void vprintmsg(int level, const char *name, size_t line, char *errtype, const ch
     fprintf (stderr, "\n");
 }
 
-void printmsg(int level, const char *name, size_t line, char *errtype, const char *msg, ...)
+void printmsg(int level, const char *name, size_t line, const char *msgtype, const char *msg, ...);
 {
     va_list   va;
     va_start(va, msg);
     vprintmsg(level, name, line, errtype, msg, va);
     va_end  (va);
 }
+
+void cvprintmsg(lex_ctx ctx, int lvl, const char *msgtype, const char *msg, va_list ap)
+{
+    vprintmsg(lvl, ctx.name, ctx.line, msgtype, msg, ap);
+}
+
+void cprintmsg (lex_ctx ctx, int lvl, const char *msgtype, const char *msg, ...)
+{
+    va_list   va;
+    va_start(va, msg);
+    cvprintmsg(ctx, lvl, msgtype, msg, va);
+    va_end  (va);
+}
diff --git a/gmqcc.h b/gmqcc.h
index e985e875f5210d1ef4fb3f896cfbd8f160b2a32e..7fdd7bb31ef475fd81500155dfad75ae1db26c6c 100644 (file)
--- a/gmqcc.h
+++ b/gmqcc.h
@@ -901,8 +901,10 @@ enum {
     LVL_ERROR
 };
 
-void vprintmsg(int level, const char *name, size_t line, char *errtype, const char *msg, va_list ap);
-void printmsg (int level, const char *name, size_t line, char *errtype, const char *msg, ...);
+void vprintmsg (int level, const char *name, size_t line, const char *msgtype, const char *msg, va_list ap);
+void printmsg  (int level, const char *name, size_t line, const char *msgtype, const char *msg, ...);
+void cvprintmsg(lex_ctx ctx, int lvl, const char *msgtype, const char *msg, va_list ap);
+void cprintmsg (lex_ctx ctx, int lvl, const char *msgtype, const char *msg, ...);
 
 /*===================================================================*/
 /*======================= main.c commandline ========================*/