static void sprint_( void (*print)( void * ), snoc_list l )
{
    if (l != NULL) {
        sprint_( print, head(l) );
        if (head(l) != NULL ) {
            printf(",");
            print( tail(l) );
        } else {
            print( tail(l) );
        }
    }
}
示例#2
0
文件: print.c 项目: zwegner/zct
/**
sprint():
Prints the arguments to the given string, sprintf style. These additional formats are supported:
B: BOARD *, prints board position
C: COLOR, prints color string
E: SEARCH_BLOCK *, prints iterative search stack element
F: BOARD *, prints FEN string
I: BITBOARD, prints a bitboard or two with modifier 'l'
L: BITBOARD, prints a 64-bit integer
M: MOVE, prints a move, or a zero-terminated move list with modifier 'l'
O: VALUE, prints a value converted into a win probability
P: PIECE, prints the name of a piece
R: SEARCH_STATE, prints an iterative search return point
S: SQUARE, prints a square
T: int, prints a time interval
V: VALUE, prints an evaluation
X: BITBOARD, prints a long long integer in hexadecimal.
Created 100306; last modified 011208
**/
void sprint(char *string, int max_length, char *text, ...)
{
	va_list args;
	char *temp;

	temp = malloc(max_length + 1);
	va_start(args, text);
	sprint_(temp, max_length, text, args);
	va_end(args);

	strcpy(string, temp);
	free(temp);
}
示例#3
0
文件: print.c 项目: zwegner/zct
/**
print():
Prints the arguments to output_stream and log_stream, printf style.
Created 122205; last modified 031709
**/
void print(char *text, ...)
{
	char string[8192];
	va_list args;
	
	va_start(args, text);
	sprint_(string, sizeof(string), text, args);
	va_end(args);
	
	LOCK(smp_data->io_lock);
	fprintf(zct->output_stream, "%s", string);
	fprintf(zct->log_stream, "%s", string);
	UNLOCK(smp_data->io_lock);
}
void sprint( void (*print)( void * ), snoc_list l )
{
    printf("(");
    sprint_( print, l );
    printf(")");
}