From: Wolfgang (Blub) Bumiller Date: Tue, 14 Aug 2012 10:06:28 +0000 (+0200) Subject: error-print functions which take lex_ctx X-Git-Tag: 0.1-rc1~320 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d8246450192ca9108e3c56513fa2a17f202c12aa;p=xonotic%2Fgmqcc.git error-print functions which take lex_ctx --- diff --git a/error.c b/error.c index 125ed96..889af6b 100644 --- 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 e985e87..7fdd7bb 100644 --- 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 ========================*/