applicat.cpp Tolti include inutili

codeb.c         Sostituita la x4go con la d4go
isam.cpp        Tolta una riga vuota
maskfld.cpp     Aggiunto controllo sugli id duplicati
relation.cpp    Aggiunto test di cancellato nel metodo TCursor::changed
realtion.h      Aggiunto const al metodo TFieldref::len


git-svn-id: svn://10.65.10.50/trunk@4027 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-12-20 12:09:45 +00:00
parent e99622f927
commit 12f4ee0441
5 changed files with 39 additions and 34 deletions

View File

@ -4,8 +4,6 @@
#define XVT_INCL_NATIVE #define XVT_INCL_NATIVE
#include <xvt.h> #include <xvt.h>
#include <stdlib.h>
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
#include <toolhelp.h> #include <toolhelp.h>
#endif #endif
@ -13,17 +11,16 @@
#include <applicat.h> #include <applicat.h>
#include <colors.h> #include <colors.h>
#include <config.h> #include <config.h>
#include <controls.h>
#include <extcdecl.h>
#include <mask.h> #include <mask.h>
#include <modaut.h>
#include <prefix.h> #include <prefix.h>
#include <printer.h> #include <printer.h>
#include <progind.h>
#include <extcdecl.h>
#include <modaut.h>
#include <relation.h> #include <relation.h>
#include <urldefid.h> #include <urldefid.h>
#include <utility.h> #include <utility.h>
#include <xvtility.h> #include <xvtility.h>
#include <controls.h>
#include <bagn002.h> #include <bagn002.h>

View File

@ -516,7 +516,6 @@ HIDDEN int cisread(isfdptr isfd, TRectype & record, int mode)
HIDDEN int delkeys(isfdptr fd, char* record,long recno) HIDDEN int delkeys(isfdptr fd, char* record,long recno)
{ {
int rt=NOERR,oldkey = fd->knum; int rt=NOERR,oldkey = fd->knum;
for (int i=1; i<=fd->r->NKeys;i++) for (int i=1; i<=fd->r->NKeys;i++)
{ {

View File

@ -267,12 +267,14 @@ void TMask_field::construct(TScanner& scanner, WINDOW parent)
parse_head(scanner); parse_head(scanner);
scanner.popkey(); // BEGIN scanner.popkey(); // BEGIN
#ifdef DBG #ifdef DBG
if (scanner.key() != "BE") if (scanner.key() != "BE")
{ {
yesnofatal_box("Testata errata o BEGIN mancante nel campo %d", _ctl_data._dlg); NFCHECK("Testata errata o BEGIN mancante nel campo %d", _ctl_data._dlg);
scanner.push(); scanner.push();
} }
if (_ctl_data._dlg > 0 && mask().id2pos(_ctl_data._dlg) >= 0)
NFCHECK("Esistono due campi con identificatore %d", _ctl_data._dlg);
#endif #endif
while(scanner.popkey() != "EN") // END of control while(scanner.popkey() != "EN") // END of control

View File

@ -436,7 +436,7 @@ void TRelation::write_enable(
// @syntax void write_enable(const char* name, const bool on) // @syntax void write_enable(const char* name, const bool on)
// //
// @comm Nel caso venga passato un numero logico uguale a 0 vengono abilitati/disabilitati tutti // @comm Nel caso venga passato un numero logico uguale a 0 vengono abilitati/disabilitati tutti
// i file dell relazione // i file della relazione
{ {
@ -881,10 +881,11 @@ bool TRelation::exist(int logicnum) const
HIDDEN bool __evalcondition(const TRelation& r,TExpression* cond) HIDDEN bool __evalcondition(const TRelation& r,TExpression* cond)
{ {
TFieldref f;
for (int i = cond->numvar() - 1; i >= 0; i--) for (int i = cond->numvar() - 1; i >= 0; i--)
{ {
const char* s = cond->varname(i); const TFixed_string s(cond->varname(i));
TFieldref f(s,0); f = s;
cond->setvar(i, f.read(r)); cond->setvar(i, f.read(r));
} }
return (bool) *cond; return (bool) *cond;
@ -1040,14 +1041,12 @@ bool TCursor::ok() const
} }
bool TCursor::changed() bool TCursor::changed()
{ {
isdef* fh = file().filehnd(); isdef* fh = file().filehnd();
if (_frozen && _lastrec > 0L)
if (_frozen && _lastrec > 0L) return _filename != fh->d->SysName; return _filename != fh->d->SysName;
const TRecnotype eod = DB_reccount(fh->fhnd); const TRecnotype eod = DB_reccount(fh->fhnd);
if (_lastrec != eod || if (_lastrec != eod ||
(_lastkrec != DB_changed(fh->fhnd)) || (_lastkrec != DB_changed(fh->fhnd)) ||
(_filename != fh->d->SysName)) (_filename != fh->d->SysName))
@ -1057,7 +1056,11 @@ bool TCursor::changed()
// _lastkrec = DB_changed(fh->fhnd); // _lastkrec = DB_changed(fh->fhnd);
return TRUE; return TRUE;
} }
else return FALSE;
if (!curr().valid())
return TRUE;
return FALSE;
} }
TRecnotype TCursor::update() TRecnotype TCursor::update()
@ -1099,7 +1102,7 @@ void TCursor::filter(
if (file().tab()) if (file().tab())
{ {
TTable& f = (TTable&) file(); const TTable& f = (const TTable&)file();
kf = kto = f.name(); kf = kto = f.name();
} }
if (from != NULL) if (from != NULL)
@ -1253,7 +1256,8 @@ TRecnotype TCursor::read(TIsamop op, TReclock lockop, TDate& atdate)
TCursor::TCursor(TRelation* r, const char* fil, int nkey, TCursor::TCursor(TRelation* r, const char* fil, int nkey,
const TRectype *from, const TRectype* to) const TRectype *from, const TRectype* to)
: _if(r), _nkey(nkey), _frozen(FALSE), _filterfunction(NULL), _fexpr(NULL), _filter_update(FALSE), _filterfunction_update(FALSE) : _if(r), _nkey(nkey), _frozen(FALSE), _filterfunction(NULL), _fexpr(NULL),
_filter_update(FALSE), _filterfunction_update(FALSE)
{ {
file().setkey(_nkey); file().setkey(_nkey);
_pos = 0; _pos = 0;
@ -1275,7 +1279,6 @@ TCursor::~TCursor()
TRecnotype TCursor::readrec() TRecnotype TCursor::readrec()
{ {
TRecnotype& nrec = file().filehnd()->RecNo; TRecnotype& nrec = file().filehnd()->RecNo;
@ -1362,8 +1365,12 @@ TRecnotype TCursor::items()
bool TCursor::next_match(int lognum, const char* fl, int nk) bool TCursor::next_match(int lognum, const char* fl, int nk)
{ {
if (lognum == 0 || lognum == file().num()) if (lognum == 0 || lognum == file().num())
{++(*this); return file().good(); } {
else return _if->next_match(lognum, fl, nk); ++(*this);
return file().good();
}
else
return _if->next_match(lognum, fl, nk);
} }
bool TCursor::is_first_match(int ln) bool TCursor::is_first_match(int ln)
@ -1403,7 +1410,7 @@ bool TSorted_cursor::check_expr(
int rt=TRUE; int rt=TRUE;
if (p>-1 && p1>-1) if (p>-1 && p1>-1)
if (s.find("UPPER") == -1) if (s.find("UPPER") < 0)
{ {
error_box("Only UPPER() operator is allowed"); error_box("Only UPPER() operator is allowed");
rt=FALSE; rt=FALSE;
@ -1432,7 +1439,7 @@ bool TSorted_cursor::is_upper(TString& s)
// Controlla se nell'espressione esiste l'operatore UPPER() // Controlla se nell'espressione esiste l'operatore UPPER()
{ {
bool rt=TRUE; bool rt=TRUE;
if (s.find("UPPER")>-1) if (s.find("UPPER") >= 0)
rt=check_expr(s); rt=check_expr(s);
else else
rt=FALSE; rt=FALSE;
@ -1552,7 +1559,6 @@ TRecnotype TSorted_cursor::buildcursor(TRecnotype rp)
int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page) int TSorted_cursor::filtercursor(int pagecnt, TRecnotype* page)
{ {
int np=0, handle=file().filehnd()->fhnd; int np=0, handle=file().filehnd()->fhnd;
TRectype& rec=file().curr(); TRectype& rec=file().curr();
TString s; TString s;
@ -1613,11 +1619,12 @@ bool TSorted_cursor::changed()
rt = TCursor::changed(); rt = TCursor::changed();
if (!rt) rt=_is_changed_expr; if (!rt) rt=_is_changed_expr;
_is_changed_expr = FALSE; _is_changed_expr = FALSE;
} else }
{ else
error_box("Can't perform changed() while expression ain't valid!"); {
rt=FALSE; NFCHECK("Can't perform changed() while expression is not valid!");
} rt=FALSE;
}
return rt; return rt;
} }
@ -1627,7 +1634,7 @@ void TSorted_cursor::change_order(const char* order_expr)
if (order_expr && *order_expr && order_expr != _order_expr) if (order_expr && *order_expr && order_expr != _order_expr)
{ {
TString s; TString s;
_order_expr = order_expr; _order_expr = order_expr;
_order_expr.restart(); _order_expr.restart();
while ((s=_order_expr.get()).not_empty() && (_is_valid_expr=check_expr(s))) ; while ((s=_order_expr.get()).not_empty() && (_is_valid_expr=check_expr(s))) ;
if (_is_valid_expr) if (_is_valid_expr)
@ -1776,7 +1783,7 @@ void TFieldref::print_on(ostream& out) const
const char* TFieldref::read(const TRectype& rec) const const char* TFieldref::read(const TRectype& rec) const
{ {
static TString256 buffer; static TString buffer;
if (_fileid >= CNF_GENERAL) if (_fileid >= CNF_GENERAL)
{ {
@ -1827,7 +1834,7 @@ void TFieldref::write(const char* val, TRectype& rec) const
} }
} }
int TFieldref::len(TRectype &rec) const int TFieldref::len(const TRectype &rec) const
{ {
if (_to >= 0) if (_to >= 0)
return _to - _from; return _to - _from;

View File

@ -535,7 +535,7 @@ public:
int to() const int to() const
{ return _to; } { return _to; }
// @cmember Ritorna la lunghezza del campo di <p TRectype> // @cmember Ritorna la lunghezza del campo di <p TRectype>
int len(TRectype &rec) const; int len(const TRectype &rec) const;
// @cmember Cerca nella relazione il campo e ne ritorna il contenuto // @cmember Cerca nella relazione il campo e ne ritorna il contenuto
const char* read(const TRelation&) const; const char* read(const TRelation&) const;
// @cmember Cerca nel record il campo e ne ritorna il contenuto // @cmember Cerca nel record il campo e ne ritorna il contenuto