Example #1
0
File: main.cpp Project: wenxq/cpp
int main(int argc, char* argv[])
{
	if (argc < 2)
	{
		std::cout << argv[0] << " [files]" << std::endl;
		return 0;
	}

	Slice key = "a2b4c6d8e0,";
	Slice tarfile = "cryptf_test.output";

	CryptoManager manager;

	FileElement elem;
	for (int i = 1; i < argc; ++i)
	{
		elem.mFileName = new_strp(argv[i]);
		manager.push(tarfile, elem);
	}

	DecodeFilePtr decoder = manager.get_decoder(tarfile, key);
	output(decoder->filelist());
	pop_all(decoder);

	std::cout << "Entry any key to exit ..." << std::endl;
	std::cin.get();
	return 0;
}
Example #2
0
/* Try to solve in solve_nr_remaining half-moves.
 * @param si slice index
 * @note assigns solve_result the length of solution found and written, i.e.:
 *            previous_move_is_illegal the move just played is illegal
 *            this_move_is_illegal     the move being played is illegal
 *            immobility_on_next_move  the moves just played led to an
 *                                     unintended immobility on the next move
 *            <=n+1 length of shortest solution found (n+1 only if in next
 *                                     branch)
 *            n+2 no solution found in this branch
 *            n+3 no solution found in next branch
 *            (with n denominating solve_nr_remaining)
 */
void take_and_make_generate_make_solve(slice_index si)
{
  numecoup const take_top = CURRMOVE_OF_PLY(nbply);
  numecoup take_current = MOVEBASE_OF_PLY(nbply)+1;
  Side const moving = trait[nbply];

  TraceFunctionEntry(__func__);
  TraceFunctionParam("%u",si);
  TraceFunctionParamListEnd();

  siblingply(advers(moving)); /* generate according to the taken piece's side */

  for (; take_current<=take_top; ++take_current)
  {
    square const take_capture = move_generation_stack[take_current].capture;
    if (en_passant_is_ep_capture(take_capture))
      generate_make_for_one_take(take_current,
                                 take_capture-offset_en_passant_capture);
    else if (get_walk_of_piece_on_square(take_capture)==Empty)
      push_move_copy(take_current);
    else
      generate_make_for_one_take(take_current,take_capture);
  }

  trait[nbply] = moving; /* move on behalf of to the taking piece's side */

  pipe_solve_delegate(si);

  finply();

  /* prevent the current take generation from disturbing if we generate more
   * moves in the current ply, e.g. while testing for immobility of a side
   */
  pop_all();

  TraceFunctionExit(__func__);
  TraceFunctionResultEnd();
}