Exemplo n.º 1
0
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);
}
Exemplo n.º 2
0
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();
}
Exemplo n.º 3
0
/**
 * 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);
}
Exemplo n.º 4
0
int puts(const char *str) {
	bufferPrint(str);
	return 0;
}
Exemplo n.º 5
0
int putchar(int c) {
	char toPrint[] = {c, 0};
	bufferPrint(toPrint);
	return c;
}