From 6d2e1f0f5e27509232896ed7c891b964d69c6464 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 13 Feb 2010 01:04:55 -0500 Subject: [PATCH] Lemon now writes errors to stderr instead of stdout, and uses full output. The previous way truncated the filename, so my editor couldn't jump to the problem line in the source code. --- misc/lemon.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/misc/lemon.c b/misc/lemon.c index 73278bc0..b7ccb870 100644 --- a/misc/lemon.c +++ b/misc/lemon.c @@ -1344,6 +1344,15 @@ int max; #define LINEWIDTH 79 /* Max width of any output line */ #define PREFIXLIMIT 30 /* Max width of the prefix on each line */ void ErrorMsg(const char *filename, int lineno, const char *format, ...){ +#if __MOJOSHADER__ + va_list ap; + fprintf(stderr, "%s:%d: ", filename, lineno); + va_start(ap, format); + vfprintf(stderr,format,ap); + va_end(ap); + fprintf(stderr, "\n"); + fflush(stderr); +#else char errmsg[ERRMSGSIZE]; char prefix[PREFIXLIMIT+10]; int errmsgsize; @@ -1380,6 +1389,7 @@ void ErrorMsg(const char *filename, int lineno, const char *format, ...){ fprintf(stdout,"%s%.*s\n",prefix,end,&errmsg[base]); base = restart; } +#endif } /**************** From the file "main.c" ************************************/ /*