Gestione mail

git-svn-id: svn://10.65.10.50/branches/R_10_00@23169 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2015-12-28 14:14:41 +00:00
parent cb39cedcec
commit 32ebb6b8f7
4 changed files with 181 additions and 135 deletions

69
ba/ba0100m.uml Normal file
View File

@ -0,0 +1,69 @@
PAGE "Configurazione E-Mail utente" -1 -1 63 11
STRING 101 260 50
BEGIN
PROMPT 1 0 "Server "
FIELD Server
END
STRING 102 260 50
BEGIN
PROMPT 1 1 "Porta "
FIELD Port
END
TEXT DLG_NULL
BEGIN
PROMPT 11 2 "Alice: 25"
END
TEXT DLG_NULL
BEGIN
PROMPT 25 2 "GMail: 465 -ssl -auth-plain"
END
STRING 103 50
BEGIN
PROMPT 1 4 "Utente "
FIELD User
END
STRING 104 50
BEGIN
PROMPT 1 5 "Password "
FIELD Password
FLAGS "*"
END
STRING 105 260 50
BEGIN
PROMPT 1 6 "Da "
FIELD From
END
LIST 106 1
BEGIN
PROMPT 21 7 "Tentativi di trasmissione "
ITEM "1|1"
ITEM "2|2"
ITEM "3|3"
ITEM "4|4"
ITEM "5|5"
FIELD Retry
END
MEMO 107 60 4
BEGIN
PROMPT 1 7 "Saluti / Firma"
FIELD Signature
END
ENDPAGE
TOOLBAR "Topbar" 0 0 0 2
#include <stdbar.h>
ENDPAGE
ENDMASK

15
ba/ba0104.cpp Normal file
View File

@ -0,0 +1,15 @@
#define WIN32_LEAN_AND_MEAN
#define STRICT
#include <shlobj.h>
#include <errno.h>
int xvt_fsys_get_desktop(char* dir)
{
int err = EINVAL;
if (dir)
{
::SHGetFolderPathA(NULL, CSIDL_DESKTOPDIRECTORY, NULL, SHGFP_TYPE_CURRENT, dir);
err = *dir ? 0 : ENOENT;
}
return err;
}

View File

@ -45,11 +45,12 @@ TProfiler_mask::TProfiler_mask() : TMask(TR("Test"), 1, 60, 20)
class TTest_application : public TSkeleton_application class TTest_application : public TSkeleton_application
{ {
TProgress_monitor* _pi; WINDOW _pi;
long _total;
clock_t _start;
clock_t start_timer() const; void start_progind(long items, const char* prompt);
bool update_progind(long item);
clock_t start_progind(const long items, const char* prompt);
clock_t stop_progind(); clock_t stop_progind();
protected: protected:
@ -69,19 +70,19 @@ public:
TTest_application() : _pi(NULL) { } TTest_application() : _pi(NULL) { }
}; };
clock_t TTest_application::start_timer() const void TTest_application::start_progind(long items, const char* msg)
{ {
CHECK(_pi == NULL_WIN, "Double progress indicator");
_pi = xvt_dm_progress_create(NULL_WIN, TR("Performance profiler"), _total = items, TRUE);
xvt_dm_progress_set_text(_pi, msg);
clock_t t = clock(); clock_t t = clock();
while (clock() == t); while (clock() == t);
t = clock(); _start = clock();
return t;
} }
clock_t TTest_application::start_progind(const long items, const char* prompt) bool TTest_application::update_progind(long item)
{ {
CHECK(_pi == NULL, "Double progress indicator"); return xvt_dm_progress_set_status(_pi, item, _total) != 0;
_pi = new TProgress_monitor(items, prompt, true);
return start_timer();
} }
clock_t TTest_application::stop_progind() clock_t TTest_application::stop_progind()
@ -89,10 +90,10 @@ clock_t TTest_application::stop_progind()
const clock_t t = clock(); const clock_t t = clock();
if (_pi != NULL) if (_pi != NULL)
{ {
delete _pi; xvt_dm_progress_destroy(_pi);
_pi = NULL; _pi = NULL_WIN;
} }
return t; return t - _start;
} }
@ -105,16 +106,13 @@ bool TTest_application::test1(TLog_report& log)
TString80 msg; TString80 msg;
const int times = 10; const int times = 10;
const clock_t start = start_progind(times, TR("Lettura file comuni")); start_progind(times, TR("Lettura file comuni"));
for (int i = 0; i < times; i++) for (int i = 1; i <= times; i++)
{ {
for (tab.first(); tab.good(); tab.next()) for (tab.first(); tab.good(); tab.next())
r++; r++;
msg.format(FR("%ld records %ld msec"), r, clock() - start); if (!update_progind(i))
_pi->set_text(msg);
if (!_pi->add_status())
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
@ -122,7 +120,7 @@ bool TTest_application::test1(TLog_report& log)
} }
} }
const clock_t t = stop_progind() - start; const clock_t t = stop_progind();
msg.format("Lettura file comuni - " msg.format("Lettura file comuni - "
"%ld records in %ld msec - %lg records per sec", r, t, 1000.0*r/t); "%ld records in %ld msec - %lg records per sec", r, t, 1000.0*r/t);
log.log(0, msg); log.log(0, msg);
@ -139,21 +137,17 @@ bool TTest_application::test2(TLog_report& log)
tab.freeze(); tab.freeze();
clock_t start;
TRecnotype r = 0; TRecnotype r = 0;
TString80 msg; TString80 msg;
const int times = 10;
start_progind(times, TR("Lettura cursore comuni"));
{ {
const int times = 10; for (int i = 1; i <= times; i++)
TProgress_monitor p(times, TR("Lettura cursore comuni"));
start = start_timer();
for (int i = 0; i < times; i++)
{ {
for (tab = 0; tab.pos() < n; ++tab) for (tab = 0; tab.pos() < n; ++tab)
r++; r++;
msg.format("Lettura cursore comuni\n%ld records %ld msec", r, clock() - start); if (!update_progind(i))
p.set_text(msg);
if (!p.add_status())
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
@ -161,7 +155,7 @@ bool TTest_application::test2(TLog_report& log)
} }
} }
} }
const clock_t t = clock() - start; const clock_t t = stop_progind();
msg.format("Lettura cursore comuni: %ld records in %ld msec - %lg records per sec\n", msg.format("Lettura cursore comuni: %ld records in %ld msec - %lg records per sec\n",
r, t, 1000.0*r/t); r, t, 1000.0*r/t);
log.log(0, msg); log.log(0, msg);
@ -174,27 +168,23 @@ bool TTest_application::test3(TLog_report& log)
TRelation rel(LF_COMUNI); TRelation rel(LF_COMUNI);
TSorted_cursor tab(&rel, "CAPCOM|DENCOM"); TSorted_cursor tab(&rel, "CAPCOM|DENCOM");
clock_t istart = start_timer(); start_progind(1, TR("Inizializzazione"));
const TRecnotype n = tab.items(); const TRecnotype n = tab.items();
clock_t istop = clock() - istart; const clock_t istop = stop_progind();
tab.freeze(); tab.freeze();
clock_t start;
TRecnotype r = 0; TRecnotype r = 0;
TString256 msg; TString256 msg;
const int times = 10;
start_progind(times, TR("Lettura cursore C.A.P."));
{ {
const int times = 10; for (int i = 1; i <= times; i++)
TProgress_monitor p(times, TR("Lettura cursore C.A.P."));
start = start_timer();
for (int i = 0; i < times; i++)
{ {
for (tab = 0; tab.pos() < n; ++tab) for (tab = 0; tab.pos() < n; ++tab)
r++; r++;
msg.format("Lettura cursore C.A.P.\n%ld records %ld msec", r, clock() - start); if (!update_progind(i))
p.set_text(msg);
if (!p.addstatus(1))
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
@ -202,7 +192,7 @@ bool TTest_application::test3(TLog_report& log)
} }
} }
} }
const clock_t t = clock() - start; const clock_t t = stop_progind();
msg.format("Lettura cursore ordinato %ld records in %ld msec - %lg records per sec - " msg.format("Lettura cursore ordinato %ld records in %ld msec - %lg records per sec - "
"%ld msec for initialization", "%ld msec for initialization",
r, t, 1000.0*r/t, istop); r, t, 1000.0*r/t, istop);
@ -217,13 +207,11 @@ bool TTest_application::test4(TLog_report& log)
srand(r); srand(r);
TString8 cod; TString8 cod;
clock_t start;
{ {
const int times = 10; const int times = 10;
TProgress_monitor p(times, TR("Lettura casuale tramite cache"));
cache().get(LF_COMUNI, cod); // Inizializzazione cache().get(LF_COMUNI, cod); // Inizializzazione
start = start_timer(); start_progind(times, TR("Lettura casuale tramite cache"));
for (int i = 0; i < times; i++) for (int i = 1; i <= times; i++)
{ {
for (long j = 0; j < 10000; j++) for (long j = 0; j < 10000; j++)
{ {
@ -232,7 +220,7 @@ bool TTest_application::test4(TLog_report& log)
cache().get(LF_COMUNI, cod); cache().get(LF_COMUNI, cod);
r++; r++;
} }
if (!p.add_status()) if (!update_progind(i))
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
@ -241,7 +229,7 @@ bool TTest_application::test4(TLog_report& log)
} }
} }
const clock_t t = clock() - start; const clock_t t = stop_progind();
TString msg; TString msg;
msg.format("Lettura cached di %ld records in %ld msec - %lg records per sec", msg.format("Lettura cached di %ld records in %ld msec - %lg records per sec",
r, t, 1000.0*r/t); r, t, 1000.0*r/t);
@ -256,32 +244,28 @@ bool TTest_application::test5(TLog_report& log)
srand(r); srand(r);
TString8 cod; TString8 cod;
clock_t start; const int times = 10;
{ TLocalisamfile f(LF_COMUNI);
const int times = 10; start_progind(times, TR("Lettura casuale senza cache"));
TProgress_monitor p(times, TR("Lettura casuale senza cache")); for (int i = 1; i <= times; i++)
TLocalisamfile f(LF_COMUNI); {
start = start_timer(); for (long j = 0; j < 10000; j++)
for (int i = 0; i < times; i++)
{ {
for (long j = 0; j < 10000; j++) const int rn = rand();
{ cod.format("%c%03d", 'A'+(rn%2), rn % 1000);
const int rn = rand(); f.put(COM_COM, cod);
cod.format("%c%03d", 'A'+(rn%2), rn % 1000); f.read();
f.put(COM_COM, cod); r++;
f.read();
r++;
}
if (!p.add_status())
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
}
} }
} if (!update_progind(i))
{
log.log(1, TR("Interrotto dall'utente"));
ok = false;
break;
}
}
const clock_t t = clock() - start; const clock_t t = stop_progind();
TString msg; TString msg;
msg.format("Lettura casuale di %ld records in %ld msec - %lg records per sec", msg.format("Lettura casuale di %ld records in %ld msec - %lg records per sec",
r, t, 1000.0*r/t); r, t, 1000.0*r/t);
@ -299,20 +283,20 @@ bool TTest_application::test6(TLog_report& log)
{ {
TTable tab("CZZ"); TTable tab("CZZ");
msg.format("Creazione di %ld records", n); msg.format("Creazione di %ld records", n);
const clock_t start = start_progind(n, msg); start_progind(n, msg);
int i; int i;
for (i = 0; i < n; i++) for (i = 1; i <= n; i++)
{ {
tab.put("CODTAB", i+1); tab.put("CODTAB", i);
tab.write(); tab.write();
if (!_pi->add_status()) if (!update_progind(i))
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
break; break;
} }
} }
const clock_t t = stop_progind() - start; const clock_t t = stop_progind();
msg.format("Scritti %ld records in %ld msec - %lg records per sec", i, t, 1000.0*i/t); msg.format("Scritti %ld records in %ld msec - %lg records per sec", i, t, 1000.0*i/t);
log.log(0, msg); log.log(0, msg);
} }
@ -325,18 +309,18 @@ bool TTest_application::test6(TLog_report& log)
cur.freeze(); cur.freeze();
msg.format("Cancellazione %ld records", n); msg.format("Cancellazione %ld records", n);
const clock_t start = start_progind(n, msg); start_progind(n, msg);
for (cur = 0; cur.pos() < n; ++cur) for (cur = 0; cur.pos() < n; ++cur)
{ {
cur.file().remove(); cur.file().remove();
if (!_pi->add_status()) if (!update_progind(cur.pos()+1))
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
break; break;
} }
} }
const clock_t t = stop_progind() - start; const clock_t t = stop_progind();
msg.format("Cancellati %ld records in %ld msec - %lg records per sec", n, t, 1000.0*n/t); msg.format("Cancellati %ld records in %ld msec - %lg records per sec", n, t, 1000.0*n/t);
log.log(0, msg); log.log(0, msg);
} }
@ -354,21 +338,21 @@ bool TTest_application::test7(TLog_report& log)
TSystemisamfile tab(LF_TAB); TSystemisamfile tab(LF_TAB);
tab.open(_excllock); tab.open(_excllock);
msg.format("Creazione di %ld records", n); msg.format("Creazione di %ld records", n);
const clock_t start = start_progind(n, msg); start_progind(n, msg);
int i; int i;
for (i = 0; i < n; i++) for (i = 1; i <= n; i++)
{ {
tab.curr().put("COD", "CZZ"); tab.curr().put("COD", "CZZ");
tab.curr().put("CODTAB", i+1); tab.curr().put("CODTAB", i);
tab.write(); tab.write();
if (!_pi->addstatus(1)) if (!update_progind(i))
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
break; break;
} }
} }
const clock_t t = stop_progind() - start; const clock_t t = stop_progind();
msg.format("Scritti %ld records in %ld msec - %lg records per sec", i, t, 1000.0*i/t); msg.format("Scritti %ld records in %ld msec - %lg records per sec", i, t, 1000.0*i/t);
log.log(0, msg); log.log(0, msg);
tab.close(); tab.close();
@ -385,20 +369,20 @@ bool TTest_application::test7(TLog_report& log)
cur.freeze(); cur.freeze();
msg.format("Cancellazione %ld records", n); msg.format("Cancellazione %ld records", n);
const clock_t start = start_progind(n, msg); start_progind(n, msg);
for (cur = 0; cur.pos() < n; ++cur) for (cur = 0; cur.pos() < n; ++cur)
{ {
tab.put("COD", cur.curr().get("COD")); tab.put("COD", cur.curr().get("COD"));
tab.put("CODTAB", cur.curr().get("CODTAB")); tab.put("CODTAB", cur.curr().get("CODTAB"));
tab.remove(); tab.remove();
if (!_pi->addstatus(1)) if (!update_progind(cur.pos()+1))
{ {
log.log(1, TR("Interrotto dall'utente")); log.log(1, TR("Interrotto dall'utente"));
ok = false; ok = false;
break; break;
} }
} }
const clock_t t = stop_progind() - start; const clock_t t = stop_progind();
msg.format("Cancellati %ld records in %ld msec - %lg records per sec", n, t, 1000.0*n/t); msg.format("Cancellati %ld records in %ld msec - %lg records per sec", n, t, 1000.0*n/t);
log.log(0, msg); log.log(0, msg);
tab.close(); tab.close();
@ -406,11 +390,6 @@ bool TTest_application::test7(TLog_report& log)
return ok; return ok;
} }
ostream* _out = NULL;
static void str_serialize(const TObject& obj)
{ *_out << obj << '\n'; }
static bool str_deserialize(istream& i, TString& str) static bool str_deserialize(istream& i, TString& str)
{ {
char* buff = str.get_buffer(50); char* buff = str.get_buffer(50);
@ -444,77 +423,59 @@ bool TTest_application::test8(TLog_report& log)
if (first_time) if (first_time)
{ {
TString80 str; TString80 str;
msg = TR("Lettura big.txt con TArray");
log.log(0, msg); start_progind(1, TR("Lettura big.txt con TArray"));
const clock_t start = start_progind(1, msg);
ifstream big("recdesc/big.txt"); ifstream big("recdesc/big.txt");
while (str_deserialize(big, str)) while (str_deserialize(big, str))
{ {
parole.add(str); TString* s = str.len() <= 16 ? new TString16(str) : new TString(str);
_pi->add_status(0L); parole.add(s);
update_progind(1);
} }
stop_progind(); const clock_t t = stop_progind();
const unsigned int n = parole.items();
msg.format("TArray %ld parole %6ld msec - %5lg wps", n, t, 1000.0*n/t);
log.log(0, msg);
} }
const unsigned int n = parole.items(); const int n = parole.items();
bool ok = n > 0; bool ok = n > 0;
if (ok) if (ok)
{ {
TAssoc_array ass; THash_table ash(883);
const clock_t start = start_progind(n, TR("Lettura big.txt con TAssoc_array")); start_progind(1, TR("Lettura big.txt con THash_table"));
FOR_EACH_ARRAY_ITEM(parole, r, o) for (int i = 1; i < n; i++)
{ {
const TString& p = *(const TString*)o; const TString& p = (const TString&)parole[i];
ass.add(p, p, false); ash.add(p, p, false);
if ((r % 256 == 0) && !_pi->set_status(r+1)) if ((i % 10000 == 0) && !update_progind(1))
{ {
ok = false; ok = false;
break; break;
} }
} }
const clock_t t = stop_progind() - start; const clock_t t = stop_progind();
msg.format("TAssoc_array %ld(%ld) parole %6ld msec - %5lg wps", n, ass.items(), t, 1000.0*n/t); msg.format("THash_table %ld parole %6ld msec - %5lg wps", ash.items(), t, 1000.0*n/t);
log.log(0, msg); log.log(0, msg);
if (first_time)
{
TFilename fn; fn.tempdir(); fn.add("assoc.txt");
_out = new ofstream(fn);
ass.for_each(str_serialize);
_out->flush();
delete _out;
_out = NULL;
}
} }
if (ok) if (ok)
{ {
THash_table ash(1024*36); TAssoc_array ass;
const clock_t start = start_progind(n, TR("Lettura big.txt con THash_table")); start_progind(1, TR("Lettura big.txt con TAssoc_array"));
FOR_EACH_ARRAY_ITEM(parole, r, o) for (int i = 1; i < n; i++)
{ {
const TString& p = *(const TString*)o; const TString& p = (const TString&)parole[i];
ash.add(p, p, false); ass.add(p, p, false);
if ((r % 256 == 0) && !_pi->set_status(r+1)) if ((i % 10000 == 0) && !update_progind(1))
{ {
ok = false; ok = false;
break; break;
} }
} }
const clock_t t = stop_progind() - start; const clock_t t = stop_progind();
msg.format("THash_table %ld(%ld) parole %6ld msec - %5lg wps", n, ash.items(), t, 1000.0*n/t); msg.format("TAssoc_array %ld parole %6ld msec - %5lg wps", ass.items(), t, 1000.0*n/t);
log.log(0, msg); log.log(0, msg);
if (first_time)
{
TFilename fn; fn.tempdir(); fn.add("hash.txt");
_out = new ofstream(fn);
ash.for_each(str_serialize);
_out->flush();
delete _out;
_out = NULL;
}
} }
if (!ok) if (!ok)

View File

@ -7,6 +7,7 @@
#include <odbcrset.h> #include <odbcrset.h>
#include <progind.h> #include <progind.h>
#include <reputils.h> #include <reputils.h>
#include <sheet.h>
#include <toolfld.h> #include <toolfld.h>
#include <urldefid.h> #include <urldefid.h>
#include <utility.h> #include <utility.h>