From d8246450192ca9108e3c56513fa2a17f202c12aa Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Tue, 14 Aug 2012 12:06:28 +0200 Subject: [PATCH] error-print functions which take lex_ctx --- error.c | 17 +++++++++++++++-- gmqcc.h | 6 ++++-- 2 files changed, 19 insertions(+), 4 deletions(-) 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 ========================*/ -- 2.39.2