/* Append the move just played in ply nbply to a table. * @param t identifies the table */ void append_to_table(table t) { TraceFunctionEntry(__func__); TraceFunctionParamListEnd(); TraceValue("%u",number_of_tables); TraceEOL(); if (current_position[number_of_tables]>=tables_stack_size) output_plaintext_error_message(TooManySol); else { unsigned int i; for (i = t; i<=number_of_tables; ++i) ++current_position[i]; memmove(&tables_stack[current_position[t]+1], &tables_stack[current_position[t]], (current_position[number_of_tables]-current_position[t])*sizeof tables_stack[0]); make_move_snapshot(&tables_stack[current_position[t]]); } TraceFunctionExit(__func__); TraceFunctionResultEnd(); }
static char *ParsePieceWalkAndSquares(char *tok, Flags Spec, piece_addition_type type) { unsigned int nr_walks_parsed = 0; TraceFunctionEntry(__func__); TraceFunctionParam("%s",tok); TraceFunctionParamListEnd(); while (true) { piece_walk_type walk; char * const save_tok = tok; tok = ParsePieceWalk(tok,&walk); if (walk>=King) { piece_addition_settings settings = { walk, Spec, type}; ++nr_walks_parsed; if (tok[0]==0) { /* the next token must be a valid square list, e.g. B a1b2 */ char * const squares_tok = ReadNextTokStr(); tok = ParseSquareList(squares_tok,&HandleAddedPiece,&settings); if (tok==squares_tok) output_plaintext_input_error_message(MissngSquareList,0); else if (*tok!=0) output_plaintext_error_message(WrongSquareList); } else { /* the remainder of the token may be * * a valid square list, e.g. Ba1b2 * * the remainder of a different word e.g. Black */ if (*ParseSquareList(tok,&HandleAddedPiece,&settings)!=0) { tok = save_tok; break; } } tok = ReadNextTokStr(); /* undocumented feature: "royal" only applies to the immediately next * piece indication because there can be at most 1 royal piece per side */ CLRFLAG(Spec,Royal); } else { if (nr_walks_parsed==0) { output_plaintext_input_error_message(WrongPieceName,0); tok = ReadNextTokStr(); } else tok = save_tok; break; } } TraceFunctionExit(__func__); TraceFunctionResult("%s",tok); TraceFunctionResultEnd(); return tok; }