Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
controls.cpp    Corretta gestione list box aperti durante la chiusura
default.url     Aggiunto BMP_STOP
dongle.cpp      Gestito utente GUEST
expr.cpp        Aggiunto errore su radice negativa
files.cpp       Tolti spazi inutili
isam.cpp        Migliorata conversione


git-svn-id: svn://10.65.10.50/trunk@6851 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-07-20 13:07:00 +00:00
parent f7c645eac7
commit 6aad57da86
6 changed files with 122 additions and 95 deletions

View File

@ -1957,8 +1957,11 @@ void TDropDownList::close()
if (_open) if (_open)
{ {
_open = FALSE; _open = FALSE;
xvt_vobj_set_visible(xi_get_window(_xi_lst->itf), FALSE); if (_xi_lst)
xvt_dwin_update (xi_get_window(_obj->itf)); {
xvt_vobj_set_visible(xi_get_window(_xi_lst->itf), FALSE);
xvt_dwin_update (xi_get_window(_obj->itf));
}
} }
} }

View File

@ -156,6 +156,7 @@ image BMP_EMAIL QRESDIR"email.bmp"
image BMP_DIR QRESDIR"dir.bmp" image BMP_DIR QRESDIR"dir.bmp"
image BMP_DIRDN QRESDIR"dirdn.bmp" image BMP_DIRDN QRESDIR"dirdn.bmp"
image BMP_FILE QRESDIR"file.bmp" image BMP_FILE QRESDIR"file.bmp"
image BMP_STOP QRESDIR"stop.bmp"
#scan <xil.h> #scan <xil.h>
#transparent $$$ #transparent $$$

View File

@ -411,11 +411,12 @@ bool TDongle::network_login(bool test_all_keys)
TConfig ini(CONFIG_INSTALL, "Server"); TConfig ini(CONFIG_INSTALL, "Server");
const char* server = ini.get("Dongle"); const char* server = ini.get("Dongle");
const char* guest = "******"; const TString16 appname = main_app().name();
const TString appname = main_app().firm_change_enabled() ? main_app().name() : "ba0100"; TString16 utente = user();
const char* utente = (!xvt_running() && appname == "ba0100") ? guest : user(); if (utente.empty() || (!xvt_running() && appname == "ba0100"))
utente = "GUEST";
const bool ok = rpc_UserLogin(server, utente, guest, appname); const bool ok = rpc_UserLogin(server, utente, "******", appname);
if (ok) if (ok)
{ {
_hardware = _dongle_network; _hardware = _dongle_network;

View File

@ -381,15 +381,18 @@ void TExpression::eval()
break; break;
case _divide: case _divide:
{ {
real& r = evalstack.pop_real(); const real& r = evalstack.pop_real();
if (r.is_zero()) if (r.is_zero())
{ {
if (!evalstack.peek_real().is_zero()) if (!evalstack.peek_real().is_zero())
{
if (_ignore_error) if (_ignore_error)
_error=1; _error=1;
else else
print_error("Divisione per zero!"); print_error("Divisione per zero!");
} else }
}
else
evalstack.peek_real() /= r; evalstack.peek_real() /= r;
} }
break; break;
@ -519,7 +522,18 @@ void TExpression::eval()
} }
break; break;
case _sqrt: case _sqrt:
evalstack.peek_real() = sqrt(evalstack.peek_real()); {
real& r = evalstack.peek_real();
if (r < ZERO)
{
if (_ignore_error)
_error=1;
else
print_error("Radice negativa!");
r = -r;
}
r = sqrt(r);
}
break; break;
case _sqr: case _sqr:
evalstack.peek_real() = sqr(evalstack.peek_real()); evalstack.peek_real() = sqr(evalstack.peek_real());
@ -1143,8 +1157,7 @@ bool TExpression::set(const char* expression, TTypeexp type)
bool TExpression::compile(const char* expression, TTypeexp type) bool TExpression::compile(const char* expression, TTypeexp type)
{ {
TCodesym currsym; _error=0;
_user_func_defined = FALSE; _user_func_defined = FALSE;
_s = expression; _s = expression;
_type = type; _type = type;
@ -1152,7 +1165,9 @@ bool TExpression::compile(const char* expression, TTypeexp type)
_code.clear(); _code.clear();
if (*_s == '\0') if (*_s == '\0')
return TRUE; return TRUE;
if ((currsym = __gettoken()) == _invalid)
TCodesym currsym = __gettoken();
if (currsym == _invalid)
return FALSE; return FALSE;
return __expression(currsym) == _endsym; return __expression(currsym) == _endsym;
} }

View File

@ -272,12 +272,12 @@ void TDir::get (
TDirop op) // @parm Tipo di operazioni effettuabili sul file (default _nordirop) TDirop op) // @parm Tipo di operazioni effettuabili sul file (default _nordirop)
{ {
int _whichdir = (dirtype == _nordir ? NORDIR : COMDIR); int whichdir = (dirtype == _nordir ? NORDIR : COMDIR);
if (op == _nordirop) if (op == _nordirop)
COpenFile (nfile, _dir, int (lock), _whichdir); COpenFile (nfile, _dir, int(lock), whichdir);
else else
CGetFile (nfile, _dir, int (lock), _whichdir); CGetFile (nfile, _dir, int(lock), whichdir);
_num = nfile; _num = nfile;
_com = _dir->SysName[0] != '$'; _com = _dir->SysName[0] != '$';
} }

View File

@ -406,6 +406,8 @@ HIDDEN int __build_key(const RecDes *recd, int numkey, RecType recin, char *key
HIDDEN int cisread(int fhnd, int knum, TRectype& record, int mode, TRecnotype& curr_recno) HIDDEN int cisread(int fhnd, int knum, TRectype& record, int mode, TRecnotype& curr_recno)
{ {
CHECKD(fhnd >= 0, "Can't use codebase handle ", fhnd);
const int rmode = (mode & READTYPES); const int rmode = (mode & READTYPES);
const int lmode = (mode & RECLOCKTYPES); const int lmode = (mode & RECLOCKTYPES);
@ -1604,101 +1606,107 @@ int TSystemisamfile::update(
if (toconvert) if (toconvert)
fname = filename(); fname = filename();
if (toconvert && (dir.eox() > 0L || fname.exist())) if (toconvert) //&& (dir.eox() > 0L || fname.exist()))
{ {
TRecnotype ni = 0L; TRecnotype ni = 0L;
TFilename tmpfname; tmpfname.temp("tf"); TFilename tmpfname; tmpfname.temp("tf");
err = _open_ex(_excllock);
if (err != NOERR)
return err;
err=DB_build(tmpfname, wrec.rec()); err=DB_build(tmpfname, wrec.rec());
if (err != NOERR) if (err != NOERR)
{ {
err=get_error(err); err=get_error(err);
return (err); return (err);
} }
// Apro il file destinazione in modo esclusivo e senza indici if (dir.eod() > 0 && fname.exist() && oldrec.len())
int tmpnum = num();
TIsam_handle ishandle = prefix().open_isamfile(tmpnum, tmpfname, TRUE, FALSE);
TCodeb_handle fhnd = prefix().get_handle(ishandle);
if (fhnd < 0 )
{ {
err=get_error(fhnd); err = _open_ex(_excllock);
return err;
}
TString s(80);
s.format("Aggiornamento archivio %s\nTempo stimato alla fine del processo: ", (const char*) fname);
const TRecnotype nitems = items();
TProgind p(nitems > 0 ? nitems : 1, s, FALSE, TRUE, 70);
TExtrectype nrec(wrec);
const int nflds = curr().items();
TArray infld, outfld;
for (int j = 0; j < nflds; j++)
{
const char* fld_name = curr().fieldname(j);
infld.add(new TRecfield(curr(), fld_name), j);
if (nrec.exist(fld_name))
outfld.add(new TRecfield(nrec, fld_name), j);
}
const clock_t start_time = clock();
for (first(); good(); next())
{
const bool tick = p.addstatus(1);
ni++;
if (curr().isdeleted())
continue;
nrec.zero();
for (j = outfld.first(); j < nflds; j = outfld.succ(j))
{
TRecfield& in_fld = (TRecfield&)infld[j];
TRecfield& out_fld = (TRecfield&)outfld[j];
const char* fld_val = in_fld;
out_fld = fld_val;
}
if (lcf)
makelc((TRectype &)nrec);
browse_null(nrec.string(),lenr/*DB_reclen(fhnd)*/);
memcpy(DB_getrecord(fhnd),nrec.string(),lenr/*DB_reclen(fhnd)*/);
err=DB_add(fhnd);
if ( err == NOERR && nrec.has_memo())
nrec.write_memo(fhnd, DB_recno(fhnd));
if (err != NOERR) if (err != NOERR)
err=get_error(err); return err;
setstatus(err);
if (tick)
// Apro il file destinazione in modo esclusivo e senza indici
int tmpnum = num();
TIsam_handle ishandle = prefix().open_isamfile(tmpnum, tmpfname, TRUE, FALSE);
TCodeb_handle fhnd = prefix().get_handle(ishandle);
if (fhnd < 0 )
{ {
const clock_t elapsed_ticks = clock() - start_time; err=get_error(fhnd);
const clock_t total_ticks = elapsed_ticks * nitems / ni; return err;
const clock_t estimated_ticks = total_ticks - elapsed_ticks;
long secs = estimated_ticks / CLOCKS_PER_SEC;
CHECK(secs >= 0, "Bad time estimation");
const int hours = int(secs / 3600L);
secs %= 3600L;
const int mins = int(secs / 60L);
secs %= 60L;
const int append_pos = s.find("o: ")+3;
s.cut(append_pos);
s << format("%02d:%02d:%02ld", hours, mins, secs);
p.set_text(s);
} }
TString s(80);
s.format("Aggiornamento archivio %s\nTempo stimato alla fine del processo: ", (const char*) fname);
const TRecnotype nitems = items();
TProgind p(nitems > 0 ? nitems : 1, s, FALSE, TRUE, 70);
TExtrectype nrec(wrec);
const int nflds = curr().items();
TArray infld, outfld;
for (int j = 0; j < nflds; j++)
{
const char* fld_name = curr().fieldname(j);
infld.add(new TRecfield(curr(), fld_name), j);
if (nrec.exist(fld_name))
outfld.add(new TRecfield(nrec, fld_name), j);
}
const clock_t start_time = clock();
for (first(); good(); next())
{
const bool tick = p.addstatus(1);
ni++;
if (curr().isdeleted())
continue;
nrec.zero();
for (j = outfld.first(); j < nflds; j = outfld.succ(j))
{
TRecfield& in_fld = (TRecfield&)infld[j];
TRecfield& out_fld = (TRecfield&)outfld[j];
const char* fld_val = in_fld;
out_fld = fld_val;
}
if (lcf)
makelc((TRectype &)nrec);
browse_null(nrec.string(),lenr/*DB_reclen(fhnd)*/);
memcpy(DB_getrecord(fhnd),nrec.string(),lenr/*DB_reclen(fhnd)*/);
err=DB_add(fhnd);
if ( err == NOERR && nrec.has_memo())
nrec.write_memo(fhnd, DB_recno(fhnd));
if (err != NOERR)
err=get_error(err);
setstatus(err);
if (tick)
{
const clock_t elapsed_ticks = clock() - start_time;
const clock_t total_ticks = elapsed_ticks * nitems / ni;
const clock_t estimated_ticks = total_ticks - elapsed_ticks;
long secs = estimated_ticks / CLOCKS_PER_SEC;
CHECK(secs >= 0, "Bad time estimation");
const int hours = int(secs / 3600L);
secs %= 3600L;
const int mins = int(secs / 60L);
secs %= 60L;
const int append_pos = s.find("o: ")+3;
s.cut(append_pos);
s << format("%02d:%02d:%02ld", hours, mins, secs);
p.set_text(s);
}
}
close();
prefix().close_isamfile(ishandle);
if (err!=NOERR) err=get_error(err);
p.setstatus(nitems);
} }
close();
prefix().close_isamfile(ishandle);
if (err!=NOERR) err=get_error(err);
p.setstatus(nitems);
if (err == NOERR) if (err == NOERR)
{ {
long c = DB_getconf(); long c = DB_getconf();
@ -1752,9 +1760,8 @@ int TSystemisamfile::update(
if (toconvert) if (toconvert)
{ {
if (dir.eox() > 0L) packindex();
packindex(); if (err == NOERR)
if (err == NOERR)
err = exec_convapp(lev, FALSE); // Post - conversion err = exec_convapp(lev, FALSE); // Post - conversion
} }
} }