From ed68f81ed75991309061c12272d54971627d013c Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 16 Dec 2015 15:49:36 +0000 Subject: [PATCH] git-svn-id: svn://10.65.10.50/branches/R_10_00@23148 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- ba/ba1100.cpp | 17 ++++++----- ba/ba1103.cpp | 1 + ba/ba1200.cpp | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 88 insertions(+), 8 deletions(-) diff --git a/ba/ba1100.cpp b/ba/ba1100.cpp index 34ba50753..e5fdf3046 100755 --- a/ba/ba1100.cpp +++ b/ba/ba1100.cpp @@ -802,7 +802,7 @@ void TManutenzione_app::repair_file(int i) FOR_EACH_TOKEN(names, name) xvt_fsys_remove_file(name); - s.format(FR("File n. %d - %s : eliminato file errato"), i, n); + s.format(FR("File n.%d - %s : eliminato file errato"), i, n); write_log(s, 2); } else @@ -820,14 +820,17 @@ void TManutenzione_app::repair_file(int i) const int reclen = rec.len(); d.set_len(reclen); d.put(i, _nordir, _sysdirop); - s.format(FR("File n. %d - %s : corretto tracciato da %d a %d bytes"), i, n, oldreclen, reclen); + if (oldreclen != reclen) + s.format(FR("File n.%d - %s : corretto tracciato da %d a %d bytes"), i, n, oldreclen, reclen); + else + s.format(FR("File n.%d - %s : Riparato tracciato record"), i, n); write_log(s, 1); } } bool TManutenzione_app::moveable_file(int file) const { - return file == LF_PCON || file == LF_CLIFO || file == LF_CAUSALI || + return file == LF_PCON || file == LF_CLIFO || file == LF_CAUSALI || file == LF_RCAUSALI || file == LF_CFVEN || file == LF_INDSP; } @@ -923,7 +926,7 @@ void TManutenzione_app::update_dir() bool kill = true; //controllo solo all'aga if (is_power_station()) - kill = yesno_box(FR("Il tracciato record del file %d e' incoerente:\n" + kill = yesno_box(FR("Il tracciato record del file %d è incoerente:\n" "Si desidera eliminare il file vuoto %s?"), i, (const char*)fs); if (kill) { @@ -1174,7 +1177,7 @@ void TManutenzione_app::convert_dir() s << TR("ditta ") << atol (pref); s << ".\n"; - TProgress_monitor p(update_items ? update_items : 1, s, is_power_station()); + TProgress_monitor p(update_items, s, is_power_station()); for (int i = LF_USER; i <= update_items; i++) { if (!p.add_status()) @@ -1498,7 +1501,7 @@ void TManutenzione_app::update() prefix().set(""); load_des(); - prefix().set_codditta(0L); + prefix().set_codditta(0L); // COM TString mxs; mxs = TR("Conversione dati comuni"); @@ -1517,7 +1520,7 @@ void TManutenzione_app::update() const long codditta = ditte.get_long(i); if (codditta > _history_firm && prefix().exist(codditta) && set_firm(codditta)) { - mxs.cut(0) << TR("Conversione Ditta") << ' ' << codditta; + mxs.cut(0) << TR("Conversione Ditta ") << codditta; write_log(""); write_log(mxs); write_log(""); diff --git a/ba/ba1103.cpp b/ba/ba1103.cpp index 81d22e979..dd71149d3 100755 --- a/ba/ba1103.cpp +++ b/ba/ba1103.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #include #include #include diff --git a/ba/ba1200.cpp b/ba/ba1200.cpp index 156c342a9..c43318b9e 100755 --- a/ba/ba1200.cpp +++ b/ba/ba1200.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -6,6 +7,7 @@ #include #include #include +#include #include @@ -31,6 +33,7 @@ TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 20) codes.add(5); items.add(TR("Lettura causale senza cache")); codes.add(6); items.add(TR("Creazione e cancellazione records")); codes.add(7); items.add(TR("Creazione e cancellazione records in modo esclusivo")); + codes.add(8); items.add(TR("Confronto TAssoc_array THash_table")); add_radio (101, 0, TR("@bSelezione test"), 1, 1, 58, codes, items); add_number(102, 0, PR("Numero di iterazioni"), 1, 0, 3, "U"); @@ -57,6 +60,7 @@ protected: bool test5(TLog_report& log); bool test6(TLog_report& log); bool test7(TLog_report& log); + bool test8(TLog_report& log); public: bool test(int n, TLog_report& log); @@ -402,6 +406,77 @@ bool TTest_application::test7(TLog_report& log) return ok; } +bool TTest_application::test8(TLog_report& log) +{ + static TArray parole(1024*1024); + + if (parole.empty()) + { + const clock_t start = start_progind(n, TR("Lettura big.txt con TArray")); + TString str; + ifstream big("recdesc/big.txt"); + while (!big.eof()) + { + big >> str; + if (str.full()) + { + str.trim(); + if (str.len() <= 16) + parole.add(new TString16(str)); + else + parole.add(new TString80(str)); + } + } + stop_progind(); + } + + TString msg; + const unsigned int n = parole.items(); + bool ok = n > 0; + + if (ok) + { + TAssoc_array ass; + const clock_t start = start_progind(n, TR("Lettura big.txt con TAssoc_array")); + FOR_EACH_ARRAY_ITEM(parole, r, o) + { + const TString& p = *(const TString*)o; + ass.add(p, p, false); + if ((r % 256 == 0) && !_pi->set_status(r+1)) + { + ok = false; + break; + } + } + const clock_t t = stop_progind() - start; + msg.format("Lettura %ld parole in TAssoc_array %6ld msec - %5lg words per sec", n, t, 1000.0*n/t); + log.log(0, msg); + } + if (ok) + { + THash_table ash; + const clock_t start = start_progind(n, TR("Lettura big.txt con THash_table")); + FOR_EACH_ARRAY_ITEM(parole, r, o) + { + const TString& p = *(const TString*)o; + ash.add(p, p, false); + if ((r % 256 == 0) && !_pi->set_status(r+1)) + { + ok = false; + break; + } + } + const clock_t t = stop_progind() - start; + msg.format("Lettura %ld parole in THash_table %6ld msec - %5lg words per sec", n, t, 1000.0*n/t); + log.log(0, msg); + } + + if (!ok) + log.log(1, TR("Interrotto dall'utente")); + + return ok; +} + bool TTest_application::test(int n, TLog_report& log) { bool ok = false; @@ -414,6 +489,7 @@ bool TTest_application::test(int n, TLog_report& log) case 5: ok = test5(log); break; case 6: ok = test6(log); break; case 7: ok = test7(log); break; + case 8: ok = test8(log); break; default: ok = false; break; } return ok; @@ -454,7 +530,7 @@ void TTest_application::main_loop() TLog_report log(TR("Report")); bool ok = true; - for (int t = 1; ok && t <= 7; t++) + for (int t = 1; ok && t <= 8; t++) { if (te <= 0 || te == t) {