MOdificato isam
git-svn-id: svn://10.65.10.50/trunk@3671 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
9358bdad25
commit
7a3e6da413
@ -40,8 +40,8 @@ extern "C" {
|
||||
extern short formflag;
|
||||
extern int SerNo;
|
||||
extern word ModAd;
|
||||
extern word _int_tab0[4];
|
||||
extern char __ptprf[80];
|
||||
extern word _int_tab0[4];
|
||||
extern char __ptprf[80];
|
||||
|
||||
// Guy moved these outside extern
|
||||
extern isfdptr* openf;
|
||||
@ -59,21 +59,13 @@ extern "C" {
|
||||
|
||||
/* @END */
|
||||
|
||||
/* @FPUB */
|
||||
/* @FPUB */
|
||||
// definite in isam.cpp
|
||||
int hashfun(const char *);
|
||||
int findfld(const RecDes *, const char *);
|
||||
#if XVT_OS == XVT_OS_SCOUNIX
|
||||
Word Hl_Port(Word);
|
||||
#endif
|
||||
short cverdata(char *);
|
||||
TrDate cpackdata(char *);
|
||||
void ceditdata(TrDate ,char *);
|
||||
void cgetdata(TrDate *,char *);
|
||||
void cputdata(char *);
|
||||
int month(TrDate);
|
||||
int year(TrDate);
|
||||
int day(TrDate);
|
||||
TrDate makedata(int,int,int);
|
||||
TrDate addmonth(TrDate,int);
|
||||
TrDate addyear(TrDate,int);
|
||||
TDitta *CGetDitta(char *);
|
||||
short CGetAut(int );
|
||||
char *CGetConf(int );
|
||||
@ -103,64 +95,11 @@ extern "C" {
|
||||
void zerordes(RecDes *);
|
||||
word setrdes(RecDes *);
|
||||
char *prefname(void);
|
||||
char *CAddPref(char *);
|
||||
char *CGetPref(void);
|
||||
void CPutPref(char *);
|
||||
char *CInsPref(char *, int);
|
||||
char *CGetIdxName(char *);
|
||||
int findfld(RecDes *,char *);
|
||||
void setdec(char *, int);
|
||||
unsigned int CFieldSize(char *, RecDes *);
|
||||
unsigned int CFieldDec(char *, RecDes *);
|
||||
int CFieldType(char *, RecDes *);
|
||||
int CGetField(char *, RecDes *, RecType, void *);
|
||||
int CPutField(char *, RecDes *, void *, RecType);
|
||||
int CGetFieldBuff(char *, RecDes *, RecType, char *);
|
||||
int CPutFieldBuff(char *, RecDes *, char *, RecType);
|
||||
int CZeroField(char *, RecDes *, RecType);
|
||||
void CZeroRec(RecDes *, RecType);
|
||||
int CBuildKey(RecDes *,int ,RecType, char *);
|
||||
void CBOpenFile(FilCtrl *,char *,unsigned int, int *);
|
||||
void CBCloseFile(FilCtrl *,int *);
|
||||
void GetHead(FilCtrl *, int, int *);
|
||||
int GetAPage(FilCtrl *, Page *,RecNoType ,int *);
|
||||
void GetAKey( Page ,int ,int ,char *,RecNoType *);
|
||||
void BTrRead(FilCtrl *,char *,char *,RecNoType *,int *);
|
||||
RecNoType cisgeteod(isfdptr, int *);
|
||||
int cisbuild(isfdptr,int ,RecNoType ,int *);
|
||||
int cisextend(isfdptr,int ,RecNoType ,int *);
|
||||
long cisextension(int ,RecNoType ,int *);
|
||||
int cisupdflags(isfdptr, int *, short);
|
||||
int cisopen(isfdptr*, int, RecType *, unsigned int ,int *);
|
||||
int cisopentemp(isfdptr*, int, PathSt, RecType *, short, RecNoType, RecNoType, int *);
|
||||
RecNoType cisgeteod(isfdptr, int *);
|
||||
int cisclosetemp(isfdptr*,RecType *, short, int *);
|
||||
int cisclose(isfdptr*,RecType *,int *);
|
||||
int cisallocrec(int ,RecType *,int *);
|
||||
int ciscopyrec(int ,RecType , RecType ,int *);
|
||||
int cisstart(isfdptr,int ,RecType ,unsigned int ,int *);
|
||||
int cisread(isfdptr,RecType ,unsigned int ,int *);
|
||||
int ciswrite(isfdptr,RecType ,int *);
|
||||
int cisdelete(isfdptr,RecType ,int *);
|
||||
int cisrewrite(isfdptr,RecType ,int *);
|
||||
int cisdelcurr(isfdptr,int *);
|
||||
int cisrewcurr(isfdptr,RecType ,int *);
|
||||
int cisreadrec(isfdptr,RecNoType ,RecType ,unsigned int,int *);
|
||||
int cisrewrec(isfdptr,RecNoType ,RecType ,int *);
|
||||
int cisdelrec(isfdptr,RecNoType ,int *);
|
||||
RecNoType cisgetrecno(isfdptr, int *);
|
||||
int cislock(isfdptr,int *);
|
||||
int cisunlock(isfdptr,int *);
|
||||
int cisrelease(isfdptr,int *);
|
||||
void IndexOn(void);
|
||||
void IndexOff(void);
|
||||
void StTrans(void);
|
||||
void EndTrans(void);
|
||||
void AbTrans(void);
|
||||
int cupdatefile(int ,unsigned int ,RecDes *,short ,int *);
|
||||
int creorgfile(int ,short ,int *);
|
||||
int creorgindex(int ,short ,int *);
|
||||
int cloadfile(char *,int ,char ,char ,char ,short ,int *);
|
||||
int cdumpfile(char *,int ,int ,char ,char ,char ,short ,int *);
|
||||
int init_sort(struct s_prm *);
|
||||
void sort(char *);
|
||||
char *sort_op(void);
|
||||
|
@ -12,14 +12,12 @@
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
extern "C" char *CAddPref(char* name);
|
||||
|
||||
#include <extcdecl.h>
|
||||
|
||||
#define BLOCKLEN 512
|
||||
#define INVFLD 255
|
||||
|
||||
HIDDEN char _files_tmp_string[128];
|
||||
HIDDEN char _files_tmp_string[256];
|
||||
|
||||
TFile::TFile (int lenrec, int base)
|
||||
|
||||
@ -344,6 +342,7 @@ int TDir::items (
|
||||
|
||||
TTrec::TTrec ()
|
||||
: _des(NULL), _tab("")
|
||||
|
||||
{
|
||||
_rec = new RecDes;
|
||||
zero ();
|
||||
@ -373,7 +372,43 @@ int TTrec::compare(const TSortable & a) const
|
||||
|
||||
void TTrec::rehash()
|
||||
{
|
||||
setrdes(_rec);
|
||||
int pos, tmppos, nf, i;
|
||||
|
||||
for (i = 0; i < MaxFields; i++) _rec->SortFd[i] = INVFLD;
|
||||
if (_rec->NFields)
|
||||
{
|
||||
for (i = 0; i < _rec->NFields; i++)
|
||||
{
|
||||
nf = i;
|
||||
pos = hashfun(_rec->Fd[nf].Name);
|
||||
while (TRUE)
|
||||
{
|
||||
if (_rec->SortFd[pos] == INVFLD)
|
||||
{
|
||||
_rec->SortFd[pos] = (byte) nf;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(_rec->Fd[_rec->SortFd[pos]].Name, _rec->Fd[nf].Name) <= 0)
|
||||
{
|
||||
pos++;
|
||||
if (pos >= MaxFields)
|
||||
pos = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
tmppos = _rec->SortFd[pos];
|
||||
_rec->SortFd[pos] = (byte) nf;
|
||||
nf = tmppos;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
_rec->Fd[0].RecOff = 1;
|
||||
for (i = 1; i < _rec->NFields; i++)
|
||||
_rec->Fd[i].RecOff = _rec->Fd[i - 1].RecOff + _rec->Fd[i - 1].Len;
|
||||
}
|
||||
}
|
||||
|
||||
TTrec & TTrec::operator = (const TTrec & b)
|
||||
|
@ -13,7 +13,7 @@ I9=$(IP)object.h $(I6) $(I2)
|
||||
I10=$(IP)strings.h $(I9)
|
||||
I11=$(IP)sysfld.h
|
||||
I13=$(IP)array.h $(I9)
|
||||
I14=
|
||||
I14=$(IP)rectypes.h
|
||||
I15=$(IP)lffiles.h
|
||||
I16=$(IP)files.h $(I9) $(I4) $(IP)rectypes.h
|
||||
I12=$(IP)prefix.h $(I4) $(I10) $(I16)
|
||||
@ -63,6 +63,9 @@ I60=$(IP)printwin.h $(I32) $(I58)
|
||||
I61=$(IP)tabapp.h $(I53)
|
||||
I62=$(IP)memo.h $(I58)
|
||||
I63=$(IP)golem.h $(I32)
|
||||
I64=$(IP)archives.h $(I10)
|
||||
I65=$(IP)varmask.h $(I33) $(I54)
|
||||
I66=$(IP)varrec.h $(I30) $(I28)
|
||||
|
||||
U1=$(IP)default.url $(I43)
|
||||
#U2=$(IP)pr_menu.h $(I43) # Guai a chi la usa!
|
||||
@ -75,6 +78,12 @@ F6=$(IP)anagr.h
|
||||
F9=$(IP)nditte.h
|
||||
F11=$(IP)unloc.h
|
||||
F13=$(IP)comuni.h
|
||||
F17=$(IP)cfven.h
|
||||
F18=$(IP)occas.h
|
||||
F19=$(IP)pconti.h
|
||||
F20=$(IP)clifo.h
|
||||
F23=$(IP)mov.h
|
||||
F24=$(IP)rmov.h
|
||||
F25=$(IP)rmoviva.h
|
||||
F29=$(IP)scadenze.h
|
||||
|
||||
|
857
include/isam.cpp
857
include/isam.cpp
File diff suppressed because it is too large
Load Diff
114
include/isam.h
114
include/isam.h
@ -40,7 +40,7 @@
|
||||
#ifndef __LFFILES_H
|
||||
#include <lffiles.h>
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __TEXT_H
|
||||
class TTextfile;
|
||||
#endif
|
||||
@ -52,63 +52,6 @@ class TTextfile;
|
||||
const int MAX_KEYS = 8;
|
||||
|
||||
class TLocalisamfile;
|
||||
class TRectype;
|
||||
|
||||
// @doc INTERNAL
|
||||
|
||||
// @class TMemo_info | Classe per la definizione dei campi Memo
|
||||
//
|
||||
// @base public | TObject
|
||||
class TMemo_info : public TObject
|
||||
// @author:(INTERNAL) Sandro
|
||||
{
|
||||
// @access:(INTERNAL) Private Member
|
||||
|
||||
// @cmember:(INTERNAL) Campi memo modificati
|
||||
TBit_array _dirty;
|
||||
// @cmember:(INTERNAL) Array di stringhe contenenti i campi memo
|
||||
TString_array _data;
|
||||
// @cmember:(INTERNAL) Numero di record sul file dati
|
||||
TRecnotype _recno;
|
||||
// @cmember:(INTERNAL) Record che possiede il campo memo
|
||||
const TRectype * _owner;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
|
||||
// @cmember Ritorna il descrittore del record (vedi <t RecDes>)
|
||||
RecDes * rec_des( ) const;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Ritorna il numero di record sul file dati
|
||||
TRecnotype recno( ) const
|
||||
{ return _recno; }
|
||||
|
||||
// @cmember Ritorna il numero logico del record
|
||||
int num() const ;
|
||||
// @cmember Setta il numero di record sul file dati
|
||||
void recno( TRecnotype r )
|
||||
{ _recno = r; }
|
||||
// @cmember Setta il contenuto del campo memo <p fieldname> con <p data>
|
||||
void put( const char * fieldname, const char * data );
|
||||
// @cmember Ritorna il contenuto del campo memo <p fieldname> con <p data>
|
||||
TString& get( const char * fieldname );
|
||||
// @cmember Scrive fisicamente il campo memo sul file
|
||||
void write_data( isdef * def );
|
||||
// @cmember Ritorna TRUE se il campo memo <p fieldname> e' stato letto dal file
|
||||
bool memo_loaded( const char * fieldname );
|
||||
// @cmember Annula tutte le modifiche sui campi memo (prima della scrittura sul file)
|
||||
void reset( );
|
||||
|
||||
// @cmember Costruttore
|
||||
TMemo_info( const TRectype * owner, const TRecnotype recno );
|
||||
// @cmember Costruttore
|
||||
TMemo_info( const TRectype * owner, TMemo_info& memoinfo);
|
||||
// @cmember Distruttore
|
||||
virtual ~TMemo_info( );
|
||||
};
|
||||
|
||||
|
||||
// @doc EXTERNAL
|
||||
|
||||
@ -145,13 +88,14 @@ class TRectype : public TSortable
|
||||
char _tab[5];
|
||||
// @cmember:(INTERNAL) Campo "COD" della tabella
|
||||
TRecfield * _cod;
|
||||
// @cmember:(INTERNAL) Puntatore alla classe contenente i campi memo
|
||||
TMemo_info * _memoinfo;
|
||||
TBit_array * _memo_dirty;
|
||||
TString_array * _memo_data;
|
||||
TRecnotype _memo_recno;
|
||||
|
||||
// @access Protected Member
|
||||
protected:
|
||||
// @cmember Segnalazione di un campo inesistente
|
||||
virtual void unknown_field(const char* name) const;
|
||||
virtual void unknown_field(const char* name) const;
|
||||
// @cmember Compara due tipo di record del file (vedi <c TSortable>)
|
||||
virtual int compare(const TSortable& s) const;
|
||||
// @cmember Ritorna il nome dell'ultimo campo chiave identificato da <p key>
|
||||
@ -163,13 +107,12 @@ protected:
|
||||
{ _isempty = val;}
|
||||
|
||||
// @cmember Ritorna il contenuto del campo <p fieldname> (non tipizzata)
|
||||
virtual const TString& get_str(const char* fieldname) const;
|
||||
// @cmember Setta il contenuto del campo <p fieldname> al valore <p val> (non tipizzata)
|
||||
virtual const TString & get_str(const char* fieldname) const ;
|
||||
// @cmember Setta il contenuto del campo <p fieldname> (non tipizzata)
|
||||
virtual void put_str(const char* fieldname, const char* val);
|
||||
// @cmember Ritorna il contenuto del campo <p nf>-esimo
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
public:
|
||||
// @cmember Duplica il tipo di record
|
||||
virtual TObject* dup() const;
|
||||
|
||||
@ -185,6 +128,7 @@ public:
|
||||
virtual int remove(TBaseisamfile& f) const;
|
||||
// @cmember Cambia il campo <p field> della chiave principale con il valore <p val>
|
||||
virtual void renum_key(const char* field, const char* val);
|
||||
|
||||
// @cmember Ritorna il numero di campi del record
|
||||
int items() const;
|
||||
// @cmember Setta il record come non vuoto (chiama <mf TRectype::setempty>)
|
||||
@ -279,14 +223,15 @@ public:
|
||||
{ put(fieldname, " "); }
|
||||
|
||||
// @cmember Assegnazione tra TRectype
|
||||
virtual TRectype& operator =(const TRectype& rec);
|
||||
virtual TRectype & operator =(const TRectype& rec);
|
||||
// @cmember Assegnazione tra TRectype
|
||||
virtual TRectype& operator =(const char* rec);
|
||||
virtual TRectype & operator =(const char* rec);
|
||||
// @cmember Assegnazione tra TRectype
|
||||
TRectype& operator =(const TBaseisamfile& f);
|
||||
|
||||
|
||||
// @cmember Ritorna il descrittore del record
|
||||
virtual RecDes* rec_des() const;
|
||||
virtual RecDes * rec_des() const;
|
||||
// @cmember Ritorna il numero logico del record
|
||||
int num() const
|
||||
{ return _logicnum;}
|
||||
@ -302,19 +247,13 @@ public:
|
||||
bool ok() const
|
||||
{ return _rec != NULL; }
|
||||
|
||||
// @cmember Inizializza la struttura di <c TMemo_info>
|
||||
void init_memo(const TRecnotype recno = RECORD_NON_FISICO );
|
||||
// @cmember Scrive le informazioni contenute in <c TMemo_info>
|
||||
void write_memo(isdef * file, const TRecnotype recno );
|
||||
// @cmember Ritorna il reference alla <c TMemo_info>
|
||||
TMemo_info& memo_info( ) const
|
||||
{ CHECK( _memoinfo, "Tentativo di accesso ad una memoinfo vuota!" ); return *_memoinfo; }
|
||||
// @cmember Indica se il record possiede un campo memo
|
||||
bool has_memo() const
|
||||
{ return _memoinfo != NULL; }
|
||||
|
||||
// @cmember Costruttore. Costruisce un record staccato da un file.
|
||||
// Sarebbe meglio utilizzare uno degli altri due costruttori
|
||||
virtual void init_memo(const TRecnotype recno = RECORD_NON_FISICO);
|
||||
virtual void write_memo(isdef * file, const TRecnotype recno);
|
||||
bool has_memo() const { return _memo_data != NULL; }
|
||||
void memo_recno (const TRecnotype recno = RECORD_NON_FISICO) { _memo_recno = recno; }
|
||||
|
||||
// @cmember Costruttore Costruisce un record staccato da un file.
|
||||
// Sarebbe meglio utilizzare una delle altre due
|
||||
TRectype(int logicnum);
|
||||
// @cmember Costruttore. Costruisce il record e lo associa al file isam <p i>
|
||||
TRectype(const TBaseisamfile* i);
|
||||
@ -322,7 +261,7 @@ public:
|
||||
TRectype(const TRectype& r);
|
||||
|
||||
// @cmember Distruttore
|
||||
virtual ~TRectype();
|
||||
virtual ~TRectype();
|
||||
};
|
||||
|
||||
// @doc EXTERNAL
|
||||
@ -410,9 +349,9 @@ protected:
|
||||
const char* filename() const;
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
// @cmember Sostituisce il record corrente del file
|
||||
void set_curr(TRectype * curr);
|
||||
public:
|
||||
// @cmember Sostituisce il record corrente del del file
|
||||
void set_curr(TRectype * curr);
|
||||
// @cmember Attiva la chiave <p nkey> sul file aperto
|
||||
void setkey(int nkey);
|
||||
// @cmember Ritorna la chiave attiva sul file aperto
|
||||
@ -597,9 +536,6 @@ public:
|
||||
TRectype& operator =(const TRectype& rec)
|
||||
{ return curr() = rec;}
|
||||
|
||||
// @cmember Controlla se il file possiede dei campi memo
|
||||
bool has_memo( );
|
||||
|
||||
// @cmember Costruttore
|
||||
TBaseisamfile(int logicnum, bool linkrecinst = FALSE);
|
||||
// @cmember Distruttore
|
||||
@ -667,7 +603,7 @@ public:
|
||||
// @cmember Calcola lo spazio che il file occuperebbe se venisse esteso a <p eox>
|
||||
long size(TRecnotype eox);
|
||||
// @cmember Esegue la conversione del tracciato record del file
|
||||
int update(TTrec& newrec, bool vis = TRUE);
|
||||
int update(const TTrec& newrec, bool vis = TRUE);
|
||||
|
||||
// @cmember Esegue sia <mf TSystemisamfile::packfile> e <mf TSystemisamfile::packindex>
|
||||
int pack(bool vis = TRUE, bool ask = TRUE);
|
||||
|
Loading…
x
Reference in New Issue
Block a user