void bufferPrintf(const char* format, ...) { char buffer[1000]; buffer[0] = '\0'; va_list args; va_start(args, format); vsprintf(buffer, format, args); va_end(args); bufferPrint(buffer); }
void bufferPrintf(const char* format, ...) { static char buffer[1000]; EnterCriticalSection(); buffer[0] = '\0'; va_list args; va_start(args, format); vsprintf(buffer, format, args); va_end(args); bufferPrint(buffer); LeaveCriticalSection(); }
/** * Discards the current token, preparing it to be built anew. Also prints * an error message and the line the error occurred on. **/ void actError(state s, token *t, char c) { unsigned int pos = bufferPos(); fprintf(stdout, "(%d,%d): error: unexpected character ", bufferLineNumber(), pos); if (c == '\n') fprintf(stdout, "'\\n'\n"); else fprintf(stdout, "'%c'\n", c); bufferPrint(stdout); for (int i = 1; i < pos; i++) fprintf(stdout, " "); fprintf(stdout, "^\n"); tokenClean(t); tokenInit(t); }
int puts(const char *str) { bufferPrint(str); return 0; }
int putchar(int c) { char toPrint[] = {c, 0}; bufferPrint(toPrint); return c; }