Hi folks, While meld works fine for mostly any file, I get following error for attached diff.Invoking 'patch' failed. Maybe you don't have 'GNU patch' installed,Dir "/tmp/tmphO9TfQ-meld" contains a file name testparsesem.cpp.rej with contents: --- testparsesem.cpp (working copy)Context:
Hope this helps, tijn |
Index: fsaparse/binary/rebuilder/testparsesem.cpp =================================================================== --- fsaparse/binary/rebuilder/testparsesem.cpp (revision 4344) +++ fsaparse/binary/rebuilder/testparsesem.cpp (working copy) @@ -34,10 +34,6 @@ #include "resource/settings/notifiers/phontab.hpp" #include "resource/settings/notifiers/qry_trans.hpp" -using namespace std; -using namespace qgo; -using namespace boost; - int nrErrors; extern bool markItems; extern FILE* earleyLogFile; @@ -64,7 +60,7 @@ static float cScore = 0; static interpretations is; -static void InspectTree(stree* tree) +static void InspectTree(util::logger& log, stree* tree) { if (tree != 0) { @@ -79,28 +75,28 @@ switch (tree->sError) { case seSpellingError: - printf("spelling error: "); + log.trace("spelling error: "); // mkdb: spelling { is.spelling_error(); } break; case seUnknownWord: - printf("unknown word(%s): ", tree->name); + log.trace("unknown word(%s): ", tree->name); // mkdb: spelling { is.spelling_error(); } break; case seCategoryMismatch: - printf("category error(%s): ", tree->name); + log.trace("category error(%s): ", tree->name); // mkdb: spelling { is.spelling_error(); } break; case seSkip: - printf("skipped: "); + log.trace("skipped: "); // mkdb: spelling { is.spelling_error(); @@ -111,36 +107,36 @@ case seNone: break; // not necessary... } - printf("%s", daughter->name); + log.trace("%s", daughter->name); if (tree->termCorrection != 0) { - printf(", correction = %s", tree->termCorrection); + log.trace(", correction = %s", tree->termCorrection); } if (tree->dictCorrection != 0) { - printf(", correction ="); + log.trace(", correction ="); for (bSlistIterator<Word> iter = *tree->dictCorrection; iter; iter++) { - printf(" %s", (const char*) (*iter).text); + log.trace(" %s", (const char*) (*iter).text); } } - printf("\n"); + log.trace("\n"); } else if (daughter->sError == seInserted) { - printf("inserted: %s\n", daughter->name); + log.trace("inserted: %s\n", daughter->name); } else if (tree->dictCorrection != 0) { - printf("%s matched:", daughter->name); + log.trace("%s matched:", daughter->name); for (bSlistIterator<Word> iter = *tree->dictCorrection; iter; iter++) { - printf(" %s", (const char*) (*iter).text); + log.trace(" %s", (const char*) (*iter).text); } - printf("\n"); + log.trace("\n"); } } - InspectTree(daughter); + InspectTree(log, daughter); daughter = daughter->sister; } } @@ -148,43 +144,48 @@ static int nrAccepted; -static void Interpret(FORMULA f) +static void Interpret(util::logger& log, FORMULA f) { if (f == 0 || f->type != term || strcmp(f->argument.term.head, "url") != 0) { - printf("unknown expression: %s\n", to_string(f).c_str()); + log.trace("unknown expression: %s\n", to_string(f).c_str()); return; } f = f->argument.term.arguments->argument.bi.op1; if (f == 0 || f->type != term || strcmp(f->argument.term.head, "s") != 0) { - printf("unknown expression: %s\n", to_string(f).c_str()); + log.trace("unknown expression: %s\n", to_string(f).c_str()); return; } } struct print_interpretation : interpretation_acceptor { + print_interpretation(util::logger& log_) + : log(log_) + { + } + virtual bool operator()(FORMULA f) { AnonimizeFormula(f); if (nrAccepted > 0) { - printf("ALTERNATIVE_INTERPRETATION\n"); + log.trace("ALTERNATIVE_INTERPRETATION\n"); } if (markedObjects.size() != 0) { - printf("marked objects ="); + log.trace("marked objects ="); for (bSlistIterator<FORMULA> mo = markedObjects; mo; mo++) { - printf(" %s", to_string(*mo).c_str()); + log.trace(" %s", to_string(*mo).c_str()); } putchar('\n'); } - printf("repr = %s\n", to_string(f).c_str()); + log.trace("repr = %s\n", to_string(f).c_str()); fflush(stdout); // mkdb: repr @@ -196,10 +197,13 @@ } } - Interpret(f); + Interpret(log, f); ++nrAccepted; return (false); } + +private: + util::logger& log; }; // mkdb: @@ -214,9 +218,9 @@ } } -static void compile_model_question(uint32_t nrQuestions, const char* buf, uint32_t maxNrTrees, uint32_t maxNrAnalyses, const std::string& urlName) +static void compile_model_question(util::logger& log, uint32_t nrQuestions, const char* buf, uint32_t maxNrTrees, uint32_t maxNrAnalyses, const std::string& urlName) { - printf("%d. %s\n", nrQuestions, buf); + log.trace("%d. %s\n", nrQuestions, buf); // mkdb: vraag { is.reset(urlName, buf); @@ -261,7 +265,7 @@ { if (nrAnalyses == 0) { - printf("NO ANALYSIS\n"); + log.trace("NO ANALYSIS\n"); // mkdb: no_analysis { is.nr_analyses(0); @@ -271,7 +275,7 @@ { if (nrAnalyses > 1) { - printf("NR_ANALYSES = %d(%d)\n", nrAnalysesMin, nrAnalyses); + log.trace("NR_ANALYSES = %d(%d)\n", nrAnalysesMin, nrAnalyses); // mkdb: nr_anlysis { is.nr_analyses(nrAnalysesMin); @@ -285,46 +289,46 @@ score = GetScore(i); stree* tree = GetTree(i); - printf("parse_errors = %g\n", pWeight); + log.trace("parse_errors = %g\n", pWeight); // mkdb: parse_error { is.parse_error(pWeight); } - printf("parse_score = %g\n", score); + log.trace("parse_score = %g\n", score); // mkdb: parse_score { cScore = score; is.parse_score(cScore); } - printf("tree = "); PrintSTree(tree); printf("\n"); - InspectTree(tree); + log.trace("tree = "); PrintSTree(tree); log.trace("\n"); + InspectTree(log, tree); KillSTree(tree); FORMULA formula = GetMeaning(i); - printf("sem = %s\n", to_string(formula).c_str()); + log.trace("sem = %s\n", to_string(formula).c_str()); nrAccepted = 0; - print_interpretation collector; + print_interpretation collector(log); Interpret(formula, &collector); if (nrAccepted == 0) { - printf("repr = <none>\n"); + log.trace("repr = <none>\n"); } else { intFound = true; } - printf("\n"); + log.trace("\n"); KillFormula(formula); } // for if (!intFound) { - printf("\nNO INTERPRETATION FOUND\n"); + log.trace("\nNO INTERPRETATION FOUND\n"); // mkdb: no_interpretation { is.no_interpretation(); @@ -334,20 +338,22 @@ } else { - printf("\nTOO MANY ANALYSES (%d, %d)\n", nrAnalyses, nrTrees); + log.trace("\nTOO MANY ANALYSES (%d, %d)\n", nrAnalyses, nrTrees); } } else { - printf("\nTOO MANY TREES (%d)\n", nrTrees); + log.trace("\nTOO MANY TREES (%d)\n", nrTrees); } - printf("\n"); + log.trace("\n"); CleanUpParses(); } void read_set_file(const char *file) { + using namespace qgo; + using namespace boost; typedef factory<groups::common | groups::database | groups::dictionary | groups::parser | groups::phontab | groups::qry_trans> fimpl; shared_ptr<database_interface> dbin(new database_notifiers); shared_ptr<dictionary_interface> din(new dictionary_notifiers); @@ -375,8 +381,8 @@ static void version() { - printf("%s\n", "$Revision$"); - printf("%s\n", "Timestamp: " __DATE__ " " __TIME__); + fprintf(stderr, "%s\n", "$Revision$"); + fprintf(stderr, "%s\n", "Timestamp: " __DATE__ " " __TIME__); } // globals accessible to resource/settings/settings.hpp @@ -385,7 +391,8 @@ int main(int argc, char* argv[]) { - SPAWNLOG("testparsesem"); + INITLOG(log, "testparsesem"); + log.set_output(std::cout); int optc; cpu_timer total_timer; @@ -474,7 +481,7 @@ GetNextUrl(urlFile, urlName); } - compile_model_question(nrQuestions, buf, maxNrTrees, maxNrAnalyses, urlName); + compile_model_question(log, nrQuestions, buf, maxNrTrees, maxNrAnalyses, urlName); if (os_comp_db.is_open()) { @@ -486,11 +493,11 @@ is.print_sumfile_line(os_sum); } - printf("time: %g sec.\n", question_timer.get_time()); - printf("memory: %.1f(%.1f) Mb.\n", (double) bAllocated / 1048576, (double) bAllocInUse / 1048576); + log.trace("time: %g sec.\n", question_timer.get_time()); + log.trace("memory: %.1f(%.1f) Mb.\n", (double) bAllocated / 1048576, (double) bAllocInUse / 1048576); } - printf("%d questions in %g sec.\n", nrQuestions, total_timer.get_time()); + log.trace("%d questions in %g sec.\n", nrQuestions, total_timer.get_time()); if (os_comp_db.is_open()) {