void errprintf (const char* format, ...) { va_list args; va_start (args, format); veprintf (format, args); va_end (args); exitstatus = EXIT_FAILURE; }
void errprintf(const char* format, ...) { va_list args; va_start(args, format); veprintf(format, args); va_end(args); set_exit_status(EXIT_FAILURE); }
int eprintf(char *format, ...) { va_list args; va_start(args, format); int rv = veprintf(format, args); va_end(args); return rv; }
/* * Overloading libtraceevent standard info print * function, display with -v in perf. */ void pr_stat(const char *fmt, ...) { va_list args; va_start(args, fmt); veprintf(1, verbose, fmt, args); va_end(args); eprintf(1, verbose, "\n"); }
/** * Input is comparable to eprintf, but indents (according to xmlindent) and adds * a newline. */ void xmlPrint (char *fmt, ...) { va_list args; xmlIndentPrint (); va_start (args, fmt); veprintf (fmt, args); va_end (args); eprintf ("\n"); }
int eprintf(int level, int var, const char *fmt, ...) { va_list args; int ret; va_start(args, fmt); ret = veprintf(level, var, fmt, args); va_end(args); return ret; }
void eprintf (const char* format, ...) { va_list args; va_start (args, format); veprintf (format, args); va_end (args); }
void vcerror(long lexIdx, short etype, const char *buf, va_list va, short eno) { static const char *TNames[] = { "?","Warning","Error", "Fatal", "SoftError" #ifndef REGISTERED , "Unimplemented" #endif }; long lexIdxBeg; long lexFileNameLen; long lexLine; char *lexFile; long errcol = 0; char ebuf[100]; long ebufoff = 0; lexLine=FindLexFileLine(lexIdx, &lexFile, &lexFileNameLen, &lexIdxBeg); /* * Use original lexer file to obtain line for printing since the * internal copy could be munged. * * We need to determine a couple of things: * lexLine - Indicates the line number of the error (0 if no associated line) * errcol - The physical column where the error occurred (0 for no line) * ebuf - The null terminated buffer. This buffer is at most 80 characters * but will contain the character position that has the error. * ebufoff - The logical start of the error buffer. This will be 0 as long as * the error occurs in the first 80 columns. Beyond that, this will * jump by 10. * lexFile - The name of the file containing the error * lexFileNameLen */ ebuf[0] = 0; if (lexLine && ErrorInFileValid) { short c; long i = lexIdxBeg; short pos = 0; while ((c = FindLexCharAt(i)) != EOF && c != '\n') { if (c == '\t') { short tab; tab = ((pos + ebufoff + 8) & ~7) - ebufoff; while (pos < tab) ebuf[pos++] = ' '; } else ebuf[pos++] = c; if (i == lexIdx) errcol = pos + ebufoff; if (pos > 80) { if ((errcol - (pos + ebufoff)) > 10) break; memcpy(ebuf, ebuf+10, pos-10); pos -= 10; ebufoff += 10; } ++i; } ebuf[pos] = 0; } eprintf(1, "DC1: \"%.*s\" L:%d ", lexFileNameLen, lexFile, lexLine); if (ErrorOpt & 1) eprintf(1, "C:%d %c:%d ", errcol + 1, TNames[etype][0], eno); else eprintf(1, "%s:%d ", TNames[etype], eno); veprintf(1, buf, va); eprintf(1, "\n"); if (lexLine && ErrorInFileValid && (ErrorOpt & 2)) { short pos = errcol - ebufoff; /* We Need to account for the fact that the ^ will take up one space */ if (pos) pos = pos - 1; eprintf(0, "%s\n%*.*s^\n", ebuf, pos, pos, ""); } if (etype == ESOFT || etype == EFATAL) { ExitError(20); } if (etype == EWARN && ExitCode < 5) ExitCode = 5; if (etype != EWARN && ExitCode < 20) ExitCode = 20; }