diff --git a/autotests/solver_format.cpp b/autotests/solver_format.cpp --- a/autotests/solver_format.cpp +++ b/autotests/solver_format.cpp @@ -51,10 +51,10 @@ static DealerScene *getDealer( int wanted_game ) { - fprintf(stderr, "diuuuuu=\n"); + qCDebug(KPAT_LOG, "diuuuuu=\n"); foreach ( DealerInfo * di, DealerInfoList::self()->games() ) { - fprintf(stderr, "di=%p\n", di); + qCDebug(KPAT_LOG, "di=%p\n", di); if ( di->providesId( wanted_game ) ) { DealerScene * d = di->createGame(); diff --git a/dealer.cpp b/dealer.cpp --- a/dealer.cpp +++ b/dealer.cpp @@ -770,10 +770,10 @@ #ifndef NDEBUG if ( m.totype == O_Type ) - fprintf( stderr, "move from %d out (at %d) Prio: %d\n", m.from, + qCDebug(KPAT_LOG, "move from %d out (at %d) Prio: %d\n", m.from, m.turn_index, m.pri ); else - fprintf( stderr, "move from %d to %d (%d) Prio: %d\n", m.from, m.to, + qCDebug(KPAT_LOG, "move from %d to %d (%d) Prio: %d\n", m.from, m.to, m.turn_index, m.pri ); #endif diff --git a/main.cpp b/main.cpp --- a/main.cpp +++ b/main.cpp @@ -219,11 +219,11 @@ f->solver()->translate_layout(); int ret = f->solver()->patsolve(); if ( ret == SolverInterface::SolutionExists ) - fprintf( stdout, "won\n"); + qCDebug(KPAT_LOG, "won\n"); else if ( ret == SolverInterface::NoSolutionExists ) - fprintf( stdout, "lost\n" ); + qCDebug(KPAT_LOG, "lost\n" ); else - fprintf( stdout, "unknown\n"); + qCDebug(KPAT_LOG, "unknown\n"); return 0; } @@ -245,20 +245,20 @@ f->solver()->translate_layout(); int ret = f->solver()->patsolve(); if ( ret == SolverInterface::SolutionExists ) { - fprintf( stdout, "%d: %d won (%lld ms)\n", dealer, i, mytime.elapsed() ); + qCDebug(KPAT_LOG, "%d: %d won (%lld ms)\n", dealer, i, mytime.elapsed() ); count--; QFile file(QStringLiteral("%1/%2-%3-1").arg(testdir).arg(dealer).arg(i)); file.open( QFile::WriteOnly ); f->saveLegacyFile( &file ); } else if ( ret == SolverInterface::NoSolutionExists ) { - fprintf( stdout, "%d: %d lost (%lld ms)\n", dealer, i, mytime.elapsed() ); + qCDebug(KPAT_LOG, "%d: %d lost (%lld ms)\n", dealer, i, mytime.elapsed() ); count--; QFile file(QStringLiteral("%1/%2-%3-0").arg(testdir).arg(dealer).arg(i)); file.open( QFile::WriteOnly ); f->saveLegacyFile( &file ); } else { - fprintf( stdout, "%d: %d unknown (%lld ms)\n", dealer, i, mytime.elapsed() ); + qCDebug(KPAT_LOG, "%d: %d unknown (%lld ms)\n", dealer, i, mytime.elapsed() ); } } } @@ -310,13 +310,13 @@ f->solver()->translate_layout(); int ret = f->solver()->patsolve(); if ( ret == SolverInterface::SolutionExists ) - fprintf( stdout, "%d won (%lld ms)\n", i, mytime.elapsed() ); + qCDebug(KPAT_LOG, "%d won (%lld ms)\n", i, mytime.elapsed() ); else if ( ret == SolverInterface::NoSolutionExists ) - fprintf( stdout, "%d lost (%lld ms)\n", i, mytime.elapsed() ); + qCDebug(KPAT_LOG, "%d lost (%lld ms)\n", i, mytime.elapsed() ); else - fprintf( stdout, "%d unknown (%lld ms)\n", i, mytime.elapsed() ); + qCDebug(KPAT_LOG, "%d unknown (%lld ms)\n", i, mytime.elapsed() ); } - fprintf( stdout, "all_moves %ld\n", all_moves ); + qCDebug(KPAT_LOG, "all_moves %ld\n", all_moves ); return 0; } diff --git a/patsolve/abstract_fc_solve_solver.cpp b/patsolve/abstract_fc_solve_solver.cpp --- a/patsolve/abstract_fc_solve_solver.cpp +++ b/patsolve/abstract_fc_solve_solver.cpp @@ -161,7 +161,7 @@ const long reached_iters = freecell_solver_user_get_num_times_long(solver_instance); Q_ASSERT(reached_iters <= default_max_positions); #if 0 - fprintf(stderr, "iters = %ld\n", reached_iters); + qCDebug(KPAT_LOG, "iters = %ld\n", reached_iters); #endif switch (solver_ret) @@ -245,21 +245,21 @@ #if 0 int i, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 10; ++w) { Q_ASSERT( Wp[w] == &W[w][Wlen[w]-1] ); - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (o = 0; o < 4; ++o) { if ( O[o] != -1 ) printcard( O[o] + PS_KING, stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); #endif } diff --git a/patsolve/clocksolver.cpp b/patsolve/clocksolver.cpp --- a/patsolve/clocksolver.cpp +++ b/patsolve/clocksolver.cpp @@ -29,9 +29,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nmake move %d from %d out %d (at %d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d out %d (at %d)\n\n", m->card_index, m->from, m->to, m->turn_index ); else - fprintf( stderr, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #else //print_layout(); @@ -71,9 +71,9 @@ { #if PRINT2 if ( m->totype == O_Type ) - fprintf( stderr, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -279,17 +279,17 @@ { int i, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 8; ++w) { - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (o = 0; o < 12; ++o) { printcard(W[8][o], stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); } diff --git a/patsolve/fortyeightsolver.cpp b/patsolve/fortyeightsolver.cpp --- a/patsolve/fortyeightsolver.cpp +++ b/patsolve/fortyeightsolver.cpp @@ -81,9 +81,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nmake move %d from %d to %d out (at %d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d out (at %d)\n\n", m->card_index, m->from, m->to, m->turn_index ); else - fprintf( stderr, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -159,9 +159,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nundo move %d from %d to %d out (at %d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d out (at %d)\n\n", m->card_index, m->from, m->to, m->turn_index ); else - fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -358,7 +358,7 @@ } } - //fprintf(stderr, "\n"); + //qCDebug(KPAT_LOG, "\n"); *numout = n; for (int w = 0; w < 8; w++) @@ -435,7 +435,7 @@ { /* printcard( W[w][Wlen[w]-i-1], stderr ); printcard( *Wp[w], stderr ); - fprintf( stderr, " switch? %d\n", i ); */ + qCDebug(KPAT_LOG, " switch? %d\n", i ); */ if ( SUIT( W[w][Wlen[w]-i-1] ) != SUIT( *Wp[w] ) || RANK ( W[w][Wlen[w]-i-1] ) != RANK ( W[w][Wlen[w]-i] ) + 1) { @@ -467,7 +467,7 @@ card_t cur = W[w][Wlen[w]-i]; /* printcard( top, stderr ); printcard( cur, stderr ); - fprintf( stderr, " %d\n", i ); */ + qCDebug(KPAT_LOG, " %d\n", i ); */ Q_ASSERT( SUIT( top ) == SUIT( cur ) ); if ( RANK( top ) == RANK( cur ) + 1 ) { @@ -658,29 +658,29 @@ FortyeightSolverState d; checkState(d); - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (int w = 0; w < 10; w++) { if ( w == NUM_DECK ) - fprintf( stderr, "Deck(9): " ); + qCDebug(KPAT_LOG, "Deck(9): " ); else if ( w == 8 ) - fprintf( stderr, "Pile(8): " ); + qCDebug(KPAT_LOG, "Pile(8): " ); else if ( w < 8 ) - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (int i = 0; i < Wlen[w]; i++) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (int o = 0; o < 8; ++o) { printcard(O[o] + Osuit[o], stderr); } - fprintf( stderr, "\nLast-Deal: %d\n", lastdeal ); + qCDebug(KPAT_LOG, "\nLast-Deal: %d\n", lastdeal ); #if 1 - fprintf( stderr, "FE: %d FS: %d\n", d.firstempty, d.freestores); + qCDebug(KPAT_LOG, "FE: %d FS: %d\n", d.firstempty, d.freestores); for (int o = 0; o < 8; ++o) { - fprintf( stderr, "Pile%d: empty:%d linedup:%d highestbreak:%d fromscore:%d\n", o, d.empty[o], d.linedup[o], d.highestbreak[o], d.fromscore[o]); + qCDebug(KPAT_LOG, "Pile%d: empty:%d linedup:%d highestbreak:%d fromscore:%d\n", o, d.empty[o], d.linedup[o], d.highestbreak[o], d.fromscore[o]); } #endif - fprintf(stderr, "print-layout-end\n"); + qCDebug(KPAT_LOG, "print-layout-end\n"); } diff --git a/patsolve/freecellsolver.cpp b/patsolve/freecellsolver.cpp --- a/patsolve/freecellsolver.cpp +++ b/patsolve/freecellsolver.cpp @@ -551,22 +551,22 @@ { int i, t, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < Nwpiles; ++w) { - fprintf(stderr, "W-Pile%d: ", w); + qCDebug(KPAT_LOG, "W-Pile%d: ", w); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } for (t = 0; t < Ntpiles; ++t) { - fprintf(stderr, "T-Pile%d: ", t+Nwpiles); + qCDebug(KPAT_LOG, "T-Pile%d: ", t+Nwpiles); printcard(W[t+Nwpiles][Wlen[t+Nwpiles]], stderr); } - fprintf( stderr, "\n" ); + qCDebug(KPAT_LOG, "\n" ); for (o = 0; o < 4; ++o) { printcard(O[o] + Osuit[o], stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); } #endif diff --git a/patsolve/golfsolver.cpp b/patsolve/golfsolver.cpp --- a/patsolve/golfsolver.cpp +++ b/patsolve/golfsolver.cpp @@ -33,9 +33,9 @@ #ifndef WITH_BH_SOLVER #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #else //print_layout(); @@ -88,9 +88,9 @@ #ifndef WITH_BH_SOLVER #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -263,7 +263,7 @@ BHS__GOLF__BITS_PER_COL )) { - fprintf(stderr, "Error reading the board at line No. %d!\n", + qCDebug(KPAT_LOG, "Error reading the board at line No. %d!\n", error_line_num); exit(-1); } @@ -395,19 +395,19 @@ void GolfSolver::print_layout() { #ifndef WITH_BH_SOLVER - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (int w = 0; w < 9; w++) { if ( w == 8 ) - fprintf( stderr, "Deck: " ); + qCDebug(KPAT_LOG, "Deck: " ); else if ( w == 7 ) - fprintf( stderr, "Pile: " ); + qCDebug(KPAT_LOG, "Pile: " ); else - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (int i = 0; i < Wlen[w]; i++) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf(stderr, "print-layout-end\n"); + qCDebug(KPAT_LOG, "print-layout-end\n"); #endif } diff --git a/patsolve/grandfsolver.cpp b/patsolve/grandfsolver.cpp --- a/patsolve/grandfsolver.cpp +++ b/patsolve/grandfsolver.cpp @@ -28,11 +28,11 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else if ( m->from == offs ) - fprintf( stderr, "\nmake redeal\n\n" ); + qCDebug(KPAT_LOG, "\nmake redeal\n\n" ); else - fprintf( stderr, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #else //print_layout(); @@ -174,11 +174,11 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else if ( m->from == offs ) - fprintf( stderr, "\nundo redeal\n\n" ); + qCDebug(KPAT_LOG, "\nundo redeal\n\n" ); else - fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -326,10 +326,10 @@ // TODO: there is no point in moving if we're not opening anything // e.g. if both i and j have perfect runs below the cards #if 0 - fprintf( stderr, "%d %d %d\n", i, l, j ); + qCDebug(KPAT_LOG, "%d %d %d\n", i, l, j ); printcard( card, stderr ); printcard( *Wp[j], stderr ); - fprintf( stderr, " allowed %d\n",allowed ); + qCDebug(KPAT_LOG, " allowed %d\n",allowed ); #endif if ( allowed ) { @@ -484,19 +484,19 @@ { int i, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 21; ++w) { - fprintf( stderr, "Play%d-%d(%d): ", w / 7, w % 7, w ); + qCDebug(KPAT_LOG, "Play%d-%d(%d): ", w / 7, w % 7, w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (o = 0; o < 4; ++o) { if ( !DOWN( W[offs][o] ) ) printcard(RANK( W[offs][o] ) + Osuit[o], stderr); } - fprintf( stderr, "\nRedeals: %d", m_redeal ); - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nRedeals: %d", m_redeal ); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); } diff --git a/patsolve/gypsysolver.cpp b/patsolve/gypsysolver.cpp --- a/patsolve/gypsysolver.cpp +++ b/patsolve/gypsysolver.cpp @@ -33,9 +33,9 @@ #if PRINT //qCDebug(KPAT_LOG) << "\n\nmake_move\n"; if ( m->totype == O_Type ) - fprintf( stderr, "move %d from %d out (at %d) Prio: %d\n\n", m->card_index, m->from, m->turn_index, m->pri ); + qCDebug(KPAT_LOG, "move %d from %d out (at %d) Prio: %d\n\n", m->card_index, m->from, m->turn_index, m->pri ); else - fprintf( stderr, "move %d from %d to %d (%d) Prio: %d\n\n", m->card_index, m->from, m->to, m->turn_index, m->pri ); + qCDebug(KPAT_LOG, "move %d from %d to %d (%d) Prio: %d\n\n", m->card_index, m->from, m->to, m->turn_index, m->pri ); print_layout(); #else //print_layout(); @@ -121,9 +121,9 @@ #if PRINT //qCDebug(KPAT_LOG) << "\n\nundo_move\n"; if ( m->totype == O_Type ) - fprintf( stderr, "move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -504,24 +504,24 @@ { int i, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 8; ++w) { - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (o = 0; o < 8; ++o) { if ( Wlen[outs + o] ) printcard( *Wp[outs + o], stderr); } - fprintf( stderr, "\nDeck: " ); + qCDebug(KPAT_LOG, "\nDeck: " ); for (i = 0; i < Wlen[deck]; ++i) printcard(W[deck][i], stderr); - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); return; } diff --git a/patsolve/idiotsolver.cpp b/patsolve/idiotsolver.cpp --- a/patsolve/idiotsolver.cpp +++ b/patsolve/idiotsolver.cpp @@ -28,9 +28,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #else //print_layout(); @@ -79,9 +79,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -252,20 +252,20 @@ { int i, w; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 6; ++w) { if ( w == 4 ) - fprintf( stderr, "Deck: " ); + qCDebug(KPAT_LOG, "Deck: " ); else if ( w == 5 ) - fprintf( stderr, "Away: " ); + qCDebug(KPAT_LOG, "Away: " ); else - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); } inline bool higher( const card_t &c1, const card_t &c2) diff --git a/patsolve/klondikesolver.cpp b/patsolve/klondikesolver.cpp --- a/patsolve/klondikesolver.cpp +++ b/patsolve/klondikesolver.cpp @@ -35,9 +35,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #else //print_layout(); @@ -139,9 +139,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -398,13 +398,13 @@ card_t below = W[i][Wlen[i]-2-l]; int o = SUIT(below); bool empty = (O[o] == NONE); - //fprintf( stderr, "%d %d\n", i, l ); + //qCDebug(KPAT_LOG, "%d %d\n", i, l ); //printcard( below, stderr ); if ( ( empty && RANK( below ) != PS_ACE ) || ( !empty && RANK( below ) != O[o] + 1 ) ) allowed = 0; - //fprintf( stderr, " allowed %d %d %d %d\n",allowed, empty, RANK( below ), PS_ACE); + //qCDebug(KPAT_LOG, " allowed %d %d %d %d\n",allowed, empty, RANK( below ), PS_ACE); } if ( allowed ) { mp->card_index = l; @@ -579,22 +579,22 @@ { int i, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 9; ++w) { if ( w == 8 ) - fprintf( stderr, "Deck: " ); + qCDebug(KPAT_LOG, "Deck: " ); else if ( w == 7 ) - fprintf( stderr, "Pile: " ); + qCDebug(KPAT_LOG, "Pile: " ); else - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (o = 0; o < 4; ++o) { printcard(O[o] + Osuit[o], stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); } diff --git a/patsolve/mod3solver.cpp b/patsolve/mod3solver.cpp --- a/patsolve/mod3solver.cpp +++ b/patsolve/mod3solver.cpp @@ -29,9 +29,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nmake move %d from %d out %d (at %d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d out %d (at %d)\n\n", m->card_index, m->from, m->to, m->turn_index ); else - fprintf( stderr, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #else //print_layout(); @@ -101,9 +101,9 @@ { #if PRINT2 if ( m->totype == O_Type ) - fprintf( stderr, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -223,14 +223,14 @@ if (firstfree[row] < 0) firstfree[row] = j; - //fprintf(stderr, "firstfree %d %d %d\n", row, firstfree[row], j); + //qCDebug(KPAT_LOG, "firstfree %d %d %d\n", row, firstfree[row], j); if (j != firstfree[row] && row < 4) continue; } if ( Wlen[j] && RANK( *Wp[j] ) != row + 2 + ( Wlen[j] - 1 ) * 3 ) { - //fprintf( stderr, "rank %d %d\n", i, j ); + //qCDebug(KPAT_LOG, "rank %d %d\n", i, j ); continue; } @@ -404,42 +404,42 @@ { int i, w = 0, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for ( int row = 0; row < 3; ++row ) { - fprintf( stderr, "Row%d: ", row ); + qCDebug(KPAT_LOG, "Row%d: ", row ); for (int col = 0; col < 8; col++) { if ( Wlen[w] ) printcard(*Wp[w], stderr); else - fprintf( stderr, " " ); - fprintf( stderr, "(%02d) ", w ); + qCDebug(KPAT_LOG, " " ); + qCDebug(KPAT_LOG, "(%02d) ", w ); w++; } fputc('\n', stderr); } for (int col = 0; col < 8; col++) { - fprintf( stderr, "Play%02d: ", w ); + qCDebug(KPAT_LOG, "Play%02d: ", w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); w++; } - fprintf( stderr, "Aces: " ); + qCDebug(KPAT_LOG, "Aces: " ); for (o = 0; o < Wlen[aces]; ++o) { printcard(W[aces][o], stderr); } fputc( '\n', stderr ); - fprintf( stderr, "Deck: " ); + qCDebug(KPAT_LOG, "Deck: " ); for (o = 0; o < Wlen[deck]; ++o) { printcard(W[deck][o], stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); } diff --git a/patsolve/patsolve.cpp b/patsolve/patsolve.cpp --- a/patsolve/patsolve.cpp +++ b/patsolve/patsolve.cpp @@ -89,14 +89,14 @@ #ifndef NDEBUG { print_layout(); - fprintf( stderr, "moves %d\n", n ); + qCDebug(KPAT_LOG, "moves %d\n", n ); for (int j = 0; j < n; j++) { - fprintf( stderr, " " ); + qCDebug(KPAT_LOG, " " ); if ( Possible[j].totype == O_Type ) - fprintf( stderr, "move from %d out (at %d) Prio: %d\n", Possible[j].from, + qCDebug(KPAT_LOG, "move from %d out (at %d) Prio: %d\n", Possible[j].from, Possible[j].turn_index, Possible[j].pri ); else - fprintf( stderr, "move %d from %d to %d (%d) Prio: %d\n", Possible[j].card_index, + qCDebug(KPAT_LOG, "move %d from %d to %d (%d) Prio: %d\n", Possible[j].card_index, Possible[j].from, Possible[j].to, Possible[j].turn_index, Possible[j].pri ); } @@ -172,9 +172,9 @@ return; } } - //fprintf( stderr, "%d ", Wpilenum[w] ); + //qCDebug(KPAT_LOG, "%d ", Wpilenum[w] ); } - //fprintf( stderr, "\n" ); + //qCDebug(KPAT_LOG, "\n" ); } #define NBUCKETS 65521 /* the largest 16 bit prime */ @@ -448,11 +448,11 @@ #if 0 if (w < 4) { - fprintf( stderr, "get_pile_num %d ", l->pilenum ); + qCDebug(KPAT_LOG, "get_pile_num %d ", l->pilenum ); for (int i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } - fprintf( stderr, "\n" ); + qCDebug(KPAT_LOG, "\n" ); } #endif return l->pilenum; diff --git a/patsolve/simonsolver.cpp b/patsolve/simonsolver.cpp --- a/patsolve/simonsolver.cpp +++ b/patsolve/simonsolver.cpp @@ -39,9 +39,9 @@ #if PRINT //qCDebug(KPAT_LOG) << "\n\nmake_move\n"; if ( m->totype == O_Type ) - fprintf( stderr, "move %d from %d out (at %d) Prio: %d\n\n", m->card_index, m->from, m->turn_index, m->pri ); + qCDebug(KPAT_LOG, "move %d from %d out (at %d) Prio: %d\n\n", m->card_index, m->from, m->turn_index, m->pri ); else - fprintf( stderr, "move %d from %d to %d (%d) Prio: %d\n\n", m->card_index, m->from, m->to, m->turn_index, m->pri ); + qCDebug(KPAT_LOG, "move %d from %d to %d (%d) Prio: %d\n\n", m->card_index, m->from, m->to, m->turn_index, m->pri ); print_layout(); #else //print_layout(); @@ -93,9 +93,9 @@ #if PRINT //qCDebug(KPAT_LOG) << "\n\nundo_move\n"; if ( m->totype == O_Type ) - fprintf( stderr, "move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -310,7 +310,7 @@ RANK( card_below ) == RANK( card ) + 1 ) { if ( conti[j]+l != 13 || conti[i]>conti[j]+l || SUIT( card ) != SUIT( *Wp[j] ) ) { - // fprintf( stderr, "continue\n" ); + // qCDebug(KPAT_LOG, "continue\n" ); continue; } } @@ -463,21 +463,21 @@ { int i, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 10; ++w) { Q_ASSERT( Wp[w] == &W[w][Wlen[w]-1] ); - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (o = 0; o < 4; ++o) { if ( O[o] != -1 ) printcard( O[o] + PS_KING, stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); } #endif diff --git a/patsolve/spidersolver.cpp b/patsolve/spidersolver.cpp --- a/patsolve/spidersolver.cpp +++ b/patsolve/spidersolver.cpp @@ -29,9 +29,9 @@ #if PRINT //qCDebug(KPAT_LOG) << "\n\nmake_move\n"; if ( m->totype == O_Type ) - fprintf( stderr, "move %d from %d out (at %d) Prio: %d\n\n", m->card_index, m->from, m->turn_index, m->pri ); + qCDebug(KPAT_LOG, "move %d from %d out (at %d) Prio: %d\n\n", m->card_index, m->from, m->turn_index, m->pri ); else - fprintf( stderr, "move %d from %d to %d (%d) Prio: %d\n\n", m->card_index, m->from, m->to, m->turn_index, m->pri ); + qCDebug(KPAT_LOG, "move %d from %d to %d (%d) Prio: %d\n\n", m->card_index, m->from, m->to, m->turn_index, m->pri ); print_layout(); #else //print_layout(); @@ -118,9 +118,9 @@ #if PRINT //qCDebug(KPAT_LOG) << "\n\nundo_move\n"; if ( m->totype == O_Type ) - fprintf( stderr, "move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -342,20 +342,20 @@ #if 0 printcard( card_below, stderr ); printcard( card, stderr ); - fprintf( stderr, "%d %d %d %d %d\n", i, j, conti[i], conti[j],l ); + qCDebug(KPAT_LOG, "%d %d %d %d %d\n", i, j, conti[i], conti[j],l ); #endif bool card_stack_j_not_empty = Wlen[j] > 0; if (card_stack_j_not_empty && SUIT( card ) != SUIT( *Wp[j] ) ) { - //fprintf( stderr, "continue %d %d %d %d\n",conti[j]+l, conti[i],conti[j]+l, SUIT( card ) != SUIT( *Wp[j] ) ); + //qCDebug(KPAT_LOG, "continue %d %d %d %d\n",conti[j]+l, conti[i],conti[j]+l, SUIT( card ) != SUIT( *Wp[j] ) ); continue; } #if 1 // too bad: see bug 175945 if ( conti[j]+l+1 != 13 || conti[i]>conti[j]+l ) { - //fprintf( stderr, "continue %d %d %d %d\n",conti[j]+l, conti[i],conti[j]+l, SUIT( card ) != SUIT( *Wp[j] ) ); + //qCDebug(KPAT_LOG, "continue %d %d %d %d\n",conti[j]+l, conti[i],conti[j]+l, SUIT( card ) != SUIT( *Wp[j] ) ); //continue; } #endif @@ -417,7 +417,7 @@ card_t theone = W[i][Wlen[i]-conti_pos-1]; card_t below = W[i][Wlen[i]-conti_pos-2]; #if 0 - fprintf(stderr, "checking pile%d len:%d prio:%d ", i, l, mp->pri); + qCDebug(KPAT_LOG, "checking pile%d len:%d prio:%d ", i, l, mp->pri); printcard( card, stderr ); printcard( theone, stderr ); printcard( below, stderr ); @@ -575,24 +575,24 @@ { int i, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 15; ++w) { Q_ASSERT( Wp[w] == &W[w][Wlen[w]-1] ); if ( w < 10 ) - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); else - fprintf( stderr, "Deal%d: ", w-10 ); + qCDebug(KPAT_LOG, "Deal%d: ", w-10 ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (o = 0; o < 8; ++o) { if ( O[o] != -1 ) printcard( O[o] + PS_KING, stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); return; } diff --git a/patsolve/yukonsolver.cpp b/patsolve/yukonsolver.cpp --- a/patsolve/yukonsolver.cpp +++ b/patsolve/yukonsolver.cpp @@ -36,9 +36,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nmake move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #else //print_layout(); @@ -96,9 +96,9 @@ { #if PRINT if ( m->totype == O_Type ) - fprintf( stderr, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d out (at %d)\n\n", m->card_index, m->from, m->turn_index ); else - fprintf( stderr, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); + qCDebug(KPAT_LOG, "\nundo move %d from %d to %d (%d)\n\n", m->card_index, m->from, m->to, m->turn_index ); print_layout(); #endif @@ -280,10 +280,10 @@ // TODO: there is no point in moving if we're not opening anything // e.g. if both i and j have perfect runs below the cards #if 0 - fprintf( stderr, "%d %d %d\n", i, l, j ); + qCDebug(KPAT_LOG, "%d %d %d\n", i, l, j ); printcard( card, stderr ); printcard( *Wp[j], stderr ); - fprintf( stderr, " allowed %d\n",allowed ); + qCDebug(KPAT_LOG, " allowed %d\n",allowed ); #endif if ( allowed ) { mp->card_index = l; @@ -421,17 +421,17 @@ { int i, w, o; - fprintf(stderr, "print-layout-begin\n"); + qCDebug(KPAT_LOG, "print-layout-begin\n"); for (w = 0; w < 7; ++w) { - fprintf( stderr, "Play%d: ", w ); + qCDebug(KPAT_LOG, "Play%d: ", w ); for (i = 0; i < Wlen[w]; ++i) { printcard(W[w][i], stderr); } fputc('\n', stderr); } - fprintf( stderr, "Off: " ); + qCDebug(KPAT_LOG, "Off: " ); for (o = 0; o < 4; ++o) { printcard(O[o] + Osuit[o], stderr); } - fprintf(stderr, "\nprint-layout-end\n"); + qCDebug(KPAT_LOG, "\nprint-layout-end\n"); }